DEHACKED lumps from IWAD now have precedence over embedded lumps and separate files

See https://forum.drdteam.org/viewtopic.php?t=7588

Processing order is now the same as in Chocolate Doom
prBoom+ loads separate files after all WAD lumps though
This makes sense but would change loading sequence existed in ZDoom for years
This commit is contained in:
alexey.lysiuk 2017-04-04 12:20:12 +03:00
parent f12c42d8d1
commit dd30d2a045
3 changed files with 26 additions and 4 deletions

View file

@ -2422,16 +2422,29 @@ static bool isDehFile(int lumpnum)
&& (0 == stricmp(extension, ".deh") || 0 == stricmp(extension, ".bex"));
}
int D_LoadDehLumps()
int D_LoadDehLumps(DehLumpSource source)
{
int lastlump = 0, lumpnum, count = 0;
while ((lumpnum = Wads.FindLump("DEHACKED", &lastlump)) >= 0)
{
const int filenum = Wads.GetLumpFile(lumpnum);
if (FromIWAD == source && filenum > FWadCollection::IWAD_FILENUM)
{
// No more DEHACKED lumps in IWAD
break;
}
else if (FromPWADs == source && filenum <= FWadCollection::IWAD_FILENUM)
{
// Skip DEHACKED lumps from IWAD
continue;
}
count += D_LoadDehLump(lumpnum);
}
if (0 == PatchSize && dehload > 0)
if (FromPWADs == source && 0 == PatchSize && dehload > 0)
{
// No DEH/BEX patch is loaded yet, try to find lump(s) with specific extensions

View file

@ -34,7 +34,13 @@
#ifndef __D_DEHACK_H__
#define __D_DEHACK_H__
int D_LoadDehLumps();
enum DehLumpSource
{
FromIWAD,
FromPWADs
};
int D_LoadDehLumps(DehLumpSource source);
bool D_LoadDehLump(int lumpnum);
bool D_LoadDehFile(const char *filename);
void FinishDehPatch ();

View file

@ -2507,6 +2507,9 @@ void D_DoomMain (void)
if (!batchrun) Printf ("DecalLibrary: Load decals.\n");
DecalLibrary.ReadAllDecals ();
// Load embedded Dehacked patches
D_LoadDehLumps(FromIWAD);
// [RH] Add any .deh and .bex files on the command line.
// If there are none, try adding any in the config file.
// Note that the command line overrides defaults from the config.
@ -2528,7 +2531,7 @@ void D_DoomMain (void)
}
// Load embedded Dehacked patches
D_LoadDehLumps();
D_LoadDehLumps(FromPWADs);
// Create replacements for dehacked pickups
FinishDehPatch();