foxygit / doom Log in
commit fc09dbdf6703e62146a74a164be475ba965d00ab
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Tue Dec 28 16:43:41 2010 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Tue Dec 28 16:43:41 2010 +0000

    Make demo loop handling of DEMO4 case depend on the executable version
    being emulated: the Vanilla versions did not have any conditional
    behavior based on gamemode/gamemission.
    This has the side effect of causing the game to exit with an error when
    playing with Final Doom, but this is Vanilla behavior.

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 2230
---
 NEWS         |  4 ++++
 NOT-BUGS     | 23 +++++++++++++++++++++++
 src/d_main.c |  8 +++++++-
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index c3289f3c..0dbdb06f 100644
--- a/NEWS
+++ b/NEWS
@@ -52,6 +52,10 @@
        messages are actually errors (thanks Proteh).
      * The setup tool now passes through all command line arguments
        when launching the game (thanks AlexXav).
+     * Demo loop behavior (ie. whether to play DEMO4) now depends on
+       the version being emulated.  When playing Final Doom the game
+       will exit unexpectedly as it tries to play the fourth demo -
+       this is Vanilla behaviour (thanks AlexXav).

     Bugs fixed:
      * A workaround has been a bug in old versions of SDL_mixer
diff --git a/NOT-BUGS b/NOT-BUGS
index 38d97770..f7d22231 100644
--- a/NOT-BUGS
+++ b/NOT-BUGS
@@ -31,6 +31,29 @@ 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 397062a9..73978c2f 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -494,7 +494,13 @@ void D_DoAdvanceDemo (void)
     paused = false;
     gameaction = ga_nothing;

-    if (gamemode == retail && gameversion != exe_chex)
+    // The Ultimate Doom executable changed the demo sequence to add
+    // a DEMO4 demo.  Final Doom was based on Ultimate, so also
+    // includes this change; however, the Final Doom IWADs do not
+    // include a DEMO4 lump, so the game bombs out with an error
+    // when it reaches this point in the demo sequence.
+
+    if (gameversion == exe_ultimate || gameversion == exe_final)
       demosequence = (demosequence+1)%7;
     else
       demosequence = (demosequence+1)%6;