mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- lump flags cleanup.
This commit is contained in:
parent
025e80b74a
commit
ef300a9ea8
11 changed files with 20 additions and 52 deletions
|
@ -292,7 +292,7 @@ bool F7ZFile::Open(bool quiet)
|
|||
lump_p->LumpNameSetup(name);
|
||||
lump_p->LumpSize = static_cast<int>(SzArEx_GetFileSize(archPtr, i));
|
||||
lump_p->Owner = this;
|
||||
lump_p->Flags = LUMPF_ZIPFILE|LUMPF_COMPRESSED;
|
||||
lump_p->Flags = LUMPF_FULLPATH|LUMPF_COMPRESSED;
|
||||
lump_p->Position = i;
|
||||
lump_p->CheckEmbedded();
|
||||
lump_p++;
|
||||
|
|
|
@ -108,6 +108,7 @@ bool FPakFile::Open(bool quiet)
|
|||
for(uint32_t i = 0; i < NumLumps; i++)
|
||||
{
|
||||
Lumps[i].LumpNameSetup(fileinfo[i].name);
|
||||
Lumps[i].Flags = LUMPF_FULLPATH;
|
||||
Lumps[i].Owner = this;
|
||||
Lumps[i].Position = LittleLong(fileinfo[i].filepos);
|
||||
Lumps[i].LumpSize = LittleLong(fileinfo[i].filelen);
|
||||
|
|
|
@ -159,7 +159,7 @@ bool FRFFFile::Open(bool quiet)
|
|||
Lumps[i].Owner = this;
|
||||
if (lumps[i].Flags & 0x10)
|
||||
{
|
||||
Lumps[i].Flags |= LUMPF_BLOODCRYPT;
|
||||
Lumps[i].Flags |= LUMPF_COMPRESSED; // flags the lump as not directly usable
|
||||
}
|
||||
Lumps[i].IndexNum = LittleLong(lumps[i].IndexNum);
|
||||
// Rearrange the name and extension to construct the fullname.
|
||||
|
@ -207,7 +207,7 @@ FileReader *FRFFLump::GetReader()
|
|||
{
|
||||
// Don't return the reader if this lump is encrypted
|
||||
// In that case always force caching of the lump
|
||||
if (!(Flags & LUMPF_BLOODCRYPT))
|
||||
if (!(Flags & LUMPF_COMPRESSED))
|
||||
{
|
||||
return FUncompressedLump::GetReader();
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ int FRFFLump::FillCache()
|
|||
{
|
||||
int res = FUncompressedLump::FillCache();
|
||||
|
||||
if (Flags & LUMPF_BLOODCRYPT)
|
||||
if (Flags & LUMPF_COMPRESSED)
|
||||
{
|
||||
int cryptlen = MIN<int> (LumpSize, 256);
|
||||
uint8_t *data = (uint8_t *)Cache;
|
||||
|
|
|
@ -187,7 +187,7 @@ bool FWadFile::Open(bool quiet)
|
|||
Lumps[i].Position = isBigEndian ? BigLong(fileinfo[i].FilePos) : LittleLong(fileinfo[i].FilePos);
|
||||
Lumps[i].LumpSize = isBigEndian ? BigLong(fileinfo[i].Size) : LittleLong(fileinfo[i].Size);
|
||||
Lumps[i].Namespace = ns_global;
|
||||
Lumps[i].Flags = Lumps[i].Compressed? LUMPF_COMPRESSED : 0;
|
||||
Lumps[i].Flags = Lumps[i].Compressed ? LUMPF_COMPRESSED | LUMPF_SHORTNAME : LUMPF_SHORTNAME;
|
||||
Lumps[i].FullName = "";
|
||||
|
||||
// Check if the lump is within the WAD file and print a warning if not.
|
||||
|
|
|
@ -340,7 +340,7 @@ bool FZipFile::Open(bool quiet)
|
|||
lump_p->LumpSize = LittleLong(zip_fh->UncompressedSize);
|
||||
lump_p->Owner = this;
|
||||
// The start of the Reader will be determined the first time it is accessed.
|
||||
lump_p->Flags = LUMPF_ZIPFILE;
|
||||
lump_p->Flags = LUMPF_FULLPATH;
|
||||
lump_p->NeedFileStart = true;
|
||||
lump_p->Method = uint8_t(zip_fh->Method);
|
||||
if (lump_p->Method != METHOD_STORED) lump_p->Flags |= LUMPF_COMPRESSED;
|
||||
|
|
|
@ -8,6 +8,15 @@
|
|||
class FResourceFile;
|
||||
class FTexture;
|
||||
|
||||
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.
|
||||
};
|
||||
|
||||
// This holds a compresed Zip entry with all needed info to decompress it.
|
||||
struct FCompressedBuffer
|
||||
{
|
||||
|
|
|
@ -963,7 +963,7 @@ void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &b
|
|||
if (ns == ns_global)
|
||||
{
|
||||
// In Zips all graphics must be in a separate namespace.
|
||||
if (Wads.GetLumpFlags(i) & LUMPF_ZIPFILE) continue;
|
||||
if (Wads.GetLumpFlags(i) & LUMPF_FULLPATH) continue;
|
||||
|
||||
// Ignore lumps with empty names.
|
||||
if (Wads.CheckLumpName(i, "")) continue;
|
||||
|
|
|
@ -467,7 +467,7 @@ int FWadCollection::CheckNumForName (const char *name, int space)
|
|||
// from a Zip return that. WADs don't know these namespaces and single lumps must
|
||||
// work as well.
|
||||
if (space > ns_specialzipdirectory && lump->Namespace == ns_global &&
|
||||
!(lump->Flags & LUMPF_ZIPFILE)) break;
|
||||
!(lump->Flags & LUMPF_FULLPATH)) break;
|
||||
}
|
||||
i = NextLumpIndex[i];
|
||||
}
|
||||
|
@ -1539,7 +1539,7 @@ FileReader FWadCollection::OpenLumpReader(int lump)
|
|||
auto rl = LumpInfo[lump].lump;
|
||||
auto rd = rl->GetReader();
|
||||
|
||||
if (rl->RefCount == 0 && rd != nullptr && !rd->GetBuffer() && !(rl->Flags & (LUMPF_BLOODCRYPT | LUMPF_COMPRESSED)))
|
||||
if (rl->RefCount == 0 && rd != nullptr && !rd->GetBuffer() && !(rl->Flags & LUMPF_COMPRESSED))
|
||||
{
|
||||
FileReader rdr;
|
||||
rdr.OpenFilePart(*rd, rl->GetFileOffset(), rl->LumpSize);
|
||||
|
@ -1558,7 +1558,7 @@ FileReader FWadCollection::ReopenLumpReader(int lump, bool alwayscache)
|
|||
auto rl = LumpInfo[lump].lump;
|
||||
auto rd = rl->GetReader();
|
||||
|
||||
if (rl->RefCount == 0 && rd != nullptr && !rd->GetBuffer() && !alwayscache && !(rl->Flags & (LUMPF_BLOODCRYPT|LUMPF_COMPRESSED)))
|
||||
if (rl->RefCount == 0 && rd != nullptr && !rd->GetBuffer() && !alwayscache && !(rl->Flags & LUMPF_COMPRESSED))
|
||||
{
|
||||
int fileno = Wads.GetLumpFile(lump);
|
||||
const char *filename = Wads.GetWadFullName(fileno);
|
||||
|
@ -1677,24 +1677,6 @@ const char *FWadCollection::GetWadFullName (int wadnum) const
|
|||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// IsEncryptedFile
|
||||
//
|
||||
// Returns true if the first 256 bytes of the lump are encrypted for Blood.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
bool FWadCollection::IsEncryptedFile(int lump) const
|
||||
{
|
||||
if ((unsigned)lump >= (unsigned)NumLumps)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return !!(LumpInfo[lump].lump->Flags & LUMPF_BLOODCRYPT);
|
||||
}
|
||||
|
||||
|
||||
// FMemLump -----------------------------------------------------------------
|
||||
|
||||
FMemLump::FMemLump ()
|
||||
|
|
|
@ -67,16 +67,6 @@ typedef enum {
|
|||
ns_firstskin,
|
||||
} namespace_t;
|
||||
|
||||
enum ELumpFlags
|
||||
{
|
||||
LUMPF_MAYBEFLAT=1, // might be a flat outside F_START/END
|
||||
LUMPF_ZIPFILE=2, // contains a full path
|
||||
LUMPF_EMBEDDED=4, // from an embedded WAD
|
||||
LUMPF_BLOODCRYPT = 8, // encrypted
|
||||
LUMPF_COMPRESSED = 16, // compressed
|
||||
LUMPF_SEQUENTIAL = 32, // compressed but a sequential reader can be retrieved.
|
||||
};
|
||||
|
||||
|
||||
// [RH] Copy an 8-char string and uppercase it.
|
||||
void uppercopy (char *to, const char *from);
|
||||
|
@ -187,8 +177,6 @@ public:
|
|||
bool CheckLumpName (int lump, const char *name) const; // [RH] Returns true if the names match
|
||||
unsigned GetLumpsInFolder(const char *path, TArray<FolderEntry> &result, bool atomic) const;
|
||||
|
||||
bool IsEncryptedFile(int lump) const;
|
||||
|
||||
int GetNumLumps() const
|
||||
{
|
||||
return NumLumps;
|
||||
|
|
|
@ -164,19 +164,8 @@ MapData *P_OpenMapData(const char * mapname, bool justcheck)
|
|||
// As such any special handling for other types of lumps is skipped.
|
||||
map->MapLumps[0].Reader = Wads.ReopenLumpReader(lump_name);
|
||||
strncpy(map->MapLumps[0].Name, Wads.GetLumpFullName(lump_name), 8);
|
||||
map->Encrypted = Wads.IsEncryptedFile(lump_name);
|
||||
map->InWad = true;
|
||||
|
||||
if (map->Encrypted)
|
||||
{ // If it's encrypted, then it's a Blood file, presumably a map.
|
||||
if (!P_IsBuildMap(map))
|
||||
{
|
||||
delete map;
|
||||
return NULL;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
|
||||
if (stricmp(Wads.GetLumpFullName(lump_name + 1), "TEXTMAP") != 0)
|
||||
|
|
|
@ -65,7 +65,6 @@ private:
|
|||
FileReader nofile;
|
||||
public:
|
||||
bool HasBehavior = false;
|
||||
bool Encrypted = false;
|
||||
bool isText = false;
|
||||
bool InWad = false;
|
||||
int lumpnum = -1;
|
||||
|
|
Loading…
Reference in a new issue