shithub: choc

Download patch

ref: 4e8d5dc97fe53f4ce110221c218f703834b3b9c2
parent: 6a2255c70b882391931a7ef7ad9ada47a88b7c77
author: James Haley <haleyjd@hotmail.com>
date: Sat Mar 2 01:35:52 EST 2013

Complete support for v1.31 behaviors in addition to v1.2, including the
ability to save on multiple save slots.

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

--- a/src/d_mode.c
+++ b/src/d_mode.c
@@ -137,6 +137,7 @@
     { heretic,  exe_heretic_1_3 },
     { hexen,    exe_hexen_1_1 },
     { strife,   exe_strife_1_2 },
+    { strife,   exe_strife_1_31 },
 };
 
 boolean D_ValidGameVersion(GameMission_t mission, GameVersion_t version)
--- a/src/d_mode.h
+++ b/src/d_mode.h
@@ -74,7 +74,8 @@
     exe_heretic_1_3, // Heretic 1.3
 
     exe_hexen_1_1,   // Hexen 1.1
-    exe_strife_1_2, // Strife v1.2
+    exe_strife_1_2,  // Strife v1.2
+    exe_strife_1_31  // Strife v1.31
 } GameVersion_t;
 
 // Skill level.
--- a/src/net_client.c
+++ b/src/net_client.c
@@ -35,6 +35,7 @@
 #include "m_argv.h"
 #include "m_fixed.h"
 #include "m_config.h"
+#include "m_misc.h"
 #include "net_client.h"
 #include "net_common.h"
 #include "net_defs.h"
--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -960,8 +960,9 @@
     char *cmdline;
     GameVersion_t version;
 } gameversions[] = {
-    {"Strife 1.2",          "1.2",       exe_strife_1_2},
-    { NULL,                  NULL,         0},
+    { "Strife 1.2",          "1.2",       exe_strife_1_2  },
+    { "Strife 1.31",         "1.31",      exe_strife_1_31 },
+    { NULL,                  NULL,        0               }
 };
 
 // Initialize the game version
@@ -971,16 +972,17 @@
     int p;
     int i;
 
-    // This is mostly redundant for now, as we only support
-    // Strife v1.2. But perhaps in the future we might decide
-    // to support older versions ...
-    // - haleyjd: the current code emulates v1.2. 1.31 support is the TODO.
+    // haleyjd: we support emulating either the 1.2 or the 1.31 versions of 
+    // Strife, which are the most significant. 1.2 is the most mature version
+    // that still has the single saveslot restriction, whereas 1.31 is the
+    // final revision. The differences between the two are barely worth
+    // mentioning aside from that main one.
 
     //! 
     // @arg <version>
     // @category compat
     //
-    // Emulate a specific version of Doom.  Valid values are "1.2".
+    // Emulate a specific version of Doom.  Valid values are "1.2" and "1.31".
     //
 
     p = M_CheckParmWithArgs("-gameversion", 1);
@@ -1011,7 +1013,7 @@
     }
     else
     {
-        gameversion = exe_strife_1_2;
+        gameversion = exe_strife_1_31;
     }
 }
 
--- a/src/strife/doomstat.c
+++ b/src/strife/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_strife_1_2;
+GameVersion_t   gameversion = exe_strife_1_31;
 char *gamedescription;
 
 // Set if homebrew PWAD stuff has been added.
--- a/src/strife/f_finale.c
+++ b/src/strife/f_finale.c
@@ -128,6 +128,7 @@
 {
     // Exit states
     SLIDE_EXITHACK    = -99, // Hacky exit - start a new dialog
+    SLIDE_HACKHACK    =  -9, // Bizarre unused state
     SLIDE_EXIT        =  -1, // Exit to next finale state
     SLIDE_CHOCO       =  -2, // haleyjd: This state is Choco-specific... see below.
 
@@ -161,7 +162,11 @@
     // Blah Ending
     SLIDE_BLAHEND1    =  17,
     SLIDE_BLAHEND2,
-    SLIDE_BLAHEND3 // Next state = -1
+    SLIDE_BLAHEND3, // Next state = -1
+
+    // Demo Ending - haleyjd 20130301: v1.31 only
+    SLIDE_DEMOEND1    =  25,
+    SLIDE_DEMOEND2 // Next state = -1
 };
 
 //
@@ -231,6 +236,15 @@
         break;
     case 34: // For the demo version ending
         slideshow_state = SLIDE_EXIT;
+        
+        // haleyjd 20130301: Somebody noticed the demo levels were missing the
+        // ending they used to have in the demo version EXE, I guess. But the
+        // weird thing is, this will only trigger if you run with strife0.wad,
+        // and no released version thereof actually works with the 1.31 EXE
+        // due to differing dialog formats... was there to be an updated demo
+        // that never got released?!
+        if(gameversion == exe_strife_1_31 && isdemoversion)
+            slideshow_state = SLIDE_DEMOEND1;
         break;
     }
 
@@ -404,16 +418,34 @@
         slideshow_tics = 315;
         break;
 
+    case SLIDE_DEMOEND1: // state #25 - only exists in 1.31
+        slideshow_panel = DEH_String("PANEL7");
+        slideshow_tics = 175;
+        slideshow_state = SLIDE_DEMOEND2;
+        break;
+    case SLIDE_DEMOEND2: // state #26 - ditto
+        slideshow_panel = DEH_String("VELLOGO");
+        slideshow_tics = 175;
+        slideshow_state = SLIDE_EXIT; // Go to end credits
+        break;
+
     case SLIDE_EXITHACK: // state -99: super hack state
         gamestate = GS_LEVEL;
         P_DialogStartP1();
         break;
+    case SLIDE_HACKHACK: // state -9: unknown bizarre unused state
+        S_StartSound(NULL, sfx_rifle);
+        slideshow_tics = 3150;
+        break;
     case SLIDE_EXIT: // state -1: proceed to next finale stage
         finalecount = 0;
         finalestage = F_STAGE_ARTSCREEN;
         wipegamestate = -1;
         S_StartMusic(mus_fast);
-        slideshow_state = SLIDE_CHOCO; // haleyjd: see below...
+        // haleyjd 20130301: The ONLY glitch fixed in 1.31 of Strife
+        // *would* be something this insignificant, of course!
+        if(gameversion != exe_strife_1_31)
+            slideshow_state = SLIDE_CHOCO; // haleyjd: see below...
         break;
     case SLIDE_CHOCO: 
         // haleyjd 09/14/10: This wouldn't be necessary except that Choco
@@ -437,8 +469,11 @@
     }
 
     finalecount = 0;
-    patch = (patch_t *)W_CacheLumpName(DEH_String("PANEL0"), PU_CACHE);
-    V_DrawPatch(0, 0, patch);
+    if(gameversion != exe_strife_1_31) // See above. This was removed in 1.31.
+    {
+       patch = (patch_t *)W_CacheLumpName(DEH_String("PANEL0"), PU_CACHE);
+       V_DrawPatch(0, 0, patch);
+    }
 }
 
 //
--- a/src/strife/m_menu.c
+++ b/src/strife/m_menu.c
@@ -129,9 +129,9 @@
 
 boolean                 inhelpscreens;
 boolean                 menuactive;
-boolean                 menupause;     // haleyjd 08/29/10: [STRIFE] New global
-int                     menupausetime; // haleyjd 09/04/10: [STRIFE] New global
-boolean                 menuindialog;  // haleyjd 09/04/10: ditto
+boolean                 menupause;      // haleyjd 08/29/10: [STRIFE] New global
+int                     menupausetime;  // haleyjd 09/04/10: [STRIFE] New global
+boolean                 menuindialog;   // haleyjd 09/04/10: ditto
 
 // haleyjd 08/27/10: [STRIFE] SKULLXOFF == -28, LINEHEIGHT == 19
 #define CURSORXOFF		-28
@@ -161,6 +161,12 @@
 // current menudef
 menu_t*	currentMenu;                          
 
+// haleyjd 03/01/13: [STRIFE] v1.31-only:
+// Keeps track of whether the save game menu is being used to name a new
+// character slot, or to just save the current game. In the v1.31 disassembly
+// this was the new dword_8632C variable.
+boolean namingCharacter; 
+
 //
 // PROTOTYPES
 //
@@ -602,10 +608,13 @@
 {
     int map;
 
+    // 20130301: clear naming character flag for 1.31 save logic
+    if(gameversion == exe_strife_1_31)
+        namingCharacter = false;
     sendsave = 1;
     ClearTmp();
     G_WriteSaveName(choice, savegamestrings[choice]);
-    quickSaveSlot = choice;  // VERIFY VARIABLE
+    quickSaveSlot = choice;  
     SaveDef.lastOn = choice;
     ClearSlot();
     FromCurr();
@@ -666,21 +675,13 @@
 //
 void M_LoadSelect(int choice)
 {
-    /*
-    char    name[256];
-
-    strcpy(name, P_SaveGameFile(choice));
-
-    G_LoadGame (name);
-    M_ClearMenus (0);
-    */
-    
-    // [STRIFE] (v1.2) - TODO: v1.31
+    // [STRIFE]: completely rewritten
     char *name = NULL;
 
     G_WriteSaveName(choice, savegamestrings[choice]);
     ToCurr();
 
+    // use safe & portable filepath concatenation for Choco
     name = M_SafeFilePath(savegamedir, M_MakeStrifeSaveDir(choice, ""));
 
     G_ReadCurrent(name);
@@ -693,7 +694,7 @@
 //
 // Selected from DOOM menu
 //
-// [STRIFE] Verified unmodified (v1.2) - TODO: v1.31
+// [STRIFE] Verified unmodified
 //
 void M_LoadGame (int choice)
 {
@@ -734,15 +735,7 @@
 //
 void M_DoSave(int slot)
 {
-    /*
-    G_SaveGame (slot,savegamestrings[slot]);
-    M_ClearMenus (0);
-
-    // PICK QUICKSAVE SLOT YET?
-    if (quickSaveSlot == -2)
-        quickSaveSlot = slot;
-    */
-    // [STRIFE] (v1.2) - TODO: v1.31
+    // [STRIFE]: completely rewritten
     if(slot >= 0)
     {
         sendsave = 1;
@@ -763,7 +756,7 @@
     // we are going to be intercepting all chars
     saveStringEnter = 1;
 
-    // [STRIFE] (v1.2) - TODO: 1.31
+    // [STRIFE]
     quickSaveSlot = choice;
     //saveSlot = choice;
 
@@ -778,7 +771,7 @@
 //
 void M_SaveGame (int choice)
 {
-    // [STRIFE] (v1.2) - TODO: v1.31
+    // [STRIFE]
     if (netgame)
     {
         // haleyjd 20110211: Hooray for Rogue's awesome multiplayer support...
@@ -794,10 +787,19 @@
     if (gamestate != GS_LEVEL)
         return;
 
-    // [STRIFE] (v1.2) - TODO: v1.31
-    //M_SetupNextMenu(&SaveDef);
-    M_ReadSaveStrings();
-    M_DoSave(quickSaveSlot);
+    // [STRIFE]
+    if(gameversion == exe_strife_1_31)
+    {
+        // haleyjd 20130301: in 1.31, we can choose a slot again.
+        M_SetupNextMenu(&SaveDef);
+        M_ReadSaveStrings();
+    }
+    else
+    {
+        // In 1.2 and lower, you save over your character slot exclusively
+        M_ReadSaveStrings();
+        M_DoSave(quickSaveSlot);
+    }
 }
 
 
@@ -863,7 +865,7 @@
 //
 // M_QuickLoad
 //
-// [STRIFE] Verified unmodified (v1.2) - TODO: v1.31
+// [STRIFE] Verified unmodified
 //
 void M_QuickLoad(void)
 {
@@ -1044,6 +1046,8 @@
         return;
     }
     // haleyjd 09/07/10: [STRIFE] Removed Chex Quest and DOOM gamemodes
+    if(gameversion == exe_strife_1_31)
+       namingCharacter = true; // for 1.31 save logic
     M_SetupNextMenu(&NewDef);
 }
 
@@ -1051,6 +1055,9 @@
 //
 //      M_Episode
 //
+
+// haleyjd: [STRIFE] Unused
+/*
 int     epi;
 
 void M_DrawEpisode(void)
@@ -1058,8 +1065,6 @@
     V_DrawPatchDirect(54, 38, W_CacheLumpName(DEH_String("M_EPISOD"), PU_CACHE));
 }
 
-/*
-// haleyjd: [STRIFE] Unused
 void M_VerifyNightmare(int key)
 {
     if (key != key_menu_confirm)
@@ -1260,8 +1265,30 @@
 }
 */
 
+#if 0
+extern void F_StartCast(void);
 
 //
+// M_CheckStartCast
+//
+// [STRIFE] New but unused function. Was going to start a cast
+//   call from within the menu system... not functional even in
+//   the earliest demo version.
+//
+void M_CheckStartCast()
+{
+    if(usergame)
+    {
+        M_StartMessage(DEH_String("You have to end your game first."), NULL, false);
+        return;
+    }
+
+    F_StartCast();
+    M_ClearMenus(0);
+}
+#endif
+
+//
 // M_QuitResponse
 //
 // haleyjd 09/11/10: [STRIFE] Modifications to start up endgame
@@ -1814,8 +1841,16 @@
             break;
 
         case KEY_ENTER:
-            // [STRIFE] v1.2 - TODO: v1.31
+            // [STRIFE]
             saveStringEnter = 0;
+            if(gameversion == exe_strife_1_31 && !namingCharacter)
+            {
+               // In 1.31, we can be here as a result of normal saving again,
+               // whereas in 1.2 this only ever happens when naming your
+               // character to begin a new game.
+               M_DoSave(quickSaveSlot);
+               return true;
+            }
             if (savegamestrings[quickSaveSlot][0])
                 M_DoNameChar(quickSaveSlot);
             break;
@@ -1869,8 +1904,8 @@
 
     // [STRIFE]:
     // * In v1.2 this is moved to F9 (quickload)
-    // * In v1.31 it is moved to a different button and quicksave
-    //   functionality is restored separate from normal saving (STRIFE-TODO)
+    // * In v1.31 it is moved to F12 with DM spy, and quicksave
+    //   functionality is restored separate from normal saving
     /*
     if (devparm && key == key_menu_help)
     {
@@ -1910,12 +1945,10 @@
         }
         else if (key == key_menu_save)     // Save
         {
-            /*
-            M_StartControlPanel();
-            S_StartSound(NULL, sfx_swtchn);
-            M_SaveGame(0);
-            */
-            // [STRIFE] (v1.2) - TODO: v1.31
+            // [STRIFE]: Hub saves
+            if(gameversion == exe_strife_1_31)
+                namingCharacter = false; // just saving normally, in 1.31
+
             if(netgame || players[consoleplayer].health <= 0 ||
                 players[consoleplayer].cheats & CF_ONFIRE)
             {
@@ -1931,14 +1964,21 @@
         }
         else if (key == key_menu_load)     // Load
         {
-            /*
-            M_StartControlPanel();
-            S_StartSound(NULL, sfx_swtchn);
-            M_LoadGame(0);
-            */
-            // [STRIFE] (v1.2) - TODO: v1.31
-            S_StartSound(NULL, sfx_swtchn);
-            M_QuickLoad();
+            // [STRIFE]: Hub saves
+            if(gameversion == exe_strife_1_31)
+            {
+                // 1.31: normal save loading
+                namingCharacter = false;
+                M_StartControlPanel();
+                M_LoadGame(0);
+                S_StartSound(NULL, sfx_swtchn);
+            }
+            else
+            {
+                // Pre 1.31: quickload only
+                S_StartSound(NULL, sfx_swtchn);
+                M_QuickLoad();
+            }
             return true;
         }
         else if (key == key_menu_volume)   // Sound Volume
@@ -1953,15 +1993,15 @@
         {
             //M_ChangeDetail(0);
             M_AutoUseHealth(); // [STRIFE]
-            S_StartSound(NULL,sfx_swtchn);
+            S_StartSound(NULL, sfx_swtchn);
             return true;
         }
-        // STRIFE-TODO: autouse health toggle
         else if (key == key_menu_qsave)    // Quicksave
         {
-            //S_StartSound(NULL, sfx_swtchn);
-            //M_QuickSave();
-            // [STRIFE] (v1.2) - TODO: v1.31
+            // [STRIFE]: Hub saves
+            if(gameversion == exe_strife_1_31)
+                namingCharacter = false; // for 1.31 save changes
+
             if(netgame || players[consoleplayer].health <= 0 ||
                players[consoleplayer].cheats & CF_ONFIRE)
             {
@@ -1991,12 +2031,15 @@
         {
             // [STRIFE]
             // * v1.2: takes a screenshot
-            // * v1.31: does quickload again... (STRIFE-TODO)
-            /*
-            S_StartSound(NULL, sfx_swtchn);
-            M_QuickLoad();
-            */
-            G_ScreenShot();
+            // * v1.31: does quickload again
+            if(gameversion == exe_strife_1_31)
+            {
+                namingCharacter = false;
+                S_StartSound(NULL, sfx_swtchn);
+                M_QuickLoad();
+            }
+            else
+                G_ScreenShot();
             return true;
         }
         else if (key == key_menu_quit)     // Quit DOOM
@@ -2014,6 +2057,12 @@
             I_SetPalette (W_CacheLumpName (DEH_String("PLAYPAL"),PU_CACHE));
             return true;
         }
+        else if(gameversion == exe_strife_1_31 && key == key_spy)
+        {
+            // haleyjd 20130301: 1.31 moved screenshots to F12.
+            G_ScreenShot();
+            return true;
+        }
     }
 
     // Pop-up menu?
@@ -2107,12 +2156,15 @@
     else if (key == key_menu_activate)
     {
         // Deactivate menu
+        if(gameversion == exe_strife_1_31) // [STRIFE]: 1.31 saving
+            namingCharacter = false;
+
         if(menuindialog) // [STRIFE] - Get out of dialog engine semi-gracefully
             P_DialogDoChoice(-1);
 
         currentMenu->lastOn = itemOn;
         M_ClearMenus (0);
-        S_StartSound(NULL, sfx_mtalht);   // villsa [STRIFE] TODO - fix sounds
+        S_StartSound(NULL, sfx_mtalht); // villsa [STRIFE]: sounds
         return true;
     }
     else if (key == key_menu_back)
--- a/src/strife/p_dialog.c
+++ b/src/strife/p_dialog.c
@@ -33,6 +33,7 @@
 #include "w_wad.h"
 #include "deh_str.h"
 #include "d_main.h"
+#include "d_mode.h"
 #include "d_player.h"
 #include "doomstat.h"
 #include "m_random.h"
@@ -1229,6 +1230,10 @@
             objlump = W_CacheLumpName(mission_objective, PU_CACHE);
             strncpy(mission_objective, objlump, OBJECTIVE_LEN);
         }
+        // haleyjd 20130301: v1.31 hack: if first char of message is a period,
+        // clear the player's message. Is this actually used anywhere?
+        if(gameversion == exe_strife_1_31 && message[0] == '.')
+            message = NULL;
         dialogplayer->message = message;
     }
 
--- a/src/strife/st_stuff.c
+++ b/src/strife/st_stuff.c
@@ -683,10 +683,19 @@
         // haleyjd 09/01/10: Removed Chex Quest stuff.
         // haleyjd 09/15/10: Removed retail/registered/shareware stuff
 
-        // STRIFE-TODO: different bounds in v1.31
+        // haleyjd 20130301: different bounds in v1.31
         // Ohmygod - this is not going to work.
-        if (map <= 0 || map > 40)
-            return false;
+        if(gameversion == exe_strife_1_31)
+        {
+            if ((isdemoversion && (map < 32 || map > 34)) ||
+                (isregistered  && (map <= 0 || map > 34)))
+                return false;
+        }
+        else
+        {
+            if (map <= 0 || map > 40)
+                return false;
+        }
 
         // So be it.
         plyr->message = DEH_String(STSTR_CLEV);