shithub: choc

Download patch

ref: d64626ff417323e05a479caeee02168c1eafd798
parent: cfd1a3f8f739b049af04b9e637db9a51758cef27
parent: 71d316afb2ae7191a4ef6fac2d757238ae3616e1
author: Simon Howard <fraggle@gmail.com>
date: Sat Oct 22 14:33:37 EDT 2011

Merge from trunk.

Subversion-branch: /branches/v2-branch
Subversion-revision: 2458

--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,10 @@
      * Updated COPYING to current version of GPL2 (thanks Rahul
        Sundaram).
      * Fix bug with detection of IWAD type by filename (thanks mether).
+     * Reduce palette accuracy to 6 bits per channel, to more accurately
+       emulate the PC VGA hardware (thanks GhostlyDeath).
+     * Fix teleport behavior when emulating the alternate Final Doom
+       executable (-gameversion final2) (thanks xttl).
 
 1.6.0 (2011-05-17):
 
--- a/NOT-BUGS
+++ b/NOT-BUGS
@@ -31,6 +31,30 @@
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+== 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.
+
+An alternate version of Final Doom was included in the Id Anthology
+boxed set, and this version of the game fixed this bug. However, this
+version also changes the teleport behavior, so the default is to
+emulate the most commonly distributed version of the game. To use
+the alternate version, run with:
+
+    chocolate-doom -gameversion final2
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 == Game exits when accessing the options menu ==
 
 The game may exit with the message "Bad V_DrawPatch" when accessing
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -918,10 +918,12 @@
             else
             {
                 // Final Doom: tnt or plutonia
-                // Default to the "alt" version of the executable that
-                // fixes the demo loop behavior.
+                // Defaults to emulating the first Final Doom executable,
+                // which has the crash in the demo loop; however, having
+                // this as the default should mean that it plays back
+                // most demos correctly.
 
-                gameversion = exe_final2;
+                gameversion = exe_final;
             }
         }
     }
--- a/src/doom/p_telept.c
+++ b/src/doom/p_telept.c
@@ -104,19 +104,18 @@
 				
 		if (!P_TeleportMove (thing, m->x, m->y))
 		    return 0;
-		
-                // fraggle: this was changed in final doom, 
-                // problem between normal doom2 1.9 and final doom
-                //
-                // Note that although chex.exe is based on Final Doom,
-                // it does not have this quirk.
 
-                if (gameversion < exe_final || gameversion == exe_chex)
+                // The first Final Doom executable does not set thing->z
+                // when teleporting. This quirk is unique to this
+                // particular version; the later version included in
+                // some versions of the Id Anthology fixed this.
+
+                if (gameversion != exe_final)
 		    thing->z = thing->floorz;
-                
+
 		if (thing->player)
 		    thing->player->viewz = thing->z+thing->player->viewheight;
-				
+
 		// spawn teleport fog at source and destination
 		fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG);
 		S_StartSound (fog, sfx_telept);
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1121,11 +1121,14 @@
 {
     int i;
 
-    for (i=0; i<256; ++i) 
+    for (i=0; i<256; ++i)
     {
-        palette[i].r = gammatable[usegamma][*doompalette++];
-        palette[i].g = gammatable[usegamma][*doompalette++];
-        palette[i].b = gammatable[usegamma][*doompalette++];
+        // Zero out the bottom two bits of each channel - the PC VGA
+        // controller only supports 6 bits of accuracy.
+
+        palette[i].r = gammatable[usegamma][*doompalette++] & ~3;
+        palette[i].g = gammatable[usegamma][*doompalette++] & ~3;
+        palette[i].b = gammatable[usegamma][*doompalette++] & ~3;
     }
 
     palette_to_set = true;