- changed autoloading of *.deh lumps: it is now controlled by a CVAR with 3 options: never load *.deh lumps, load all of them or only load the last one. *.deh loading is disabled by default.

This commit is contained in:
Christoph Oelckers 2013-07-30 09:32:33 +02:00
parent 27de9f45af
commit 81334809c4
2 changed files with 38 additions and 14 deletions

View file

@ -2329,6 +2329,18 @@ static int DoInclude (int dummy)
return GetLine(); return GetLine();
} }
CVAR(Int, dehload, 0, CVAR_ARCHIVE) // Autoloading of .DEH lumps is disabled by default.
// checks if lump is a .deh or .bex file. Only lumps in the root directory are considered valid.
static bool isDehFile(int lumpnum)
{
const char* const fullName = Wads.GetLumpFullName(lumpnum);
const char* const extension = strrchr(fullName, '.');
return NULL != extension && strchr(fullName, '/') == NULL
&& (0 == stricmp(extension, ".deh") || 0 == stricmp(extension, ".bex"));
}
int D_LoadDehLumps() int D_LoadDehLumps()
{ {
int lastlump = 0, lumpnum, count = 0; int lastlump = 0, lumpnum, count = 0;
@ -2338,28 +2350,32 @@ int D_LoadDehLumps()
count += D_LoadDehLump(lumpnum); count += D_LoadDehLump(lumpnum);
} }
#if 0 // commented out for 'maint' version. if (0 == PatchSize && dehload > 0)
if (0 == PatchSize)
{ {
// No DEH/BEX patch is loaded yet, try to find lump(s) with specific extensions // No DEH/BEX patch is loaded yet, try to find lump(s) with specific extensions
for (lumpnum = 0, lastlump = Wads.GetNumLumps(); if (dehload == 1) // load all .DEH lumps that are found.
lumpnum < lastlump;
++lumpnum)
{ {
const char* const fullName = Wads.GetLumpFullName(lumpnum); for (lumpnum = 0, lastlump = Wads.GetNumLumps(); lumpnum < lastlump; ++lumpnum)
const char* const extension = strrchr(fullName, '.'); {
if (isDehFile(lumpnum))
const bool isDehOrBex = NULL != extension
&& (0 == stricmp(extension, ".deh") || 0 == stricmp(extension, ".bex"));
if (isDehOrBex)
{ {
count += D_LoadDehLump(lumpnum); count += D_LoadDehLump(lumpnum);
} }
} }
} }
#endif else // only load the last .DEH lump that is found.
{
for (lumpnum = Wads.GetNumLumps()-1; lumpnum >=0; --lumpnum)
{
if (isDehFile(lumpnum))
{
count += D_LoadDehLump(lumpnum);
break;
}
}
}
}
return count; return count;
} }

View file

@ -850,6 +850,13 @@ OptionValue Autosave
2, "Never" 2, "Never"
} }
OptionValue dehopt
{
0, "Never"
1, "All"
2, "Only last one"
}
OptionMenu "MiscOptions" OptionMenu "MiscOptions"
{ {
Title "Miscellaneous Options" Title "Miscellaneous Options"
@ -864,6 +871,7 @@ OptionMenu "MiscOptions"
Option "Enable cheats from all games", "allcheats", "OnOff" Option "Enable cheats from all games", "allcheats", "OnOff"
Option "Enable autosaves", "disableautosave", "Autosave" Option "Enable autosaves", "disableautosave", "Autosave"
Slider "Number of autosaves", "autosavecount", 1, 20, 1, 0 Slider "Number of autosaves", "autosavecount", 1, 20, 1, 0
Option "Load *.deh/*.bex lumps", "dehload", "dehopt"
StaticText " " StaticText " "
Option "Cache nodes", "gl_cachenodes", "OnOff" Option "Cache nodes", "gl_cachenodes", "OnOff"
Slider "Time threshold for node caching", "gl_cachetime", 0.0, 2.0, 0.1 Slider "Time threshold for node caching", "gl_cachetime", 0.0, 2.0, 0.1