Commit 299b38c7 by James R.

Actually play music from the special WAD

parent 0e6c3901
......@@ -1816,8 +1816,8 @@ boolean S_MusicInfo(char *mname, UINT16 *mflags, boolean *looping)
boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi)
{
return (
(checkDigi ? W_CheckNumForName(va("O_%s", mname)) != LUMPERROR : false)
|| (checkMIDI ? W_CheckNumForName(va("D_%s", mname)) != LUMPERROR : false)
(checkDigi ? W_CheckSpecialNumForName(va("O_%s", mname), WAD_MUSIC) != LUMPERROR : false)
|| (checkMIDI ? W_CheckSpecialNumForName(va("D_%s", mname), WAD_MUSIC) != LUMPERROR : false)
);
}
......@@ -1872,9 +1872,9 @@ static boolean S_LoadMusic(const char *mname)
return false;
if (!S_DigMusicDisabled() && S_DigExists(mname))
mlumpnum = W_GetNumForName(va("o_%s", mname));
mlumpnum = W_GetSpecialNumForName(va("o_%s", mname), WAD_MUSIC);
else if (!S_MIDIMusicDisabled() && S_MIDIExists(mname))
mlumpnum = W_GetNumForName(va("d_%s", mname));
mlumpnum = W_GetSpecialNumForName(va("d_%s", mname), WAD_MUSIC);
else if (S_DigMusicDisabled() && S_DigExists(mname))
{
CONS_Alert(CONS_NOTICE, "Digital music is disabled!\n");
......
......@@ -980,7 +980,7 @@ INT32 W_InitMultipleFiles(char **filenames, boolean addons)
*/
static boolean TestValidLump(UINT16 wad, UINT16 lump)
{
I_Assert(wad < MAX_WADFILES);
I_Assert(wad < TOTAL_WADFILES);
if (!wadfiles[wad]) // make sure the wad file exists
return false;
......@@ -1093,7 +1093,7 @@ UINT16 W_CheckNumForFullNamePK3(const char *name, UINT16 wad, UINT16 startlump)
// W_CheckNumForName
// Returns LUMPERROR if name not found.
//
lumpnum_t W_CheckNumForName(const char *name)
lumpnum_t W_CheckSpecialNumForName(const char *name, int type)
{
INT32 i;
lumpnum_t check = INT16_MAX;
......@@ -1109,6 +1109,14 @@ lumpnum_t W_CheckNumForName(const char *name)
}
}
if (type > 0)
{
i = type;/* holy shit */
check = W_CheckNumForNamePwad(name,type,0);
}
if (check == INT16_MAX)/* now check WADs anyway */
{
// scan wad files backwards so patch lump files take precedence
for (i = numwadfiles - 1; i >= 0; i--)
{
......@@ -1116,6 +1124,7 @@ lumpnum_t W_CheckNumForName(const char *name)
if (check != INT16_MAX)
break; //found it
}
}
if (check == INT16_MAX) return LUMPERROR;
else
......@@ -1165,11 +1174,11 @@ lumpnum_t W_CheckNumForMap(const char *name)
//
// Calls W_CheckNumForName, but bombs out if not found.
//
lumpnum_t W_GetNumForName(const char *name)
lumpnum_t W_GetSpecialNumForName(const char *name, int type)
{
lumpnum_t i;
i = W_CheckNumForName(name);
i = W_CheckSpecialNumForName(name, type);
if (i == LUMPERROR)
I_Error("W_GetNumForName: %s not found!\n", name);
......@@ -1503,7 +1512,6 @@ void *W_CacheLumpNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
void *W_CacheLumpNum(lumpnum_t lumpnum, INT32 tag)
{
return W_CacheLumpNumPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum),tag);
}
......
......@@ -152,8 +152,10 @@ UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlum
UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump);
lumpnum_t W_CheckNumForMap(const char *name);
lumpnum_t W_CheckNumForName(const char *name);
lumpnum_t W_GetNumForName(const char *name); // like W_CheckNumForName but I_Error on LUMPERROR
lumpnum_t W_CheckSpecialNumForName(const char *name, int type);
#define W_CheckNumForName( name ) W_CheckSpecialNumForName(name, 0)
lumpnum_t W_GetSpecialNumForName(const char *name, int type); // like W_CheckNumForName but I_Error on LUMPERROR
#define W_GetNumForName( name ) W_GetSpecialNumForName(name, 0)
lumpnum_t W_CheckNumForNameInBlock(const char *name, const char *blockstart, const char *blockend);
UINT8 W_LumpExists(const char *name); // Lua uses this.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment