From 52d1c4313b996c4074c97efa2909e72c8bb2cc3b Mon Sep 17 00:00:00 2001 From: yamamama Date: Wed, 8 Apr 2026 16:52:56 -0400 Subject: [PATCH] Compatmode: load maps in PK3s outside of a designated folder Fixes #189 --- src/w_wad.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/w_wad.c b/src/w_wad.c index aab5e5f58..10b285644 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1237,6 +1237,13 @@ UINT16 W_FindNextEmptyInPwad(UINT16 wad, UINT16 startlump) UINT16 W_CheckNumForMapPwad(const char *name, UINT32 hash, UINT16 wad, UINT16 startlump) { UINT16 i, end; + boolean compatload = false; + + if (wadfiles[wad]->compatmode) + { + // Compatibility mode: "blind idiot" trace to the first map header/WAD + compatload = true; + } if (wadfiles[wad]->type == RET_WAD) { @@ -1285,6 +1292,33 @@ UINT16 W_CheckNumForMapPwad(const char *name, UINT32 hash, UINT16 wad, UINT16 st return i; } } + else if (compatload) + { + for (i = startlump; i < wadfiles[wad]->numlumps; i++) + { + // Not the hash? + if ((wadfiles[wad]->lumpinfo + i)->hash.longname != hash) + continue; + + // Not the name? (always use longname, even in wads, to accomodate WADNAME) + if (strcasecmp(name, (wadfiles[wad]->lumpinfo + i)->longname)) + continue; + + if (W_LumpLength(i | (wad << 16)) > 0) + { + // Not a header? Maybe it's a WAD file... + + if (!W_IsLumpWad(i | (wad << 16))) + { + // ...no dice? + continue; + } + } + + // Found a map! + return i; + } + } } return INT16_MAX;