summaryrefslogtreecommitdiff
path: root/src/doom/d_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/doom/d_main.c')
-rw-r--r--src/doom/d_main.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index 991907fa..f626d408 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -532,6 +532,9 @@ void D_DoAdvanceDemo (void)
// include a DEMO4 lump, so the game bombs out with an error
// when it reaches this point in the demo sequence.
+ // However! There is an alternate version of Final Doom that
+ // includes a fixed executable.
+
if (gameversion == exe_ultimate || gameversion == exe_final)
demosequence = (demosequence+1)%7;
else
@@ -914,6 +917,7 @@ static struct
{"Hacx", "hacx", exe_hacx},
{"Ultimate Doom", "ultimate", exe_ultimate},
{"Final Doom", "final", exe_final},
+ {"Final Doom (alt)", "final2", exe_final2},
{"Chex Quest", "chex", exe_chex},
{ NULL, NULL, 0},
};
@@ -930,7 +934,7 @@ static void InitGameVersion(void)
// @category compat
//
// Emulate a specific version of Doom. Valid values are "1.9",
- // "ultimate" and "final".
+ // "ultimate", "final", "final2", "hacx" and "chex".
//
p = M_CheckParmWithArgs("-gameversion", 1);
@@ -994,8 +998,10 @@ static void InitGameVersion(void)
else
{
// Final Doom: tnt or plutonia
+ // Default to the "alt" version of the executable that
+ // fixes the demo loop behavior.
- gameversion = exe_final;
+ gameversion = exe_final2;
}
}
}
@@ -1034,11 +1040,37 @@ void PrintGameVersion(void)
static void LoadChexDeh(void)
{
- char *chex_deh;
+ char *chex_deh = NULL;
+ char *sep;
if (gameversion == exe_chex)
{
- chex_deh = D_FindWADByName("chex.deh");
+ // Look for chex.deh in the same directory as the IWAD file.
+
+ sep = strrchr(iwadfile, DIR_SEPARATOR);
+
+ if (sep != NULL)
+ {
+ chex_deh = malloc(strlen(iwadfile) + 9);
+ strcpy(chex_deh, iwadfile);
+ chex_deh[sep - iwadfile + 1] = '\0';
+ strcat(chex_deh, "chex.deh");
+ }
+ else
+ {
+ chex_deh = strdup("chex.deh");
+ }
+
+ // If the dehacked patch isn't found, try searching the WAD
+ // search path instead. We might find it...
+
+ if (!M_FileExists(chex_deh))
+ {
+ free(chex_deh);
+ chex_deh = D_FindWADByName("chex.deh");
+ }
+
+ // Still not found?
if (chex_deh == NULL)
{