commit ab050f0a6f70c33215e591dae3d7591d966c01dc
Author: Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Fri Apr 22 06:10:43 2016 +0200
Commit: Fabian Greffrath <fabian@greffrath.com>
CommitDate: Fri Apr 22 06:10:43 2016 +0200
gamevariant can be either freedoom or freedm
Also, simplify the checks and set the variable earlier, i.e. before
any PWADs are loaded that could contain one of the lumps we check for.
---
src/d_mode.h | 8 ++++----
src/doom/d_main.c | 50 ++++++++++++++++++++++++++++++--------------------
2 files changed, 34 insertions(+), 24 deletions(-)
diff --git a/src/d_mode.h b/src/d_mode.h
index a4bd87ed..0be49371 100644
--- a/src/d_mode.h
+++ b/src/d_mode.h
@@ -78,10 +78,10 @@ typedef enum
typedef enum
{
- vanilla = 0, // Vanilla Doom
- freedoom = 1, // FreeDoom: Phase 1 + 2
- freedm = 2, // FreeDM
- bfgedition = 4, // Doom Classic (Doom 3: BFG Edition)
+ vanilla, // Vanilla Doom
+ freedoom, // FreeDoom: Phase 1 + 2
+ freedm, // FreeDM
+ bfgedition, // Doom Classic (Doom 3: BFG Edition)
} GameVariant_t;
// Skill level.
diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index 630180cb..475f90ee 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -408,7 +408,7 @@ boolean D_GrabMouseCallback(void)
//
void D_DoomLoop (void)
{
- if (gamevariant & bfgedition &&
+ if (gamevariant == bfgedition &&
(demorecording || (gameaction == ga_playdemo) || netgame))
{
printf(" WARNING: You are playing using one of the Doom Classic\n"
@@ -576,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 (gamevariant & bfgedition && !strcasecmp(pagename, "TITLEPIC")
+ if (gamevariant == bfgedition && !strcasecmp(pagename, "TITLEPIC")
&& W_CheckNumForName("titlepic") < 0)
{
pagename = DEH_String("INTERPIC");
@@ -809,17 +809,13 @@ void D_IdentifyVersion(void)
void D_SetGameDescription(void)
{
- gamevariant = W_CheckNumForName("FREEDOOM") >= 0 ?
- W_CheckNumForName("FREEDM") >= 0 ?
- freedoom & freedm : freedoom : vanilla;
-
gamedescription = "Unknown";
if (logical_gamemission == doom)
{
// Doom 1. But which version?
- if (gamevariant & freedoom)
+ if (gamevariant == freedoom)
{
gamedescription = GetGameName("Freedoom: Phase 1");
}
@@ -842,16 +838,13 @@ void D_SetGameDescription(void)
{
// Doom 2 of some kind. But which mission?
- if (gamevariant & freedoom)
+ if (gamevariant == freedm)
{
- if (gamevariant & freedm)
- {
- gamedescription = GetGameName("FreeDM");
- }
- else
- {
- gamedescription = GetGameName("Freedoom: Phase 2");
- }
+ gamedescription = GetGameName("FreeDM");
+ }
+ else if (gamevariant == freedoom)
+ {
+ gamedescription = GetGameName("Freedoom: Phase 2");
}
else if (logical_gamemission == doom2)
{
@@ -1124,7 +1117,7 @@ static void D_Endoom(void)
static void LoadIwadDeh(void)
{
// The Freedoom IWADs have DEHACKED lumps that must be loaded.
- if (gamevariant & freedoom)
+ if (gamevariant == freedoom || gamevariant == freedm)
{
// Old versions of Freedoom (before 2014-09) did not have technically
// valid DEHACKED lumps, so ignore errors and just continue if this
@@ -1435,6 +1428,24 @@ void D_DoomMain (void)
LoadIwadDeh();
}
+ // Check which IWAD variant we are using.
+
+ if (W_CheckNumForName("FREEDOOM") >= 0)
+ {
+ if (W_CheckNumForName("FREEDM") >= 0)
+ {
+ gamevariant = freedm;
+ }
+ else
+ {
+ gamevariant = freedoom;
+ }
+ }
+ else if (W_CheckNumForName("DMENUPIC") >= 0)
+ {
+ gamevariant = bfgedition;
+ }
+
// Doom 3: BFG Edition includes modified versions of the classic
// IWADs which can be identified by an additional DMENUPIC lump.
// Furthermore, the M_GDHIGH lumps have been modified in a way that
@@ -1443,10 +1454,9 @@ void D_DoomMain (void)
// We specifically check for DMENUPIC here, before PWADs have been
// loaded which could probably include a lump of that name.
- if (W_CheckNumForName("dmenupic") >= 0)
+ if (gamevariant == bfgedition)
{
printf("BFG Edition: Using workarounds as needed.\n");
- gamevariant = bfgedition;
// BFG Edition changes the names of the secret levels to
// censor the Wolfenstein references. It also has an extra
@@ -1633,7 +1643,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 (gamevariant & freedoom && !(gamevariant & freedm))
+ if (gamevariant == freedoom)
{
printf(" WARNING: You are playing using one of the Freedoom IWAD\n"
" files, which might not work in this port. See this page\n"