introduce a gamevariant variable to tell different IWADs apart

Chocolate Doom supports different variants that are available of the
IWADs, e.g. for Doom 2 it supports the Vanilla IWAD, the one shipped
with the Doom 3: BFG Edition as well as Freedoom: Phase 2 and FreeDM.

Each of these IWAD variants requires some specific special-casing and
the newly introduced global "gamevariant" variable can be used to keep
track of all of this.
This commit is contained in:
Fabian Greffrath 2016-04-20 17:03:47 +02:00
parent 5e162ed7e3
commit 6df0ab8680
4 changed files with 23 additions and 16 deletions

View file

@ -74,6 +74,16 @@ typedef enum
exe_strife_1_31 // Strife v1.31
} GameVersion_t;
// What IWAD variant are we using?
typedef enum
{
vanilla = 0, // Vanilla Doom
freedoom = 1, // FreeDoom: Phase 1 + 2
freedm = 2, // FreeDM
bfgedition = 4, // Doom Classic (Doom 3: BFG Edition)
} GameVariant_t;
// Skill level.
typedef enum

View file

@ -118,9 +118,6 @@ boolean advancedemo;
// Store demo, do not accept any inputs
boolean storedemo;
// "BFG Edition" version of doom2.wad does not include TITLEPIC.
boolean bfgedition;
// If true, the main game loop has started.
boolean main_loop_started = false;
@ -411,7 +408,7 @@ boolean D_GrabMouseCallback(void)
//
void D_DoomLoop (void)
{
if (bfgedition &&
if (gamevariant & bfgedition &&
(demorecording || (gameaction == ga_playdemo) || netgame))
{
printf(" WARNING: You are playing using one of the Doom Classic\n"
@ -579,7 +576,7 @@ void D_DoAdvanceDemo (void)
// The Doom 3: BFG Edition version of doom2.wad does not have a
// TITLETPIC lump. Use INTERPIC instead as a workaround.
if (bfgedition && !strcasecmp(pagename, "TITLEPIC")
if (gamevariant & bfgedition && !strcasecmp(pagename, "TITLEPIC")
&& W_CheckNumForName("titlepic") < 0)
{
pagename = DEH_String("INTERPIC");
@ -812,8 +809,9 @@ void D_IdentifyVersion(void)
void D_SetGameDescription(void)
{
boolean is_freedoom = W_CheckNumForName("FREEDOOM") >= 0,
is_freedm = W_CheckNumForName("FREEDM") >= 0;
gamevariant = W_CheckNumForName("FREEDOOM") >= 0 ?
W_CheckNumForName("FREEDM") >= 0 ?
freedoom & freedm : freedoom : vanilla;
gamedescription = "Unknown";
@ -821,7 +819,7 @@ void D_SetGameDescription(void)
{
// Doom 1. But which version?
if (is_freedoom)
if (gamevariant & freedoom)
{
gamedescription = GetGameName("Freedoom: Phase 1");
}
@ -844,9 +842,9 @@ void D_SetGameDescription(void)
{
// Doom 2 of some kind. But which mission?
if (is_freedoom)
if (gamevariant & freedoom)
{
if (is_freedm)
if (gamevariant & freedm)
{
gamedescription = GetGameName("FreeDM");
}
@ -1126,7 +1124,7 @@ static void D_Endoom(void)
static void LoadIwadDeh(void)
{
// The Freedoom IWADs have DEHACKED lumps that must be loaded.
if (W_CheckNumForName("FREEDOOM") >= 0)
if (gamevariant & freedoom)
{
// Old versions of Freedoom (before 2014-09) did not have technically
// valid DEHACKED lumps, so ignore errors and just continue if this
@ -1448,7 +1446,7 @@ void D_DoomMain (void)
if (W_CheckNumForName("dmenupic") >= 0)
{
printf("BFG Edition: Using workarounds as needed.\n");
bfgedition = true;
gamevariant = bfgedition;
// BFG Edition changes the names of the secret levels to
// censor the Wolfenstein references. It also has an extra
@ -1635,7 +1633,7 @@ void D_DoomMain (void)
// Freedoom's IWADs are Boom-compatible, which means they usually
// don't work in Vanilla (though FreeDM is okay). Show a warning
// message and give a link to the website.
if (W_CheckNumForName("FREEDOOM") >= 0 && W_CheckNumForName("FREEDM") < 0)
if (gamevariant & freedoom && !(gamevariant & freedm))
{
printf(" WARNING: You are playing using one of the Freedoom IWAD\n"
" files, which might not work in this port. See this page\n"

View file

@ -25,6 +25,7 @@
GameMode_t gamemode = indetermined;
GameMission_t gamemission = doom;
GameVersion_t gameversion = exe_final2;
GameVariant_t gamevariant = vanilla;
char *gamedescription;
// Set if homebrew PWAD stuff has been added.

View file

@ -56,11 +56,9 @@ extern boolean devparm; // DEBUG: launched with -devparm
extern GameMode_t gamemode;
extern GameMission_t gamemission;
extern GameVersion_t gameversion;
extern GameVariant_t gamevariant;
extern char *gamedescription;
// If true, we're using one of the mangled BFG edition IWADs.
extern boolean bfgedition;
// Convenience macro.
// 'gamemission' can be equal to pack_chex or pack_hacx, but these are
// just modified versions of doom and doom2, and should be interpreted