Compatmode: load maps in PK3s outside of a designated folder
Fixes #189
This commit is contained in:
parent
4a735d7d66
commit
52d1c4313b
1 changed files with 34 additions and 0 deletions
34
src/w_wad.c
34
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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue