shithub: choc

Download patch

ref: 46ad00deca23f3c57fcaed47af67f9003d6a4048
parent: 9eb11191b5ac68764da60c2f583d9c34ac05794e
parent: bd20fc62a36475e7a9fff269784d0f1e5c1128b4
author: Simon Howard <fraggle@gmail.com>
date: Thu May 21 15:33:16 EDT 2009

Merge from trunk.

Subversion-branch: /branches/raven-branch
Subversion-revision: 1528

--- a/man/manpage.template
+++ b/man/manpage.template
@@ -18,9 +18,9 @@
 .TP 
 \fBDOOMWADDIR\fR, \fBDOOMWADPATH\fR
 These environment variables provide paths to search for Doom .WAD files when
-looking for a game IWAD file or a PWAD file specified with the '-file' option.
+looking for a game IWAD file or a PWAD file specified with the `-file' option.
 \fBDOOMWADDIR\fR specifies a single path in which to look for WAD files,
-while \fBDOOMWWADDIR\fR specifies a colon-separated list of paths to search.
+while \fBDOOMWWADPATH\fR specifies a colon-separated list of paths to search.
 .TP
 \fBPCSOUND_DRIVER\fR
 When running in PC speaker sound effect mode, this environment variable 
--- a/pcsound/pcsound_sdl.c
+++ b/pcsound/pcsound_sdl.c
@@ -32,7 +32,7 @@
 #include "pcsound.h"
 #include "pcsound_internal.h"
 
-#define SOUND_SLICE_TIME 100 /* ms */
+#define MAX_SOUND_SLICE_TIME 70 /* ms */
 #define SQUARE_WAVE_AMP 0x2000
 
 // If true, we initialised SDL and have the responsibility to shut it 
@@ -164,6 +164,33 @@
     }
 }
 
+// Calculate slice size, based on MAX_SOUND_SLICE_TIME.
+// The result must be a power of two.
+
+static int GetSliceSize(void)
+{
+    int limit;
+    int n;
+
+    limit = (pcsound_sample_rate * MAX_SOUND_SLICE_TIME) / 1000;
+
+    // Try all powers of two, not exceeding the limit.
+
+    for (n=0;; ++n)
+    {
+        // 2^n <= limit < 2^n+1 ?
+
+        if ((1 << (n + 1)) > limit)
+        {
+            return (1 << n);
+        }
+    }
+
+    // Should never happen?
+
+    return 1024;
+}
+
 static int PCSound_SDL_Init(pcsound_callback_func callback_func)
 {
     int slicesize;
@@ -179,7 +206,7 @@
             return 0;
         }
 
-        slicesize = (SOUND_SLICE_TIME * pcsound_sample_rate) / 1000;
+        slicesize = GetSliceSize();
 
         if (Mix_OpenAudio(pcsound_sample_rate, AUDIO_S16SYS, 2, slicesize) < 0)
         {
--- a/src/doom/p_enemy.c
+++ b/src/doom/p_enemy.c
@@ -1612,7 +1612,58 @@
     P_RadiusAttack(thingy, thingy->target, 128);
 }
 
+// Check whether the death of the specified monster type is allowed
+// to trigger the end of episode special action.
+//
+// This behavior changed in v1.9, the most notable effect of which
+// was to break uac_dead.wad
 
+static boolean CheckBossEnd(mobjtype_t motype)
+{
+    if (gameversion < exe_ultimate)
+    {
+        if (gamemap != 8)
+        {
+            return false;
+        }
+
+        // Baron death on later episodes is nothing special.
+
+        if (motype == MT_BRUISER && gameepisode != 1)
+        {
+            return false;
+        }
+
+        return true;
+    }
+    else
+    {
+        // New logic that appeared in Ultimate Doom.
+        // Looks like the logic was overhauled while adding in the
+        // episode 4 support.  Now bosses only trigger on their
+        // specific episode.
+
+	switch(gameepisode)
+	{
+            case 1:
+                return gamemap == 8 && motype == MT_BRUISER;
+
+            case 2:
+                return gamemap == 8 && motype == MT_CYBORG;
+
+            case 3:
+                return gamemap == 8 && motype == MT_SPIDER;
+
+	    case 4:
+                return (gamemap == 6 && motype == MT_CYBORG)
+                    || (gamemap == 8 && motype == MT_SPIDER);
+
+            default:
+                return gamemap == 8;
+	}
+    }
+}
+
 //
 // A_BossDeath
 // Possibly trigger special effects
@@ -1636,75 +1687,12 @@
     }
     else
     {
-	switch(gameepisode)
-	{
-	  case 1:
-	    if (gamemap != 8)
-		return;
-
-            // fraggle: disable this as it breaks uac_dead.wad.
-            // There is at least one version of Doom 1.9 which it is
-            // possible to play uac_dead through on.  I think this was
-            // added here for Ultimate Doom.
-            //
-            // See lmps/doom/ultimate/uac_dead.zip in idgames for
-            // an example of a demo which goes out of sync if this
-            // is left in here.
-            //
-            // For the time being, I'm making the assumption that 
-            // doing this is not going to break anything else.
-            //
-            // 2005/10/24: Modify this to test the gameversion setting
-
-            if (gameversion >= exe_ultimate && mo->type != MT_BRUISER)
-                return;
-	    break;
-	    
-	  case 2:
-	    if (gamemap != 8)
-		return;
-
-	    if (mo->type != MT_CYBORG)
-		return;
-	    break;
-	    
-	  case 3:
-	    if (gamemap != 8)
-		return;
-	    
-	    if (mo->type != MT_SPIDER)
-		return;
-	    
-	    break;
-	    
-	  case 4:
-	    switch(gamemap)
-	    {
-	      case 6:
-		if (mo->type != MT_CYBORG)
-		    return;
-		break;
-		
-	      case 8: 
-		if (mo->type != MT_SPIDER)
-		    return;
-		break;
-		
-	      default:
-		return;
-		break;
-	    }
-	    break;
-	    
-	  default:
-	    if (gamemap != 8)
-		return;
-	    break;
-	}
-		
+        if (!CheckBossEnd(mo->type))
+        {
+            return;
+        }
     }
 
-    
     // make sure there is a player alive for victory
     for (i=0 ; i<MAXPLAYERS ; i++)
 	if (playeringame[i] && players[i].health > 0)
--- a/src/setup/display.c
+++ b/src/setup/display.c
@@ -389,7 +389,8 @@
     
     window = TXT_NewWindow("Display Configuration");
 
-    TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP, 40, 5);
+    TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP, 
+                                  TXT_SCREEN_W / 2, 5);
 
     TXT_AddWidgets(window, 
                    fs_checkbox = TXT_NewCheckBox("Fullscreen", &fullscreen),