foxygit / doom Log in
commit 999f56818bcb45b48c22b0e21a74592ad7b80a14
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Tue Nov 22 23:45:14 2016 -0500
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Tue Nov 22 23:45:14 2016 -0500

    doom: Load IWAD DEHs after setting gamevariant.

    Certain IWADs (Freedoom and Hacx) contain DEHACKED lumps that must be
    loaded to be played properly. This is conditional on the value of
    gamevariant, but this variable was only being initialized for these
    IWADs after the code to load the DEHACKED lumps. Reorder to correct.
---
 src/doom/d_main.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index 4c669b18..65a39a10 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -1438,19 +1438,6 @@ void D_DoomMain (void)
     D_IdentifyVersion();
     InitGameVersion();

-    //!
-    // @category mod
-    //
-    // Disable automatic loading of Dehacked patches for certain
-    // IWAD files.
-    //
-    if (!M_ParmExists("-nodeh"))
-    {
-        // Some IWADs have dehacked patches that need to be loaded for
-        // them to be played properly.
-        LoadIwadDeh();
-    }
-
     // Check which IWAD variant we are using.

     if (W_CheckNumForName("FREEDOOM") >= 0)
@@ -1469,6 +1456,19 @@ void D_DoomMain (void)
         gamevariant = bfgedition;
     }

+    //!
+    // @category mod
+    //
+    // Disable automatic loading of Dehacked patches for certain
+    // IWAD files.
+    //
+    if (!M_ParmExists("-nodeh"))
+    {
+        // Some IWADs have dehacked patches that need to be loaded for
+        // them to be played properly.
+        LoadIwadDeh();
+    }
+
     // 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