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

As having named map lumps means the lump being named "MAPXX" isn't guaranteed anymore.
This commit is contained in:
SteelT 2022-09-22 16:05:44 -04:00
parent bd965ccd50
commit 89a22783b6

View file

@ -2278,11 +2278,15 @@ 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;
for (i = LUMPNUM(lumppos); i < wadfiles[WADFILENUM(lumpnum)]->numlumps; 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);