Compatmode: load maps in PK3s outside of a designated folder

Fixes #189
This commit is contained in:
yamamama 2026-04-08 16:52:56 -04:00
parent 4a735d7d66
commit 52d1c4313b

View file

@ -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;