adapt Chocolate Doom's gameversion concept

This will be helpful to fix some Final or Ultimate only demo
desyncing issues.
This commit is contained in:
Fabian Greffrath 2020-01-17 15:45:38 +01:00
parent e6910bf07d
commit 5ce7ef8211
4 changed files with 89 additions and 0 deletions

View File

@ -990,6 +990,77 @@ void IdentifyVersion (void)
I_Error("IWAD not found\n");
}
// [FG] emulate a specific version of Doom
static struct
{
const char *description;
const 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, NULL, 0},
};
static void InitGameVersion(void)
{
int i, p;
p = M_CheckParm("-gameversion");
if (p && p < myargc-1)
{
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 ||
(gamemode == commercial && gamemission == doom2))
{
// original
gameversion = exe_doom_1_9;
}
else if (gamemode == retail)
{
gameversion = exe_ultimate;
}
else if (gamemode == commercial)
{
// Final Doom: tnt or plutonia
// Defaults to emulating the first Final Doom executable,
// which has the crash in the demo loop; however, having
// this as the default should mean that it plays back
// most demos correctly.
gameversion = exe_final;
}
}
}
// killough 5/3/98: old code removed
//
@ -1397,6 +1468,9 @@ void D_DoomMain(void)
IdentifyVersion();
// [FG] emulate a specific version of Doom
InitGameVersion();
modifiedgame = false;
// killough 10/98: process all command-line DEH's first

View File

@ -73,6 +73,15 @@ typedef enum {
unknown
} Language_t;
// [FG] emulate a specific version of Doom
typedef enum
{
exe_doom_1_9, // Doom 1.9: for shareware, registered and commercial
exe_ultimate, // Ultimate Doom (retail)
exe_final, // Final Doom
} GameVersion_t;
// [FG] support the BFG Edition IWADs
extern int bfgedition;

View File

@ -30,6 +30,9 @@
GameMode_t gamemode = indetermined;
GameMission_t gamemission = doom;
// [FG] emulate a specific version of Doom
GameVersion_t gameversion = exe_doom_1_9;
// Language.
Language_t language = english;

View File

@ -60,6 +60,9 @@ extern int screenblocks; // killough 11/98
extern GameMode_t gamemode;
extern GameMission_t gamemission;
// [FG] emulate a specific version of Doom
extern GameVersion_t gameversion;
// Set if homebrew PWAD stuff has been added.
extern boolean modifiedgame;