vres_GetMap: Count resources in folders up until next 0-length lump, instead of 'MAP'

89a22783b6
This commit is contained in:
NepDisk 2025-02-07 10:38:54 -05:00
parent 372532ad0f
commit de6919c64f

View file

@ -2512,7 +2512,7 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
}
else
{
// Count number of lumps until the end of resource OR up until next "MAPXX" lump.
// Count number of lumps until the end of resource OR up until next 0-length lump.
lumpnum_t lumppos = lumpnum + 1;
lumpnum_t lastlump = wadfiles[WADFILENUM(lumpnum)]->numlumps;
// or the end of directory, for PK3 files
@ -2526,8 +2526,12 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
free(dirname);
}
for (i = LUMPNUM(lumppos); i < lastlump; i++, lumppos++, numlumps++)
if (memcmp(W_CheckNameForNum(lumppos), "MAP", 3) == 0)
{
if (W_LumpLength(lumppos) == 0)
{
break;
}
}
numlumps++;
vlumps = Z_Malloc(sizeof(virtlump_t)*numlumps, PU_LEVEL, NULL);
@ -2621,4 +2625,4 @@ void *vres_GetPatch(virtlump_t *vlump, INT32 tag)
Patch_CreateGL(patch);
return (void *)patch;
#endif
}
}