ref: 76a7eebc335c6f57da589ee66971b850f0ec4c50
parent: b8d2d8bb8b3cf1b5475e8c9be292248f140b2126
author: Simon Howard <[email protected]>
date: Tue Sep 20 17:53:05 EDT 2011
Add dedicated pack_chex and pack_hacx values for the Chex Quest and Hacx IWADs. Subversion-branch: /branches/v2-branch Subversion-revision: 2390
--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@ -46,8 +46,8 @@
{ "tnt.wad", pack_tnt, commercial, "Final Doom: TNT: Evilution" },
{ "doom.wad", doom, retail, "Doom" },
{ "doom1.wad", doom, shareware, "Doom Shareware" },
- { "chex.wad", doom, shareware, "Chex Quest" },
- { "hacx.wad", doom2, commercial, "Hacx" },
+ { "chex.wad", pack_chex, shareware, "Chex Quest" },
+ { "hacx.wad", pack_hacx, commercial, "Hacx" },
{ "heretic.wad", heretic, retail, "Heretic" },
{ "heretic1.wad", heretic, shareware, "Heretic Shareware" },
{ "hexen.wad", hexen, commercial, "Hexen" },
@@ -449,6 +449,7 @@
if (!strcasecmp(name, iwads[i].name))
{
mission = iwads[i].mission;
+printf("identified %s: mission = %i\n", name, mission);
break;
}
}
--- a/src/d_iwad.h
+++ b/src/d_iwad.h
@@ -32,7 +32,9 @@
#define IWAD_MASK_DOOM ((1 << doom) \
| (1 << doom2) \
| (1 << pack_tnt) \
- | (1 << pack_plut))
+ | (1 << pack_plut) \
+ | (1 << pack_chex) \
+ | (1 << pack_hacx))
#define IWAD_MASK_HERETIC (1 << heretic)
#define IWAD_MASK_HEXEN (1 << hexen)
#define IWAD_MASK_STRIFE (1 << strife)
--- a/src/d_mode.c
+++ b/src/d_mode.c
@@ -38,6 +38,7 @@
int episode;
int map;
} valid_modes[] = {
+ { pack_chex, shareware, 1, 5 },
{ doom, shareware, 1, 9 },
{ doom, registered, 3, 9 },
{ doom, retail, 4, 9 },
@@ -44,6 +45,7 @@
{ doom2, commercial, 1, 32 },
{ pack_tnt, commercial, 1, 32 },
{ pack_plut, commercial, 1, 32 },
+ { pack_hacx, commercial, 1, 32 },
{ heretic, shareware, 1, 9 },
{ heretic, registered, 3, 9 },
{ heretic, retail, 5, 9 },
@@ -127,9 +129,11 @@
GameVersion_t version;
} valid_versions[] = {
{ doom, exe_doom_1_9 },
+ { doom, exe_hacx },
{ doom, exe_ultimate },
- { doom, exe_chex },
{ doom, exe_final },
+ { doom, exe_final2 },
+ { doom, exe_chex },
{ heretic, exe_heretic_1_3 },
{ hexen, exe_hexen_1_1 },
{ strife, exe_strife_1_2 },
@@ -141,7 +145,8 @@
// All Doom variants can use the Doom versions.
- if (mission == doom2 || mission == pack_plut || mission == pack_tnt)
+ if (mission == doom2 || mission == pack_plut || mission == pack_tnt
+ || mission == pack_hacx || mission == pack_chex)
{
mission = doom;
}
@@ -166,11 +171,13 @@
{
case doom:
case heretic:
+ case pack_chex:
return true;
case none:
case hexen:
case doom2:
+ case pack_hacx:
case pack_tnt:
case pack_plut:
case strife:
--- a/src/d_mode.h
+++ b/src/d_mode.h
@@ -38,7 +38,9 @@
doom2, // Doom 2
pack_tnt, // Final Doom: TNT: Evilution
pack_plut, // Final Doom: The Plutonia Experiment
- heretic, // Heretic
+ pack_chex, // Chex Quest (modded doom)
+ pack_hacx, // Hacx (modded doom2)
+ heretic, // Heretic
hexen, // Hexen
strife, // Strife
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -721,7 +721,7 @@
// Make sure gamemode is set up correctly
- if (gamemission == doom)
+ if (logical_gamemission == doom)
{
// Doom 1. But which version?
@@ -754,7 +754,7 @@
{
gamedescription = "Unknown";
- if (gamemission == doom)
+ if (logical_gamemission == doom)
{
// Doom 1. But which version?
@@ -777,39 +777,15 @@
{
// 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 @@
{
// 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 @@
// 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 @@
}
}
-// 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 @@
LoadChexDeh();
LoadHacxDeh();
D_SetGameDescription();
- savegamedir = M_GetSaveGameDir(SaveGameIWADName());
+ savegamedir = M_GetSaveGameDir(D_SaveGameIWADName(gamemission));
// Check for -file in shareware
if (modifiedgame)
--- a/src/doom/doomstat.h
+++ b/src/doom/doomstat.h
@@ -66,6 +66,15 @@
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;
--- a/src/doom/f_finale.c
+++ b/src/doom/f_finale.c
@@ -122,7 +122,7 @@
viewactive = false;
automapactive = false;
- if (gamemission == doom)
+ if (logical_gamemission == doom)
{
S_ChangeMusic(mus_victor, true);
}
@@ -144,8 +144,8 @@
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;
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -363,7 +363,7 @@
{
// Can't select the super shotgun in Doom 1.
- if (weapon == wp_supershotgun && gamemission == doom)
+ if (weapon == wp_supershotgun && logical_gamemission == doom)
{
return false;
}
--- a/src/doom/hu_stuff.c
+++ b/src/doom/hu_stuff.c
@@ -340,7 +340,7 @@
hu_font,
HU_FONTSTART);
- switch ( gamemission )
+ switch ( logical_gamemission )
{
case doom:
s = HU_TITLE;
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -1156,7 +1156,7 @@
{
char **endmsg;
- if (gamemission == doom)
+ if (logical_gamemission == doom)
{
// Doom 1
--- a/src/doom/st_stuff.c
+++ b/src/doom/st_stuff.c
@@ -550,9 +550,9 @@
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.