Only load map lumps that are WADs or have no extension

This commit is contained in:
Alug committed 2024-08-05 16:21:29 +02:00
1 parent b5ba82e52b
commit 1fb126b4d3
2 files changed
+23 -6

No files matched your search

+2 -2
View File
@@ -2840,8 +2840,8 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
// internal game map
maplumpname = G_BuildMapName(gamemap);
lastloadedmaplumpnum = W_CheckNumForName(maplumpname);
if (lastloadedmaplumpnum == INT16_MAX)
lastloadedmaplumpnum = W_CheckNumForMap(maplumpname);
if (lastloadedmaplumpnum == LUMPERROR)
I_Error("Map %s not found.\n", maplumpname);
curmapvirt = vres_GetMap(lastloadedmaplumpnum);
+21 -4
View File
@@ -1216,8 +1216,14 @@ lumpnum_t W_CheckNumForMap(const char *name)
for (lumpNum = 0; lumpNum < wadfiles[i]->numlumps; lumpNum++)
{
p = wadfiles[i]->lumpinfo + lumpNum;
if (p->hash == hash && !strncmp(name, p->name, 8))
return (i<<16) + lumpNum;
if (p->hash != hash)
continue;
if (strncmp(name, p->name, 8))
continue;
return (i<<16) + lumpNum;
}
}
else if (wadfiles[i]->type == RET_PK3)
@@ -1231,8 +1237,19 @@ lumpnum_t W_CheckNumForMap(const char *name)
for (; lumpNum < end; lumpNum++)
{
p = wadfiles[i]->lumpinfo + lumpNum;
if (p->hash == hash && !strnicmp(name, p->name, 8))
return (i<<16) + lumpNum;
if (p->hash != hash)
continue;
if (strnicmp(name, p->name, 8))
continue;
const char *extension = strrchr(p->fullname, '.');
if (extension && stricmp(extension, ".wad"))
continue;
return (i<<16) + lumpNum;
}
}
}