shithub: choc

Download patch

ref: 8ede3a584620f43c0b40599308a6f3c77074f2fc
parent: 9dc7a7f5d543317b2fd7c63a4ca1c3d14eebf205
author: Acts 19 quiz <N/A>
date: Fri Dec 31 06:12:43 EST 2021

Add detection and search for doom2f.wad and french.deh, respectively.

--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@ -38,6 +38,7 @@
     { "tnt.wad",      pack_tnt,  commercial, "Final Doom: TNT: Evilution" },
     { "doom.wad",     doom,      retail,     "Doom" },
     { "doom1.wad",    doom,      shareware,  "Doom Shareware" },
+    { "doom2f.wad",   doom2,     commercial, "Doom II: L'Enfer sur Terre" },
     { "chex.wad",     pack_chex, retail,     "Chex Quest" },
     { "hacx.wad",     pack_hacx, commercial, "Hacx" },
     { "freedoom2.wad", doom2,    commercial, "Freedoom: Phase 2" },
--- a/src/d_mode.h
+++ b/src/d_mode.h
@@ -82,6 +82,7 @@
     freedoom,   // FreeDoom: Phase 1 + 2
     freedm,     // FreeDM
     bfgedition, // Doom Classic (Doom 3: BFG Edition)
+    doom2f,     // Doom II (French)
 } GameVariant_t;
 
 // Skill level.
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -1240,6 +1240,41 @@
             I_Error("Failed to load chex.deh needed for emulating chex.exe.");
         }
     }
+
+    if (gamevariant == doom2f)
+    {
+        char *french_deh = NULL;
+        char *dirname;
+
+        // Look for french.deh in the same directory as the IWAD file.
+        dirname = M_DirName(iwadfile);
+        french_deh = M_StringJoin(dirname, DIR_SEPARATOR_S, "french.deh", NULL);
+        free(dirname);
+
+        // If the dehacked patch isn't found, try searching the WAD
+        // search path instead.  We might find it...
+        if (!M_FileExists(french_deh))
+        {
+            free(french_deh);
+            french_deh = D_FindWADByName("french.deh");
+        }
+
+        // Still not found?
+        if (french_deh == NULL)
+        {
+            I_Error("Unable to find French Doom II dehacked file\n"
+                    "(french.deh).  The dehacked file is required in order to\n"
+                    "emulate French doom2.exe correctly.  It can be found in\n"
+                    "your nearest /idgames repository mirror at:\n\n"
+                    "   utils/exe_edit/patches/french.zip");
+        }
+
+        if (!DEH_LoadFile(french_deh))
+        {
+            I_Error("Failed to load french.deh needed for emulating French\n"
+                    "doom2.exe.");
+        }
+    }
 }
 
 static void G_CheckDemoStatusAtExit (void)
@@ -1492,6 +1527,10 @@
     else if (W_CheckNumForName("DMENUPIC") >= 0)
     {
         gamevariant = bfgedition;
+    }
+    else if (gamemission == doom2 && W_CheckNumForName("M_RDTHIS") < 0 && W_CheckNumForName("M_EPISOD") < 0 && W_CheckNumForName("M_EPI1") < 0 && W_CheckNumForName("M_EPI2") < 0 && W_CheckNumForName("M_EPI3") < 0 && W_CheckNumForName("WIOSTF") < 0 && W_CheckNumForName("WIOBJ") >= 0)
+    {
+        gamevariant = doom2f;
     }
 
     //!