renamed things in file system to reduce Doom specific terminology.
This commit is contained in:
parent
a3475d3973
commit
d1abc3eb8c
50 changed files with 313 additions and 318 deletions
|
|
@ -185,7 +185,7 @@ static void SetupGenMidi()
|
|||
|
||||
static void SetupWgOpn()
|
||||
{
|
||||
int lump = fileSystem.CheckNumForFullName("xg.wopn");
|
||||
int lump = fileSystem.FindFile("xg.wopn");
|
||||
if (lump < 0)
|
||||
{
|
||||
return;
|
||||
|
|
@ -310,7 +310,7 @@ static ZMusic_MidiSource GetMIDISource(const char *fn)
|
|||
if (src.Compare("*") == 0) src = mus_playing.name;
|
||||
|
||||
auto lump = fileSystem.CheckNumForName(src.GetChars(), ns_music);
|
||||
if (lump < 0) lump = fileSystem.CheckNumForFullName(src.GetChars());
|
||||
if (lump < 0) lump = fileSystem.FindFile(src.GetChars());
|
||||
if (lump < 0)
|
||||
{
|
||||
Printf("Cannot find MIDI lump %s.\n", src.GetChars());
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ FileReader FPatchSetReader::OpenFile(const char *name)
|
|||
|
||||
FLumpPatchSetReader::FLumpPatchSetReader(const char *filename)
|
||||
{
|
||||
mLumpIndex = fileSystem.CheckNumForFullName(filename);
|
||||
mLumpIndex = fileSystem.FindFile(filename);
|
||||
|
||||
mBasePath = filename;
|
||||
FixPathSeperator(mBasePath);
|
||||
|
|
@ -316,7 +316,7 @@ FileReader FLumpPatchSetReader::OpenFile(const char *name)
|
|||
FString path;
|
||||
if (IsAbsPath(name)) return FileReader(); // no absolute paths in the virtual file system.
|
||||
path = mBasePath + name;
|
||||
auto index = fileSystem.CheckNumForFullName(path.GetChars());
|
||||
auto index = fileSystem.FindFile(path.GetChars());
|
||||
if (index < 0) return FileReader();
|
||||
return fileSystem.ReopenFileReader(index);
|
||||
}
|
||||
|
|
@ -472,7 +472,7 @@ FSoundFontReader *FSoundFontManager::OpenSoundFont(const char *const name, int a
|
|||
// To avoid clashes this will only be done if the name has the '.cfg' extension.
|
||||
// Sound fonts cannot be loaded this way.
|
||||
const char *p = name + strlen(name) - 4;
|
||||
if (p > name && !stricmp(p, ".cfg") && fileSystem.CheckNumForFullName(name) >= 0)
|
||||
if (p > name && !stricmp(p, ".cfg") && fileSystem.FindFile(name) >= 0)
|
||||
{
|
||||
return new FLumpPatchSetReader(name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -730,15 +730,15 @@ void ReadBindings(int lump, bool override)
|
|||
|
||||
void C_SetDefaultKeys(const char* baseconfig)
|
||||
{
|
||||
auto lump = fileSystem.CheckNumForFullName("engine/commonbinds.txt");
|
||||
auto lump = fileSystem.FindFile("engine/commonbinds.txt");
|
||||
if (lump >= 0)
|
||||
{
|
||||
// Bail out if a mod tries to override this. Main game resources are allowed to do this, though.
|
||||
auto fileno2 = fileSystem.GetFileContainer(lump);
|
||||
if (fileno2 > fileSystem.GetMaxIwadNum())
|
||||
if (fileno2 > fileSystem.GetMaxBaseNum())
|
||||
{
|
||||
I_FatalError("File %s is overriding core lump %s.",
|
||||
fileSystem.GetResourceFileFullName(fileno2), "engine/commonbinds.txt");
|
||||
fileSystem.GetContainerFullName(fileno2), "engine/commonbinds.txt");
|
||||
}
|
||||
|
||||
ReadBindings(lump, true);
|
||||
|
|
@ -748,7 +748,7 @@ void C_SetDefaultKeys(const char* baseconfig)
|
|||
while ((lump = fileSystem.FindLumpFullName(baseconfig, &lastlump)) != -1)
|
||||
{
|
||||
// Read this only from the main game resources.
|
||||
if (fileSystem.GetFileContainer(lump) <= fileSystem.GetMaxIwadNum())
|
||||
if (fileSystem.GetFileContainer(lump) <= fileSystem.GetMaxBaseNum())
|
||||
ReadBindings(lump, true);
|
||||
}
|
||||
|
||||
|
|
@ -758,7 +758,7 @@ void C_SetDefaultKeys(const char* baseconfig)
|
|||
// [SW] - We need to check to see the origin of the DEFBINDS... if it
|
||||
// Comes from an IWAD/IPK3/IPK7 allow it to override the users settings...
|
||||
// If it comes from a user mod however, don't.
|
||||
if (fileSystem.GetFileContainer(lump) > fileSystem.GetMaxIwadNum())
|
||||
if (fileSystem.GetFileContainer(lump) > fileSystem.GetMaxBaseNum())
|
||||
ReadBindings(lump, false);
|
||||
else
|
||||
ReadBindings(lump, true);
|
||||
|
|
|
|||
|
|
@ -233,14 +233,14 @@ CCMD (wdir)
|
|||
if (argv.argc() != 2) wadnum = -1;
|
||||
else
|
||||
{
|
||||
wadnum = fileSystem.CheckIfResourceFileLoaded (argv[1]);
|
||||
wadnum = fileSystem.CheckIfContainerLoaded (argv[1]);
|
||||
if (wadnum < 0)
|
||||
{
|
||||
Printf ("%s must be loaded to view its directory.\n", argv[1]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < fileSystem.GetNumEntries(); ++i)
|
||||
for (int i = 0; i < fileSystem.GetFileCount(); ++i)
|
||||
{
|
||||
if (wadnum == -1 || fileSystem.GetFileContainer(i) == wadnum)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
void FileSystem::InitHashChains()
|
||||
{
|
||||
Super::InitHashChains();
|
||||
unsigned NumEntries = GetNumEntries();
|
||||
unsigned NumEntries = GetFileCount();
|
||||
for (unsigned i = 0; i < (unsigned)NumEntries; i++)
|
||||
{
|
||||
files[i].HashFirst = files[i].HashNext = NULL_INDEX;
|
||||
|
|
@ -89,7 +89,7 @@ static void UpperCopy(char* to, const char* from)
|
|||
void FileSystem::SetupName(int fileindex)
|
||||
{
|
||||
const char* name = GetFileName(fileindex);
|
||||
int containerflags = GetResourceFileFlags(GetFileContainer(fileindex));
|
||||
int containerflags = GetContainerFlags(GetFileContainer(fileindex));
|
||||
int lflags = GetFileFlags(fileindex);
|
||||
|
||||
if ((containerflags & wadflags) == wadflags)
|
||||
|
|
@ -158,7 +158,7 @@ void FileSystem::SetNamespace(int filenum, const char* startmarker, const char*
|
|||
TArray<Marker> markers;
|
||||
int FirstLump = GetFirstEntry(filenum);
|
||||
int LastLump = GetLastEntry(filenum);
|
||||
auto FileName = GetResourceFileName(filenum);
|
||||
auto FileName = GetContainerName(filenum);
|
||||
|
||||
for (int i = FirstLump; i <= LastLump; i++)
|
||||
{
|
||||
|
|
@ -291,7 +291,7 @@ void FileSystem::SkinHack(int filenum, FileSys::FileSystemMessageFunc Printf)
|
|||
|
||||
int FirstLump = GetFirstEntry(filenum);
|
||||
int LastLump = GetLastEntry(filenum);
|
||||
auto FileName = GetResourceFileName(filenum);
|
||||
auto FileName = GetContainerName(filenum);
|
||||
|
||||
for (int i = FirstLump; i <= LastLump; i++)
|
||||
{
|
||||
|
|
@ -344,7 +344,7 @@ void FileSystem::SkinHack(int filenum, FileSys::FileSystemMessageFunc Printf)
|
|||
|
||||
void FileSystem::SetupNamespace(int filenum, FileSys::FileSystemMessageFunc Printf)
|
||||
{
|
||||
int flags = GetResourceFileFlags(filenum);
|
||||
int flags = GetContainerFlags(filenum);
|
||||
|
||||
// Set namespace for entries from WADs.
|
||||
if ((flags & wadflags) == wadflags)
|
||||
|
|
@ -363,7 +363,7 @@ void FileSystem::SetupNamespace(int filenum, FileSys::FileSystemMessageFunc Prin
|
|||
{
|
||||
int FirstLump = GetFirstEntry(filenum);
|
||||
int LastLump = GetLastEntry(filenum);
|
||||
auto FileName = GetResourceFileName(filenum);
|
||||
auto FileName = GetContainerName(filenum);
|
||||
|
||||
for (int i = FirstLump; i <= LastLump; i++)
|
||||
{
|
||||
|
|
@ -421,15 +421,15 @@ void FileSystem::SetupNamespace(int filenum, FileSys::FileSystemMessageFunc Prin
|
|||
bool FileSystem::InitFiles(std::vector<std::string>& filenames, FileSys::FileSystemFilterInfo* filter, FileSys::FileSystemMessageFunc Printf, bool allowduplicates)
|
||||
{
|
||||
if (!Super::InitFiles(filenames, filter, Printf, allowduplicates)) return false;
|
||||
files.Resize(GetNumEntries());
|
||||
files.Resize(GetFileCount());
|
||||
memset(files.Data(), 0, sizeof(files[0]) * files.size());
|
||||
int numfiles = GetNumEntries();
|
||||
int numfiles = GetFileCount();
|
||||
for (int i = 0; i < numfiles; i++)
|
||||
{
|
||||
SetupName(i);
|
||||
}
|
||||
|
||||
int numresfiles = GetNumWads();
|
||||
int numresfiles = GetContainerCount();
|
||||
for (int i = 0; i < numresfiles; i++)
|
||||
{
|
||||
SetupNamespace(i, Printf);
|
||||
|
|
@ -640,7 +640,7 @@ int FileSystem::CheckNumForAnyName(const char* name, namespace_t namespc) const
|
|||
return CheckNumForName(name, namespc);
|
||||
}
|
||||
|
||||
int lookup = Super::CheckNumForFullName(name, false);
|
||||
int lookup = Super::FindFile(name, false);
|
||||
if (lookup >= 0) return lookup;
|
||||
}
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -30,32 +30,27 @@ public:
|
|||
|
||||
bool Initialize(std::vector<std::string>& filenames, FileSystemFilterInfo* filter = nullptr, FileSystemMessageFunc Printf = nullptr, bool allowduplicates = false);
|
||||
|
||||
// The wadnum for the IWAD
|
||||
int GetIwadNum() { return IwadIndex; }
|
||||
void SetIwadNum(int x) { IwadIndex = x; }
|
||||
// The container for the IWAD
|
||||
int GetBaseNum() { return BaseIndex; }
|
||||
void SetBaseNum(int x) { BaseIndex = x; }
|
||||
|
||||
int GetMaxIwadNum() { return MaxIwadIndex; }
|
||||
void SetMaxIwadNum(int x) { MaxIwadIndex = x; }
|
||||
int GetMaxBaseNum() { return MaxBaseIndex; }
|
||||
void SetMaxBaseNum(int x) { MaxBaseIndex = x; }
|
||||
|
||||
int CheckIfResourceFileLoaded (const char *name) noexcept;
|
||||
int CheckIfContainerLoaded (const char *name) noexcept;
|
||||
void AddAdditionalFile(const char* filename, FileReader* wadinfo = NULL) {}
|
||||
|
||||
const char *GetResourceFileName (int filenum) const noexcept;
|
||||
const char *GetResourceFileFullName (int wadnum) const noexcept;
|
||||
const char *GetContainerName (int container) const noexcept;
|
||||
const char *GetContainerFullName (int container) const noexcept;
|
||||
|
||||
int GetFirstEntry(int wadnum) const noexcept;
|
||||
int GetLastEntry(int wadnum) const noexcept;
|
||||
int GetEntryCount(int wadnum) const noexcept;
|
||||
int GetResourceFileFlags(int wadnum) const noexcept;
|
||||
|
||||
int CheckNumForFullName (const char *cname, bool ignoreext = false) const;
|
||||
int CheckNumForFullNameInFile (const char *name, int wadfile) const;
|
||||
int GetNumForFullName (const char *name) const;
|
||||
int FindFile(const char* name) const
|
||||
{
|
||||
return CheckNumForFullName(name);
|
||||
}
|
||||
int GetFirstEntry(int container) const noexcept;
|
||||
int GetLastEntry(int container) const noexcept;
|
||||
int GetEntryCount(int container) const noexcept;
|
||||
int GetContainerFlags(int container) const noexcept;
|
||||
|
||||
int FindFile (const char *cname, bool ignoreext = false) const;
|
||||
int GetFileInContainer (const char *name, int wadfile) const;
|
||||
int GetFile (const char *name) const;
|
||||
|
||||
bool FileExists(const char* name) const
|
||||
{
|
||||
|
|
@ -70,22 +65,22 @@ public:
|
|||
void RenameFile(int num, const char* fn);
|
||||
bool CreatePathlessCopy(const char* name, int id, int flags);
|
||||
|
||||
void ReadFile (int lump, void *dest);
|
||||
void ReadFile (int filenum, void *dest);
|
||||
// These should only be used if the file data really needs padding.
|
||||
FileData ReadFile (int lump);
|
||||
FileData ReadFileFullName(const char* name) { return ReadFile(GetNumForFullName(name)); }
|
||||
FileData ReadFile (int filenum);
|
||||
FileData ReadFileFullName(const char* name) { return ReadFile(GetFile(name)); }
|
||||
|
||||
FileReader OpenFileReader(int lump, int readertype, int readerflags); // opens a reader that redirects to the containing file's one.
|
||||
FileReader OpenFileReader(int filenum, int readertype, int readerflags); // opens a reader that redirects to the containing file's one.
|
||||
FileReader OpenFileReader(const char* name);
|
||||
FileReader ReopenFileReader(const char* name, bool alwayscache = false);
|
||||
FileReader OpenFileReader(int lump)
|
||||
FileReader OpenFileReader(int filenum)
|
||||
{
|
||||
return OpenFileReader(lump, READER_SHARED, READERFLAG_SEEKABLE);
|
||||
return OpenFileReader(filenum, READER_SHARED, READERFLAG_SEEKABLE);
|
||||
}
|
||||
|
||||
FileReader ReopenFileReader(int lump, bool alwayscache = false)
|
||||
FileReader ReopenFileReader(int filenum, bool alwayscache = false)
|
||||
{
|
||||
return OpenFileReader(lump, alwayscache ? READER_CACHED : READER_NEW, READERFLAG_SEEKABLE);
|
||||
return OpenFileReader(filenum, alwayscache ? READER_CACHED : READER_NEW, READERFLAG_SEEKABLE);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -96,28 +91,28 @@ public:
|
|||
int GetResource(int resid, const char* type, int filenum = -1) const;
|
||||
|
||||
|
||||
ptrdiff_t FileLength(int lump) const;
|
||||
int GetFileFlags (int lump); // Return the flags for this lump
|
||||
const char* GetFileName(int lump) const; // Gets uninterpreted name from the FResourceFile
|
||||
std::string GetFileFullPath (int lump) const; // [RH] Returns wad's name + lump's full name
|
||||
int GetFileContainer (int lump) const;
|
||||
// [RH] Returns wadnum for a specified lump
|
||||
int GetResourceId(int lump) const; // Returns the RFF index number for this lump
|
||||
const char* GetResourceType(int lump) const;
|
||||
ptrdiff_t FileLength(int filenum) const;
|
||||
int GetFileFlags (int filenum); // Return the flags for this filenum
|
||||
const char* GetFileName(int filenum) const; // Gets uninterpreted name from the FResourceFile
|
||||
std::string GetFileFullPath (int filenum) const; // [RH] Returns wad's name + filenum's full name
|
||||
int GetFileContainer (int filenum) const;
|
||||
// [RH] Returns container for a specified filenum
|
||||
int GetResourceId(int filenum) const; // Returns the RFF index number for this filenum
|
||||
const char* GetResourceType(int filenum) const;
|
||||
unsigned GetFilesInFolder(const char *path, std::vector<FolderEntry> &result, bool atomic) const;
|
||||
|
||||
int GetNumEntries() const
|
||||
int GetFileCount() const
|
||||
{
|
||||
return NumEntries;
|
||||
}
|
||||
|
||||
int GetNumWads() const
|
||||
int GetContainerCount() const
|
||||
{
|
||||
return (int)Files.size();
|
||||
}
|
||||
|
||||
int AddFromBuffer(const char* name, char* data, int size, int id, int flags);
|
||||
FileReader* GetFileReader(int wadnum); // Gets a FileReader object to the entire WAD
|
||||
FileReader* GetFileReader(int container); // Gets a FileReader object to the entire WAD
|
||||
|
||||
protected:
|
||||
|
||||
|
|
@ -129,26 +124,26 @@ protected:
|
|||
|
||||
std::vector<uint32_t> Hashes; // one allocation for all hash lists.
|
||||
|
||||
uint32_t *FirstLumpIndex_FullName = nullptr; // The same information for fully qualified paths from .zips
|
||||
uint32_t *NextLumpIndex_FullName = nullptr;
|
||||
uint32_t *FirstFileIndex_FullName = nullptr; // The same information for fully qualified paths from .zips
|
||||
uint32_t *NextFileIndex_FullName = nullptr;
|
||||
|
||||
uint32_t *FirstLumpIndex_NoExt = nullptr; // The same information for fully qualified paths from .zips
|
||||
uint32_t *NextLumpIndex_NoExt = nullptr;
|
||||
uint32_t *FirstFileIndex_NoExt = nullptr; // The same information for fully qualified paths from .zips
|
||||
uint32_t *NextFileIndex_NoExt = nullptr;
|
||||
|
||||
uint32_t* FirstLumpIndex_ResId = nullptr; // The same information for fully qualified paths from .zips
|
||||
uint32_t* NextLumpIndex_ResId = nullptr;
|
||||
uint32_t* FirstFileIndex_ResId = nullptr; // The same information for fully qualified paths from .zips
|
||||
uint32_t* NextFileIndex_ResId = nullptr;
|
||||
|
||||
uint32_t NumEntries = 0; // Not necessarily the same as FileInfo.Size()
|
||||
uint32_t NumWads = 0;
|
||||
|
||||
int IwadIndex = -1;
|
||||
int MaxIwadIndex = -1;
|
||||
int BaseIndex = -1;
|
||||
int MaxBaseIndex = -1;
|
||||
|
||||
StringPool* stringpool = nullptr;
|
||||
|
||||
private:
|
||||
void DeleteAll();
|
||||
void MoveLumpsInFolder(const char *);
|
||||
void MoveFilesInFolder(const char *);
|
||||
void AddFile(const char* filename, FileReader* wadinfo, FileSystemFilterInfo* filter, FileSystemMessageFunc Printf);
|
||||
protected:
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public:
|
|||
const char* GetFileName() const { return FileName; }
|
||||
uint32_t GetFirstEntry() const { return FirstLump; }
|
||||
int GetFlags() const noexcept { return flags; }
|
||||
void SetFirstLump(uint32_t f) { FirstLump = f; }
|
||||
void SetFirstFile(uint32_t f) { FirstLump = f; }
|
||||
const char* GetHash() const { return Hash; }
|
||||
|
||||
int EntryCount() const { return NumLumps; }
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ struct FileSystem::LumpRecord
|
|||
int resourceId;
|
||||
int flags;
|
||||
|
||||
void SetFromLump(FResourceFile* file, int fileindex, int filenum, StringPool* sp, const char* name = nullptr)
|
||||
void SetFromFile(FResourceFile* file, int fileindex, int filenum, StringPool* sp, const char* name = nullptr)
|
||||
{
|
||||
resfile = file;
|
||||
resindex = fileindex;
|
||||
|
|
@ -199,10 +199,10 @@ bool FileSystem::InitFiles(std::vector<std::string>& filenames, FileSystemFilter
|
|||
{
|
||||
AddFile(filenames[i].c_str(), nullptr, filter, Printf);
|
||||
|
||||
if (i == (unsigned)MaxIwadIndex) MoveLumpsInFolder("after_iwad/");
|
||||
if (i == (unsigned)MaxBaseIndex) MoveFilesInFolder("after_iwad/");
|
||||
std::string path = "filter/%s";
|
||||
path += Files.back()->GetHash();
|
||||
MoveLumpsInFolder(path.c_str());
|
||||
MoveFilesInFolder(path.c_str());
|
||||
}
|
||||
|
||||
NumEntries = (uint32_t)FileInfo.size();
|
||||
|
|
@ -237,7 +237,7 @@ int FileSystem::AddFromBuffer(const char* name, char* data, int size, int id, in
|
|||
FileData blob(data, size);
|
||||
fr.OpenMemoryArray(blob);
|
||||
|
||||
// wrap this into a single lump resource file (should be done a little better later.)
|
||||
// wrap this into a single filenum resource file (should be done a little better later.)
|
||||
auto rf = new FResourceFile(name, fr, stringpool, 0);
|
||||
auto Entries = rf->AllocateEntries(1);
|
||||
Entries[0].FileName = rf->NormalizeFileName(ExtractBaseName(name, true).c_str());
|
||||
|
|
@ -246,8 +246,8 @@ int FileSystem::AddFromBuffer(const char* name, char* data, int size, int id, in
|
|||
|
||||
Files.push_back(rf);
|
||||
FileInfo.resize(FileInfo.size() + 1);
|
||||
FileSystem::LumpRecord* lump_p = &FileInfo.back();
|
||||
lump_p->SetFromLump(rf, 0, (int)Files.size() - 1, stringpool);
|
||||
FileSystem::LumpRecord* file_p = &FileInfo.back();
|
||||
file_p->SetFromFile(rf, 0, (int)Files.size() - 1, stringpool);
|
||||
return (int)FileInfo.size() - 1;
|
||||
}
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ int FileSystem::AddFromBuffer(const char* name, char* data, int size, int id, in
|
|||
// AddFile
|
||||
//
|
||||
// Files with a .wad extension are wadlink files with multiple lumps,
|
||||
// other files are single lumps with the base filename for the lump name.
|
||||
// other files are single lumps with the base filename for the filenum name.
|
||||
//
|
||||
// [RH] Removed reload hack
|
||||
//==========================================================================
|
||||
|
|
@ -308,17 +308,17 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, FileSystemFil
|
|||
if (resfile != NULL)
|
||||
{
|
||||
if (Printf)
|
||||
Printf(FSMessageLevel::Message, "adding %s, %d lumps\n", filename, resfile->EntryCount());
|
||||
Printf(FSMessageLevel::Message, "adding %s, %d files\n", filename, resfile->EntryCount());
|
||||
|
||||
uint32_t lumpstart = (uint32_t)FileInfo.size();
|
||||
|
||||
resfile->SetFirstLump(lumpstart);
|
||||
resfile->SetFirstFile(lumpstart);
|
||||
Files.push_back(resfile);
|
||||
for (int i = 0; i < resfile->EntryCount(); i++)
|
||||
{
|
||||
FileInfo.resize(FileInfo.size() + 1);
|
||||
FileSystem::LumpRecord* lump_p = &FileInfo.back();
|
||||
lump_p->SetFromLump(resfile, i, (int)Files.size() - 1, stringpool);
|
||||
FileSystem::LumpRecord* file_p = &FileInfo.back();
|
||||
file_p->SetFromFile(resfile, i, (int)Files.size() - 1, stringpool);
|
||||
}
|
||||
|
||||
for (int i = 0; i < resfile->EntryCount(); i++)
|
||||
|
|
@ -349,7 +349,7 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, FileSystemFil
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int FileSystem::CheckIfResourceFileLoaded (const char *name) noexcept
|
||||
int FileSystem::CheckIfContainerLoaded (const char *name) noexcept
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
|
@ -357,7 +357,7 @@ int FileSystem::CheckIfResourceFileLoaded (const char *name) noexcept
|
|||
{
|
||||
for (i = 0; i < (unsigned)Files.size(); ++i)
|
||||
{
|
||||
if (stricmp (GetResourceFileFullName (i), name) == 0)
|
||||
if (stricmp (GetContainerFullName (i), name) == 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
|
@ -367,7 +367,7 @@ int FileSystem::CheckIfResourceFileLoaded (const char *name) noexcept
|
|||
{
|
||||
for (i = 0; i < (unsigned)Files.size(); ++i)
|
||||
{
|
||||
auto pth = ExtractBaseName(GetResourceFileName(i), true);
|
||||
auto pth = ExtractBaseName(GetContainerName(i), true);
|
||||
if (stricmp (pth.c_str(), name) == 0)
|
||||
{
|
||||
return i;
|
||||
|
|
@ -387,7 +387,7 @@ int FileSystem::CheckIfResourceFileLoaded (const char *name) noexcept
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int FileSystem::CheckNumForFullName (const char *name, bool ignoreext) const
|
||||
int FileSystem::FindFile (const char *name, bool ignoreext) const
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
|
|
@ -396,8 +396,8 @@ int FileSystem::CheckNumForFullName (const char *name, bool ignoreext) const
|
|||
return -1;
|
||||
}
|
||||
if (*name == '/') name++; // ignore leading slashes in file names.
|
||||
uint32_t *fli = ignoreext ? FirstLumpIndex_NoExt : FirstLumpIndex_FullName;
|
||||
uint32_t *nli = ignoreext ? NextLumpIndex_NoExt : NextLumpIndex_FullName;
|
||||
uint32_t *fli = ignoreext ? FirstFileIndex_NoExt : FirstFileIndex_FullName;
|
||||
uint32_t *nli = ignoreext ? NextFileIndex_NoExt : NextFileIndex_FullName;
|
||||
auto len = strlen(name);
|
||||
|
||||
for (i = fli[MakeHash(name) % NumEntries]; i != NULL_INDEX; i = nli[i])
|
||||
|
|
@ -415,21 +415,21 @@ int FileSystem::CheckNumForFullName (const char *name, bool ignoreext) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
int FileSystem::CheckNumForFullNameInFile (const char *name, int rfnum) const
|
||||
int FileSystem::GetFileInContainer (const char *name, int rfnum) const
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
if (rfnum < 0)
|
||||
{
|
||||
return CheckNumForFullName (name);
|
||||
return FindFile (name);
|
||||
}
|
||||
|
||||
i = FirstLumpIndex_FullName[MakeHash (name) % NumEntries];
|
||||
i = FirstFileIndex_FullName[MakeHash (name) % NumEntries];
|
||||
|
||||
while (i != NULL_INDEX &&
|
||||
(stricmp(name, FileInfo[i].Name) || FileInfo[i].rfnum != rfnum))
|
||||
{
|
||||
i = NextLumpIndex_FullName[i];
|
||||
i = NextFileIndex_FullName[i];
|
||||
}
|
||||
|
||||
return i != NULL_INDEX ? i : -1;
|
||||
|
|
@ -443,11 +443,11 @@ int FileSystem::CheckNumForFullNameInFile (const char *name, int rfnum) const
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int FileSystem::GetNumForFullName (const char *name) const
|
||||
int FileSystem::GetFile (const char *name) const
|
||||
{
|
||||
int i;
|
||||
|
||||
i = CheckNumForFullName (name);
|
||||
i = FindFile (name);
|
||||
|
||||
if (i == -1)
|
||||
throw FileSystemException("GetNumForFullName: %s not found!", name);
|
||||
|
|
@ -472,8 +472,8 @@ int FileSystem::FindFileWithExtensions(const char* name, const char *const *exts
|
|||
return -1;
|
||||
}
|
||||
if (*name == '/') name++; // ignore leading slashes in file names.
|
||||
uint32_t* fli = FirstLumpIndex_NoExt;
|
||||
uint32_t* nli = NextLumpIndex_NoExt;
|
||||
uint32_t* fli = FirstFileIndex_NoExt;
|
||||
uint32_t* nli = NextFileIndex_NoExt;
|
||||
auto len = strlen(name);
|
||||
|
||||
for (i = fli[MakeHash(name) % NumEntries]; i != NULL_INDEX; i = nli[i])
|
||||
|
|
@ -510,8 +510,8 @@ int FileSystem::FindResource (int resid, const char *type, int filenum) const no
|
|||
return -1;
|
||||
}
|
||||
|
||||
uint32_t* fli = FirstLumpIndex_ResId;
|
||||
uint32_t* nli = NextLumpIndex_ResId;
|
||||
uint32_t* fli = FirstFileIndex_ResId;
|
||||
uint32_t* nli = NextFileIndex_ResId;
|
||||
|
||||
for (i = fli[resid % NumEntries]; i != NULL_INDEX; i = nli[i])
|
||||
{
|
||||
|
|
@ -549,18 +549,18 @@ int FileSystem::GetResource (int resid, const char *type, int filenum) const
|
|||
//
|
||||
// FileLength
|
||||
//
|
||||
// Returns the buffer size needed to load the given lump.
|
||||
// Returns the buffer size needed to load the given filenum.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
ptrdiff_t FileSystem::FileLength (int lump) const
|
||||
ptrdiff_t FileSystem::FileLength (int filenum) const
|
||||
{
|
||||
if ((size_t)lump >= NumEntries)
|
||||
if ((size_t)filenum >= NumEntries)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
const auto &lump_p = FileInfo[lump];
|
||||
return (int)lump_p.resfile->Length(lump_p.resindex);
|
||||
const auto &file_p = FileInfo[filenum];
|
||||
return (int)file_p.resfile->Length(file_p.resindex);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -569,15 +569,15 @@ ptrdiff_t FileSystem::FileLength (int lump) const
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int FileSystem::GetFileFlags (int lump)
|
||||
int FileSystem::GetFileFlags (int filenum)
|
||||
{
|
||||
if ((size_t)lump >= NumEntries)
|
||||
if ((size_t)filenum >= NumEntries)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const auto& lump_p = FileInfo[lump];
|
||||
return lump_p.resfile->GetEntryFlags(lump_p.resindex) ^ lump_p.flags;
|
||||
const auto& file_p = FileInfo[filenum];
|
||||
return file_p.resfile->GetEntryFlags(file_p.resindex) ^ file_p.flags;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -597,12 +597,12 @@ void FileSystem::InitHashChains (void)
|
|||
Hashes.resize(6 * NumEntries);
|
||||
// Mark all buckets as empty
|
||||
memset(Hashes.data(), -1, Hashes.size() * sizeof(Hashes[0]));
|
||||
FirstLumpIndex_FullName = &Hashes[NumEntries * 0];
|
||||
NextLumpIndex_FullName = &Hashes[NumEntries * 1];
|
||||
FirstLumpIndex_NoExt = &Hashes[NumEntries * 2];
|
||||
NextLumpIndex_NoExt = &Hashes[NumEntries * 3];
|
||||
FirstLumpIndex_ResId = &Hashes[NumEntries * 4];
|
||||
NextLumpIndex_ResId = &Hashes[NumEntries * 5];
|
||||
FirstFileIndex_FullName = &Hashes[NumEntries * 0];
|
||||
NextFileIndex_FullName = &Hashes[NumEntries * 1];
|
||||
FirstFileIndex_NoExt = &Hashes[NumEntries * 2];
|
||||
NextFileIndex_NoExt = &Hashes[NumEntries * 3];
|
||||
FirstFileIndex_ResId = &Hashes[NumEntries * 4];
|
||||
NextFileIndex_ResId = &Hashes[NumEntries * 5];
|
||||
|
||||
|
||||
// Now set up the chains
|
||||
|
|
@ -612,8 +612,8 @@ void FileSystem::InitHashChains (void)
|
|||
if (FileInfo[i].Name[0] != 0)
|
||||
{
|
||||
j = MakeHash(FileInfo[i].Name) % NumEntries;
|
||||
NextLumpIndex_FullName[i] = FirstLumpIndex_FullName[j];
|
||||
FirstLumpIndex_FullName[j] = i;
|
||||
NextFileIndex_FullName[i] = FirstFileIndex_FullName[j];
|
||||
FirstFileIndex_FullName[j] = i;
|
||||
|
||||
std::string nameNoExt = FileInfo[i].Name;
|
||||
auto dot = nameNoExt.find_last_of('.');
|
||||
|
|
@ -621,12 +621,12 @@ void FileSystem::InitHashChains (void)
|
|||
if ((dot > slash || slash == std::string::npos) && dot != std::string::npos) nameNoExt.resize(dot);
|
||||
|
||||
j = MakeHash(nameNoExt.c_str()) % NumEntries;
|
||||
NextLumpIndex_NoExt[i] = FirstLumpIndex_NoExt[j];
|
||||
FirstLumpIndex_NoExt[j] = i;
|
||||
NextFileIndex_NoExt[i] = FirstFileIndex_NoExt[j];
|
||||
FirstFileIndex_NoExt[j] = i;
|
||||
|
||||
j = FileInfo[i].resourceId % NumEntries;
|
||||
NextLumpIndex_ResId[i] = FirstLumpIndex_ResId[j];
|
||||
FirstLumpIndex_ResId[j] = i;
|
||||
NextFileIndex_ResId[i] = FirstFileIndex_ResId[j];
|
||||
FirstFileIndex_ResId[j] = i;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -653,7 +653,7 @@ void FileSystem::RenameFile(int num, const char* newfn)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FileSystem::MoveLumpsInFolder(const char *path)
|
||||
void FileSystem::MoveFilesInFolder(const char *path)
|
||||
{
|
||||
if (FileInfo.size() == 0)
|
||||
{
|
||||
|
|
@ -667,14 +667,14 @@ void FileSystem::MoveLumpsInFolder(const char *path)
|
|||
for (i = 0; i < FileInfo.size(); i++)
|
||||
{
|
||||
auto& li = FileInfo[i];
|
||||
if (li.rfnum >= GetIwadNum()) break;
|
||||
if (li.rfnum >= GetBaseNum()) break;
|
||||
if (strnicmp(li.Name, path, len) == 0)
|
||||
{
|
||||
auto lic = li; // make a copy before pushing.
|
||||
FileInfo.push_back(lic);
|
||||
li.Name = ""; //nuke the name of the old record.
|
||||
auto &ln = FileInfo.back();
|
||||
ln.SetFromLump(li.resfile, li.resindex, rfnum, stringpool, ln.Name + len);
|
||||
ln.SetFromFile(li.resfile, li.resindex, rfnum, stringpool, ln.Name + len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -683,7 +683,7 @@ void FileSystem::MoveLumpsInFolder(const char *path)
|
|||
//
|
||||
// W_FindLump
|
||||
//
|
||||
// Find a named lump. Specifically allows duplicates for merging of e.g.
|
||||
// Find a named filenum. Specifically allows duplicates for merging of e.g.
|
||||
// SNDINFO lumps.
|
||||
//
|
||||
//==========================================================================
|
||||
|
|
@ -694,38 +694,38 @@ int FileSystem::FindLumpFullName(const char* name, int* lastlump, bool noext)
|
|||
|
||||
const LumpRecord * last = FileInfo.data() + FileInfo.size();
|
||||
|
||||
LumpRecord * lump_p = FileInfo.data() + *lastlump;
|
||||
LumpRecord * file_p = FileInfo.data() + *lastlump;
|
||||
|
||||
if (!noext)
|
||||
{
|
||||
while (lump_p < last)
|
||||
while (file_p < last)
|
||||
{
|
||||
if (!stricmp(name, lump_p->Name))
|
||||
if (!stricmp(name, file_p->Name))
|
||||
{
|
||||
int lump = int(lump_p - FileInfo.data());
|
||||
*lastlump = lump + 1;
|
||||
return lump;
|
||||
int filenum = int(file_p - FileInfo.data());
|
||||
*lastlump = filenum + 1;
|
||||
return filenum;
|
||||
}
|
||||
lump_p++;
|
||||
file_p++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto len = strlen(name);
|
||||
while (lump_p <= &FileInfo.back())
|
||||
while (file_p <= &FileInfo.back())
|
||||
{
|
||||
auto res = strnicmp(name, lump_p->Name, len);
|
||||
auto res = strnicmp(name, file_p->Name, len);
|
||||
if (res == 0)
|
||||
{
|
||||
auto p = lump_p->Name + len;
|
||||
auto p = file_p->Name + len;
|
||||
if (*p == 0 || (*p == '.' && strpbrk(p + 1, "./") == 0))
|
||||
{
|
||||
int lump = int(lump_p - FileInfo.data());
|
||||
*lastlump = lump + 1;
|
||||
return lump;
|
||||
int filenum = int(file_p - FileInfo.data());
|
||||
*lastlump = filenum + 1;
|
||||
return filenum;
|
||||
}
|
||||
}
|
||||
lump_p++;
|
||||
file_p++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -738,34 +738,34 @@ int FileSystem::FindLumpFullName(const char* name, int* lastlump, bool noext)
|
|||
//
|
||||
// FileSystem :: GetFileName
|
||||
//
|
||||
// Returns the lump's internal name
|
||||
// Returns the filenum's internal name
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
const char* FileSystem::GetFileName(int lump) const
|
||||
const char* FileSystem::GetFileName(int filenum) const
|
||||
{
|
||||
if ((size_t)lump >= NumEntries)
|
||||
if ((size_t)filenum >= NumEntries)
|
||||
return NULL;
|
||||
else return FileInfo[lump].Name;
|
||||
else return FileInfo[filenum].Name;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FileSystem :: GetFileFullPath
|
||||
//
|
||||
// Returns the name of the lump's wad prefixed to the lump's full name.
|
||||
// Returns the name of the filenum's wad prefixed to the filenum's full name.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
std::string FileSystem::GetFileFullPath(int lump) const
|
||||
std::string FileSystem::GetFileFullPath(int filenum) const
|
||||
{
|
||||
std::string foo;
|
||||
|
||||
if ((size_t) lump < NumEntries)
|
||||
if ((size_t) filenum < NumEntries)
|
||||
{
|
||||
foo = GetResourceFileName(FileInfo[lump].rfnum);
|
||||
foo = GetContainerName(FileInfo[filenum].rfnum);
|
||||
foo += ':';
|
||||
foo += +GetFileName(lump);
|
||||
foo += +GetFileName(filenum);
|
||||
}
|
||||
return foo;
|
||||
}
|
||||
|
|
@ -774,18 +774,18 @@ std::string FileSystem::GetFileFullPath(int lump) const
|
|||
//
|
||||
// FileSystem :: GetResourceId
|
||||
//
|
||||
// Returns the index number for this lump. This is *not* the lump's position
|
||||
// in the lump directory, but rather a special value that RFF can associate
|
||||
// Returns the index number for this filenum. This is *not* the filenum's position
|
||||
// in the filenum directory, but rather a special value that RFF can associate
|
||||
// with files. Other archive types will return 0, since they don't have it.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
int FileSystem::GetResourceId(int lump) const
|
||||
int FileSystem::GetResourceId(int filenum) const
|
||||
{
|
||||
if ((size_t)lump >= NumEntries)
|
||||
if ((size_t)filenum >= NumEntries)
|
||||
return -1;
|
||||
else
|
||||
return FileInfo[lump].resourceId;
|
||||
return FileInfo[filenum].resourceId;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -796,13 +796,13 @@ int FileSystem::GetResourceId(int lump) const
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
const char *FileSystem::GetResourceType(int lump) const
|
||||
const char *FileSystem::GetResourceType(int filenum) const
|
||||
{
|
||||
if ((size_t)lump >= NumEntries)
|
||||
if ((size_t)filenum >= NumEntries)
|
||||
return nullptr;
|
||||
else
|
||||
{
|
||||
auto p = strrchr(FileInfo[lump].Name, '.');
|
||||
auto p = strrchr(FileInfo[filenum].Name, '.');
|
||||
if (!p) return ""; // has no extension
|
||||
if (strchr(p, '/')) return ""; // the '.' is part of a directory.
|
||||
return p + 1;
|
||||
|
|
@ -815,11 +815,11 @@ const char *FileSystem::GetResourceType(int lump) const
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int FileSystem::GetFileContainer (int lump) const
|
||||
int FileSystem::GetFileContainer (int filenum) const
|
||||
{
|
||||
if ((size_t)lump >= FileInfo.size())
|
||||
if ((size_t)filenum >= FileInfo.size())
|
||||
return -1;
|
||||
return FileInfo[lump].rfnum;
|
||||
return FileInfo[filenum].rfnum;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -857,7 +857,7 @@ unsigned FileSystem::GetFilesInFolder(const char *inpath, std::vector<FolderEntr
|
|||
if (strncmp(FileInfo[i].Name, path.c_str(), path.length()) == 0)
|
||||
{
|
||||
// Only if it hasn't been replaced.
|
||||
if ((unsigned)CheckNumForFullName(FileInfo[i].Name) == i)
|
||||
if ((unsigned)FindFile(FileInfo[i].Name) == i)
|
||||
{
|
||||
FolderEntry fe{ FileInfo[i].Name, (uint32_t)i };
|
||||
result.push_back(fe);
|
||||
|
|
@ -890,20 +890,20 @@ unsigned FileSystem::GetFilesInFolder(const char *inpath, std::vector<FolderEntr
|
|||
//
|
||||
// W_ReadFile
|
||||
//
|
||||
// Loads the lump into the given buffer, which must be >= W_LumpLength().
|
||||
// Loads the filenum into the given buffer, which must be >= W_LumpLength().
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FileSystem::ReadFile (int lump, void *dest)
|
||||
void FileSystem::ReadFile (int filenum, void *dest)
|
||||
{
|
||||
auto lumpr = OpenFileReader (lump);
|
||||
auto lumpr = OpenFileReader (filenum);
|
||||
auto size = lumpr.GetLength ();
|
||||
auto numread = lumpr.Read (dest, size);
|
||||
|
||||
if (numread != size)
|
||||
{
|
||||
throw FileSystemException("W_ReadFile: only read %td of %td on '%s'\n",
|
||||
numread, size, FileInfo[lump].Name);
|
||||
numread, size, FileInfo[filenum].Name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -912,17 +912,17 @@ void FileSystem::ReadFile (int lump, void *dest)
|
|||
//
|
||||
// ReadFile - variant 2
|
||||
//
|
||||
// Loads the lump into a newly created buffer and returns it.
|
||||
// Loads the filenum into a newly created buffer and returns it.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FileData FileSystem::ReadFile (int lump)
|
||||
FileData FileSystem::ReadFile (int filenum)
|
||||
{
|
||||
if ((unsigned)lump >= (unsigned)FileInfo.size())
|
||||
if ((unsigned)filenum >= (unsigned)FileInfo.size())
|
||||
{
|
||||
throw FileSystemException("ReadFile: %u >= NumEntries", lump);
|
||||
throw FileSystemException("ReadFile: %u >= NumEntries", filenum);
|
||||
}
|
||||
return FileInfo[lump].resfile->Read(FileInfo[lump].resindex);
|
||||
return FileInfo[filenum].resfile->Read(FileInfo[filenum].resindex);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -934,30 +934,30 @@ FileData FileSystem::ReadFile (int lump)
|
|||
//==========================================================================
|
||||
|
||||
|
||||
FileReader FileSystem::OpenFileReader(int lump, int readertype, int readerflags)
|
||||
FileReader FileSystem::OpenFileReader(int filenum, int readertype, int readerflags)
|
||||
{
|
||||
if ((unsigned)lump >= (unsigned)FileInfo.size())
|
||||
if ((unsigned)filenum >= (unsigned)FileInfo.size())
|
||||
{
|
||||
throw FileSystemException("OpenFileReader: %u >= NumEntries", lump);
|
||||
throw FileSystemException("OpenFileReader: %u >= NumEntries", filenum);
|
||||
}
|
||||
|
||||
auto file = FileInfo[lump].resfile;
|
||||
return file->GetEntryReader(FileInfo[lump].resindex, readertype, readerflags);
|
||||
auto file = FileInfo[filenum].resfile;
|
||||
return file->GetEntryReader(FileInfo[filenum].resindex, readertype, readerflags);
|
||||
}
|
||||
|
||||
FileReader FileSystem::OpenFileReader(const char* name)
|
||||
{
|
||||
FileReader fr;
|
||||
auto lump = CheckNumForFullName(name);
|
||||
if (lump >= 0) fr = OpenFileReader(lump);
|
||||
auto filenum = FindFile(name);
|
||||
if (filenum >= 0) fr = OpenFileReader(filenum);
|
||||
return fr;
|
||||
}
|
||||
|
||||
FileReader FileSystem::ReopenFileReader(const char* name, bool alwayscache)
|
||||
{
|
||||
FileReader fr;
|
||||
auto lump = CheckNumForFullName(name);
|
||||
if (lump >= 0) fr = ReopenFileReader(lump, alwayscache);
|
||||
auto filenum = FindFile(name);
|
||||
if (filenum >= 0) fr = ReopenFileReader(filenum, alwayscache);
|
||||
return fr;
|
||||
}
|
||||
|
||||
|
|
@ -982,13 +982,13 @@ FileReader *FileSystem::GetFileReader(int rfnum)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetResourceFileName
|
||||
// GetContainerName
|
||||
//
|
||||
// Returns the name of the given wad.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
const char *FileSystem::GetResourceFileName (int rfnum) const noexcept
|
||||
const char *FileSystem::GetContainerName (int rfnum) const noexcept
|
||||
{
|
||||
const char *name, *slash;
|
||||
|
||||
|
|
@ -1022,7 +1022,7 @@ int FileSystem::GetFirstEntry (int rfnum) const noexcept
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int FileSystem::GetResourceFileFlags(int rfnum) const noexcept
|
||||
int FileSystem::GetContainerFlags(int rfnum) const noexcept
|
||||
{
|
||||
if ((uint32_t)rfnum >= Files.size())
|
||||
{
|
||||
|
|
@ -1071,7 +1071,7 @@ int FileSystem::GetEntryCount (int rfnum) const noexcept
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
const char *FileSystem::GetResourceFileFullName (int rfnum) const noexcept
|
||||
const char *FileSystem::GetContainerFullName (int rfnum) const noexcept
|
||||
{
|
||||
if ((unsigned int)rfnum >= Files.size())
|
||||
{
|
||||
|
|
@ -1094,15 +1094,15 @@ bool FileSystem::CreatePathlessCopy(const char *name, int id, int /*flags*/)
|
|||
|
||||
// The old code said 'filename' and ignored the path, this looked like a bug.
|
||||
FixPathSeparator(&name2.front());
|
||||
auto lump = FindFile(name2.c_str());
|
||||
if (lump < 0) return false; // Does not exist.
|
||||
auto filenum = FindFile(name2.c_str());
|
||||
if (filenum < 0) return false; // Does not exist.
|
||||
|
||||
auto oldlump = FileInfo[lump];
|
||||
auto oldlump = FileInfo[filenum];
|
||||
auto slash = strrchr(oldlump.Name, '/');
|
||||
|
||||
if (slash == nullptr)
|
||||
{
|
||||
FileInfo[lump].flags = RESFF_FULLPATH;
|
||||
FileInfo[filenum].flags = RESFF_FULLPATH;
|
||||
return true; // already is pathless.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ void V_InitCustomFonts()
|
|||
{
|
||||
*p = TexMan.GetGameTexture(texid);
|
||||
}
|
||||
else if (fileSystem.GetFileContainer(sc.LumpNum) >= fileSystem.GetIwadNum())
|
||||
else if (fileSystem.GetFileContainer(sc.LumpNum) >= fileSystem.GetBaseNum())
|
||||
{
|
||||
// Print a message only if this isn't in zdoom.pk3
|
||||
sc.ScriptMessage("%s: Unable to find texture in font definition for %s", sc.String, namebuffer.GetChars());
|
||||
|
|
@ -871,7 +871,7 @@ void V_InitFonts()
|
|||
FFont *CreateHexLumpFont(const char *fontname, int lump);
|
||||
FFont *CreateHexLumpFont2(const char *fontname, int lump);
|
||||
|
||||
auto lump = fileSystem.CheckNumForFullNameInFile("newconsolefont.hex", 0); // This is always loaded from gzdoom.pk3 to prevent overriding it with incomplete replacements.
|
||||
auto lump = fileSystem.GetFileInContainer("newconsolefont.hex", 0); // This is always loaded from gzdoom.pk3 to prevent overriding it with incomplete replacements.
|
||||
if (lump == -1) I_FatalError("newconsolefont.hex not found"); // This font is needed - do not start up without it.
|
||||
NewConsoleFont = CreateHexLumpFont("NewConsoleFont", lump);
|
||||
NewSmallFont = CreateHexLumpFont2("NewSmallFont", lump);
|
||||
|
|
|
|||
|
|
@ -1524,7 +1524,7 @@ void M_ParseMenuDefs()
|
|||
DefaultOptionMenuSettings->Reset();
|
||||
OptionSettings.mLinespacing = 17;
|
||||
|
||||
int IWADMenu = fileSystem.CheckNumForName("MENUDEF", ns_global, fileSystem.GetIwadNum());
|
||||
int IWADMenu = fileSystem.CheckNumForName("MENUDEF", ns_global, fileSystem.GetBaseNum());
|
||||
|
||||
while ((lump = fileSystem.FindLump ("MENUDEF", &lastlump)) != -1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ void FModel::DestroyVertexBuffer()
|
|||
|
||||
static int FindGFXFile(FString & fn)
|
||||
{
|
||||
int lump = fileSystem.CheckNumForFullName(fn.GetChars()); // if we find something that matches the name plus the extension, return it and do not enter the substitution logic below.
|
||||
int lump = fileSystem.FindFile(fn.GetChars()); // if we find something that matches the name plus the extension, return it and do not enter the substitution logic below.
|
||||
if (lump != -1) return lump;
|
||||
|
||||
int best = -1;
|
||||
|
|
@ -100,7 +100,7 @@ static int FindGFXFile(FString & fn)
|
|||
|
||||
for (const char ** extp=extensions; *extp; extp++)
|
||||
{
|
||||
lump = fileSystem.CheckNumForFullName((fn + *extp).GetChars());
|
||||
lump = fileSystem.FindFile((fn + *extp).GetChars());
|
||||
if (lump >= best) best = lump;
|
||||
}
|
||||
return best;
|
||||
|
|
@ -148,7 +148,7 @@ unsigned FindModel(const char * path, const char * modelfile, bool silent)
|
|||
|
||||
if (path) fullname.Format("%s%s", path, modelfile);
|
||||
else fullname = modelfile;
|
||||
int lump = fileSystem.CheckNumForFullName(fullname.GetChars());
|
||||
int lump = fileSystem.FindFile(fullname.GetChars());
|
||||
|
||||
if (lump<0)
|
||||
{
|
||||
|
|
@ -175,7 +175,7 @@ unsigned FindModel(const char * path, const char * modelfile, bool silent)
|
|||
{
|
||||
FString anivfile = fullname.GetChars();
|
||||
anivfile.Substitute("_d.3d","_a.3d");
|
||||
if ( fileSystem.CheckNumForFullName(anivfile.GetChars()) > 0 )
|
||||
if ( fileSystem.FindFile(anivfile.GetChars()) > 0 )
|
||||
{
|
||||
model = new FUE1Model;
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ unsigned FindModel(const char * path, const char * modelfile, bool silent)
|
|||
{
|
||||
FString datafile = fullname.GetChars();
|
||||
datafile.Substitute("_a.3d","_d.3d");
|
||||
if ( fileSystem.CheckNumForFullName(datafile.GetChars()) > 0 )
|
||||
if ( fileSystem.FindFile(datafile.GetChars()) > 0 )
|
||||
{
|
||||
model = new FUE1Model;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,14 +53,14 @@ bool FUE1Model::Load( const char *filename, int lumpnum, const char *buffer, int
|
|||
if ( (size_t)realfilename.IndexOf("_d.3d") == realfilename.Len()-5 )
|
||||
{
|
||||
realfilename.Substitute("_d.3d","_a.3d");
|
||||
lumpnum2 = fileSystem.CheckNumForFullName(realfilename.GetChars());
|
||||
lumpnum2 = fileSystem.FindFile(realfilename.GetChars());
|
||||
mDataLump = lumpnum;
|
||||
mAnivLump = lumpnum2;
|
||||
}
|
||||
else
|
||||
{
|
||||
realfilename.Substitute("_a.3d","_d.3d");
|
||||
lumpnum2 = fileSystem.CheckNumForFullName(realfilename.GetChars());
|
||||
lumpnum2 = fileSystem.FindFile(realfilename.GetChars());
|
||||
mAnivLump = lumpnum;
|
||||
mDataLump = lumpnum2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -373,10 +373,10 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
i_data += "#define NPOT_EMULATION\nuniform vec2 uNpotEmulation;\n";
|
||||
#endif
|
||||
|
||||
int vp_lump = fileSystem.CheckNumForFullNameInFile(vert_prog_lump, 0);
|
||||
int vp_lump = fileSystem.GetFileInContainer(vert_prog_lump, 0);
|
||||
if (vp_lump == -1) I_Error("Unable to load '%s'", vert_prog_lump);
|
||||
|
||||
int fp_lump = fileSystem.CheckNumForFullNameInFile(frag_prog_lump, 0);
|
||||
int fp_lump = fileSystem.GetFileInContainer(frag_prog_lump, 0);
|
||||
if (fp_lump == -1) I_Error("Unable to load '%s'", frag_prog_lump);
|
||||
|
||||
|
||||
|
|
@ -418,8 +418,8 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
|
||||
if (*proc_prog_lump != '#')
|
||||
{
|
||||
int pp_lump = fileSystem.CheckNumForFullNameInFile(proc_prog_lump, 0); // if it's a core shader, ignore overrides by user mods.
|
||||
if (pp_lump == -1) pp_lump = fileSystem.CheckNumForFullName(proc_prog_lump);
|
||||
int pp_lump = fileSystem.GetFileInContainer(proc_prog_lump, 0); // if it's a core shader, ignore overrides by user mods.
|
||||
if (pp_lump == -1) pp_lump = fileSystem.FindFile(proc_prog_lump);
|
||||
if (pp_lump == -1) I_Error("Unable to load '%s'", proc_prog_lump);
|
||||
FString pp_data = GetStringFromLump(pp_lump);
|
||||
|
||||
|
|
@ -429,13 +429,13 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
|
||||
if (pp_data.IndexOf("GetTexCoord") >= 0)
|
||||
{
|
||||
int pl_lump = fileSystem.CheckNumForFullNameInFile("shaders/glsl/func_defaultmat2.fp", 0);
|
||||
int pl_lump = fileSystem.GetFileInContainer("shaders/glsl/func_defaultmat2.fp", 0);
|
||||
if (pl_lump == -1) I_Error("Unable to load '%s'", "shaders/glsl/func_defaultmat2.fp");
|
||||
fp_comb << "\n" << GetStringFromLump(pl_lump);
|
||||
}
|
||||
else
|
||||
{
|
||||
int pl_lump = fileSystem.CheckNumForFullNameInFile("shaders/glsl/func_defaultmat.fp", 0);
|
||||
int pl_lump = fileSystem.GetFileInContainer("shaders/glsl/func_defaultmat.fp", 0);
|
||||
if (pl_lump == -1) I_Error("Unable to load '%s'", "shaders/glsl/func_defaultmat.fp");
|
||||
fp_comb << "\n" << GetStringFromLump(pl_lump);
|
||||
|
||||
|
|
@ -461,7 +461,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
|
||||
if (pp_data.IndexOf("ProcessLight") < 0)
|
||||
{
|
||||
int pl_lump = fileSystem.CheckNumForFullNameInFile("shaders/glsl/func_defaultlight.fp", 0);
|
||||
int pl_lump = fileSystem.GetFileInContainer("shaders/glsl/func_defaultlight.fp", 0);
|
||||
if (pl_lump == -1) I_Error("Unable to load '%s'", "shaders/glsl/func_defaultlight.fp");
|
||||
fp_comb << "\n" << GetStringFromLump(pl_lump);
|
||||
}
|
||||
|
|
@ -483,7 +483,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
|
||||
if (light_fragprog)
|
||||
{
|
||||
int pp_lump = fileSystem.CheckNumForFullNameInFile(light_fragprog, 0);
|
||||
int pp_lump = fileSystem.GetFileInContainer(light_fragprog, 0);
|
||||
if (pp_lump == -1) I_Error("Unable to load '%s'", light_fragprog);
|
||||
fp_comb << GetStringFromLump(pp_lump) << "\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ void FShaderProgram::CreateShader(ShaderType type)
|
|||
|
||||
void FShaderProgram::Compile(ShaderType type, const char *lumpName, const char *defines, int maxGlslVersion)
|
||||
{
|
||||
int lump = fileSystem.CheckNumForFullName(lumpName);
|
||||
int lump = fileSystem.FindFile(lumpName);
|
||||
if (lump == -1) I_FatalError("Unable to load '%s'", lumpName);
|
||||
FString code = GetStringFromLump(lump);
|
||||
|
||||
|
|
|
|||
|
|
@ -381,10 +381,10 @@ bool FShader::Load(const char * name, const char * vert_prog_lump_, const char *
|
|||
i_data += "#define NPOT_EMULATION\nuniform vec2 uNpotEmulation;\n";
|
||||
#endif
|
||||
|
||||
int vp_lump = fileSystem.CheckNumForFullNameInFile(vert_prog_lump.GetChars(), 0);
|
||||
int vp_lump = fileSystem.GetFileInContainer(vert_prog_lump.GetChars(), 0);
|
||||
if (vp_lump == -1) I_Error("Unable to load '%s'", vert_prog_lump.GetChars());
|
||||
|
||||
int fp_lump = fileSystem.CheckNumForFullNameInFile(frag_prog_lump.GetChars(), 0);
|
||||
int fp_lump = fileSystem.GetFileInContainer(frag_prog_lump.GetChars(), 0);
|
||||
if (fp_lump == -1) I_Error("Unable to load '%s'", frag_prog_lump.GetChars());
|
||||
|
||||
|
||||
|
|
@ -418,7 +418,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump_, const char *
|
|||
|
||||
if (proc_prog_lump[0] != '#')
|
||||
{
|
||||
int pp_lump = fileSystem.CheckNumForFullName(proc_prog_lump.GetChars());
|
||||
int pp_lump = fileSystem.FindFile(proc_prog_lump.GetChars());
|
||||
if (pp_lump == -1) I_Error("Unable to load '%s'", proc_prog_lump.GetChars());
|
||||
FString pp_data = GetStringFromLump(pp_lump);
|
||||
|
||||
|
|
@ -428,13 +428,13 @@ bool FShader::Load(const char * name, const char * vert_prog_lump_, const char *
|
|||
|
||||
if (pp_data.IndexOf("GetTexCoord") >= 0)
|
||||
{
|
||||
int pl_lump = fileSystem.CheckNumForFullNameInFile("shaders_gles/glsl/func_defaultmat2.fp", 0);
|
||||
int pl_lump = fileSystem.GetFileInContainer("shaders_gles/glsl/func_defaultmat2.fp", 0);
|
||||
if (pl_lump == -1) I_Error("Unable to load '%s'", "shaders_gles/glsl/func_defaultmat2.fp");
|
||||
fp_comb << "\n" << GetStringFromLump(pl_lump);
|
||||
}
|
||||
else
|
||||
{
|
||||
int pl_lump = fileSystem.CheckNumForFullNameInFile("shaders_gles/glsl/func_defaultmat.fp", 0);
|
||||
int pl_lump = fileSystem.GetFileInContainer("shaders_gles/glsl/func_defaultmat.fp", 0);
|
||||
if (pl_lump == -1) I_Error("Unable to load '%s'", "shaders_gles/glsl/func_defaultmat.fp");
|
||||
fp_comb << "\n" << GetStringFromLump(pl_lump);
|
||||
|
||||
|
|
@ -460,7 +460,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump_, const char *
|
|||
|
||||
if (pp_data.IndexOf("ProcessLight") < 0)
|
||||
{
|
||||
int pl_lump = fileSystem.CheckNumForFullNameInFile("shaders_gles/glsl/func_defaultlight.fp", 0);
|
||||
int pl_lump = fileSystem.GetFileInContainer("shaders_gles/glsl/func_defaultlight.fp", 0);
|
||||
if (pl_lump == -1) I_Error("Unable to load '%s'", "shaders_gles/glsl/func_defaultlight.fp");
|
||||
fp_comb << "\n" << GetStringFromLump(pl_lump);
|
||||
}
|
||||
|
|
@ -482,7 +482,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump_, const char *
|
|||
|
||||
if (light_fragprog.Len())
|
||||
{
|
||||
int pp_lump = fileSystem.CheckNumForFullNameInFile(light_fragprog.GetChars(), 0);
|
||||
int pp_lump = fileSystem.GetFileInContainer(light_fragprog.GetChars(), 0);
|
||||
if (pp_lump == -1) I_Error("Unable to load '%s'", light_fragprog.GetChars());
|
||||
fp_comb << GetStringFromLump(pp_lump) << "\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ void FShaderProgram::CreateShader(ShaderType type)
|
|||
|
||||
void FShaderProgram::Compile(ShaderType type, const char *lumpName, const char *defines, int maxGlslVersion)
|
||||
{
|
||||
int lump = fileSystem.CheckNumForFullName(lumpName);
|
||||
int lump = fileSystem.FindFile(lumpName);
|
||||
if (lump == -1) I_FatalError("Unable to load '%s'", lumpName);
|
||||
FString code = GetStringFromLump(lump);
|
||||
Compile(type, lumpName, code, defines, maxGlslVersion);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ void VkPPShader::Reset()
|
|||
|
||||
FString VkPPShader::LoadShaderCode(const FString &lumpName, const FString &defines, int version)
|
||||
{
|
||||
int lump = fileSystem.CheckNumForFullName(lumpName.GetChars());
|
||||
int lump = fileSystem.FindFile(lumpName.GetChars());
|
||||
if (lump == -1) I_FatalError("Unable to load '%s'", lumpName.GetChars());
|
||||
FString code = GetStringFromLump(lump);
|
||||
|
||||
|
|
|
|||
|
|
@ -465,15 +465,15 @@ FString VkShaderManager::GetTargetGlslVersion()
|
|||
|
||||
FString VkShaderManager::LoadPublicShaderLump(const char *lumpname)
|
||||
{
|
||||
int lump = fileSystem.CheckNumForFullNameInFile(lumpname, 0);
|
||||
if (lump == -1) lump = fileSystem.CheckNumForFullName(lumpname);
|
||||
int lump = fileSystem.GetFileInContainer(lumpname, 0);
|
||||
if (lump == -1) lump = fileSystem.FindFile(lumpname);
|
||||
if (lump == -1) I_Error("Unable to load '%s'", lumpname);
|
||||
return GetStringFromLump(lump);
|
||||
}
|
||||
|
||||
FString VkShaderManager::LoadPrivateShaderLump(const char *lumpname)
|
||||
{
|
||||
int lump = fileSystem.CheckNumForFullNameInFile(lumpname, 0);
|
||||
int lump = fileSystem.GetFileInContainer(lumpname, 0);
|
||||
if (lump == -1) I_Error("Unable to load '%s'", lumpname);
|
||||
return GetStringFromLump(lump);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -491,7 +491,7 @@ PNamespace *ParseOneScript(const int baselump, ZCCParseState &state)
|
|||
if (fileno == 0 && fileno2 != 0)
|
||||
{
|
||||
I_FatalError("File %s is overriding core lump %s.",
|
||||
fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(lumpnum)), Includes[i].GetChars());
|
||||
fileSystem.GetContainerFullName(fileSystem.GetFileContainer(lumpnum)), Includes[i].GetChars());
|
||||
}
|
||||
|
||||
ParseSingleFile(nullptr, nullptr, lumpnum, parser, state);
|
||||
|
|
|
|||
|
|
@ -799,7 +799,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetChar, ::GetChar)
|
|||
DEFINE_ACTION_FUNCTION(_Wads, GetNumLumps)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
ACTION_RETURN_INT(fileSystem.GetNumEntries());
|
||||
ACTION_RETURN_INT(fileSystem.GetFileCount());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Wads, CheckNumForName)
|
||||
|
|
@ -816,7 +816,7 @@ DEFINE_ACTION_FUNCTION(_Wads, CheckNumForFullName)
|
|||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_STRING(name);
|
||||
ACTION_RETURN_INT(fileSystem.CheckNumForFullName(name.GetChars()));
|
||||
ACTION_RETURN_INT(fileSystem.FindFile(name.GetChars()));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Wads, FindLump)
|
||||
|
|
@ -825,7 +825,7 @@ DEFINE_ACTION_FUNCTION(_Wads, FindLump)
|
|||
PARAM_STRING(name);
|
||||
PARAM_INT(startlump);
|
||||
PARAM_INT(ns);
|
||||
const bool isLumpValid = startlump >= 0 && startlump < fileSystem.GetNumEntries();
|
||||
const bool isLumpValid = startlump >= 0 && startlump < fileSystem.GetFileCount();
|
||||
ACTION_RETURN_INT(isLumpValid ? fileSystem.FindLump(name.GetChars(), &startlump, 0 != ns) : -1);
|
||||
}
|
||||
|
||||
|
|
@ -835,7 +835,7 @@ DEFINE_ACTION_FUNCTION(_Wads, FindLumpFullName)
|
|||
PARAM_STRING(name);
|
||||
PARAM_INT(startlump);
|
||||
PARAM_BOOL(noext);
|
||||
const bool isLumpValid = startlump >= 0 && startlump < fileSystem.GetNumEntries();
|
||||
const bool isLumpValid = startlump >= 0 && startlump < fileSystem.GetFileCount();
|
||||
ACTION_RETURN_INT(isLumpValid ? fileSystem.FindLumpFullName(name.GetChars(), &startlump, noext) : -1);
|
||||
}
|
||||
|
||||
|
|
@ -864,7 +864,7 @@ DEFINE_ACTION_FUNCTION(_Wads, ReadLump)
|
|||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(lump);
|
||||
const bool isLumpValid = lump >= 0 && lump < fileSystem.GetNumEntries();
|
||||
const bool isLumpValid = lump >= 0 && lump < fileSystem.GetFileCount();
|
||||
ACTION_RETURN_STRING(isLumpValid ? GetStringFromLump(lump, false) : FString());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ int RunEndoom()
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (fileSystem.GetFileContainer(endoom_lump) == fileSystem.GetMaxIwadNum() && showendoom == 2)
|
||||
if (fileSystem.GetFileContainer(endoom_lump) == fileSystem.GetMaxBaseNum() && showendoom == 2)
|
||||
{
|
||||
// showendoom==2 means to show only lumps from PWADs.
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ FGameTexture::~FGameTexture()
|
|||
bool FGameTexture::isUserContent() const
|
||||
{
|
||||
int filenum = fileSystem.GetFileContainer(Base->GetSourceLump());
|
||||
return (filenum > fileSystem.GetMaxIwadNum());
|
||||
return (filenum > fileSystem.GetMaxBaseNum());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -182,7 +182,7 @@ void FGameTexture::AddAutoMaterials()
|
|||
if (this->*(layer.pointer) == nullptr) // only if no explicit assignment had been done.
|
||||
{
|
||||
FStringf lookup("%s%s%s", layer.path, fullname ? "" : "auto/", searchname.GetChars());
|
||||
auto lump = fileSystem.CheckNumForFullName(lookup.GetChars(), true);
|
||||
auto lump = fileSystem.FindFile(lookup.GetChars(), true);
|
||||
if (lump != -1)
|
||||
{
|
||||
auto bmtex = TexMan.FindGameTexture(fileSystem.GetFileName(lump), ETextureType::Any, FTextureManager::TEXMAN_TryAny);
|
||||
|
|
@ -199,7 +199,7 @@ void FGameTexture::AddAutoMaterials()
|
|||
if (!this->Layers || this->Layers.get()->*(layer.pointer) == nullptr) // only if no explicit assignment had been done.
|
||||
{
|
||||
FStringf lookup("%s%s%s", layer.path, fullname ? "" : "auto/", searchname.GetChars());
|
||||
auto lump = fileSystem.CheckNumForFullName(lookup.GetChars(), true);
|
||||
auto lump = fileSystem.FindFile(lookup.GetChars(), true);
|
||||
if (lump != -1)
|
||||
{
|
||||
auto bmtex = TexMan.FindGameTexture(fileSystem.GetFileName(lump), ETextureType::Any, FTextureManager::TEXMAN_TryAny);
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ FTextureID FTextureManager::CheckForTexture (const char *name, ETextureType uset
|
|||
if (strchr(name, '/') || (flags & TEXMAN_ForceLookup))
|
||||
{
|
||||
FGameTexture *const NO_TEXTURE = (FGameTexture*)-1; // marker for lumps we already checked that do not map to a texture.
|
||||
int lump = fileSystem.CheckNumForFullName(name);
|
||||
int lump = fileSystem.FindFile(name);
|
||||
if (lump >= 0)
|
||||
{
|
||||
FGameTexture *tex = GetLinkedTexture(lump);
|
||||
|
|
@ -394,7 +394,7 @@ bool FTextureManager::OkForLocalization(FTextureID texnum, const char *substitut
|
|||
|
||||
// Mode 3 must also reject substitutions for non-IWAD content.
|
||||
int file = fileSystem.GetFileContainer(Textures[texnum.GetIndex()].Texture->GetSourceLump());
|
||||
if (file > fileSystem.GetMaxIwadNum()) return true;
|
||||
if (file > fileSystem.GetMaxBaseNum()) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -936,7 +936,7 @@ void FTextureManager::LoadTextureX(int wadnum, FMultipatchTextureBuilder &build)
|
|||
void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &build)
|
||||
{
|
||||
int firsttexture = Textures.Size();
|
||||
bool iwad = wadnum >= fileSystem.GetIwadNum() && wadnum <= fileSystem.GetMaxIwadNum();
|
||||
bool iwad = wadnum >= fileSystem.GetBaseNum() && wadnum <= fileSystem.GetMaxBaseNum();
|
||||
|
||||
FirstTextureForFile.Push(firsttexture);
|
||||
|
||||
|
|
@ -1217,7 +1217,7 @@ void FTextureManager::AddTextures(void (*progressFunc_)(), void (*checkForHacks)
|
|||
progressFunc = progressFunc_;
|
||||
//if (BuildTileFiles.Size() == 0) CountBuildTiles ();
|
||||
|
||||
int wadcnt = fileSystem.GetNumWads();
|
||||
int wadcnt = fileSystem.GetContainerCount();
|
||||
|
||||
FMultipatchTextureBuilder build(*this, progressFunc_, checkForHacks);
|
||||
|
||||
|
|
@ -1409,7 +1409,7 @@ int FTextureManager::GuesstimateNumTextures ()
|
|||
{
|
||||
int numtex = 0;
|
||||
|
||||
for(int i = fileSystem.GetNumEntries()-1; i>=0; i--)
|
||||
for(int i = fileSystem.GetFileCount()-1; i>=0; i--)
|
||||
{
|
||||
int space = fileSystem.GetFileNamespace(i);
|
||||
switch(space)
|
||||
|
|
@ -1445,7 +1445,7 @@ int FTextureManager::GuesstimateNumTextures ()
|
|||
int FTextureManager::CountTexturesX ()
|
||||
{
|
||||
int count = 0;
|
||||
int wadcount = fileSystem.GetNumWads();
|
||||
int wadcount = fileSystem.GetContainerCount();
|
||||
for (int wadnum = 0; wadnum < wadcount; wadnum++)
|
||||
{
|
||||
// Use the most recent PNAMES for this WAD.
|
||||
|
|
@ -1503,16 +1503,16 @@ void FTextureManager::AdjustSpriteOffsets()
|
|||
int sprid;
|
||||
TMap<int, bool> donotprocess;
|
||||
|
||||
int numtex = fileSystem.GetNumEntries();
|
||||
int numtex = fileSystem.GetFileCount();
|
||||
|
||||
for (int i = 0; i < numtex; i++)
|
||||
{
|
||||
if (fileSystem.GetFileContainer(i) > fileSystem.GetMaxIwadNum()) break; // we are past the IWAD
|
||||
if (fileSystem.GetFileNamespace(i) == ns_sprites && fileSystem.GetFileContainer(i) >= fileSystem.GetIwadNum() && fileSystem.GetFileContainer(i) <= fileSystem.GetMaxIwadNum())
|
||||
if (fileSystem.GetFileContainer(i) > fileSystem.GetMaxBaseNum()) break; // we are past the IWAD
|
||||
if (fileSystem.GetFileNamespace(i) == ns_sprites && fileSystem.GetFileContainer(i) >= fileSystem.GetBaseNum() && fileSystem.GetFileContainer(i) <= fileSystem.GetMaxBaseNum())
|
||||
{
|
||||
const char *str = fileSystem.GetFileShortName(i);
|
||||
FTextureID texid = TexMan.CheckForTexture(str, ETextureType::Sprite, 0);
|
||||
if (texid.isValid() && fileSystem.GetFileContainer(GetGameTexture(texid)->GetSourceLump()) > fileSystem.GetMaxIwadNum())
|
||||
if (texid.isValid() && fileSystem.GetFileContainer(GetGameTexture(texid)->GetSourceLump()) > fileSystem.GetMaxBaseNum())
|
||||
{
|
||||
// This texture has been replaced by some PWAD.
|
||||
memcpy(&sprid, str, 4);
|
||||
|
|
@ -1551,12 +1551,12 @@ void FTextureManager::AdjustSpriteOffsets()
|
|||
|
||||
int lumpnum = tex->GetSourceLump();
|
||||
// We only want to change texture offsets for sprites in the IWAD or the file this lump originated from.
|
||||
if (lumpnum >= 0 && lumpnum < fileSystem.GetNumEntries())
|
||||
if (lumpnum >= 0 && lumpnum < fileSystem.GetFileCount())
|
||||
{
|
||||
int wadno = fileSystem.GetFileContainer(lumpnum);
|
||||
if ((iwadonly && wadno >= fileSystem.GetIwadNum() && wadno <= fileSystem.GetMaxIwadNum()) || (!iwadonly && wadno == ofslumpno))
|
||||
if ((iwadonly && wadno >= fileSystem.GetBaseNum() && wadno <= fileSystem.GetMaxBaseNum()) || (!iwadonly && wadno == ofslumpno))
|
||||
{
|
||||
if (wadno >= fileSystem.GetIwadNum() && wadno <= fileSystem.GetMaxIwadNum() && !forced && iwadonly)
|
||||
if (wadno >= fileSystem.GetBaseNum() && wadno <= fileSystem.GetMaxBaseNum() && !forced && iwadonly)
|
||||
{
|
||||
memcpy(&sprid, tex->GetName().GetChars(), 4);
|
||||
if (donotprocess.CheckKey(sprid)) continue; // do not alter sprites that only get partially replaced.
|
||||
|
|
@ -1630,7 +1630,7 @@ void FTextureManager::Listaliases()
|
|||
|
||||
void FTextureManager::SetLinkedTexture(int lump, FGameTexture* tex)
|
||||
{
|
||||
if (lump < fileSystem.GetNumEntries())
|
||||
if (lump < fileSystem.GetFileCount())
|
||||
{
|
||||
linkedMap.Insert(lump, tex);
|
||||
}
|
||||
|
|
@ -1644,7 +1644,7 @@ void FTextureManager::SetLinkedTexture(int lump, FGameTexture* tex)
|
|||
|
||||
FGameTexture* FTextureManager::GetLinkedTexture(int lump)
|
||||
{
|
||||
if (lump < fileSystem.GetNumEntries())
|
||||
if (lump < fileSystem.GetFileCount())
|
||||
{
|
||||
auto check = linkedMap.CheckKey(lump);
|
||||
if (check) return *check;
|
||||
|
|
|
|||
|
|
@ -672,7 +672,7 @@ FString V_GetColorStringByName(const char* name, FScriptPosition* sc)
|
|||
int c[3], step;
|
||||
size_t namelen;
|
||||
|
||||
if (fileSystem.GetNumEntries() == 0) return FString();
|
||||
if (fileSystem.GetFileCount() == 0) return FString();
|
||||
|
||||
rgblump = fileSystem.CheckNumForName("X11R6RGB");
|
||||
if (rgblump == -1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue