ref: 9f358870161c4866526cd85b04ffa1d2f3188899
parent: b9be9f99ef4b050650018a9eee4478077255c9e8
author: Simon Howard <[email protected]>
date: Mon Oct 24 14:50:39 EDT 2005
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
--- 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
--- a/README
+++ b/README
@@ -65,6 +65,9 @@
-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)
--- 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,26 +955,54 @@
{
// 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");
else if (gamemission == pack_plut)
@@ -977,8 +1009,6 @@
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 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 @@
#endif
IdentifyVersion();
+ InitGameVersion();
+ SetGameDescription();
// Check for -file in shareware
if (modifiedgame)
--- 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,7 +68,15 @@
} 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 @@
//-----------------------------------------------------------------------------
//
// $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
--- 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 @@
// 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.
--- 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 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 @@
//-----------------------------------------------------------------------------
//
// $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
--- 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 @@
//
// 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:
--- 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 @@
// 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)
{
--- 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 @@
// 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)