- redid autoload handler and resource file filtering to use the newly defined method with multi-part names.

As a result the old 'Group' property could be removed and all other means to get a section name were disabled.
As an example, if the code gets 'doom.doom2.commercial' it will use the following sections in this order:

global.autoload
doom.autoload
doom.doom2.autoload
doom.doom2.commercial.autoload.
This commit is contained in:
Christoph Oelckers 2015-04-06 11:57:12 +02:00
parent 3241b1d3db
commit 258822ef3b
7 changed files with 22 additions and 35 deletions

View file

@ -138,12 +138,6 @@ void FIWadManager::ParseIWadInfo(const char *fn, const char *data, int datasize)
sc.MustGetString();
iwad->Autoname = sc.String;
}
else if (sc.Compare("Group"))
{
sc.MustGetStringName("=");
sc.MustGetString();
iwad->Group = sc.String;
}
else if (sc.Compare("Config"))
{
sc.MustGetStringName("=");

View file

@ -1990,10 +1990,9 @@ static void D_DoomInit()
//
//==========================================================================
static void AddAutoloadFiles(const char *group, const char *autoname)
static void AddAutoloadFiles(const char *autoname)
{
LumpFilterGroup = group;
LumpFilterIWAD = autoname;
LumpFilterIWAD.Format("%s.", autoname); // The '.' is appened to simplify parsing the string
if (!(gameinfo.flags & GI_SHAREWARE) && !Args->CheckParm("-noautoload"))
{
@ -2025,25 +2024,14 @@ static void AddAutoloadFiles(const char *group, const char *autoname)
// Add common (global) wads
D_AddConfigWads (allwads, "Global.Autoload");
// Add game-specific wads
file = gameinfo.ConfigName;
file += ".Autoload";
D_AddConfigWads (allwads, file);
long len;
int lastpos = -1;
// Add group-specific wads
if (group != NULL && group[0] != 0)
{
file = group;
file += ".Autoload";
D_AddConfigWads(allwads, file);
}
// Add IWAD-specific wads
if (autoname != NULL && autoname[0] != 0)
while ((len = LumpFilterIWAD.IndexOf('.', lastpos+1)) > 0)
{
file = autoname;
file += ".Autoload";
file = LumpFilterIWAD.Left(len) + ".Autoload";
D_AddConfigWads(allwads, file);
lastpos = len;
}
}
}
@ -2294,7 +2282,7 @@ void D_DoomMain (void)
FBaseCVar::DisableCallbacks();
GameConfig->DoGameSetup (gameinfo.ConfigName);
AddAutoloadFiles(iwad_info->Group, iwad_info->Autoname);
AddAutoloadFiles(iwad_info->Autoname);
// Run automatically executed files
execFiles = new DArgs;

View file

@ -75,7 +75,6 @@ struct FIWADInfo
{
FString Name; // Title banner text for this IWAD
FString Autoname; // Name of autoload ini section for this IWAD
FString Group; // Groupname for this IWAD
FString Configname; // Name of config section for this IWAD
FString Required; // Requires another IWAD
DWORD FgColor; // Foreground color for title banner

View file

@ -69,4 +69,4 @@ int SinglePlayerClass[MAXPLAYERS];
bool ToggleFullscreen;
int BorderTopRefresh;
FString LumpFilterGroup, LumpFilterIWAD;
FString LumpFilterIWAD;

View file

@ -251,6 +251,6 @@ EXTERN_CVAR (Int, compatflags2);
extern int i_compatflags, i_compatflags2, ii_compatflags, ii_compatflags2, ib_compatflags;
// Filters from AddAutoloadFiles(). Used to filter files from archives.
extern FString LumpFilterGroup, LumpFilterIWAD;
extern FString LumpFilterIWAD;
#endif

View file

@ -163,6 +163,7 @@ FGameConfigFile::FGameConfigFile ()
// Create auto-load sections, so users know what's available.
// Note that this totem pole is the reverse of the order that
// they will appear in the file.
#if 0
CreateSectionAtStart("Harmony.Autoload");
CreateSectionAtStart("UrbanBrawl.Autoload");
CreateSectionAtStart("Chex3.Autoload");
@ -185,6 +186,7 @@ FGameConfigFile::FGameConfigFile ()
CreateSectionAtStart("DoomU.Autoload");
CreateSectionAtStart("Doom1.Autoload");
CreateSectionAtStart("Doom.Autoload");
#endif
CreateSectionAtStart("Global.Autoload");
// The same goes for auto-exec files.
@ -336,9 +338,6 @@ void FGameConfigFile::DoGlobalSetup ()
}
if (last < 211)
{
//RenameSection("Hacx2.Autoload", "hacx.2_0.Autoload");
//RenameSection("Hacx12.Autoload", "hacx.1_2.Autoload");
//RenameSection("Hexen1.Autoload", "hexen.hexen.Autoload");
RenameSection("Chex3.Autoload", "chex.3.Autoload");
RenameSection("Chex1.Autoload", "chex.1.Autoload");
RenameSection("HexenDK.Autoload", "hexen.deathkings.Autoload");

View file

@ -345,9 +345,16 @@ void FResourceFile::PostProcessArchive(void *lumps, size_t lumpsize)
// each one so that we don't risk refiltering already filtered lumps.
DWORD max = NumLumps;
max -= FilterLumpsByGameType(gameinfo.gametype, lumps, lumpsize, max);
max -= FilterLumps(gameinfo.ConfigName, lumps, lumpsize, max);
max -= FilterLumps(LumpFilterGroup, lumps, lumpsize, max);
max -= FilterLumps(LumpFilterIWAD, lumps, lumpsize, max);
long len;
int lastpos = -1;
FString file;
while ((len = LumpFilterIWAD.IndexOf('.', lastpos+1)) > 0)
{
max -= FilterLumps(LumpFilterIWAD.Left(len), lumps, lumpsize, max);
lastpos = len;
}
JunkLeftoverFilters(lumps, lumpsize, max);
}