shithub: choc

Download patch

ref: dbdd53e7734b1166185a9906897d5dc87fd95376
parent: 97ddedc959ecf361cc7ff2d9055aa4899252bccb
parent: 68f51552ff65668deaeef923fc8c496d64ea9a60
author: Simon Howard <[email protected]>
date: Sun Mar 6 17:42:12 EST 2011

Merge from raven-branch.

Subversion-branch: /branches/strife-branch
Subversion-revision: 2293

--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,10 @@
 1.6.0 (2011-??-??):
 
+    Compatibility:
+     * Very short sound effects are not played, to better emulate the
+       behavior of DMX in Vanilla Doom (thanks to Quasar for help in
+       investigating this).
+
     Bugs fixed:
      * Menu navigation when using joystick/joypad (thanks Alexandre
        Xavier).
@@ -7,6 +12,7 @@
        right shift, not left shift (thanks AlexXav).
      * Default joystick buttons for the setup tool now match Vanilla
        (thanks twipley).
+     * Visual Studio project files work again (thanks GhostlyDeath).
 
     libtextscreen:
      * It is now possible to type a '+' in input boxes (thanks
--- a/pkg/osx/IWADController.h
+++ b/pkg/osx/IWADController.h
@@ -36,6 +36,9 @@
     id doom2;
     id plutonia;
     id tnt;
+
+    id heretic;
+    id hexen;
 }
 
 - (void) closeConfigWindow: (id)sender;
@@ -47,6 +50,7 @@
 - (void) saveConfig;
 - (char *) doomWadPath;
 - (void) setEnvironment;
+- (const char *) getGameName;
 
 @end
 
--- a/pkg/osx/IWADController.m
+++ b/pkg/osx/IWADController.m
@@ -33,6 +33,8 @@
     IWAD_TNT,
     IWAD_PLUTONIA,
     IWAD_CHEX,
+    IWAD_HERETIC,
+    IWAD_HEXEN,
     NUM_IWAD_TYPES
 } IWAD;
 
@@ -42,7 +44,9 @@
     @"Doom II: Hell on Earth",
     @"Final Doom: TNT: Evilution",
     @"Final Doom: Plutonia Experiment",
-    @"Chex Quest"
+    @"Chex Quest",
+    @"Heretic",
+    @"Hexen"
 };
 
 static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] =
@@ -52,6 +56,8 @@
     @"tnt.wad",
     @"plutonia.wad",
     @"chex.wad",
+    @"heretic.wad",
+    @"hexen.wad",
     @"undefined"
 };
 
@@ -64,6 +70,8 @@
     iwadList[IWAD_TNT] = self->tnt;
     iwadList[IWAD_PLUTONIA] = self->plutonia;
     iwadList[IWAD_CHEX] = self->chex;
+    iwadList[IWAD_HERETIC] = self->heretic;
+    iwadList[IWAD_HEXEN] = self->hexen;
 }
 
 - (IWAD) getSelectedIWAD
@@ -102,6 +110,27 @@
     }
 }
 
+// Get the name used for the executable for the selected IWAD.
+
+- (const char *) getGameName
+{
+    IWAD selectedIWAD;
+
+    selectedIWAD = [self getSelectedIWAD];
+
+    switch (selectedIWAD)
+    {
+        case IWAD_HERETIC:
+            return "heretic";
+
+        case IWAD_HEXEN:
+            return "hexen";
+
+        default:
+            return "doom";
+    }
+}
+
 - (void) setIWADConfig
 {
     IWADLocation *iwadList[NUM_IWAD_TYPES];
@@ -250,6 +279,10 @@
 
 - (void) awakeFromNib
 {
+    // TODO: This is temporary:
+    self->heretic = self->doom1;
+    self->hexen = self->doom2;
+
     [self->configWindow center];
 
     // Set configuration for all IWADs from configuration file.
--- a/pkg/osx/LauncherManager.m
+++ b/pkg/osx/LauncherManager.m
@@ -278,6 +278,8 @@
 {
     NSString *iwad;
     NSString *args;
+    char *executable_name;
+    const char *game_name;
 
     [self saveConfig];
 
@@ -294,7 +296,11 @@
         return;
     }
 
-    ExecuteProgram(PACKAGE_TARNAME, [iwad UTF8String],
+    game_name = [self->iwadController getGameName];
+    executable_name = malloc(strlen(PROGRAM_PREFIX) + strlen(game_name) + 1);
+    sprintf(executable_name, "%s%s", PROGRAM_PREFIX, game_name);
+
+    ExecuteProgram(executable_name, [iwad UTF8String],
                                     [args UTF8String]);
     [NSApp terminate:sender];
 }
@@ -303,10 +309,22 @@
 
 - (void) runSetup: (id)sender
 {
-    [self saveConfig];
+    const char *game_name;
+    char *arg;
 
+    [self saveConfig];
     [self->iwadController setEnvironment];
-    ExecuteProgram("chocolate-setup", NULL, NULL);
+
+    // Provide the -game command line parameter to select the game
+    // to configure, based on the game selected in the dropdown.
+
+    game_name = [self->iwadController getGameName];
+    arg = malloc(strlen(game_name) + 8);
+    sprintf(arg, "-game %s", game_name);
+
+    ExecuteProgram(PROGRAM_PREFIX "setup", NULL, arg);
+
+    free(arg);
 }
 
 // Invoked when the "Terminal" option is selected from the menu, to open
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -1100,8 +1100,6 @@
 
     I_AtExit(D_Endoom, false);
 
-    M_FindResponseFile ();
-
     // print banner
 
     I_PrintBanner(PACKAGE_STRING);
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -805,7 +805,6 @@
 
     I_AtExit(D_Endoom, false);
 
-    M_FindResponseFile();
     nomonsters = M_CheckParm("-nomonsters");
     respawnparm = M_CheckParm("-respawn");
     ravpic = M_CheckParm("-ravpic");
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -232,7 +232,6 @@
     int p;
 
     I_AtExit(D_HexenQuitMessage, false);
-    M_FindResponseFile();
     startepisode = 1;
     autostart = false;
     startskill = sk_medium;
--- a/src/i_main.c
+++ b/src/i_main.c
@@ -154,6 +154,8 @@
 
     LockCPUAffinity();
 
+    M_FindResponseFile();
+
     // start doom
 
     D_DoomMain ();
--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -664,10 +664,22 @@
     // If the header specifies that the length of the sound is greater than
     // the length of the lump itself, this is an invalid sound lump
 
-    if (length > lumplen - 8)
+    // We also discard sound lumps that are less than 49 samples long,
+    // as this is how DMX behaves - although the actual cut-off length
+    // seems to vary slightly depending on the sample rate.  This needs
+    // further investigation to better understand the correct
+    // behavior.
+
+    if (length > lumplen - 8 || length <= 48)
     {
         return false;
     }
+
+    // The DMX sound library seems to skip the first 16 and last 16
+    // bytes of the lump - reason unknown.
+
+    data += 16;
+    length -= 32;
 
     // Sample rate conversion
 
--- a/src/setup/display.c
+++ b/src/setup/display.c
@@ -257,9 +257,7 @@
         }
     }
 
-    // Shouldn't happen; fall back to the first in the list.
-
-    return 0;
+    return -1;
 }
 
 // Set selected_bpp to match screen_bpp.
@@ -277,7 +275,11 @@
         if (pixel_depths[i].bpp == screen_bpp)
         {
             selected_bpp = GetSupportedBPPIndex(pixel_depths[i].description);
-            return 1;
+
+            if (selected_bpp >= 0)
+            {
+                return 1;
+            }
         }
     }
 
@@ -715,6 +717,7 @@
     M_BindVariable("fullscreen",                &fullscreen);
     M_BindVariable("screen_width",              &screen_width);
     M_BindVariable("screen_height",             &screen_height);
+    M_BindVariable("screen_bpp",                &screen_bpp);
     M_BindVariable("startup_delay",             &startup_delay);
     M_BindVariable("video_driver",              &video_driver);
     M_BindVariable("usegamma",                  &usegamma);
--- a/src/setup/keyboard.c
+++ b/src/setup/keyboard.c
@@ -314,12 +314,6 @@
     AddKeyControl(table, "- to brown",            &key_multi_msgplayer[2]);
     AddKeyControl(table, "- to red",              &key_multi_msgplayer[3]);
 
-    TXT_AddWidgets(table, TXT_NewStrut(0, 1),
-                          TXT_NewStrut(0, 1),
-                          TXT_NewLabel(" - Map - "),
-                          TXT_NewStrut(0, 0),
-                          NULL);
-
     scrollpane = TXT_NewScrollPane(0, 13, table);
 
     TXT_AddWidget(window, scrollpane);
--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -1377,8 +1377,6 @@
 
     I_AtExit(D_Endoom, false);
 
-    M_FindResponseFile ();
-
     // haleyjd 20110206 [STRIFE]: -nograph parameter
 
     //!