Skip to content

Commit

Permalink
Merge pull request #1418 from Acts19quiz/master_Acts19quiz
Browse files Browse the repository at this point in the history
Add detection and search for doom2f.wad and french.deh, respectively.
  • Loading branch information
fragglet committed Jan 29, 2022
2 parents 6667c66 + b1a2bc0 commit 41865b1
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/d_iwad.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ static const iwad_t iwads[] =
{ "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" },
Expand Down
1 change: 1 addition & 0 deletions src/d_mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ typedef enum
heretic, // Heretic
hexen, // Hexen
strife, // Strife
doom2f, // Doom 2: L'Enfer sur Terre

none
} GameMission_t;
Expand Down
44 changes: 44 additions & 0 deletions src/doom/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,14 @@ static void D_Endoom(void)
I_Endoom(endoom);
}

boolean IsFrenchIWAD(void)
{
return (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);
}

// Load dehacked patches needed for certain IWADs.
static void LoadIwadDeh(void)
{
Expand Down Expand Up @@ -1240,6 +1248,42 @@ static void LoadIwadDeh(void)
I_Error("Failed to load chex.deh needed for emulating chex.exe.");
}
}

if (IsFrenchIWAD())
{
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);
printf("French version\n");
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)
Expand Down

0 comments on commit 41865b1

Please sign in to comment.