Fix: Added missing function to lua music freeslots

Completely forgot the function required to get the music to be allocated
in the first place. oops
This commit is contained in:
yellowtd 2014-07-13 00:11:27 -04:00
parent f8fd14cbf2
commit df69c922e2
2 changed files with 27 additions and 0 deletions

View file

@ -627,6 +627,8 @@ static void readfreeslots(MYFILE *f)
// TODO: Name too long (truncated) warnings.
if (fastcmp(type, "SFX"))
S_AddSoundFx(word, false, 0, false);
else if (fastcmp(type, "MUS"))
S_AddMusic(word, -1);
else if (fastcmp(type, "SPR"))
{
for (i = SPR_FIRSTFREESLOT; i <= SPR_LASTFREESLOT; i++)
@ -3454,6 +3456,19 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
}
DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
else if (fastcmp(word, "MUSIC"))
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
i = get_mus(word2); // find a sound by name
if (i < NUMMUSIC && i >= 0)
readmusic(f, i, savemusicnames);
else
{
deh_warning("Music %d out of range (0 - %d)", i, NUMMUSIC-1);
ignorelines(f);
}
DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
/* else if (fastcmp(word, "SPRITE"))
{
if (i < NUMSPRITES && i >= 0)
@ -8191,6 +8206,17 @@ static inline int lib_freeslot(lua_State *L)
} else
return r;
}
else if (fastcmp(type, "MUS")) {
musicenum_t music;
strlwr(word);
CONS_Printf("Music mus_%s allocated.\n",word);
music = S_AddMusic(word, -1);
if (music != mus_None) {
lua_pushinteger(L, music);
r++;
} else
return r;
}
else if (fastcmp(type, "SPR"))
{
char wad;

View file

@ -1647,6 +1647,7 @@ typedef enum
void S_InitRuntimeSounds(void);
sfxenum_t S_AddSoundFx(const char *name, boolean singular, INT32 flags, boolean skinsound);
musicenum_t S_AddMusic(const char *name, INT32 dummyval);
void S_RemoveSoundFx(sfxenum_t id);
#endif