diff options
author | Simon Howard | 2011-09-20 21:53:05 +0000 |
---|---|---|
committer | Simon Howard | 2011-09-20 21:53:05 +0000 |
commit | 76a7eebc335c6f57da589ee66971b850f0ec4c50 (patch) | |
tree | 4dead04fe9b054d58f4b5a6a9265a260f741d003 /src | |
parent | b8d2d8bb8b3cf1b5475e8c9be292248f140b2126 (diff) | |
download | chocolate-doom-76a7eebc335c6f57da589ee66971b850f0ec4c50.tar.gz chocolate-doom-76a7eebc335c6f57da589ee66971b850f0ec4c50.tar.bz2 chocolate-doom-76a7eebc335c6f57da589ee66971b850f0ec4c50.zip |
Add dedicated pack_chex and pack_hacx values for the Chex Quest and Hacx
IWADs.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2390
Diffstat (limited to 'src')
-rw-r--r-- | src/d_iwad.c | 5 | ||||
-rw-r--r-- | src/d_iwad.h | 4 | ||||
-rw-r--r-- | src/d_mode.c | 11 | ||||
-rw-r--r-- | src/d_mode.h | 4 | ||||
-rw-r--r-- | src/doom/d_main.c | 66 | ||||
-rw-r--r-- | src/doom/doomstat.h | 9 | ||||
-rw-r--r-- | src/doom/f_finale.c | 6 | ||||
-rw-r--r-- | src/doom/g_game.c | 2 | ||||
-rw-r--r-- | src/doom/hu_stuff.c | 2 | ||||
-rw-r--r-- | src/doom/m_menu.c | 2 | ||||
-rw-r--r-- | src/doom/st_stuff.c | 4 |
11 files changed, 46 insertions, 69 deletions
diff --git a/src/d_iwad.c b/src/d_iwad.c index 9e7cd5ea..f4e10339 100644 --- a/src/d_iwad.c +++ b/src/d_iwad.c @@ -46,8 +46,8 @@ static iwad_t iwads[] = { "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 @@ static GameMission_t IdentifyIWADByName(char *name, int mask) if (!strcasecmp(name, iwads[i].name)) { mission = iwads[i].mission; +printf("identified %s: mission = %i\n", name, mission); break; } } diff --git a/src/d_iwad.h b/src/d_iwad.h index c0f7e9c0..97eaf3eb 100644 --- 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) diff --git a/src/d_mode.c b/src/d_mode.c index 2d94d82f..6b056e84 100644 --- a/src/d_mode.c +++ b/src/d_mode.c @@ -38,12 +38,14 @@ static struct int episode; int map; } valid_modes[] = { + { pack_chex, shareware, 1, 5 }, { doom, shareware, 1, 9 }, { doom, registered, 3, 9 }, { doom, retail, 4, 9 }, { 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 @@ static struct { 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 @@ boolean D_ValidGameVersion(GameMission_t mission, GameVersion_t version) // 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 @@ boolean D_IsEpisodeMap(GameMission_t mission) { 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: diff --git a/src/d_mode.h b/src/d_mode.h index 1f959d8d..2a51c1d2 100644 --- a/src/d_mode.h +++ b/src/d_mode.h @@ -38,7 +38,9 @@ typedef enum 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 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. |