mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-12-04 01:41:42 +00:00
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)
|
||||
|
|
|
@ -46,7 +46,7 @@ void D_GrabCVarDefaults()
|
|||
while ((lump = fileSystem.FindLump("DEFCVARS", &lastlump)) != -1)
|
||||
{
|
||||
// don't parse from wads
|
||||
if (lastlump > fileSystem.GetLastEntry(fileSystem.GetMaxIwadNum()))
|
||||
if (lastlump > fileSystem.GetLastEntry(fileSystem.GetMaxBaseNum()))
|
||||
{
|
||||
// would rather put this in a modal of some sort, but this will have to do.
|
||||
Printf(TEXTCOLOR_RED "Cannot load DEFCVARS from a wadfile!\n");
|
||||
|
|
|
@ -369,10 +369,10 @@ int FIWadManager::ScanIWAD (const char *iwad)
|
|||
}
|
||||
};
|
||||
|
||||
if (check.GetNumEntries() > 0)
|
||||
if (check.GetFileCount() > 0)
|
||||
{
|
||||
memset(&mLumpsFound[0], 0, mLumpsFound.Size() * sizeof(mLumpsFound[0]));
|
||||
for(int ii = 0; ii < check.GetNumEntries(); ii++)
|
||||
for(int ii = 0; ii < check.GetFileCount(); ii++)
|
||||
{
|
||||
auto full = check.GetFileName(ii);
|
||||
if (full && strnicmp(full, "maps/", 5) == 0)
|
||||
|
@ -829,14 +829,14 @@ int FIWadManager::IdentifyVersion (std::vector<std::string>&wadfiles, const char
|
|||
iwadnum++;
|
||||
}
|
||||
|
||||
fileSystem.SetIwadNum(iwadnum);
|
||||
fileSystem.SetBaseNum(iwadnum);
|
||||
if (picks[pick].mRequiredPath.IsNotEmpty())
|
||||
{
|
||||
D_AddFile (wadfiles, picks[pick].mRequiredPath.GetChars(), true, -1, GameConfig);
|
||||
iwadnum++;
|
||||
}
|
||||
D_AddFile (wadfiles, picks[pick].mFullPath.GetChars(), true, -1, GameConfig);
|
||||
fileSystem.SetMaxIwadNum(iwadnum);
|
||||
fileSystem.SetMaxBaseNum(iwadnum);
|
||||
|
||||
auto info = mIWadInfos[picks[pick].mInfoIndex];
|
||||
|
||||
|
|
|
@ -1966,7 +1966,7 @@ static FString CheckGameInfo(std::vector<std::string> & pwads)
|
|||
{
|
||||
// Found one!
|
||||
auto data = check.ReadFile(num);
|
||||
auto wadname = check.GetResourceFileName(check.GetFileContainer(num));
|
||||
auto wadname = check.GetContainerName(check.GetFileContainer(num));
|
||||
return ParseGameInfo(pwads, wadname, data.string(), (int)data.size());
|
||||
}
|
||||
}
|
||||
|
@ -1981,9 +1981,9 @@ static FString CheckGameInfo(std::vector<std::string> & pwads)
|
|||
|
||||
static void SetMapxxFlag()
|
||||
{
|
||||
int lump_name = fileSystem.CheckNumForName("MAP01", ns_global, fileSystem.GetIwadNum());
|
||||
int lump_wad = fileSystem.CheckNumForFullNameInFile("maps/map01.wad", fileSystem.GetIwadNum());
|
||||
int lump_map = fileSystem.CheckNumForFullNameInFile("maps/map01.map", fileSystem.GetIwadNum());
|
||||
int lump_name = fileSystem.CheckNumForName("MAP01", ns_global, fileSystem.GetBaseNum());
|
||||
int lump_wad = fileSystem.GetFileInContainer("maps/map01.wad", fileSystem.GetBaseNum());
|
||||
int lump_map = fileSystem.GetFileInContainer("maps/map01.map", fileSystem.GetBaseNum());
|
||||
|
||||
if (lump_name >= 0 || lump_wad >= 0 || lump_map >= 0) gameinfo.flags |= GI_MAPxx;
|
||||
}
|
||||
|
@ -2317,7 +2317,7 @@ static void RenameSprites(FileSystem &fileSystem, const TArray<FString>& deletel
|
|||
break;
|
||||
}
|
||||
|
||||
unsigned NumFiles = fileSystem.GetNumEntries();
|
||||
unsigned NumFiles = fileSystem.GetFileCount();
|
||||
|
||||
for (uint32_t i = 0; i < NumFiles; i++)
|
||||
{
|
||||
|
@ -2342,7 +2342,7 @@ static void RenameSprites(FileSystem &fileSystem, const TArray<FString>& deletel
|
|||
if (fileSystem.GetFileNamespace(i) == ns_sprites)
|
||||
{
|
||||
// Only sprites in the IWAD normally get renamed
|
||||
if (renameAll || fileSystem.GetFileContainer(i) == fileSystem.GetIwadNum())
|
||||
if (renameAll || fileSystem.GetFileContainer(i) == fileSystem.GetBaseNum())
|
||||
{
|
||||
for (int j = 0; j < numrenames; ++j)
|
||||
{
|
||||
|
@ -2388,7 +2388,7 @@ static void RenameSprites(FileSystem &fileSystem, const TArray<FString>& deletel
|
|||
else if (fileSystem.GetFileNamespace(i) == ns_global)
|
||||
{
|
||||
int fn = fileSystem.GetFileContainer(i);
|
||||
if (fn >= fileSystem.GetIwadNum() && fn <= fileSystem.GetMaxIwadNum() && deletelumps.Find(shortName) < deletelumps.Size())
|
||||
if (fn >= fileSystem.GetBaseNum() && fn <= fileSystem.GetMaxBaseNum() && deletelumps.Find(shortName) < deletelumps.Size())
|
||||
{
|
||||
shortName[0] = 0; // Lump must be deleted from directory.
|
||||
}
|
||||
|
@ -2431,8 +2431,8 @@ void RenameNerve(FileSystem& fileSystem)
|
|||
0x70, 0xc2, 0xca, 0x36, 0xac, 0x65, 0xaf, 0x45 }
|
||||
};
|
||||
size_t nervesize[numnerveversions] = { 3819855, 3821966, 3821885, 4003409 }; // NERVE.WAD's file size
|
||||
int w = fileSystem.GetIwadNum();
|
||||
while (++w < fileSystem.GetNumWads())
|
||||
int w = fileSystem.GetBaseNum();
|
||||
while (++w < fileSystem.GetContainerCount())
|
||||
{
|
||||
auto fr = fileSystem.GetFileReader(w);
|
||||
int isizecheck = -1;
|
||||
|
@ -2497,7 +2497,7 @@ void FixMacHexen(FileSystem& fileSystem)
|
|||
return;
|
||||
}
|
||||
|
||||
FileReader* reader = fileSystem.GetFileReader(fileSystem.GetIwadNum());
|
||||
FileReader* reader = fileSystem.GetFileReader(fileSystem.GetBaseNum());
|
||||
auto iwadSize = reader->GetLength();
|
||||
|
||||
static const ptrdiff_t DEMO_SIZE = 13596228;
|
||||
|
@ -2551,8 +2551,8 @@ void FixMacHexen(FileSystem& fileSystem)
|
|||
// Hexen Beta is very similar to Demo but it has MAP41: Maze at the end of the WAD
|
||||
// So keep this map if it's present but discard all extra lumps
|
||||
|
||||
const int lastLump = fileSystem.GetLastEntry(fileSystem.GetIwadNum()) - (isBeta ? 12 : 0);
|
||||
assert(fileSystem.GetFirstEntry(fileSystem.GetIwadNum()) + 299 < lastLump);
|
||||
const int lastLump = fileSystem.GetLastEntry(fileSystem.GetBaseNum()) - (isBeta ? 12 : 0);
|
||||
assert(fileSystem.GetFirstEntry(fileSystem.GetBaseNum()) + 299 < lastLump);
|
||||
|
||||
for (int i = lastLump - EXTRA_LUMPS + 1; i <= lastLump; ++i)
|
||||
{
|
||||
|
@ -2565,14 +2565,14 @@ static void FindStrifeTeaserVoices(FileSystem& fileSystem)
|
|||
{
|
||||
if (gameinfo.gametype == GAME_Strife && gameinfo.flags & GI_SHAREWARE)
|
||||
{
|
||||
unsigned NumFiles = fileSystem.GetNumEntries();
|
||||
unsigned NumFiles = fileSystem.GetFileCount();
|
||||
for (uint32_t i = 0; i < NumFiles; i++)
|
||||
{
|
||||
auto shortName = fileSystem.GetShortName(i);
|
||||
if (fileSystem.GetFileNamespace(i) == ns_global)
|
||||
{
|
||||
// Strife teaser voices are not in the expected namespace.
|
||||
if (fileSystem.GetFileContainer(i) == fileSystem.GetIwadNum())
|
||||
if (fileSystem.GetFileContainer(i) == fileSystem.GetBaseNum())
|
||||
{
|
||||
if (shortName[0] == 'V' &&
|
||||
shortName[1] == 'O' &&
|
||||
|
@ -2842,7 +2842,7 @@ void System_CrashInfo(char* buffer, size_t bufflen, const char *lfstr)
|
|||
buffer += snprintf(buffer, buffend - buffer, " %s", Args->GetArg(i));
|
||||
}
|
||||
|
||||
for (i = 0; (arg = fileSystem.GetResourceFileName(i)) != NULL; ++i)
|
||||
for (i = 0; (arg = fileSystem.GetContainerName(i)) != NULL; ++i)
|
||||
{
|
||||
buffer += mysnprintf(buffer, buffend - buffer, "%sWad %d: %s", lfstr, i, arg);
|
||||
}
|
||||
|
@ -3989,11 +3989,11 @@ void I_UpdateWindowTitle()
|
|||
|
||||
CCMD(fs_dir)
|
||||
{
|
||||
int numfiles = fileSystem.GetNumEntries();
|
||||
int numfiles = fileSystem.GetFileCount();
|
||||
|
||||
for (int i = 0; i < numfiles; i++)
|
||||
{
|
||||
auto container = fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(i));
|
||||
auto container = fileSystem.GetContainerFullName(fileSystem.GetFileContainer(i));
|
||||
auto fn1 = fileSystem.GetFileName(i);
|
||||
auto fns = fileSystem.GetFileShortName(i);
|
||||
auto fnid = fileSystem.GetResourceId(i);
|
||||
|
@ -4006,7 +4006,7 @@ CCMD(fs_dir)
|
|||
CCMD(type)
|
||||
{
|
||||
if (argv.argc() < 2) return;
|
||||
int lump = fileSystem.CheckNumForFullName(argv[1]);
|
||||
int lump = fileSystem.FindFile(argv[1]);
|
||||
if (lump >= 0)
|
||||
{
|
||||
auto data = fileSystem.ReadFile(lump);
|
||||
|
|
|
@ -143,7 +143,7 @@ CCMD (mapchecksum)
|
|||
{
|
||||
if (argv.argc() == 1)
|
||||
{ //current map
|
||||
const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(level.lumpnum));
|
||||
const char *wadname = fileSystem.GetContainerName(fileSystem.GetFileContainer(level.lumpnum));
|
||||
|
||||
for (size_t i = 0; i < 16; ++i)
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ CCMD (mapchecksum)
|
|||
{
|
||||
if(!strcmp(argv[i], "*"))
|
||||
{
|
||||
const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(level.lumpnum));
|
||||
const char *wadname = fileSystem.GetContainerName(fileSystem.GetFileContainer(level.lumpnum));
|
||||
|
||||
for (size_t i = 0; i < 16; ++i)
|
||||
{
|
||||
|
@ -184,7 +184,7 @@ CCMD (mapchecksum)
|
|||
else
|
||||
{
|
||||
map->GetChecksum(cksum);
|
||||
const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(map->lumpnum));
|
||||
const char *wadname = fileSystem.GetContainerName(fileSystem.GetFileContainer(map->lumpnum));
|
||||
delete map;
|
||||
for (size_t j = 0; j < sizeof(cksum); ++j)
|
||||
{
|
||||
|
@ -389,7 +389,7 @@ CCMD(targetinv)
|
|||
|
||||
CCMD(listmaps)
|
||||
{
|
||||
int iwadNum = fileSystem.GetIwadNum();
|
||||
int iwadNum = fileSystem.GetBaseNum();
|
||||
|
||||
for (unsigned i = 0; i < wadlevelinfos.Size(); i++)
|
||||
{
|
||||
|
@ -403,7 +403,7 @@ CCMD(listmaps)
|
|||
if (argv.argc() == 1
|
||||
|| CheckWildcards(argv[1], info->MapName.GetChars())
|
||||
|| CheckWildcards(argv[1], info->LookupLevelName().GetChars())
|
||||
|| CheckWildcards(argv[1], fileSystem.GetResourceFileName(mapWadNum)))
|
||||
|| CheckWildcards(argv[1], fileSystem.GetContainerName(mapWadNum)))
|
||||
{
|
||||
bool isFromPwad = mapWadNum != iwadNum;
|
||||
|
||||
|
@ -411,7 +411,7 @@ CCMD(listmaps)
|
|||
|
||||
Printf("%s%s: '%s' (%s)\n", lineColor, info->MapName.GetChars(),
|
||||
info->LookupLevelName().GetChars(),
|
||||
fileSystem.GetResourceFileName(mapWadNum));
|
||||
fileSystem.GetContainerName(mapWadNum));
|
||||
}
|
||||
delete map;
|
||||
}
|
||||
|
|
|
@ -1915,7 +1915,7 @@ static bool CheckSingleWad (const char *name, bool &printRequires, bool printwar
|
|||
{
|
||||
return true;
|
||||
}
|
||||
if (fileSystem.CheckIfResourceFileLoaded (name) < 0)
|
||||
if (fileSystem.CheckIfContainerLoaded (name) < 0)
|
||||
{
|
||||
if (printwarn)
|
||||
{
|
||||
|
@ -2311,11 +2311,11 @@ static void PutSaveWads (FSerializer &arc)
|
|||
const char *name;
|
||||
|
||||
// Name of IWAD
|
||||
name = fileSystem.GetResourceFileName (fileSystem.GetIwadNum());
|
||||
name = fileSystem.GetContainerName (fileSystem.GetBaseNum());
|
||||
arc.AddString("Game WAD", name);
|
||||
|
||||
// Name of wad the map resides in
|
||||
name = fileSystem.GetResourceFileName (fileSystem.GetFileContainer (primaryLevel->lumpnum));
|
||||
name = fileSystem.GetContainerName (fileSystem.GetFileContainer (primaryLevel->lumpnum));
|
||||
arc.AddString("Map WAD", name);
|
||||
}
|
||||
|
||||
|
|
|
@ -496,15 +496,15 @@ void SBarInfo::ParseSBarInfo(int lump)
|
|||
sc.MustGetToken(TK_Identifier);
|
||||
if(sc.Compare("Doom"))
|
||||
{
|
||||
baselump = fileSystem.CheckNumForFullName("sbarinfo/doom.txt");
|
||||
baselump = fileSystem.FindFile("sbarinfo/doom.txt");
|
||||
}
|
||||
else if(sc.Compare("Heretic"))
|
||||
{
|
||||
baselump = fileSystem.CheckNumForFullName("sbarinfo/heretic.txt");
|
||||
baselump = fileSystem.FindFile("sbarinfo/heretic.txt");
|
||||
}
|
||||
else if(sc.Compare("Hexen"))
|
||||
{
|
||||
baselump = fileSystem.CheckNumForFullName("sbarinfo/hexen.txt");
|
||||
baselump = fileSystem.FindFile("sbarinfo/hexen.txt");
|
||||
}
|
||||
else if(sc.Compare("Strife"))
|
||||
gameType = GAME_Strife;
|
||||
|
@ -522,7 +522,7 @@ void SBarInfo::ParseSBarInfo(int lump)
|
|||
else if (fileSystem.GetFileContainer(baselump) > 0)
|
||||
{
|
||||
I_FatalError("File %s is overriding core lump sbarinfo/%s.txt.",
|
||||
fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(baselump)), sc.String);
|
||||
fileSystem.GetContainerFullName(fileSystem.GetFileContainer(baselump)), sc.String);
|
||||
}
|
||||
ParseSBarInfo(baselump);
|
||||
}
|
||||
|
|
|
@ -3113,12 +3113,12 @@ int D_LoadDehLumps(DehLumpSource source, int flags)
|
|||
{
|
||||
const int filenum = fileSystem.GetFileContainer(lumpnum);
|
||||
|
||||
if (FromIWAD == source && filenum > fileSystem.GetMaxIwadNum())
|
||||
if (FromIWAD == source && filenum > fileSystem.GetMaxBaseNum())
|
||||
{
|
||||
// No more DEHACKED lumps in IWAD
|
||||
break;
|
||||
}
|
||||
else if (FromPWADs == source && filenum <= fileSystem.GetMaxIwadNum())
|
||||
else if (FromPWADs == source && filenum <= fileSystem.GetMaxBaseNum())
|
||||
{
|
||||
// Skip DEHACKED lumps from IWAD
|
||||
continue;
|
||||
|
@ -3128,7 +3128,7 @@ int D_LoadDehLumps(DehLumpSource source, int flags)
|
|||
|
||||
if((flags & DEH_SKIP_BEX_STRINGS_IF_LANGUAGE) && FromIWAD == source)
|
||||
{
|
||||
int iwadnum = fileSystem.GetIwadNum();
|
||||
int iwadnum = fileSystem.GetBaseNum();
|
||||
int lastlump2 = fileSystem.GetFirstEntry(iwadnum);
|
||||
int lumpnum2 = fileSystem.FindLump("LANGUAGE", &lastlump2);
|
||||
|
||||
|
@ -3146,7 +3146,7 @@ int D_LoadDehLumps(DehLumpSource source, int flags)
|
|||
|
||||
if (dehload == 1) // load all .DEH lumps that are found.
|
||||
{
|
||||
for (lumpnum = 0, lastlump = fileSystem.GetNumEntries(); lumpnum < lastlump; ++lumpnum)
|
||||
for (lumpnum = 0, lastlump = fileSystem.GetFileCount(); lumpnum < lastlump; ++lumpnum)
|
||||
{
|
||||
if (isDehFile(lumpnum))
|
||||
{
|
||||
|
@ -3156,7 +3156,7 @@ int D_LoadDehLumps(DehLumpSource source, int flags)
|
|||
}
|
||||
else // only load the last .DEH lump that is found.
|
||||
{
|
||||
for (lumpnum = fileSystem.GetNumEntries()-1; lumpnum >=0; --lumpnum)
|
||||
for (lumpnum = fileSystem.GetFileCount()-1; lumpnum >=0; --lumpnum)
|
||||
{
|
||||
if (isDehFile(lumpnum))
|
||||
{
|
||||
|
@ -3205,7 +3205,7 @@ bool D_LoadDehFile(const char *patchfile, int flags)
|
|||
else
|
||||
{
|
||||
// Couldn't find it in the filesystem; try from a lump instead.
|
||||
int lumpnum = fileSystem.CheckNumForFullName(patchfile);
|
||||
int lumpnum = fileSystem.FindFile(patchfile);
|
||||
if (lumpnum < 0)
|
||||
{
|
||||
// Compatibility fallback. It's just here because
|
||||
|
|
|
@ -20,7 +20,7 @@ void InitDoomFonts()
|
|||
int wadfile = -1;
|
||||
auto a = fileSystem.CheckNumForName("FONTA33", ns_graphics);
|
||||
if (a != -1) wadfile = fileSystem.GetFileContainer(a);
|
||||
if (wadfile > fileSystem.GetIwadNum())
|
||||
if (wadfile > fileSystem.GetBaseNum())
|
||||
{
|
||||
// The font has been replaced, so we need to create a copy of the original as well.
|
||||
SmallFont = new FFont("SmallFont", "FONTA%02u", nullptr, HU_FONTSTART, HU_FONTSIZE, 1, -1);
|
||||
|
@ -37,7 +37,7 @@ void InitDoomFonts()
|
|||
int wadfile = -1;
|
||||
auto a = fileSystem.CheckNumForName("STCFN065", ns_graphics);
|
||||
if (a != -1) wadfile = fileSystem.GetFileContainer(a);
|
||||
if (wadfile > fileSystem.GetIwadNum())
|
||||
if (wadfile > fileSystem.GetBaseNum())
|
||||
{
|
||||
// The font has been replaced, so we need to create a copy of the original as well.
|
||||
SmallFont = new FFont("SmallFont", "STCFN%.3d", nullptr, HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1, -1, false, false, true);
|
||||
|
|
|
@ -946,7 +946,7 @@ void FMapInfoParser::ParseCluster()
|
|||
{
|
||||
// Check if this comes from either Hexen.wad or Hexdd.wad and if so, map to the string table.
|
||||
int fileno = fileSystem.GetFileContainer(lump);
|
||||
auto fn = fileSystem.GetResourceFileName(fileno);
|
||||
auto fn = fileSystem.GetContainerName(fileno);
|
||||
if (fn && (!stricmp(fn, "HEXEN.WAD") || !stricmp(fn, "HEXDD.WAD")))
|
||||
{
|
||||
FStringf key("TXT_%.5s_%s", fn, clusterinfo->ExitText.GetChars());
|
||||
|
@ -2217,7 +2217,7 @@ level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo)
|
|||
{
|
||||
// Try to localize Hexen's map names. This does not use the above feature to allow these names to be unique.
|
||||
int fileno = fileSystem.GetFileContainer(sc.LumpNum);
|
||||
auto fn = fileSystem.GetResourceFileName(fileno);
|
||||
auto fn = fileSystem.GetContainerName(fileno);
|
||||
if (fn && (!stricmp(fn, "HEXEN.WAD") || !stricmp(fn, "HEXDD.WAD")))
|
||||
{
|
||||
FStringf key("TXT_%.5s_%s", fn, levelinfo->MapName.GetChars());
|
||||
|
@ -2458,7 +2458,7 @@ void FMapInfoParser::ParseMapInfo (int lump, level_info_t &gamedefaults, level_i
|
|||
if (fileSystem.GetFileContainer(sc.LumpNum) == 0)
|
||||
{
|
||||
I_FatalError("File %s is overriding core lump %s.",
|
||||
fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(inclump)), sc.String);
|
||||
fileSystem.GetContainerFullName(fileSystem.GetFileContainer(inclump)), sc.String);
|
||||
}
|
||||
}
|
||||
// use a new parser object to parse the include. Otherwise we'd have to save the entire FScanner in a local variable which is a lot more messy.
|
||||
|
@ -2700,11 +2700,11 @@ void G_ParseMapInfo (FString basemapinfo)
|
|||
{
|
||||
FMapInfoParser parse;
|
||||
level_info_t defaultinfo;
|
||||
int baselump = fileSystem.GetNumForFullName(basemapinfo.GetChars());
|
||||
int baselump = fileSystem.GetFile(basemapinfo.GetChars());
|
||||
if (fileSystem.GetFileContainer(baselump) > 0)
|
||||
{
|
||||
I_FatalError("File %s is overriding core lump %s.",
|
||||
fileSystem.GetResourceFileName(fileSystem.GetFileContainer(baselump)), basemapinfo.GetChars());
|
||||
fileSystem.GetContainerName(fileSystem.GetFileContainer(baselump)), basemapinfo.GetChars());
|
||||
}
|
||||
parse.ParseMapInfo(baselump, gamedefaults, defaultinfo);
|
||||
}
|
||||
|
|
|
@ -468,7 +468,7 @@ void STAT_ChangeLevel(const char *newl, FLevelLocals *Level)
|
|||
wad = fileSystem.GetFileContainer(map->lumpnum);
|
||||
delete map;
|
||||
}
|
||||
const char * name = fileSystem.GetResourceFileName(wad);
|
||||
const char * name = fileSystem.GetContainerName(wad);
|
||||
FString section = ExtractFileBase(name) + "." + StartEpisode->mEpisodeMap;
|
||||
section.ToUpper();
|
||||
|
||||
|
|
|
@ -255,11 +255,11 @@ void InitBuildTiles()
|
|||
// Unfortunately neither the palettes nor the .ART files contain any usable identifying marker
|
||||
// so this can only go by the file names.
|
||||
|
||||
int numlumps = fileSystem.GetNumEntries();
|
||||
int numlumps = fileSystem.GetFileCount();
|
||||
for (int i = 0; i < numlumps; i++)
|
||||
{
|
||||
const char* name = fileSystem.GetFileName(i);
|
||||
if (fileSystem.CheckNumForFullName(name) != i) continue; // This palette is hidden by a later one. Do not process
|
||||
if (fileSystem.FindFile(name) != i) continue; // This palette is hidden by a later one. Do not process
|
||||
FString base = ExtractFileBase(name, true);
|
||||
base.ToLower();
|
||||
if (base.Compare("palette.dat") == 0 && fileSystem.FileLength(i) >= 768) // must be a valid palette, i.e. at least 256 colors.
|
||||
|
@ -276,7 +276,7 @@ void InitBuildTiles()
|
|||
// only read from the same source as the palette.
|
||||
// The entire format here is just too volatile to allow liberal mixing.
|
||||
// An .ART set must be treated as one unit.
|
||||
lumpnum = fileSystem.CheckNumForFullNameInFile(artpath.GetChars(), fileSystem.GetFileContainer(i));
|
||||
lumpnum = fileSystem.GetFileInContainer(artpath.GetChars(), fileSystem.GetFileContainer(i));
|
||||
if (lumpnum < 0)
|
||||
{
|
||||
break;
|
||||
|
|
|
@ -309,7 +309,7 @@ bool FIntermissionActionTextscreen::ParseKey(FScanner &sc)
|
|||
{
|
||||
// Check if this comes from either Hexen.wad or Hexdd.wad and if so, map to the string table.
|
||||
int fileno = fileSystem.GetFileContainer(lump);
|
||||
auto fn = fileSystem.GetResourceFileName(fileno);
|
||||
auto fn = fileSystem.GetContainerName(fileno);
|
||||
if (fn && (!stricmp(fn, "HEXEN.WAD") || !stricmp(fn, "HEXDD.WAD")))
|
||||
{
|
||||
FStringf key("TXT_%.5s_%s", fn, sc.String);
|
||||
|
@ -325,7 +325,7 @@ bool FIntermissionActionTextscreen::ParseKey(FScanner &sc)
|
|||
else
|
||||
{
|
||||
// only print an error if coming from a PWAD
|
||||
if (fileSystem.GetFileContainer(sc.LumpNum) > fileSystem.GetMaxIwadNum())
|
||||
if (fileSystem.GetFileContainer(sc.LumpNum) > fileSystem.GetMaxBaseNum())
|
||||
sc.ScriptMessage("Unknown text lump '%s'", sc.String);
|
||||
mText.Format("Unknown text lump '%s'", sc.String);
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ void ParseCompatibility()
|
|||
|
||||
// The contents of this file are not cumulative, as it should not
|
||||
// be present in user-distributed maps.
|
||||
FScanner sc(fileSystem.GetNumForFullName("compatibility.txt"));
|
||||
FScanner sc(fileSystem.GetFile("compatibility.txt"));
|
||||
|
||||
while (sc.GetString()) // Get MD5 signature
|
||||
{
|
||||
|
@ -297,7 +297,7 @@ FName MapLoader::CheckCompatibility(MapData *map)
|
|||
// When playing Doom IWAD levels force BCOMPATF_NOSECTIONMERGE, COMPAT_SHORTTEX and COMPATF_LIGHT.
|
||||
// I'm not sure if the IWAD maps actually need COMPATF_LIGHT but it certainly does not hurt.
|
||||
// TNT's MAP31 also needs COMPATF_STAIRINDEX but that only gets activated for TNT.WAD.
|
||||
if (fileSystem.GetFileContainer(map->lumpnum) == fileSystem.GetIwadNum())
|
||||
if (fileSystem.GetFileContainer(map->lumpnum) == fileSystem.GetBaseNum())
|
||||
{
|
||||
if ((gameinfo.flags & GI_COMPATSHORTTEX) && Level->maptype == MAPTYPE_DOOM)
|
||||
{
|
||||
|
|
|
@ -853,7 +853,7 @@ bool MapLoader::LoadGLNodes(MapData * map)
|
|||
bool mapinwad = map->InWad;
|
||||
FResourceFile * f_gwa = map->resource;
|
||||
|
||||
const char * name = fileSystem.GetResourceFileFullName(lumpfile);
|
||||
const char * name = fileSystem.GetContainerFullName(lumpfile);
|
||||
|
||||
if (mapinwad)
|
||||
{
|
||||
|
|
|
@ -159,7 +159,7 @@ bool MapLoader::LoadScriptFile (const char *name, bool include, int type)
|
|||
{
|
||||
int lumpnum = fileSystem.CheckNumForName (name);
|
||||
const bool found = lumpnum >= 0
|
||||
|| (lumpnum = fileSystem.CheckNumForFullName (name)) >= 0;
|
||||
|| (lumpnum = fileSystem.FindFile (name)) >= 0;
|
||||
|
||||
if (!found)
|
||||
{
|
||||
|
@ -173,7 +173,7 @@ bool MapLoader::LoadScriptFile (const char *name, bool include, int type)
|
|||
FileReader lump = fileSystem.ReopenFileReader (lumpnum);
|
||||
|
||||
auto fn = fileSystem.GetFileContainer(lumpnum);
|
||||
auto wadname = fileSystem.GetResourceFileName(fn);
|
||||
auto wadname = fileSystem.GetContainerName(fn);
|
||||
if (stricmp(wadname, "STRIFE0.WAD") && stricmp(wadname, "STRIFE1.WAD") && stricmp(wadname, "SVE.WAD")) name = nullptr; // Only localize IWAD content.
|
||||
|
||||
bool res = LoadScriptFile(name, lumpnum, lump, fileSystem.FileLength(lumpnum), include, type);
|
||||
|
|
|
@ -105,7 +105,7 @@ void FSavegameManager::ReadSaveStrings()
|
|||
// old, incompatible savegame. List as not usable.
|
||||
oldVer = true;
|
||||
}
|
||||
else if (iwad.CompareNoCase(fileSystem.GetResourceFileName(fileSystem.GetIwadNum())) == 0)
|
||||
else if (iwad.CompareNoCase(fileSystem.GetContainerName(fileSystem.GetBaseNum())) == 0)
|
||||
{
|
||||
missing = !G_CheckSaveGameWads(arc, false);
|
||||
}
|
||||
|
|
|
@ -140,9 +140,9 @@ MapData *P_OpenMapData(const char * mapname, bool justcheck)
|
|||
// Names with more than 8 characters will only be checked as .wad and .map.
|
||||
if (strlen(mapname) <= 8) lump_name = fileSystem.CheckNumForName(mapname);
|
||||
fmt.Format("maps/%s.wad", mapname);
|
||||
lump_wad = fileSystem.CheckNumForFullName(fmt.GetChars());
|
||||
lump_wad = fileSystem.FindFile(fmt.GetChars());
|
||||
fmt.Format("maps/%s.map", mapname);
|
||||
lump_map = fileSystem.CheckNumForFullName(fmt.GetChars());
|
||||
lump_map = fileSystem.FindFile(fmt.GetChars());
|
||||
|
||||
if (lump_name > lump_wad && lump_name > lump_map && lump_name != -1)
|
||||
{
|
||||
|
|
|
@ -2322,7 +2322,7 @@ bool FBehavior::Init(FLevelLocals *Level, int lumpnum, FileReader * fr, int len,
|
|||
if ((Level->flags2 & LEVEL2_HEXENHACK) && gameinfo.gametype == GAME_Hexen && lumpnum == -1 && reallumpnum > 0)
|
||||
{
|
||||
int fileno = fileSystem.GetFileContainer(reallumpnum);
|
||||
const char * filename = fileSystem.GetResourceFileName(fileno);
|
||||
const char * filename = fileSystem.GetContainerName(fileno);
|
||||
if (!stricmp(filename, "HEXEN.WAD") || !stricmp(filename, "HEXDD.WAD"))
|
||||
{
|
||||
ShouldLocalize = true;
|
||||
|
|
|
@ -410,7 +410,7 @@ void player_t::SetLogNumber (int num)
|
|||
if (lumpnum != -1)
|
||||
{
|
||||
auto fn = fileSystem.GetFileContainer(lumpnum);
|
||||
auto wadname = fileSystem.GetResourceFileName(fn);
|
||||
auto wadname = fileSystem.GetContainerName(fn);
|
||||
if (!stricmp(wadname, "STRIFE0.WAD") || !stricmp(wadname, "STRIFE1.WAD") || !stricmp(wadname, "SVE.WAD"))
|
||||
{
|
||||
// If this is an original IWAD text, try looking up its lower priority string version first.
|
||||
|
@ -895,7 +895,7 @@ static int SetupCrouchSprite(AActor *self, int crouchsprite)
|
|||
int wadnorm = fileSystem.GetFileContainer(spritenorm);
|
||||
int wadcrouch = fileSystem.GetFileContainer(spritenorm);
|
||||
|
||||
if (wadnorm > fileSystem.GetMaxIwadNum() && wadcrouch <= fileSystem.GetMaxIwadNum())
|
||||
if (wadnorm > fileSystem.GetMaxBaseNum() && wadcrouch <= fileSystem.GetMaxBaseNum())
|
||||
{
|
||||
// Question: Add an option / disable crouching or do what?
|
||||
return false;
|
||||
|
|
|
@ -100,7 +100,7 @@ void R_InitColormaps (bool allowCustomColormap)
|
|||
cm.blend = 0;
|
||||
fakecmaps.Push(cm);
|
||||
|
||||
uint32_t NumLumps = fileSystem.GetNumEntries();
|
||||
uint32_t NumLumps = fileSystem.GetFileCount();
|
||||
|
||||
for (uint32_t i = 0; i < NumLumps; i++)
|
||||
{
|
||||
|
|
|
@ -1234,7 +1234,7 @@ class GLDefsParser
|
|||
|
||||
if (lumpnum != -1)
|
||||
{
|
||||
if (iwad && fileSystem.GetFileContainer(lumpnum) <= fileSystem.GetMaxIwadNum()) useme = true;
|
||||
if (iwad && fileSystem.GetFileContainer(lumpnum) <= fileSystem.GetMaxBaseNum()) useme = true;
|
||||
if (thiswad && fileSystem.GetFileContainer(lumpnum) == fileSystem.GetFileContainer(workingLump)) useme = true;
|
||||
}
|
||||
if (!useme) return;
|
||||
|
@ -1421,7 +1421,7 @@ class GLDefsParser
|
|||
|
||||
if (lumpnum != -1)
|
||||
{
|
||||
if (iwad && fileSystem.GetFileContainer(lumpnum) <= fileSystem.GetMaxIwadNum()) useme = true;
|
||||
if (iwad && fileSystem.GetFileContainer(lumpnum) <= fileSystem.GetMaxBaseNum()) useme = true;
|
||||
if (thiswad && fileSystem.GetFileContainer(lumpnum) == fileSystem.GetFileContainer(workingLump)) useme = true;
|
||||
}
|
||||
if (!useme) return;
|
||||
|
|
|
@ -344,7 +344,7 @@ void R_InitSpriteDefs ()
|
|||
}
|
||||
|
||||
// Repeat, for voxels
|
||||
vmax = fileSystem.GetNumEntries();
|
||||
vmax = fileSystem.GetFileCount();
|
||||
TArray<VHasher> vhashes(vmax, true);
|
||||
memset(vhashes.Data(), -1, sizeof(VHasher)*vmax);
|
||||
for (i = 0; i < vmax; ++i)
|
||||
|
@ -588,7 +588,7 @@ void R_InitSkins (void)
|
|||
{
|
||||
// The player sprite has 23 frames. This means that the S_SKIN
|
||||
// marker needs a minimum of 23 lumps after it.
|
||||
if (base >= fileSystem.GetNumEntries() - 23 || base == -1)
|
||||
if (base >= fileSystem.GetFileCount() - 23 || base == -1)
|
||||
continue;
|
||||
|
||||
i++;
|
||||
|
|
|
@ -351,7 +351,7 @@ void SetDefaultColormap (const char *name)
|
|||
lump = fileSystem.CheckNumForName (name, ns_global);
|
||||
|
||||
// [RH] If using BUILD's palette, generate the colormap
|
||||
if (lump == -1 || fileSystem.CheckNumForFullName("palette.dat") >= 0 || fileSystem.CheckNumForFullName("blood.pal") >= 0)
|
||||
if (lump == -1 || fileSystem.FindFile("palette.dat") >= 0 || fileSystem.FindFile("blood.pal") >= 0)
|
||||
{
|
||||
DPrintf (DMSG_NOTIFY, "Make colormap\n");
|
||||
FDynamicColormap foo;
|
||||
|
@ -403,7 +403,7 @@ static void InitBoomColormaps ()
|
|||
// This is a really rough hack, but it's better than
|
||||
// not doing anything with them at all (right?)
|
||||
|
||||
uint32_t NumLumps = fileSystem.GetNumEntries();
|
||||
uint32_t NumLumps = fileSystem.GetFileCount();
|
||||
|
||||
realcolormaps.Maps = new uint8_t[256*NUMCOLORMAPS*fakecmaps.Size()];
|
||||
SetDefaultColormap ("COLORMAP");
|
||||
|
|
|
@ -1286,7 +1286,7 @@ void ParseDecorate (FScanner &sc, PNamespace *ns)
|
|||
if (includefile != 0)
|
||||
{
|
||||
I_FatalError("File %s is overriding core lump %s.",
|
||||
fileSystem.GetResourceFileFullName(includefile), sc.String);
|
||||
fileSystem.GetContainerFullName(includefile), sc.String);
|
||||
}
|
||||
}
|
||||
FScanner newscanner;
|
||||
|
|
|
@ -594,7 +594,7 @@ void S_ParseSndInfo (bool redefine)
|
|||
|
||||
CurrentPitchMask = 0;
|
||||
S_AddSound ("{ no sound }", "DSEMPTY"); // Sound 0 is no sound at all
|
||||
for (lump = 0; lump < fileSystem.GetNumEntries(); ++lump)
|
||||
for (lump = 0; lump < fileSystem.GetFileCount(); ++lump)
|
||||
{
|
||||
switch (fileSystem.GetFileNamespace (lump))
|
||||
{
|
||||
|
@ -1058,7 +1058,7 @@ static void S_AddSNDINFO (int lump)
|
|||
int file = fileSystem.GetFileContainer(lump);
|
||||
int sndifile = fileSystem.GetFileContainer(sc.LumpNum);
|
||||
if ( (file > sndifile) &&
|
||||
!(sndifile <= fileSystem.GetIwadNum() && file <= fileSystem.GetIwadNum()) )
|
||||
!(sndifile <= fileSystem.GetBaseNum() && file <= fileSystem.GetBaseNum()) )
|
||||
{
|
||||
sc.MustGetString();
|
||||
continue;
|
||||
|
|
|
@ -185,7 +185,7 @@ static FString LookupMusic(const char* musicname, int& order)
|
|||
|
||||
static int FindMusic(const char* musicname)
|
||||
{
|
||||
int lumpnum = fileSystem.CheckNumForFullName(musicname);
|
||||
int lumpnum = fileSystem.FindFile(musicname);
|
||||
if (lumpnum == -1) lumpnum = fileSystem.CheckNumForName(musicname, ns_music);
|
||||
return lumpnum;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue