Skip to content

Commit

Permalink
only use the new flag names
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Dec 14, 2023
1 parent 3013239 commit 11d6b3e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 20 deletions.
7 changes: 0 additions & 7 deletions src/common/filesystem/include/resourcefile.h
Expand Up @@ -78,19 +78,12 @@ typedef enum {

enum ELumpFlags
{
LUMPF_MAYBEFLAT = 1, // might be a flat outside F_START/END
LUMPF_FULLPATH = 2, // contains a full path. This will trigger extended namespace checks when looking up short names.
LUMPF_EMBEDDED = 4, // marks an embedded resource file for later processing.
LUMPF_SHORTNAME = 8, // the stored name is a short extension-less name
LUMPF_COMPRESSED = 16, // compressed or encrypted, i.e. cannot be read with the container file's reader.

RESFF_MAYBEFLAT = 1, // might be a flat inside a WAD outside F_START/END
RESFF_FULLPATH = 2, // contains a full path. This will trigger extended namespace checks when looking up short names.
RESFF_EMBEDDED = 4, // marks an embedded resource file for later processing.
RESFF_SHORTNAME = 8, // the stored name is a short extension-less name
RESFF_COMPRESSED = 16, // compressed or encrypted, i.e. cannot be read with the container file's reader.
RESFF_NEEDFILESTART = 32, // The real position is not known yet and needs to be calculated on access

};

struct FResourceEntry
Expand Down
2 changes: 1 addition & 1 deletion src/common/filesystem/source/file_wad.cpp
Expand Up @@ -251,7 +251,7 @@ void FWadFile::SetNamespace(const char *startmarker, const char *endmarker, name
// We can't add this to the flats namespace but
// it needs to be flagged for the texture manager.
Printf(FSMessageLevel::DebugNotify, "%s: Marking %s as potential flat\n", FileName, Entries[ii].FileName);
Entries[ii].Flags |= LUMPF_MAYBEFLAT;
Entries[ii].Flags |= RESFF_MAYBEFLAT;
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/common/filesystem/source/filesystem.cpp
Expand Up @@ -112,15 +112,15 @@ struct FileSystem::LumpRecord

auto lflags = file->GetEntryFlags(fileindex);
if (!name) name = file->getName(fileindex);
if (lflags & LUMPF_SHORTNAME)
if (lflags & RESFF_SHORTNAME)
{
UpperCopy(shortName.String, name);
shortName.String[8] = 0;
LongName = "";
Namespace = file->GetEntryNamespace(fileindex);
resourceId = -1;
}
else if ((lflags & LUMPF_EMBEDDED) || !name || !*name)
else if ((lflags & RESFF_EMBEDDED) || !name || !*name)
{
shortName.qword = 0;
LongName = "";
Expand Down Expand Up @@ -391,7 +391,7 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, LumpFilterInf
for (int i = 0; i < resfile->EntryCount(); i++)
{
int flags = resfile->GetEntryFlags(i);
if (flags & LUMPF_EMBEDDED)
if (flags & RESFF_EMBEDDED)
{
std::string path = filename;
path += ':';
Expand Down Expand Up @@ -426,7 +426,7 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, LumpFilterInf
for (int i = 0; i < resfile->EntryCount(); i++)
{
int flags = resfile->GetEntryFlags(i);
if (!(flags & LUMPF_EMBEDDED))
if (!(flags & RESFF_EMBEDDED))
{
auto reader = resfile->GetEntryReader(i, true);
md5Hash(filereader, cksum);
Expand Down Expand Up @@ -532,7 +532,7 @@ int FileSystem::CheckNumForName (const char *name, int space) const
// work as well.
auto lflags = lump.resfile->GetEntryFlags(lump.resindex);
if (space > ns_specialzipdirectory && lump.Namespace == ns_global &&
!((lflags ^lump.flags) & LUMPF_FULLPATH)) break;
!((lflags ^lump.flags) & RESFF_FULLPATH)) break;
}
i = NextLumpIndex[i];
}
Expand Down Expand Up @@ -1470,15 +1470,15 @@ bool FileSystem::CreatePathlessCopy(const char *name, int id, int /*flags*/)

if (slash == nullptr)
{
FileInfo[lump].flags = LUMPF_FULLPATH;
FileInfo[lump].flags = RESFF_FULLPATH;
return true; // already is pathless.
}


// just create a new reference to the original data with a different name.
oldlump.LongName = slash + 1;
oldlump.resourceId = id;
oldlump.flags = LUMPF_FULLPATH;
oldlump.flags = RESFF_FULLPATH;
FileInfo.push_back(oldlump);
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/common/filesystem/source/resourcefile.cpp
Expand Up @@ -106,13 +106,13 @@ void FResourceFile::CheckEmbedded(uint32_t entry, LumpFilterInfo* lfi)
const char *c = strstr(FullName, ".wad"); // fixme: Use lfi for this.
if (c && strlen(c) == 4 && (!strchr(FullName, '/') || IsFileInFolder(FullName)))
{
Entries[entry].Flags |= LUMPF_EMBEDDED;
Entries[entry].Flags |= RESFF_EMBEDDED;
}
else if (lfi) for (auto& fstr : lfi->embeddings)
{
if (!stricmp(FullName, fstr.c_str()))
{
Entries[entry].Flags |= LUMPF_EMBEDDED;
Entries[entry].Flags |= RESFF_EMBEDDED;
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/common/textures/texturemanager.cpp
Expand Up @@ -585,7 +585,7 @@ void FTextureManager::AddGroup(int wadnum, int ns, ETextureType usetype)
}
progressFunc();
}
else if (ns == ns_flats && fileSystem.GetFileFlags(firsttx) & LUMPF_MAYBEFLAT)
else if (ns == ns_flats && fileSystem.GetFileFlags(firsttx) & RESFF_MAYBEFLAT)
{
if (fileSystem.CheckNumForName(Name, ns) < firsttx)
{
Expand Down Expand Up @@ -971,7 +971,7 @@ void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &b
if (ns == ns_global)
{
// In Zips all graphics must be in a separate namespace.
if (fileSystem.GetFileFlags(i) & LUMPF_FULLPATH) continue;
if (fileSystem.GetFileFlags(i) & RESFF_FULLPATH) continue;

// Ignore lumps with empty names.
if (fileSystem.CheckFileName(i, "")) continue;
Expand Down Expand Up @@ -1425,7 +1425,7 @@ int FTextureManager::GuesstimateNumTextures ()
break;

default:
if (fileSystem.GetFileFlags(i) & LUMPF_MAYBEFLAT) numtex++;
if (fileSystem.GetFileFlags(i) & RESFF_MAYBEFLAT) numtex++;

break;
}
Expand Down

0 comments on commit 11d6b3e

Please sign in to comment.