shithub: choc

Download patch

ref: 18efe412b69bf733c2a9cd544212e4fd3a3c636a
parent: dc57eb0844fea8fd444281453b25f43ab7007a22
parent: b8fd310fc155b969346265601a48c21faec2ecf9
author: Simon Howard <[email protected]>
date: Mon Feb 24 05:37:19 EST 2014

Merge pull request #346 from fabiangreffrath/bfgedition

More robust checks for BFG Edition.

--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -576,9 +576,10 @@
 
     // 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 (bfgedition && !strcasecmp(pagename, "TITLEPIC")
+        && W_CheckNumForName("titlepic") < 0)
     {
-        pagename = "INTERPIC";
+        pagename = DEH_String("INTERPIC");
     }
 }
 
@@ -1278,6 +1279,31 @@
 
     DEH_printf("W_Init: Init WADfiles.\n");
     D_AddFile(iwadfile);
+
+    // 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
+    // makes them incompatible to Vanilla Doom and the modified version
+    // of doom2.wad is missing the TITLEPIC lump.
+    // 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)
+    {
+        printf("BFG Edition: Using workarounds as needed.\n");
+        bfgedition = true;
+
+        // BFG Edition changes the names of the secret levels to
+        // censor the Wolfenstein references. It also has an extra
+        // secret level (MAP33). In Vanilla Doom (meaning the DOS
+        // version), MAP33 overflows into the Plutonia level names
+        // array, so HUSTR_33 is actually PHUSTR_1.
+
+        DEH_AddStringReplacement(HUSTR_31, "level 31: idkfa");
+        DEH_AddStringReplacement(HUSTR_32, "level 32: keen");
+        DEH_AddStringReplacement(PHUSTR_1, "level 33: betray");
+    }
+
     modifiedgame = W_ParseCommandLine();
 
     // Debug:
@@ -1576,30 +1602,6 @@
 
     if (gamemode == commercial && W_CheckNumForName("map01") < 0)
         storedemo = true;
-
-    // Doom 3: BFG Edition includes modified versions of the classic
-    // IWADs. The modified version of doom2.wad does not have a
-    // TITLEPIC lump, so detect this so we can apply a workaround.
-    // We specifically check for TITLEPIC here, after PWADs have been
-    // loaded - this means that we can play with the BFG Edition with
-    // PWADs that change the title screen and still see the modified
-    // titles.
-
-    if (gamemode == commercial && W_CheckNumForName("titlepic") < 0)
-    {
-        printf("BFG Edition: Using INTERPIC instead of TITLEPIC.\n");
-        bfgedition = true;
-
-        // BFG Edition changes the names of the secret levels to
-        // censor the Wolfenstein references. It also has an extra
-        // secret level (MAP33). In Vanilla Doom (meaning the DOS
-        // version), MAP33 overflows into the Plutonia level names
-        // array, so HUSTR_33 is actually PHUSTR_1.
-
-        DEH_AddStringReplacement(HUSTR_31, "level 31: idkfa");
-        DEH_AddStringReplacement(HUSTR_32, "level 32: keen");
-        DEH_AddStringReplacement(PHUSTR_1, "level 33: betray");
-    }
 
     if (M_CheckParmWithArgs("-statdump", 1))
     {