Allow the game version to emulate to be specified from the command line

and set compatibility options accordingly.
This commit is contained in:
Simon Howard 2005-10-24 18:50:39 +00:00
parent 2cd6211906
commit eca3d93320
9 changed files with 182 additions and 12 deletions

2
NEWS
View file

@ -2,6 +2,8 @@
Silence sounds at odd sample rates (rather than bombing out); this Silence sounds at odd sample rates (rather than bombing out); this
is the way Vanilla Doom behaves. is the way Vanilla Doom behaves.
Handle multiple replacements of the same sprite in a PWAD. 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): 0.1.1 (2005-10-18):
Display startup "banners" if they have been modified through Display startup "banners" if they have been modified through

3
README
View file

@ -65,6 +65,9 @@ options are supported.
-nofullscreen Runs the game in a window, -nofullscreen Runs the game in a window,
-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) -grabmouse Grabs the mouse during play (see above)
-nograbmouse Does not grab the mouse during play (see above) -nograbmouse Does not grab the mouse during play (see above)

View file

@ -22,6 +22,10 @@
// 02111-1307, USA. // 02111-1307, USA.
// //
// $Log$ // $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 // Revision 1.30 2005/10/17 23:48:05 fraggle
// DEH_CheckCommandLine -> DEH_Init, for consistency with other Init // DEH_CheckCommandLine -> DEH_Init, for consistency with other Init
// functions // functions
@ -951,25 +955,53 @@ static void IdentifyVersion(void)
{ {
// Ultimate Doom // Ultimate Doom
gamedescription = GetGameName("The Ultimate DOOM");
gamemode = retail; gamemode = retail;
} }
else if (W_CheckNumForName("E3M1") > 0) else if (W_CheckNumForName("E3M1") > 0)
{ {
gamedescription = GetGameName("DOOM Registered");
gamemode = registered; gamemode = registered;
} }
else else
{ {
gamedescription = GetGameName("DOOM Shareware");
gamemode = shareware; gamemode = shareware;
} }
} }
else else
{ {
// Doom 2 of some kind. But which mission? // Doom 2 of some kind.
gamemode = commercial; 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) if (gamemission == doom2)
gamedescription = GetGameName("DOOM 2: Hell on Earth"); gamedescription = GetGameName("DOOM 2: Hell on Earth");
@ -977,8 +1009,6 @@ static void IdentifyVersion(void)
gamedescription = GetGameName("DOOM 2: Plutonia Experiment"); gamedescription = GetGameName("DOOM 2: Plutonia Experiment");
else if (gamemission == pack_tnt) else if (gamemission == pack_tnt)
gamedescription = GetGameName("DOOM 2: TNT - Evilution"); 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 // D_DoomMain
// //
@ -1278,6 +1407,8 @@ void D_DoomMain (void)
#endif #endif
IdentifyVersion(); IdentifyVersion();
InitGameVersion();
SetGameDescription();
// Check for -file in shareware // Check for -file in shareware
if (modifiedgame) if (modifiedgame)

View file

@ -68,6 +68,14 @@ typedef enum
} GameMission_t; } 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. // Identify language to use, software localization.
typedef enum typedef enum
@ -365,6 +373,10 @@ typedef enum
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $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 // Revision 1.7 2005/09/04 17:33:43 fraggle
// Support demos recorded with cph's modified "v1.91" doom exe - which // Support demos recorded with cph's modified "v1.91" doom exe - which
// contain higher resolution angleturn // contain higher resolution angleturn

View file

@ -22,6 +22,10 @@
// 02111-1307, USA. // 02111-1307, USA.
// //
// $Log$ // $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 // Revision 1.5 2005/09/04 14:51:19 fraggle
// Display the correct quit messages according to which game is being played. // Display the correct quit messages according to which game is being played.
// Remove "language" variable (do this through gettext, if ever) // Remove "language" variable (do this through gettext, if ever)
@ -55,6 +59,7 @@ rcsid[] = "$Id$";
// Game Mode - identify IWAD as shareware, retail etc. // Game Mode - identify IWAD as shareware, retail etc.
GameMode_t gamemode = indetermined; GameMode_t gamemode = indetermined;
GameMission_t gamemission = doom; GameMission_t gamemission = doom;
GameVersion_t gameversion = exe_final;
char *gamedescription; char *gamedescription;
// Set if homebrew PWAD stuff has been added. // Set if homebrew PWAD stuff has been added.

View file

@ -63,6 +63,7 @@ extern boolean devparm; // DEBUG: launched with -devparm
// //
extern GameMode_t gamemode; extern GameMode_t gamemode;
extern GameMission_t gamemission; extern GameMission_t gamemission;
extern GameVersion_t gameversion;
extern char *gamedescription; extern char *gamedescription;
// Set if homebrew PWAD stuff has been added. // Set if homebrew PWAD stuff has been added.
@ -296,6 +297,10 @@ extern int ticdup;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $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 // Revision 1.8 2005/10/16 01:18:10 fraggle
// Global "configdir" variable with directory to store config files in. // Global "configdir" variable with directory to store config files in.
// Create a function to find the filename for a savegame slot. Store // Create a function to find the filename for a savegame slot. Store

View file

@ -22,6 +22,10 @@
// 02111-1307, USA. // 02111-1307, USA.
// //
// $Log$ // $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 // Revision 1.3 2005/09/24 22:58:01 fraggle
// Commit uac_dead fix // Commit uac_dead fix
// //
@ -1657,9 +1661,11 @@ void A_BossDeath (mobj_t* mo)
// //
// For the time being, I'm making the assumption that // For the time being, I'm making the assumption that
// doing this is not going to break anything else. // doing this is not going to break anything else.
//
// 2005/10/24: Modify this to test the gameversion setting
// if (mo->type != MT_BRUISER) if (gameversion >= exe_ultimate && mo->type != MT_BRUISER)
// return; return;
break; break;
case 2: case 2:

View file

@ -22,6 +22,10 @@
// 02111-1307, USA. // 02111-1307, USA.
// //
// $Log$ // $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 // Revision 1.4 2005/10/13 22:23:55 fraggle
// Fix logic for lost soul bounce // Fix logic for lost soul bounce
// //
@ -327,9 +331,7 @@ void P_ZMovement (mobj_t* mo)
// So we need to check that this is either retail or commercial // So we need to check that this is either retail or commercial
// (but not doom2) // (but not doom2)
int correct_lost_soul_bounce int correct_lost_soul_bounce = gameversion >= exe_ultimate;
= (gamemode == retail || gamemode == commercial)
&& gamemission != doom2;
if (correct_lost_soul_bounce && mo->flags & MF_SKULLFLY) if (correct_lost_soul_bounce && mo->flags & MF_SKULLFLY)
{ {

View file

@ -22,6 +22,10 @@
// 02111-1307, USA. // 02111-1307, USA.
// //
// $Log$ // $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 // Revision 1.5 2005/09/06 21:15:08 fraggle
// Silly me - i misread cph's patch and got the logic backwards // Silly me - i misread cph's patch and got the logic backwards
// //
@ -129,7 +133,7 @@ EV_Teleport
// fraggle: this was changed in final doom, // fraggle: this was changed in final doom,
// problem between normal doom2 1.9 and 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; thing->z = thing->floorz;
if (thing->player) if (thing->player)