From 89a22783b6ae069583e15e11891c987a38ae89b3 Mon Sep 17 00:00:00 2001 From: SteelT Date: Thu, 22 Sep 2022 16:05:44 -0400 Subject: [PATCH] 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. --- src/w_wad.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index 3c739493c..ee4c8e68a 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -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);