diff --git a/src/w_wad.c b/src/w_wad.c index 84487db5b..841fbc498 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -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 -} \ No newline at end of file +}