diff options
author | Simon Howard | 2014-10-18 20:48:40 -0400 |
---|---|---|
committer | Simon Howard | 2014-10-18 20:48:40 -0400 |
commit | dec3348a9a2584fa375407341ea265535dc0f8e3 (patch) | |
tree | 930402a3f0fedf44bb9c3a9b66e3152086b93a96 /src/doom | |
parent | 5914e16076339ef487094dba8be67eed21b0a811 (diff) | |
download | chocolate-doom-dec3348a9a2584fa375407341ea265535dc0f8e3.tar.gz chocolate-doom-dec3348a9a2584fa375407341ea265535dc0f8e3.tar.bz2 chocolate-doom-dec3348a9a2584fa375407341ea265535dc0f8e3.zip |
Fix dehacked patch loading order.
The order in which we load dehacked patches is important. Change the
order so that IWAD dehacked patches are loaded before any others, and
so if, for example, we're playing with Freedoom, the Freedoom string
replacements can be overridden by those from extra mods we're playing
with.
As part of this, ditch DEH_Init() and use DEH_ParseCommandLine()
instead to handle the -deh option. Remove the DEH_Init() message
from startup and show messages about dehacked patches that we load
with the WAD files that we load.
Diffstat (limited to 'src/doom')
-rw-r--r-- | src/doom/d_main.c | 77 |
1 files changed, 43 insertions, 34 deletions
diff --git a/src/doom/d_main.c b/src/doom/d_main.c index ef8e8aea..76acaf48 100644 --- a/src/doom/d_main.c +++ b/src/doom/d_main.c @@ -1082,9 +1082,10 @@ static void LoadIwadDeh(void) // void D_DoomMain (void) { - int p; - char file[256]; - char demolumpname[9]; + int p; + char file[256]; + char demolumpname[9]; + int numiwadlumps; I_AtExit(D_Endoom, false); @@ -1153,11 +1154,6 @@ void D_DoomMain (void) } #endif - -#ifdef FEATURE_DEHACKED - printf("DEH_Init: Init Dehacked support.\n"); - DEH_Init(); -#endif //! // @vanilla @@ -1299,6 +1295,7 @@ void D_DoomMain (void) DEH_printf("W_Init: Init WADfiles.\n"); D_AddFile(iwadfile); + numiwadlumps = numlumps; W_CheckCorrectIWAD(doom); @@ -1344,6 +1341,17 @@ void D_DoomMain (void) DEH_AddStringReplacement(PHUSTR_1, "level 33: betray"); } +#ifdef FEATURE_DEHACKED + // Load Dehacked patches specified on the command line with -deh. + // Note that there's a very careful and deliberate ordering to how + // Dehacked patches are loaded. The order we use is: + // 1. IWAD dehacked patches. + // 2. Command line dehacked patches specified with -deh. + // 3. PWAD dehacked patches in DEHACKED lumps. + DEH_ParseCommandLine(); +#endif + + // Load PWAD files. modifiedgame = W_ParseCommandLine(); // Debug: @@ -1406,9 +1414,35 @@ void D_DoomMain (void) I_AtExit((atexit_func_t) G_CheckDemoStatus, true); // Generate the WAD hash table. Speed things up a bit. - W_GenerateHashTable(); + // Load DEHACKED lumps from WAD files - but only if we give the right + // command line parameter. + + //! + // @category mod + // + // Load Dehacked patches from DEHACKED lumps contained in one of the + // loaded PWAD files. + // + if (M_ParmExists("-dehlump")) + { + int i, loaded = 0; + + for (i = numiwadlumps; i < numlumps; ++i) + { + if (!strncmp(lumpinfo[i].name, "DEHACKED", 8)) + { + DEH_LoadLump(i, false, false); + loaded++; + } + } + + printf(" loaded %i DEHACKED lumps from PWAD files.\n", loaded); + } + + // Set the gamedescription string. This is only possible now that + // we've finished loading Dehacked patches. D_SetGameDescription(); savegamedir = M_GetSaveGameDir(D_SaveGameIWADName(gamemission)); @@ -1461,31 +1495,6 @@ void D_DoomMain (void) I_PrintDivider(); } - // Load DEHACKED lumps from WAD files - but only if we give the right - // command line parameter. - - //! - // @category mod - // - // Load Dehacked patches from DEHACKED lumps contained in one of the - // loaded PWAD files. - // - if (M_ParmExists("-dehlump")) - { - int i, loaded = 0; - - for (i = 0; i < numlumps; ++i) - { - if (!strncmp(lumpinfo[i].name, "DEHACKED", 8)) - { - DEH_LoadLump(i, false, false); - loaded++; - } - } - - printf("Loaded %i DEHACKED lumps from WAD files.\n", loaded); - } - DEH_printf("I_Init: Setting up machine state.\n"); I_CheckIsScreensaver(); I_InitTimer(); |