foxygit / doom Log in
commit ed4adeba77bf7dd803e7b944ee5f871965a0ca29
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Wed Mar 9 01:06:07 2011 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Wed Mar 9 01:06:07 2011 +0000

    Add support for the alternate version of the Final Doom executable that
    fixes the demo loop crash (thanks Porsche Monty, Enjay).

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 2297
---
 NEWS           | 11 +++++++++++
 NOT-BUGS       | 23 -----------------------
 src/d_main.c   | 10 ++++++++--
 src/doomdef.h  |  1 +
 src/doomstat.c |  2 +-
 src/m_menu.c   |  1 +
 6 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/NEWS b/NEWS
index 3983ac76..03defb19 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,16 @@
 1.6.0 (2011-??-??):

+     * Added support for the alternate version of the Final Doom
+       executable included in some later versions of the Id Anthology.
+       This version fixed the demo loop crash that occurred with the
+       "original" Final Doom executable.
+
+       This executable can be selected on the command line with
+       -gameversion final2. It has been made the default when playing
+       with the Final Doom IWADs (the original behavior can be
+       selected with -gameversion final).  (thanks Porsche Monty,
+       Enjay).
+
     Compatibility:
      * Very short sound effects are not played, to better emulate the
        behavior of DMX in Vanilla Doom (thanks to Quasar for help in
diff --git a/NOT-BUGS b/NOT-BUGS
index f7d22231..38d97770 100644
--- a/NOT-BUGS
+++ b/NOT-BUGS
@@ -31,29 +31,6 @@ upgrade.

 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-== Game exits in demo loop when playing Final Doom ==
-
-When playing with the Final Doom IWAD files (tnt.wad, plutonia.wad),
-if you leave the game at the title screen to play through the demo
-loop, it will eventually exit with the following error message:
-
-    W_GetNumForName: demo4 not found!
-
-This is the same behavior as the Vanilla executables that were
-bundled with Final Doom.  When Ultimate Doom was developed, a fourth
-demo was added to the demo loop, and this change was retained in the
-Final Doom version of the executable.  However, the Final Doom IWADs
-do not include a fourth demo, so the game crashes.
-
-One way to work around this problem is to make the game emulate the
-original (pre-Ultimate Doom) v1.9 executable.  To do this, add the
-command line argument "-gameversion 1.9" when running the game.
-However, be aware this version does have some subtle differences that
-will affect the playback of Final Doom demos (lost soul bouncing,
-teleport behavior).
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
 == Game exits when accessing the options menu ==

 The game may exit with the message "Bad V_DrawPatch" when accessing
diff --git a/src/d_main.c b/src/d_main.c
index 73978c2f..2cfc6b44 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -500,6 +500,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
@@ -659,6 +662,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},
 };
@@ -675,7 +679,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);
@@ -731,8 +735,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;
             }
         }
     }
diff --git a/src/doomdef.h b/src/doomdef.h
index f9cd4fd9..fa85a47f 100644
--- a/src/doomdef.h
+++ b/src/doomdef.h
@@ -107,6 +107,7 @@ typedef enum
     exe_hacx,       // Hacx executable (Doom 1.9 with patch applied)
     exe_ultimate,   // Ultimate Doom (retail)
     exe_final,      // Final Doom
+    exe_final2,     // Final Doom (alternate exe)
     exe_chex,       // Chex Quest executable (based on Final Doom)
 } GameVersion_t;

diff --git a/src/doomstat.c b/src/doomstat.c
index 22804459..e5fe46b2 100644
--- a/src/doomstat.c
+++ b/src/doomstat.c
@@ -32,7 +32,7 @@
 // Game Mode - identify IWAD as shareware, retail etc.
 GameMode_t gamemode = indetermined;
 GameMission_t	gamemission = doom;
-GameVersion_t   gameversion = exe_final;
+GameVersion_t   gameversion = exe_final2;
 char *gamedescription;

 // Set if homebrew PWAD stuff has been added.
diff --git a/src/m_menu.c b/src/m_menu.c
index efc4fefe..7144f715 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -820,6 +820,7 @@ void M_DrawReadThis1(void)
             break;

         case exe_final:
+        case exe_final2:

             // Final Doom always displays "HELP".