mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-01 00:21:43 +00:00
- made all references to the GameNames array an inline function call to allow easier modification later
- changed all parsers that check for the current game to use the same function for the game check. - fixed: The TEAMINFO parser handled 'game Any' incorrectly. SVN r2934 (trunk)
This commit is contained in:
parent
dd17c35d89
commit
352a926ddf
13 changed files with 37 additions and 104 deletions
|
@ -1877,7 +1877,7 @@ void D_DoomMain (void)
|
||||||
gameinfo.gametype = iwad_info->gametype;
|
gameinfo.gametype = iwad_info->gametype;
|
||||||
gameinfo.flags = iwad_info->flags;
|
gameinfo.flags = iwad_info->flags;
|
||||||
|
|
||||||
GameConfig->DoGameSetup (GameNames[gameinfo.gametype]);
|
GameConfig->DoGameSetup (GameName());
|
||||||
|
|
||||||
if (!(gameinfo.flags & GI_SHAREWARE) && !Args->CheckParm("-noautoload"))
|
if (!(gameinfo.flags & GI_SHAREWARE) && !Args->CheckParm("-noautoload"))
|
||||||
{
|
{
|
||||||
|
@ -1910,7 +1910,7 @@ void D_DoomMain (void)
|
||||||
D_AddConfigWads (allwads, "Global.Autoload");
|
D_AddConfigWads (allwads, "Global.Autoload");
|
||||||
|
|
||||||
// Add game-specific wads
|
// Add game-specific wads
|
||||||
file = GameNames[gameinfo.gametype];
|
file = GameName();
|
||||||
file += ".Autoload";
|
file += ".Autoload";
|
||||||
D_AddConfigWads (allwads, file);
|
D_AddConfigWads (allwads, file);
|
||||||
|
|
||||||
|
@ -1925,7 +1925,7 @@ void D_DoomMain (void)
|
||||||
|
|
||||||
// Run automatically executed files
|
// Run automatically executed files
|
||||||
execFiles = new DArgs;
|
execFiles = new DArgs;
|
||||||
GameConfig->AddAutoexec (execFiles, GameNames[gameinfo.gametype]);
|
GameConfig->AddAutoexec (execFiles, GameName());
|
||||||
D_MultiExec (execFiles, true);
|
D_MultiExec (execFiles, true);
|
||||||
|
|
||||||
// Run .cfg files at the start of the command line.
|
// Run .cfg files at the start of the command line.
|
||||||
|
@ -2145,7 +2145,7 @@ void D_DoomMain (void)
|
||||||
|
|
||||||
StartScreen->Progress ();
|
StartScreen->Progress ();
|
||||||
|
|
||||||
Printf ("R_Init: Init %s refresh subsystem.\n", GameNames[gameinfo.gametype]);
|
Printf ("R_Init: Init %s refresh subsystem.\n", GameName());
|
||||||
StartScreen->LoadingStatus ("Loading graphics", 0x3f);
|
StartScreen->LoadingStatus ("Loading graphics", 0x3f);
|
||||||
R_Init ();
|
R_Init ();
|
||||||
|
|
||||||
|
|
|
@ -199,27 +199,11 @@ static void ParseLock(FScanner &sc)
|
||||||
keynum = sc.Number;
|
keynum = sc.Number;
|
||||||
|
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
if (sc.Compare("DOOM"))
|
if (!sc.Compare("{"))
|
||||||
{
|
{
|
||||||
if (gameinfo.gametype != GAME_Doom) keynum=-1;
|
if (!CheckGame(sc.String, false)) keynum = -1;
|
||||||
|
sc.MustGetStringName("{");
|
||||||
}
|
}
|
||||||
else if (sc.Compare("HERETIC"))
|
|
||||||
{
|
|
||||||
if (gameinfo.gametype != GAME_Heretic) keynum=-1;
|
|
||||||
}
|
|
||||||
else if (sc.Compare("HEXEN"))
|
|
||||||
{
|
|
||||||
if (gameinfo.gametype != GAME_Hexen) keynum=-1;
|
|
||||||
}
|
|
||||||
else if (sc.Compare("STRIFE"))
|
|
||||||
{
|
|
||||||
if (gameinfo.gametype != GAME_Strife) keynum=-1;
|
|
||||||
}
|
|
||||||
else if (sc.Compare("CHEX"))
|
|
||||||
{
|
|
||||||
if (gameinfo.gametype != GAME_Chex) keynum=-1;
|
|
||||||
}
|
|
||||||
else sc.UnGet();
|
|
||||||
|
|
||||||
ignorekey = true;
|
ignorekey = true;
|
||||||
if (keynum > 0 && keynum < 255)
|
if (keynum > 0 && keynum < 255)
|
||||||
|
@ -239,7 +223,6 @@ static void ParseLock(FScanner &sc)
|
||||||
sc.ScriptError("Lock index %d out of range", keynum);
|
sc.ScriptError("Lock index %d out of range", keynum);
|
||||||
}
|
}
|
||||||
|
|
||||||
sc.MustGetStringName("{");
|
|
||||||
while (!sc.CheckString("}"))
|
while (!sc.CheckString("}"))
|
||||||
{
|
{
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
|
|
12
src/gi.h
12
src/gi.h
|
@ -135,4 +135,16 @@ struct gameinfo_t
|
||||||
|
|
||||||
extern gameinfo_t gameinfo;
|
extern gameinfo_t gameinfo;
|
||||||
|
|
||||||
|
inline const char *GameName()
|
||||||
|
{
|
||||||
|
return GameNames[gameinfo.gametype];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool CheckGame(const char *string, bool chexisdoom)
|
||||||
|
{
|
||||||
|
int test = gameinfo.gametype;
|
||||||
|
if (test == GAME_Chex && chexisdoom) test = GAME_Doom;
|
||||||
|
return !stricmp(string, GameNames[test]);
|
||||||
|
}
|
||||||
|
|
||||||
#endif //__GI_H__
|
#endif //__GI_H__
|
||||||
|
|
|
@ -48,10 +48,10 @@ static void LoadKeys (const char *modname, bool dbl)
|
||||||
{
|
{
|
||||||
char section[64];
|
char section[64];
|
||||||
|
|
||||||
if (GameNames[gameinfo.gametype] == NULL)
|
if (GameName() == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mysnprintf (section, countof(section), "%s.%s%sBindings", GameNames[gameinfo.gametype], modname,
|
mysnprintf (section, countof(section), "%s.%s%sBindings", GameName(), modname,
|
||||||
dbl ? ".Double" : ".");
|
dbl ? ".Double" : ".");
|
||||||
|
|
||||||
FKeyBindings *bindings = dbl? &DoubleBindings : &Bindings;
|
FKeyBindings *bindings = dbl? &DoubleBindings : &Bindings;
|
||||||
|
|
|
@ -375,9 +375,9 @@ bool M_SaveDefaults (const char *filename)
|
||||||
GameConfig->ChangePathName (filename);
|
GameConfig->ChangePathName (filename);
|
||||||
}
|
}
|
||||||
GameConfig->ArchiveGlobalData ();
|
GameConfig->ArchiveGlobalData ();
|
||||||
if (GameNames[gameinfo.gametype] != NULL)
|
if (GameName() != NULL)
|
||||||
{
|
{
|
||||||
GameConfig->ArchiveGameData (GameNames[gameinfo.gametype]);
|
GameConfig->ArchiveGameData (GameName());
|
||||||
}
|
}
|
||||||
success = GameConfig->WriteConfigFile ();
|
success = GameConfig->WriteConfigFile ();
|
||||||
if (filename != NULL)
|
if (filename != NULL)
|
||||||
|
@ -619,7 +619,7 @@ static bool FindFreeName (FString &fullname, const char *extension)
|
||||||
|
|
||||||
for (i = 0; i <= 9999; i++)
|
for (i = 0; i <= 9999; i++)
|
||||||
{
|
{
|
||||||
const char *gamename = GameNames[gameinfo.gametype];
|
const char *gamename = GameName();
|
||||||
|
|
||||||
time_t now;
|
time_t now;
|
||||||
tm *tm;
|
tm *tm;
|
||||||
|
|
|
@ -960,6 +960,6 @@ CCMD(reset2defaults)
|
||||||
CCMD(reset2saved)
|
CCMD(reset2saved)
|
||||||
{
|
{
|
||||||
GameConfig->DoGlobalSetup ();
|
GameConfig->DoGlobalSetup ();
|
||||||
GameConfig->DoGameSetup (GameNames[gameinfo.gametype]);
|
GameConfig->DoGameSetup (GameName());
|
||||||
R_SetViewSize (screenblocks);
|
R_SetViewSize (screenblocks);
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,20 +112,16 @@ static void SkipSubBlock(FScanner &sc)
|
||||||
|
|
||||||
static bool CheckSkipGameBlock(FScanner &sc)
|
static bool CheckSkipGameBlock(FScanner &sc)
|
||||||
{
|
{
|
||||||
int filter = 0;
|
bool filter = false;
|
||||||
sc.MustGetStringName("(");
|
sc.MustGetStringName("(");
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
if (sc.Compare("Doom")) filter |= GAME_Doom;
|
filter |= CheckGame(sc.String, false);
|
||||||
if (sc.Compare("Heretic")) filter |= GAME_Heretic;
|
|
||||||
if (sc.Compare("Hexen")) filter |= GAME_Hexen;
|
|
||||||
if (sc.Compare("Strife")) filter |= GAME_Strife;
|
|
||||||
if (sc.Compare("Chex")) filter |= GAME_Chex;
|
|
||||||
}
|
}
|
||||||
while (sc.CheckString(","));
|
while (sc.CheckString(","));
|
||||||
sc.MustGetStringName(")");
|
sc.MustGetStringName(")");
|
||||||
if (!(gameinfo.gametype & filter))
|
if (!filter)
|
||||||
{
|
{
|
||||||
SkipSubBlock(sc);
|
SkipSubBlock(sc);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -332,31 +332,10 @@ static void ParseOuter (FScanner &sc)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OUT_IFDOOM:
|
case OUT_IFDOOM:
|
||||||
if (!(gameinfo.gametype & GAME_DoomChex))
|
|
||||||
{
|
|
||||||
ifskip = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OUT_IFHERETIC:
|
case OUT_IFHERETIC:
|
||||||
if (gameinfo.gametype != GAME_Heretic)
|
|
||||||
{
|
|
||||||
ifskip = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OUT_IFHEXEN:
|
case OUT_IFHEXEN:
|
||||||
if (gameinfo.gametype != GAME_Hexen)
|
|
||||||
{
|
|
||||||
ifskip = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OUT_IFSTRIFE:
|
case OUT_IFSTRIFE:
|
||||||
if (gameinfo.gametype != GAME_Strife)
|
ifskip = !CheckGame(sc.String+2, true);
|
||||||
{
|
|
||||||
ifskip = true;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OUT_ENDIF:
|
case OUT_ENDIF:
|
||||||
|
|
|
@ -1449,7 +1449,7 @@ public:
|
||||||
floordrop = true;
|
floordrop = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Printf("Unknown namespace %s. Using defaults for %s\n", sc.String, GameNames[gameinfo.gametype]);
|
Printf("Unknown namespace %s. Using defaults for %s\n", sc.String, GameName());
|
||||||
switch (gameinfo.gametype)
|
switch (gameinfo.gametype)
|
||||||
{
|
{
|
||||||
default: // Shh, GCC
|
default: // Shh, GCC
|
||||||
|
|
|
@ -1301,31 +1301,10 @@ static void S_AddSNDINFO (int lump)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SI_IfDoom: //also Chex
|
case SI_IfDoom: //also Chex
|
||||||
if (!(gameinfo.gametype & GAME_DoomChex))
|
|
||||||
{
|
|
||||||
skipToEndIf = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SI_IfStrife:
|
case SI_IfStrife:
|
||||||
if (gameinfo.gametype != GAME_Strife)
|
|
||||||
{
|
|
||||||
skipToEndIf = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SI_IfHeretic:
|
case SI_IfHeretic:
|
||||||
if (gameinfo.gametype != GAME_Heretic)
|
|
||||||
{
|
|
||||||
skipToEndIf = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SI_IfHexen:
|
case SI_IfHexen:
|
||||||
if (gameinfo.gametype != GAME_Hexen)
|
skipToEndIf = !CheckGame(sc.String+3, true);
|
||||||
{
|
|
||||||
skipToEndIf = true;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,7 @@ void FStringTable::LoadLanguage (int lumpnum, DWORD code, bool exactMatch, int p
|
||||||
sc.MustGetStringName("ifgame");
|
sc.MustGetStringName("ifgame");
|
||||||
sc.MustGetStringName("(");
|
sc.MustGetStringName("(");
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
skip |= !sc.Compare(GameNames[gameinfo.gametype]);
|
skip |= !sc.Compare(GameName());
|
||||||
sc.MustGetStringName(")");
|
sc.MustGetStringName(")");
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,6 @@ enum ETeamOptions
|
||||||
|
|
||||||
FTeam::FTeam ()
|
FTeam::FTeam ()
|
||||||
{
|
{
|
||||||
m_GameFilter = 0;
|
|
||||||
m_iPlayerColor = 0;
|
m_iPlayerColor = 0;
|
||||||
m_iPlayerCount = 0;
|
m_iPlayerCount = 0;
|
||||||
m_iScore = 0;
|
m_iScore = 0;
|
||||||
|
@ -162,6 +161,7 @@ void FTeam::ParseTeamInfo ()
|
||||||
void FTeam::ParseTeamDefinition (FScanner &Scan)
|
void FTeam::ParseTeamDefinition (FScanner &Scan)
|
||||||
{
|
{
|
||||||
FTeam Team;
|
FTeam Team;
|
||||||
|
int valid = -1;
|
||||||
Scan.MustGetString ();
|
Scan.MustGetString ();
|
||||||
Team.m_Name = Scan.String;
|
Team.m_Name = Scan.String;
|
||||||
Scan.MustGetStringName ("{");
|
Scan.MustGetStringName ("{");
|
||||||
|
@ -174,23 +174,9 @@ void FTeam::ParseTeamDefinition (FScanner &Scan)
|
||||||
{
|
{
|
||||||
case TEAMINFO_Game:
|
case TEAMINFO_Game:
|
||||||
Scan.MustGetString ();
|
Scan.MustGetString ();
|
||||||
|
if (Scan.Compare("Any")) valid = 1;
|
||||||
if (!stricmp (Scan.String, "Doom"))
|
else if (CheckGame(Scan.String, false)) valid = 1;
|
||||||
Team.m_GameFilter |= GAME_Doom;
|
else if (valid == -1) valid = 0;
|
||||||
else if (!stricmp (Scan.String, "Heretic"))
|
|
||||||
Team.m_GameFilter |= GAME_Heretic;
|
|
||||||
else if (!stricmp (Scan.String, "Hexen"))
|
|
||||||
Team.m_GameFilter |= GAME_Hexen;
|
|
||||||
else if (!stricmp (Scan.String, "Raven"))
|
|
||||||
Team.m_GameFilter |= GAME_Raven;
|
|
||||||
else if (!stricmp (Scan.String, "Strife"))
|
|
||||||
Team.m_GameFilter |= GAME_Strife;
|
|
||||||
else if (!stricmp (Scan.String, "Chex"))
|
|
||||||
Team.m_GameFilter |= GAME_Chex;
|
|
||||||
else if (!stricmp (Scan.String, "Any"))
|
|
||||||
Team.m_GameFilter |= GAME_Any;
|
|
||||||
else
|
|
||||||
Scan.ScriptError ("ParseTeamDefinition: Unknown game type '%s'.\n", Scan.String);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TEAMINFO_PlayerColor:
|
case TEAMINFO_PlayerColor:
|
||||||
|
@ -236,8 +222,7 @@ void FTeam::ParseTeamDefinition (FScanner &Scan)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Team.m_GameFilter == 0 || Team.m_GameFilter & gameinfo.gametype)
|
if (valid) Teams.Push (Team);
|
||||||
Teams.Push (Team);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -64,7 +64,6 @@ private:
|
||||||
void ClearTeams ();
|
void ClearTeams ();
|
||||||
|
|
||||||
FString m_Name;
|
FString m_Name;
|
||||||
BYTE m_GameFilter;
|
|
||||||
int m_iPlayerColor;
|
int m_iPlayerColor;
|
||||||
FString m_TextColor;
|
FString m_TextColor;
|
||||||
FString m_Logo;
|
FString m_Logo;
|
||||||
|
|
Loading…
Reference in a new issue