From c10bd068de734d493a8666fbe44eadf51f7c8287 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 1 Jan 2023 23:39:28 +0000 Subject: [PATCH] Fix loading a map in a seperate file before loading a file with the relevant header --- src/p_setup.c | 2 +- src/w_wad.c | 4 ++-- src/w_wad.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 61c2a9ec3..0aff1ef4e 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -7771,7 +7771,7 @@ UINT8 P_InitMapData(boolean existingmapheaders) for (i = 0; i < nummapheaders; ++i) { name = mapheaderinfo[i]->lumpname; - maplump = W_CheckNumForMap(name); + maplump = W_CheckNumForMap(name, (mapheaderinfo[i]->lumpnum == LUMPERROR)); // Always check for cup cache reassociations. // (The core assumption is that cups < headers.) diff --git a/src/w_wad.c b/src/w_wad.c index cef5615cc..ad630a6fb 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1309,12 +1309,12 @@ lumpnum_t W_CheckNumForLongName(const char *name) // Look for valid map data through all added files in descendant order. // Get a map marker for WADs, and a standalone WAD file lump inside PK3s. -lumpnum_t W_CheckNumForMap(const char *name) +lumpnum_t W_CheckNumForMap(const char *name, boolean checktofirst) { lumpnum_t check = INT16_MAX; UINT32 uhash, hash = quickncasehash(name, LUMPNUMCACHENAME); INT32 i; - UINT16 firstfile = (partadd_earliestfile == UINT16_MAX) ? 0 : partadd_earliestfile; + UINT16 firstfile = (checktofirst || (partadd_earliestfile == UINT16_MAX)) ? 0 : partadd_earliestfile; // Check the lumpnumcache first. Loop backwards so that we check // most recent entries first diff --git a/src/w_wad.h b/src/w_wad.h index 24c0ac74b..31ca26e69 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -171,7 +171,7 @@ UINT16 W_CheckNumForFullNamePK3(const char *name, UINT16 wad, UINT16 startlump); UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlump); UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump); -lumpnum_t W_CheckNumForMap(const char *name); +lumpnum_t W_CheckNumForMap(const char *name, boolean checktofirst); lumpnum_t W_CheckNumForName(const char *name); lumpnum_t W_CheckNumForLongName(const char *name); lumpnum_t W_GetNumForName(const char *name); // like W_CheckNumForName but I_Error on LUMPERROR