summaryrefslogtreecommitdiff
path: root/src/doom
diff options
context:
space:
mode:
Diffstat (limited to 'src/doom')
-rw-r--r--src/doom/d_main.c66
-rw-r--r--src/doom/doomstat.h9
-rw-r--r--src/doom/f_finale.c6
-rw-r--r--src/doom/g_game.c2
-rw-r--r--src/doom/hu_stuff.c2
-rw-r--r--src/doom/m_menu.c2
-rw-r--r--src/doom/st_stuff.c4
7 files changed, 28 insertions, 63 deletions
diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index b425d11a..beb15019 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -721,7 +721,7 @@ void D_IdentifyVersion(void)
// Make sure gamemode is set up correctly
- if (gamemission == doom)
+ if (logical_gamemission == doom)
{
// Doom 1. But which version?
@@ -754,7 +754,7 @@ void D_SetGameDescription(void)
{
gamedescription = "Unknown";
- if (gamemission == doom)
+ if (logical_gamemission == doom)
{
// Doom 1. But which version?
@@ -777,39 +777,15 @@ void D_SetGameDescription(void)
{
// Doom 2 of some kind. But which mission?
- if (gamemission == doom2)
+ if (logical_gamemission == doom2)
gamedescription = GetGameName("DOOM 2: Hell on Earth");
- else if (gamemission == pack_plut)
+ else if (logical_gamemission == pack_plut)
gamedescription = GetGameName("DOOM 2: Plutonia Experiment");
- else if (gamemission == pack_tnt)
+ else if (logical_gamemission == pack_tnt)
gamedescription = GetGameName("DOOM 2: TNT - Evilution");
}
}
-// Check if the IWAD file is the Chex Quest IWAD.
-// Returns true if this is chex.wad.
-
-static boolean CheckChex(char *iwadname)
-{
- char *chex_iwadname = "chex.wad";
-
- return (strlen(iwadname) > strlen(chex_iwadname)
- && !strcasecmp(iwadname + strlen(iwadname) - strlen(chex_iwadname),
- chex_iwadname));
-}
-
-// Check if the IWAD file is the Hacx IWAD.
-// Returns true if this is hacx.wad.
-
-static boolean CheckHacx(char *iwadname)
-{
- char *hacx_iwadname = "hacx.wad";
-
- return (strlen(iwadname) > strlen(hacx_iwadname)
- && !strcasecmp(iwadname + strlen(iwadname) - strlen(hacx_iwadname),
- hacx_iwadname));
-}
-
// print title for every printed line
char title[128];
@@ -933,15 +909,15 @@ static void InitGameVersion(void)
{
// Determine automatically
- if (CheckChex(iwadfile))
+ if (gamemission == pack_chex)
{
// chex.exe - identified by iwad filename
gameversion = exe_chex;
}
- else if (CheckHacx(iwadfile))
+ else if (gamemission == pack_hacx)
{
- // hacx exe: identified by iwad filename
+ // hacx.exe: identified by iwad filename
gameversion = exe_hacx;
}
@@ -981,7 +957,8 @@ static void InitGameVersion(void)
// EXEs prior to the Final Doom exes do not support Final Doom.
- if (gameversion < exe_final && gamemode == commercial)
+ if (gameversion < exe_final && gamemode == commercial
+ && (gamemission == pack_tnt || gamemission == pack_plut))
{
gamemission = doom2;
}
@@ -1087,27 +1064,6 @@ static void LoadHacxDeh(void)
}
}
-// Figure out what IWAD name to use for savegames.
-
-static char *SaveGameIWADName(void)
-{
- // Chex quest hack
-
- if (gameversion == exe_chex)
- {
- return "chex.wad";
- }
-
- // Hacx hack
-
- if (gameversion == exe_hacx)
- {
- return "hacx.wad";
- }
-
- return D_SaveGameIWADName(gamemission);
-}
-
//
// D_DoomMain
//
@@ -1422,7 +1378,7 @@ void D_DoomMain (void)
LoadChexDeh();
LoadHacxDeh();
D_SetGameDescription();
- savegamedir = M_GetSaveGameDir(SaveGameIWADName());
+ savegamedir = M_GetSaveGameDir(D_SaveGameIWADName(gamemission));
// Check for -file in shareware
if (modifiedgame)
diff --git a/src/doom/doomstat.h b/src/doom/doomstat.h
index 237234d8..cd626fdf 100644
--- a/src/doom/doomstat.h
+++ b/src/doom/doomstat.h
@@ -66,6 +66,15 @@ extern GameMission_t gamemission;
extern GameVersion_t gameversion;
extern char *gamedescription;
+// Convenience macro.
+// 'gamemission' can be equal to pack_chex or pack_hacx, but these are
+// just modified versions of doom and doom2, and should be interpreted
+// as the same most of the time.
+
+#define logical_gamemission \
+ (gamemission == pack_chex ? doom : \
+ gamemission == pack_hacx ? doom2 : gamemission)
+
// Set if homebrew PWAD stuff has been added.
extern boolean modifiedgame;
diff --git a/src/doom/f_finale.c b/src/doom/f_finale.c
index dfbeafbe..f682c224 100644
--- a/src/doom/f_finale.c
+++ b/src/doom/f_finale.c
@@ -122,7 +122,7 @@ void F_StartFinale (void)
viewactive = false;
automapactive = false;
- if (gamemission == doom)
+ if (logical_gamemission == doom)
{
S_ChangeMusic(mus_victor, true);
}
@@ -144,8 +144,8 @@ void F_StartFinale (void)
screen->level = 5;
}
- if (gamemission == screen->mission
- && (gamemission != doom || gameepisode == screen->episode)
+ if (logical_gamemission == screen->mission
+ && (logical_gamemission != doom || gameepisode == screen->episode)
&& gamemap == screen->level)
{
finaletext = screen->text;
diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index 598f1c5e..d7f86b20 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -363,7 +363,7 @@ static boolean WeaponSelectable(weapontype_t weapon)
{
// Can't select the super shotgun in Doom 1.
- if (weapon == wp_supershotgun && gamemission == doom)
+ if (weapon == wp_supershotgun && logical_gamemission == doom)
{
return false;
}
diff --git a/src/doom/hu_stuff.c b/src/doom/hu_stuff.c
index f9271b3d..62e90aae 100644
--- a/src/doom/hu_stuff.c
+++ b/src/doom/hu_stuff.c
@@ -340,7 +340,7 @@ void HU_Start(void)
hu_font,
HU_FONTSTART);
- switch ( gamemission )
+ switch ( logical_gamemission )
{
case doom:
s = HU_TITLE;
diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c
index 4a365cfb..d1d0aa05 100644
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -1156,7 +1156,7 @@ static char *M_SelectEndMessage(void)
{
char **endmsg;
- if (gamemission == doom)
+ if (logical_gamemission == doom)
{
// Doom 1
diff --git a/src/doom/st_stuff.c b/src/doom/st_stuff.c
index 8595ff50..df8592a4 100644
--- a/src/doom/st_stuff.c
+++ b/src/doom/st_stuff.c
@@ -550,9 +550,9 @@ ST_Responder (event_t* ev)
S_ChangeMusic(musnum, 1);
}
}
- else if ( (gamemission == doom
+ else if ( (logical_gamemission == doom
&& cht_CheckCheat(&cheat_noclip, ev->data2))
- || (gamemission != doom
+ || (logical_gamemission != doom
&& cht_CheckCheat(&cheat_commercial_noclip,ev->data2)))
{
// Noclip cheat.