From bac58847fec9ea9876c35a65e9008a42a0566ddc Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 4 Nov 2022 16:50:37 +0000 Subject: [PATCH] Make P_InitMapData/dependents use partadd_earliestfile --- src/p_setup.c | 25 +++++++++++++------------ src/w_wad.c | 3 ++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index b08e75f01..94530ccc5 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -7766,20 +7766,9 @@ UINT8 P_InitMapData(boolean existingmapheaders) name = mapheaderinfo[i]->lumpname; maplump = W_CheckNumForMap(name); - // Doesn't exist? - if (maplump == INT16_MAX) - { -#ifndef DEVELOP - if (!existingmapheaders) - { - I_Error("P_InitMapData: Base map %s has a header but no level\n", name); - } -#endif - continue; - } - // Always check for cup cache reassociations. // (The core assumption is that cups < headers.) + if (maplump != LUMPERROR || mapheaderinfo[i]->lumpnum != LUMPERROR) { cupheader_t *cup = kartcupheaders; INT32 j; @@ -7814,6 +7803,18 @@ UINT8 P_InitMapData(boolean existingmapheaders) } } + // Doesn't exist in this set of files? + if (maplump == LUMPERROR) + { +#ifndef DEVELOP + if (!existingmapheaders) + { + I_Error("P_InitMapData: Base map %s has a header but no level\n", name); + } +#endif + continue; + } + // No change? if (mapheaderinfo[i]->lumpnum == maplump) continue; diff --git a/src/w_wad.c b/src/w_wad.c index 8edbe74b6..e81879114 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1324,6 +1324,7 @@ lumpnum_t W_CheckNumForMap(const char *name) lumpnum_t check = INT16_MAX; UINT32 uhash, hash = quickncasehash(name, LUMPNUMCACHENAME); INT32 i; + UINT16 firstfile = (partadd_earliestfile == UINT16_MAX) ? 0 : partadd_earliestfile; // Check the lumpnumcache first. Loop backwards so that we check // most recent entries first @@ -1339,7 +1340,7 @@ lumpnum_t W_CheckNumForMap(const char *name) uhash = quickncasehash(name, 8); // Not a mistake, legacy system for short lumpnames - for (i = numwadfiles - 1; i >= 0; i--) + for (i = numwadfiles - 1; i >= firstfile; i--) { check = W_CheckNumForMapPwad(name, uhash, (UINT16)i, 0);