[chocolate-doom] 03/07: Allow the game version to emulate to be specified from the command line and set compatibility options accordingly.

Jonathan Dowland jmtd at moszumanska.debian.org
Mon Jan 30 15:07:09 UTC 2017


This is an automated email from the git hooks/post-receive script.

jmtd pushed a commit to annotated tag chocolate-doom-0.1.2
in repository chocolate-doom.

commit 9f358870161c4866526cd85b04ffa1d2f3188899
Author: Simon Howard <fraggle at gmail.com>
Date:   Mon Oct 24 18:50:39 2005 +0000

    Allow the game version to emulate to be specified from the command line
    and set compatibility options accordingly.
    
    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 223
---
 NEWS           |   2 +
 README         |   3 ++
 src/d_main.c   | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
 src/doomdef.h  |  14 +++++-
 src/doomstat.c |   9 +++-
 src/doomstat.h |   7 ++-
 src/p_enemy.c  |  14 ++++--
 src/p_mobj.c   |  12 +++--
 src/p_telept.c |  10 ++--
 9 files changed, 194 insertions(+), 24 deletions(-)

diff --git a/NEWS b/NEWS
index e374615..fd2e0d5 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@
     Silence sounds at odd sample rates (rather than bombing out); this
         is the way Vanilla Doom behaves.
     Handle multiple replacements of the same sprite in a PWAD.
+    Support specifying a specific version to emulate via the command line
+        (-gameversion)
 
 0.1.1 (2005-10-18):
     Display startup "banners" if they have been modified through 
diff --git a/README b/README
index 97c9e13..c4cb7b4 100644
--- a/README
+++ b/README
@@ -65,6 +65,9 @@ options are supported.
   -nofullscreen        Runs the game in a window,
   -window
 
+  -gameversion <ver>   Emulates a specific release of Doom 1.9.  Valid
+                       values are "1.9", "ultimate" and "final".
+
   -grabmouse           Grabs the mouse during play (see above)
 
   -nograbmouse         Does not grab the mouse during play (see above)
diff --git a/src/d_main.c b/src/d_main.c
index efda9f2..91f66fe 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: d_main.c 214 2005-10-17 23:48:05Z fraggle $
+// $Id: d_main.c 223 2005-10-24 18:50:39Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,10 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.31  2005/10/24 18:50:39  fraggle
+// Allow the game version to emulate to be specified from the command line
+// and set compatibility options accordingly.
+//
 // Revision 1.30  2005/10/17 23:48:05  fraggle
 // DEH_CheckCommandLine -> DEH_Init, for consistency with other Init
 // functions
@@ -137,7 +141,7 @@
 //-----------------------------------------------------------------------------
 
 
-static const char rcsid[] = "$Id: d_main.c 214 2005-10-17 23:48:05Z fraggle $";
+static const char rcsid[] = "$Id: d_main.c 223 2005-10-24 18:50:39Z fraggle $";
 
 #define	BGCOLOR		7
 #define	FGCOLOR		8
@@ -951,25 +955,53 @@ static void IdentifyVersion(void)
         {
             // Ultimate Doom
 
-            gamedescription = GetGameName("The Ultimate DOOM");
             gamemode = retail;
         } 
         else if (W_CheckNumForName("E3M1") > 0)
         {
-            gamedescription = GetGameName("DOOM Registered");
             gamemode = registered;
         }
         else
         {
-            gamedescription = GetGameName("DOOM Shareware");
             gamemode = shareware;
         }
     }
     else
     {
-        // Doom 2 of some kind.  But which mission?
+        // Doom 2 of some kind.
 
         gamemode = commercial;
+    }
+}
+
+// Set the gamedescription string
+
+static void SetGameDescription(void)
+{
+    gamedescription = "Unknown";
+
+    if (gamemission == doom)
+    {
+        // Doom 1.  But which version?
+
+        if (gamemode == retail)
+        {
+            // Ultimate Doom
+
+            gamedescription = GetGameName("The Ultimate DOOM");
+        } 
+        else if (gamemode == registered)
+        {
+            gamedescription = GetGameName("DOOM Registered");
+        }
+        else if (gamemode == shareware)
+        {
+            gamedescription = GetGameName("DOOM Shareware");
+        }
+    }
+    else
+    {
+        // Doom 2 of some kind.  But which mission?
 
         if (gamemission == doom2)
             gamedescription = GetGameName("DOOM 2: Hell on Earth");
@@ -977,8 +1009,6 @@ static void IdentifyVersion(void)
             gamedescription = GetGameName("DOOM 2: Plutonia Experiment"); 
         else if (gamemission == pack_tnt)
             gamedescription = GetGameName("DOOM 2: TNT - Evilution");
-        else
-            gamedescription = "DOOM 2: ?????????????";
     }
 }
 
@@ -1136,6 +1166,105 @@ static void SetConfigDir(void)
     }
 }
 
+static struct 
+{
+    char *description;
+    char *cmdline;
+    GameVersion_t version;
+} gameversions[] = {
+    {"Doom 1.9",             "1.9",        exe_doom_1_9},
+    {"Ultimate Doom",        "ultimate",   exe_ultimate},
+    {"Final Doom",           "final",      exe_final},
+    {NULL},
+};
+
+// Initialise the game version
+
+static void InitGameVersion(void)
+{
+    int p;
+    int i;
+
+    p = M_CheckParm("-gameversion");
+
+    if (p > 0)
+    {
+        for (i=0; gameversions[i].description != NULL; ++i)
+        {
+            if (!strcmp(myargv[p+1], gameversions[i].cmdline))
+            {
+                gameversion = gameversions[i].version;
+                break;
+            }
+        }
+        
+        if (gameversions[i].description == NULL) 
+        {
+            printf("Supported game versions:\n");
+
+            for (i=0; gameversions[i].description != NULL; ++i)
+            {
+                printf("\t%s (%s)\n", gameversions[i].cmdline,
+                        gameversions[i].description);
+            }
+            
+            I_Error("Unknown game version '%s'", myargv[p+1]);
+        }
+    }
+    else
+    {
+        // Determine automatically
+
+        if (gamemode == shareware || gamemode == registered)
+        {
+            // original
+
+            gameversion = exe_doom_1_9;
+        }
+        else if (gamemode == retail)
+        {
+            gameversion = exe_ultimate;
+        }
+        else if (gamemode == commercial)
+        {
+            if (gamemission == doom2)
+            {
+                gameversion = exe_doom_1_9;
+            }
+            else
+            {
+                // Final Doom: tnt or plutonia
+
+                gameversion = exe_final;
+            }
+        }
+    }
+    
+    for (i=0; gameversions[i].description != NULL; ++i)
+    {
+        if (gameversions[i].version == gameversion)
+        {
+            printf("InitGameVersion: Emulating the behaviour of the "
+                   "'%s' executable.\n", gameversions[i].description);
+            break;
+        }
+    }
+
+    // The original exe does not support retail - 4th episode not supported
+
+    if (gameversion < exe_ultimate && gamemode == retail)
+    {
+        gamemode = registered;
+    }
+
+    // EXEs prior to the Final Doom exes do not support Final Doom.
+
+    if (gameversion < exe_final && gamemode == commercial)
+    {
+        gamemission = doom2;
+    }
+}
+
 //
 // D_DoomMain
 //
@@ -1278,6 +1407,8 @@ void D_DoomMain (void)
 #endif
 
     IdentifyVersion();
+    InitGameVersion();
+    SetGameDescription();
 
     // Check for -file in shareware
     if (modifiedgame)
diff --git a/src/doomdef.h b/src/doomdef.h
index 1ea9750..5b458d2 100644
--- a/src/doomdef.h
+++ b/src/doomdef.h
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: doomdef.h 70 2005-09-04 17:33:43Z fraggle $
+// $Id: doomdef.h 223 2005-10-24 18:50:39Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -68,6 +68,14 @@ typedef enum
 
 } GameMission_t;
 
+// What version are we emulating?
+
+typedef enum
+{
+    exe_doom_1_9,   // Doom 1.9: used for shareware, registered and commercial
+    exe_ultimate,   // Ultimate Doom (retail)
+    exe_final,      // Final Doom
+} GameVersion_t;
 
 // Identify language to use, software localization.
 typedef enum
@@ -365,6 +373,10 @@ typedef enum
 //-----------------------------------------------------------------------------
 //
 // $Log$
+// Revision 1.8  2005/10/24 18:50:39  fraggle
+// Allow the game version to emulate to be specified from the command line
+// and set compatibility options accordingly.
+//
 // Revision 1.7  2005/09/04 17:33:43  fraggle
 // Support demos recorded with cph's modified "v1.91" doom exe - which
 // contain higher resolution angleturn
diff --git a/src/doomstat.c b/src/doomstat.c
index b3c7187..e84f3fd 100644
--- a/src/doomstat.c
+++ b/src/doomstat.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: doomstat.c 66 2005-09-04 14:51:19Z fraggle $
+// $Id: doomstat.c 223 2005-10-24 18:50:39Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,10 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.6  2005/10/24 18:50:39  fraggle
+// Allow the game version to emulate to be specified from the command line
+// and set compatibility options accordingly.
+//
 // Revision 1.5  2005/09/04 14:51:19  fraggle
 // Display the correct quit messages according to which game is being played.
 // Remove "language" variable (do this through gettext, if ever)
@@ -46,7 +50,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: doomstat.c 66 2005-09-04 14:51:19Z fraggle $";
+rcsid[] = "$Id: doomstat.c 223 2005-10-24 18:50:39Z fraggle $";
 
 
 #include "doomstat.h"
@@ -55,6 +59,7 @@ rcsid[] = "$Id: doomstat.c 66 2005-09-04 14:51:19Z fraggle $";
 // Game Mode - identify IWAD as shareware, retail etc.
 GameMode_t gamemode = indetermined;
 GameMission_t	gamemission = doom;
+GameVersion_t   gameversion = exe_final;
 char *gamedescription;
 
 // Set if homebrew PWAD stuff has been added.
diff --git a/src/doomstat.h b/src/doomstat.h
index 3fa94c5..db42074 100644
--- a/src/doomstat.h
+++ b/src/doomstat.h
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: doomstat.h 202 2005-10-16 01:18:10Z fraggle $
+// $Id: doomstat.h 223 2005-10-24 18:50:39Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -63,6 +63,7 @@ extern  boolean	devparm;	// DEBUG: launched with -devparm
 //
 extern GameMode_t	gamemode;
 extern GameMission_t	gamemission;
+extern GameVersion_t    gameversion;
 extern char            *gamedescription;
 
 // Set if homebrew PWAD stuff has been added.
@@ -296,6 +297,10 @@ extern	int		ticdup;
 //-----------------------------------------------------------------------------
 //
 // $Log$
+// Revision 1.9  2005/10/24 18:50:39  fraggle
+// Allow the game version to emulate to be specified from the command line
+// and set compatibility options accordingly.
+//
 // Revision 1.8  2005/10/16 01:18:10  fraggle
 // Global "configdir" variable with directory to store config files in.
 // Create a function to find the filename for a savegame slot.  Store
diff --git a/src/p_enemy.c b/src/p_enemy.c
index 4bc4d3b..b09dbc6 100644
--- a/src/p_enemy.c
+++ b/src/p_enemy.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: p_enemy.c 127 2005-09-24 22:58:01Z fraggle $
+// $Id: p_enemy.c 223 2005-10-24 18:50:39Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,10 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.4  2005/10/24 18:50:39  fraggle
+// Allow the game version to emulate to be specified from the command line
+// and set compatibility options accordingly.
+//
 // Revision 1.3  2005/09/24 22:58:01  fraggle
 // Commit uac_dead fix
 //
@@ -40,7 +44,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: p_enemy.c 127 2005-09-24 22:58:01Z fraggle $";
+rcsid[] = "$Id: p_enemy.c 223 2005-10-24 18:50:39Z fraggle $";
 
 #include <stdlib.h>
 
@@ -1657,9 +1661,11 @@ void A_BossDeath (mobj_t* mo)
             //
             // 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 (mo->type != MT_BRUISER)
-            //     return;
+            if (gameversion >= exe_ultimate && mo->type != MT_BRUISER)
+                return;
 	    break;
 	    
 	  case 2:
diff --git a/src/p_mobj.c b/src/p_mobj.c
index c73780f..5a0d41c 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: p_mobj.c 191 2005-10-13 22:23:55Z fraggle $
+// $Id: p_mobj.c 223 2005-10-24 18:50:39Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,10 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.5  2005/10/24 18:50:39  fraggle
+// Allow the game version to emulate to be specified from the command line
+// and set compatibility options accordingly.
+//
 // Revision 1.4  2005/10/13 22:23:55  fraggle
 // Fix logic for lost soul bounce
 //
@@ -41,7 +45,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: p_mobj.c 191 2005-10-13 22:23:55Z fraggle $";
+rcsid[] = "$Id: p_mobj.c 223 2005-10-24 18:50:39Z fraggle $";
 
 #include "i_system.h"
 #include "z_zone.h"
@@ -327,9 +331,7 @@ void P_ZMovement (mobj_t* mo)
         // So we need to check that this is either retail or commercial
         // (but not doom2)
 	
-	int correct_lost_soul_bounce 
-            = (gamemode == retail || gamemode == commercial)
-              && gamemission != doom2;
+	int correct_lost_soul_bounce = gameversion >= exe_ultimate;
 
 	if (correct_lost_soul_bounce && mo->flags & MF_SKULLFLY)
 	{
diff --git a/src/p_telept.c b/src/p_telept.c
index 4ccef8a..5202246 100644
--- a/src/p_telept.c
+++ b/src/p_telept.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: p_telept.c 78 2005-09-06 21:15:08Z fraggle $
+// $Id: p_telept.c 223 2005-10-24 18:50:39Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,10 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.6  2005/10/24 18:50:39  fraggle
+// Allow the game version to emulate to be specified from the command line
+// and set compatibility options accordingly.
+//
 // Revision 1.5  2005/09/06 21:15:08  fraggle
 // Silly me - i misread cph's patch and got the logic backwards
 //
@@ -44,7 +48,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: p_telept.c 78 2005-09-06 21:15:08Z fraggle $";
+rcsid[] = "$Id: p_telept.c 223 2005-10-24 18:50:39Z fraggle $";
 
 
 
@@ -129,7 +133,7 @@ EV_Teleport
                 // fraggle: this was changed in final doom, 
                 // problem between normal doom2 1.9 and final doom
 
-                if (gamemission != pack_tnt && gamemission != pack_plut)
+                if (gameversion >= exe_final)
 		    thing->z = thing->floorz;
                 
 		if (thing->player)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/chocolate-doom.git



More information about the Pkg-games-commits mailing list