process TRAKINFO in IWADs, introduce process_wad_t flags (#2053)

* add PROCESS_ALL
This commit is contained in:
Roman Fomin 2024-11-27 18:49:21 +07:00 committed by GitHub
parent 71bb824efa
commit ac5ec75838
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 15 deletions

View File

@ -2260,7 +2260,7 @@ void D_DoomMain(void)
if (!M_ParmExists("-nodeh"))
{
W_ProcessInWads("DEHACKED", ProcessDehLump, true);
W_ProcessInWads("DEHACKED", ProcessDehLump, PROCESS_IWAD);
}
// process .deh files specified on the command line with -deh or -bex.
@ -2273,7 +2273,7 @@ void D_DoomMain(void)
// killough 10/98: now process all deh in wads
if (!M_ParmExists("-nodeh"))
{
W_ProcessInWads("DEHACKED", ProcessDehLump, false);
W_ProcessInWads("DEHACKED", ProcessDehLump, PROCESS_PWAD);
}
// process .deh files from PWADs autoload directories
@ -2281,7 +2281,7 @@ void D_DoomMain(void)
PostProcessDeh();
W_ProcessInWads("BRGHTMPS", R_ParseBrightmaps, false);
W_ProcessInWads("BRGHTMPS", R_ParseBrightmaps, PROCESS_PWAD);
// Moved after WAD initialization because we are checking the COMPLVL lump
G_ReloadDefaults(false); // killough 3/4/98: set defaults just loaded.
@ -2310,7 +2310,7 @@ void D_DoomMain(void)
I_Error("\nThis is not the registered version.");
}
W_ProcessInWads("UMAPDEF", U_ParseMapDefInfo, false);
W_ProcessInWads("UMAPDEF", U_ParseMapDefInfo, PROCESS_PWAD);
//!
// @category mod
@ -2320,8 +2320,7 @@ void D_DoomMain(void)
if (!M_ParmExists("-nomapinfo"))
{
W_ProcessInWads("UMAPINFO", U_ParseMapInfo, true);
W_ProcessInWads("UMAPINFO", U_ParseMapInfo, false);
W_ProcessInWads("UMAPINFO", U_ParseMapInfo, PROCESS_IWAD | PROCESS_PWAD);
}
G_ParseCompDatabase();
@ -2403,7 +2402,7 @@ void D_DoomMain(void)
startloadgame = -1;
}
W_ProcessInWads("TRAKINFO", S_ParseTrakInfo, false);
W_ProcessInWads("TRAKINFO", S_ParseTrakInfo, PROCESS_IWAD | PROCESS_PWAD);
I_Printf(VB_INFO, "M_Init: Init miscellaneous info.");
M_Init();

View File

@ -583,16 +583,24 @@ int W_LumpLengthWithName(int lump, char *name)
// indicated by the third argument, instead of from a file.
static void ProcessInWad(int i, const char *name, void (*process)(int lumpnum),
boolean iwad)
process_wad_t flag)
{
if (i >= 0)
{
ProcessInWad(lumpinfo[i].next, name, process, iwad);
ProcessInWad(lumpinfo[i].next, name, process, flag);
int condition = 0;
if (flag & PROCESS_IWAD)
{
condition |= lumpinfo[i].wad_file == wadfiles[0];
}
if (flag & PROCESS_PWAD)
{
condition |= lumpinfo[i].wad_file != wadfiles[0];
}
if (!strncasecmp(lumpinfo[i].name, name, 8)
&& lumpinfo[i].namespace == ns_global
&& (iwad ? lumpinfo[i].wad_file == wadfiles[0]
: lumpinfo[i].wad_file != wadfiles[0]))
&& lumpinfo[i].namespace == ns_global && condition)
{
process(i);
}
@ -600,10 +608,10 @@ static void ProcessInWad(int i, const char *name, void (*process)(int lumpnum),
}
void W_ProcessInWads(const char *name, void (*process)(int lumpnum),
boolean iwad)
process_wad_t flags)
{
ProcessInWad(lumpinfo[W_LumpNameHash(name) % (unsigned)numlumps].index,
name, process, iwad);
name, process, flags);
}
void W_Close(void)

View File

@ -114,8 +114,17 @@ extern const char **wadfiles;
boolean W_InitBaseFile(const char *path);
void W_AddBaseDir(const char *path);
boolean W_AddPath(const char *path);
typedef enum
{
PROCESS_PWAD = 0x01,
PROCESS_IWAD = 0x02,
PROCESS_ALL = 0x03
} process_wad_t;
void W_ProcessInWads(const char *name, void (*process)(int lumpnum),
boolean iwad);
process_wad_t flags);
void W_InitMultipleFiles(void);
// killough 4/17/98: if W_CheckNumForName() called with only