Skip to content

Commit

Permalink
Further fixes for new NERVE.WAD with older IWADs
Browse files Browse the repository at this point in the history
  • Loading branch information
bradharding committed Aug 11, 2024
1 parent 67d13b1 commit e24d584
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2754,8 +2754,8 @@ static void D_DoomMainSetup(void)
const int titlepics = W_GetNumLumps("TITLEPIC");
const int credits = W_GetNumLumps("CREDIT");

if ((titlepics == 1 && lumpinfo[W_GetNumForName("TITLEPIC")]->wadfile->type == PWAD)
|| (titlepics > 1 && !nerve))
if (((titlepics == 1 && lumpinfo[W_GetNumForName("TITLEPIC")]->wadfile->type == PWAD)
|| titlepics > 1) && !nerve)
titlelump = W_CacheLumpName("TITLEPIC");
else
switch (gamemission)
Expand Down
15 changes: 15 additions & 0 deletions src/w_wad.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,21 @@ int W_GetXNumForName(const char *name, const int x)
return i;
}

int W_GetNumForNameFromResourceWAD(const char *name)
{
int i;

for (i = 0; i < numlumps; i++)
if (!strncasecmp(lumpinfo[i]->name, name, 8)
&& M_StringEndsWith(lumpinfo[i]->wadfile->path, DOOMRETRO_RESOURCEWAD))
break;

if (i == numlumps)
I_Error("W_GetLastNumForName: %s not found!", name);

return i;
}

//
// W_LumpLength
// Returns the buffer size needed to load the given lump.
Expand Down
8 changes: 5 additions & 3 deletions src/w_wad.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,18 @@ int W_RangeCheckNumForName(int min, int max, const char *name);
int W_GetNumForName(const char *name);
int W_GetLastNumForName(const char *name);
int W_GetXNumForName(const char *name, const int x);
int W_GetNumForNameFromResourceWAD(const char *name);

int W_GetNumLumps(const char *name);

int W_LumpLength(int lump);

void *W_CacheLumpNum(int lumpnum);

#define W_CacheLumpName(name) W_CacheLumpNum(W_GetNumForName(name))
#define W_CacheXLumpName(name, x) W_CacheLumpNum(W_GetXNumForName(name, x))
#define W_CacheLastLumpName(name) W_CacheLumpNum(W_GetLastNumForName(name))
#define W_CacheLumpName(name) W_CacheLumpNum(W_GetNumForName(name))
#define W_CacheLastLumpName(name) W_CacheLumpNum(W_GetLastNumForName(name))
#define W_CacheXLumpName(name, x) W_CacheLumpNum(W_GetXNumForName(name, x))
#define W_CacheLumpNameFromResourceWAD(name) W_CacheLumpNum(W_GetNumForNameFromResourceWAD(name))

void W_Init(void);
void W_CheckForPNGLumps(void);
Expand Down
2 changes: 1 addition & 1 deletion src/wi_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ static void WI_LoadData(void)
else if (gamemission == pack_tnt)
lump = W_CacheLumpName("INTERPI3");
else if (nerve)
lump = W_CacheLastLumpName("INTERPIC");
lump = W_CacheLumpNameFromResourceWAD("INTERPIC");
else
lump = W_CacheLumpName("INTERPIC");
}
Expand Down

0 comments on commit e24d584

Please sign in to comment.