commit 6df0ab868009646160037f90e654bad0352e082f
Author: Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Wed Apr 20 17:03:47 2016 +0200
Commit: Fabian Greffrath <fabian@greffrath.com>
CommitDate: Wed Apr 20 17:07:13 2016 +0200
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.
---
src/d_mode.h | 10 ++++++++++
src/doom/d_main.c | 24 +++++++++++-------------
src/doom/doomstat.c | 1 +
src/doom/doomstat.h | 4 +---
4 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/src/d_mode.h b/src/d_mode.h
index ebbd0e83..a4bd87ed 100644
--- a/src/d_mode.h
+++ b/src/d_mode.h
@@ -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
diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index 31c7483a..630180cb 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -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"
diff --git a/src/doom/doomstat.c b/src/doom/doomstat.c
index ed4c6ccc..0b880ecc 100644
--- a/src/doom/doomstat.c
+++ b/src/doom/doomstat.c
@@ -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.
diff --git a/src/doom/doomstat.h b/src/doom/doomstat.h
index acd65dcc..8340851f 100644
--- a/src/doom/doomstat.h
+++ b/src/doom/doomstat.h
@@ -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