mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- moved the file names used for deciding to remove the root directory of zips out of the resource file management.
Yet again too much dependencies on game specifics in low level code.
This commit is contained in:
parent
135f159927
commit
7d83dfa03a
3 changed files with 20 additions and 28 deletions
|
@ -2498,6 +2498,12 @@ static int D_DoomMain_Internal (void)
|
|||
}
|
||||
lfi.gameTypeFilter.Push(FStringf("game-%s", GameTypeName()));
|
||||
|
||||
static const char* folders[] = { "flats/", "textures/", "hires/", "sprites/", "voxels/", "colormaps/", "acs/", "maps/", "voices/", "patches/", "graphics/", "sounds/", "music/" };
|
||||
for (auto p : folders) lfi.reservedFolders.Push(p);
|
||||
|
||||
static const char* reserved[] = { "mapinfo", "zmapinfo", "gameinfo", "sndinfo", "sbarinfo", "menudef", "gldefs", "animdefs", "decorate", "zscript", "maps/" };
|
||||
for (auto p : reserved) lfi.requiredPrefixes.Push(p);
|
||||
|
||||
Wads.InitMultipleFiles (allwads, iwad_info->DeleteLumps, false, &lfi);
|
||||
allwads.Clear();
|
||||
allwads.ShrinkToFit();
|
||||
|
|
|
@ -237,20 +237,7 @@ bool FZipFile::Open(bool quiet, LumpFilterInfo* filter)
|
|||
if (i == 0)
|
||||
{
|
||||
// check for special names, if one of these gets found this must be treated as a normal zip.
|
||||
bool isspecial = !name.Compare("flats/") ||
|
||||
name.IndexOf("/") < 0 ||
|
||||
!name.Compare("textures/") ||
|
||||
!name.Compare("hires/") ||
|
||||
!name.Compare("sprites/") ||
|
||||
!name.Compare("voxels/") ||
|
||||
!name.Compare("colormaps/") ||
|
||||
!name.Compare("acs/") ||
|
||||
!name.Compare("maps/") ||
|
||||
!name.Compare("voices/") ||
|
||||
!name.Compare("patches/") ||
|
||||
!name.Compare("graphics/") ||
|
||||
!name.Compare("sounds/") ||
|
||||
!name.Compare("music/");
|
||||
bool isspecial = name.IndexOf("/") < 0 || (filter && filter->reservedFolders.Find(name) < filter->reservedFolders.Size());
|
||||
if (isspecial) break;
|
||||
name0 = name;
|
||||
}
|
||||
|
@ -261,22 +248,17 @@ bool FZipFile::Open(bool quiet, LumpFilterInfo* filter)
|
|||
name0 = "";
|
||||
break;
|
||||
}
|
||||
else if (!foundspeciallump)
|
||||
else if (!foundspeciallump && filter)
|
||||
{
|
||||
// at least one of the more common definition lumps must be present.
|
||||
if (name.IndexOf(name0 + "mapinfo") == 0) foundspeciallump = true;
|
||||
else if (name.IndexOf(name0 + "zmapinfo") == 0) foundspeciallump = true;
|
||||
else if (name.IndexOf(name0 + "gameinfo") == 0) foundspeciallump = true;
|
||||
else if (name.IndexOf(name0 + "sndinfo") == 0) foundspeciallump = true;
|
||||
else if (name.IndexOf(name0 + "sbarinfo") == 0) foundspeciallump = true;
|
||||
else if (name.IndexOf(name0 + "menudef") == 0) foundspeciallump = true;
|
||||
else if (name.IndexOf(name0 + "gldefs") == 0) foundspeciallump = true;
|
||||
else if (name.IndexOf(name0 + "animdefs") == 0) foundspeciallump = true;
|
||||
else if (name.IndexOf(name0 + "decorate.") == 0) foundspeciallump = true; // DECORATE is a common subdirectory name, so the check needs to be a bit different.
|
||||
else if (name.Compare(name0 + "decorate") == 0) foundspeciallump = true;
|
||||
else if (name.IndexOf(name0 + "zscript.") == 0) foundspeciallump = true; // same here.
|
||||
else if (name.Compare(name0 + "zscript") == 0) foundspeciallump = true;
|
||||
else if (name.Compare(name0 + "maps/") == 0) foundspeciallump = true;
|
||||
for (auto &p : filter->requiredPrefixes)
|
||||
{
|
||||
if (name.IndexOf(name0 + p) == 0)
|
||||
{
|
||||
foundspeciallump = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,10 @@ struct LumpFilterInfo
|
|||
{
|
||||
TArray<FString> gameTypeFilter; // this can contain multiple entries
|
||||
FString dotFilter;
|
||||
|
||||
// The following are for checking if the root directory of a zip can be removed.
|
||||
TArray<FString> reservedFolders;
|
||||
TArray<FString> requiredPrefixes;
|
||||
};
|
||||
|
||||
class FResourceFile;
|
||||
|
|
Loading…
Reference in a new issue