take namespace enum out of namespace and added CheckNumForAnyName and CheckNumForFullNameInFile to clarify the meaning of CheckNumForFullName.

This is to take some renaming noise out of the upcoming refactoring.
This commit is contained in:
Christoph Oelckers 2024-11-24 13:18:46 +01:00
parent ba2800d698
commit 634a646c2d
51 changed files with 118 additions and 122 deletions

View file

@ -845,7 +845,7 @@ static void AM_ParseArrow(TArray<mline_t> &Arrow, const char *lumpname)
{
const int R = int((8 * PLAYERRADIUS) / 7);
FScanner sc;
int lump = fileSystem.CheckNumForFullName(lumpname, true);
int lump = fileSystem.CheckNumForAnyName(lumpname);
if (lump >= 0)
{
sc.OpenLumpNum(lump);

View file

@ -53,9 +53,6 @@
#include "s_music.h"
#include "filereadermusicinterface.h"
using namespace FileSys;
void I_InitSoundFonts();
EXTERN_CVAR (Int, snd_samplerate)

View file

@ -314,7 +314,7 @@ FileReader FLumpPatchSetReader::OpenMainConfigFile()
FileReader FLumpPatchSetReader::OpenFile(const char *name)
{
FString path;
if (IsAbsPath(name)) return FileReader(); // no absolute paths in the lump directory.
if (IsAbsPath(name)) return FileReader(); // no absolute paths in the virtual file system.
path = mBasePath + name;
auto index = fileSystem.CheckNumForFullName(path.GetChars());
if (index < 0) return FileReader();

View file

@ -114,7 +114,7 @@ static FileReader OpenMusic(const char* musicname)
{
int lumpnum;
lumpnum = mus_cb.FindMusic(musicname);
if (lumpnum == -1) lumpnum = fileSystem.CheckNumForName(musicname, FileSys::ns_music);
if (lumpnum == -1) lumpnum = fileSystem.CheckNumForName(musicname, ns_music);
if (lumpnum == -1)
{
Printf("Music \"%s\" not found\n", musicname);
@ -143,7 +143,7 @@ bool MusicExists(const char* music_name)
{
int lumpnum;
lumpnum = mus_cb.FindMusic(music_name);
if (lumpnum == -1) lumpnum = fileSystem.CheckNumForName(music_name, FileSys::ns_music);
if (lumpnum == -1) lumpnum = fileSystem.CheckNumForName(music_name, ns_music);
if (lumpnum != -1 && fileSystem.FileLength(lumpnum) != 0)
return true;
}

View file

@ -508,7 +508,7 @@ public:
}
if (!MusicStream)
{
Printf(PRINT_BOLD, "Failed to decode %s\n", fileSystem.GetFileName(soundtrack, false));
Printf(PRINT_BOLD, "Failed to decode %s\n", fileSystem.GetFileName(soundtrack));
}
}
animtex.SetSize(AnimTexture::VPX, width, height);

View file

@ -124,7 +124,7 @@ FScanner::FScanner(int lumpnum, TMap<FName, Symbol>* extsymbols) : symbols(extsy
void FScanner::Open (const char *name)
{
int lump = fileSystem.CheckNumForFullName(name, true);
int lump = fileSystem.CheckNumForAnyName(name);
if (lump == -1)
{
I_Error("Could not find script lump '%s'\n", name);

View file

@ -58,8 +58,6 @@
#include "vm.h"
#include "i_interface.h"
using namespace FileSys;
extern DObject *WP_NOCHANGE;
bool save_full = false; // for testing. Should be removed afterward.
@ -155,13 +153,13 @@ bool FSerializer::OpenReader(const char *buffer, size_t length)
//
//==========================================================================
bool FSerializer::OpenReader(FCompressedBuffer *input)
bool FSerializer::OpenReader(FileSys::FCompressedBuffer *input)
{
if (input->mSize <= 0 || input->mBuffer == nullptr) return false;
if (w != nullptr || r != nullptr) return false;
mErrors = 0;
if (input->mMethod == METHOD_STORED)
if (input->mMethod == FileSys::METHOD_STORED)
{
r = new FReader((char*)input->mBuffer, input->mSize);
}
@ -785,10 +783,10 @@ const char *FSerializer::GetOutput(unsigned *len)
//
//==========================================================================
FCompressedBuffer FSerializer::GetCompressedOutput()
FileSys::FCompressedBuffer FSerializer::GetCompressedOutput()
{
if (isReading()) return{ 0,0,0,0,0,nullptr };
FCompressedBuffer buff;
FileSys::FCompressedBuffer buff;
WriteObjects();
EndObject();
buff.filename = nullptr;
@ -827,7 +825,7 @@ FCompressedBuffer FSerializer::GetCompressedOutput()
if (err == Z_OK)
{
buff.mBuffer = new char[buff.mCompressedSize];
buff.mMethod = METHOD_DEFLATE;
buff.mMethod = FileSys::METHOD_DEFLATE;
memcpy(buff.mBuffer, compressbuf, buff.mCompressedSize);
delete[] compressbuf;
return buff;
@ -836,7 +834,7 @@ FCompressedBuffer FSerializer::GetCompressedOutput()
error:
memcpy(compressbuf, w->mOutString.GetString(), buff.mSize + 1);
buff.mCompressedSize = buff.mSize;
buff.mMethod = METHOD_STORED;
buff.mMethod = FileSys::METHOD_STORED;
return buff;
}

View file

@ -47,7 +47,7 @@
//
//==========================================================================
void FStringTable::LoadStrings (FileSys::FileSystem& fileSystem, const char *language)
void FStringTable::LoadStrings (FileSystem& fileSystem, const char *language)
{
int lastlump, lump;

View file

@ -84,7 +84,7 @@ public:
using LangMap = TMap<uint32_t, StringMap>;
using StringMacroMap = TMap<FName, StringMacro>;
void LoadStrings(FileSys::FileSystem& fileSystem, const char *language);
void LoadStrings(FileSystem& fileSystem, const char *language);
void UpdateLanguage(const char* language);
StringMap GetDefaultStrings() { return allStrings[default_table]; } // Dehacked needs these for comparison
void SetOverrideStrings(StringMap & map)

View file

@ -66,8 +66,13 @@ public:
inline int GetNumForName (const uint8_t *name, int ns) const { return GetNumForName ((const char *)name, ns); }
int CheckNumForFullName (const char *cname, bool trynormal = false, int namespc = ns_global, bool ignoreext = false) const;
int CheckNumForFullName (const char *name, int wadfile) const;
int CheckNumForFullNameInFile (const char *name, int wadfile) const;
int GetNumForFullName (const char *name) const;
int CheckNumForAnyName(const char* cname, namespace_t namespc = ns_global) const
{
return CheckNumForFullName(cname, true, namespc);
}
int FindFile(const char* name) const
{
return CheckNumForFullName(name);

View file

@ -45,6 +45,8 @@ using FileSystemMessageFunc = int(*)(FSMessageLevel msglevel, const char* format
class FResourceFile;
}
// [RH] Namespaces from BOOM.
// These are needed here in the low level part so that WAD files can be properly set up.
typedef enum {
@ -76,6 +78,8 @@ typedef enum {
ns_firstskin,
} namespace_t;
namespace FileSys {
enum ELumpFlags
{
RESFF_MAYBEFLAT = 1, // might be a flat inside a WAD outside F_START/END

View file

@ -594,7 +594,7 @@ int FileSystem::CheckNumForFullName (const char *name, bool trynormal, int names
return -1;
}
int FileSystem::CheckNumForFullName (const char *name, int rfnum) const
int FileSystem::CheckNumForFullNameInFile (const char *name, int rfnum) const
{
uint32_t i;

View file

@ -120,7 +120,7 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
}
lump = fileSystem.CheckNumForFullName(fontlumpname? fontlumpname : name, true);
lump = fileSystem.CheckNumForAnyName(fontlumpname? fontlumpname : name);
if (lump != -1 && fileSystem.GetFileContainer(lump) >= folderfile)
{
@ -871,7 +871,7 @@ void V_InitFonts()
FFont *CreateHexLumpFont(const char *fontname, int lump);
FFont *CreateHexLumpFont2(const char *fontname, int lump);
auto lump = fileSystem.CheckNumForFullName("newconsolefont.hex", 0); // This is always loaded from gzdoom.pk3 to prevent overriding it with incomplete replacements.
auto lump = fileSystem.CheckNumForFullNameInFile("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);

View file

@ -1524,7 +1524,7 @@ void M_ParseMenuDefs()
DefaultOptionMenuSettings->Reset();
OptionSettings.mLinespacing = 17;
int IWADMenu = fileSystem.CheckNumForName("MENUDEF", FileSys::ns_global, fileSystem.GetIwadNum());
int IWADMenu = fileSystem.CheckNumForName("MENUDEF", ns_global, fileSystem.GetIwadNum());
while ((lump = fileSystem.FindLump ("MENUDEF", &lastlump)) != -1)
{

View file

@ -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.CheckNumForFullName(vert_prog_lump, 0);
int vp_lump = fileSystem.CheckNumForFullNameInFile(vert_prog_lump, 0);
if (vp_lump == -1) I_Error("Unable to load '%s'", vert_prog_lump);
int fp_lump = fileSystem.CheckNumForFullName(frag_prog_lump, 0);
int fp_lump = fileSystem.CheckNumForFullNameInFile(frag_prog_lump, 0);
if (fp_lump == -1) I_Error("Unable to load '%s'", frag_prog_lump);
@ -418,7 +418,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
if (*proc_prog_lump != '#')
{
int pp_lump = fileSystem.CheckNumForFullName(proc_prog_lump, 0); // if it's a core shader, ignore overrides by user mods.
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);
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.CheckNumForFullName("shaders/glsl/func_defaultmat2.fp", 0);
int pl_lump = fileSystem.CheckNumForFullNameInFile("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.CheckNumForFullName("shaders/glsl/func_defaultmat.fp", 0);
int pl_lump = fileSystem.CheckNumForFullNameInFile("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.CheckNumForFullName("shaders/glsl/func_defaultlight.fp", 0);
int pl_lump = fileSystem.CheckNumForFullNameInFile("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.CheckNumForFullName(light_fragprog, 0);
int pp_lump = fileSystem.CheckNumForFullNameInFile(light_fragprog, 0);
if (pp_lump == -1) I_Error("Unable to load '%s'", light_fragprog);
fp_comb << GetStringFromLump(pp_lump) << "\n";
}

View file

@ -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.CheckNumForFullName(vert_prog_lump.GetChars(), 0);
int vp_lump = fileSystem.CheckNumForFullNameInFile(vert_prog_lump.GetChars(), 0);
if (vp_lump == -1) I_Error("Unable to load '%s'", vert_prog_lump.GetChars());
int fp_lump = fileSystem.CheckNumForFullName(frag_prog_lump.GetChars(), 0);
int fp_lump = fileSystem.CheckNumForFullNameInFile(frag_prog_lump.GetChars(), 0);
if (fp_lump == -1) I_Error("Unable to load '%s'", frag_prog_lump.GetChars());
@ -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.CheckNumForFullName("shaders_gles/glsl/func_defaultmat2.fp", 0);
int pl_lump = fileSystem.CheckNumForFullNameInFile("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.CheckNumForFullName("shaders_gles/glsl/func_defaultmat.fp", 0);
int pl_lump = fileSystem.CheckNumForFullNameInFile("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.CheckNumForFullName("shaders_gles/glsl/func_defaultlight.fp", 0);
int pl_lump = fileSystem.CheckNumForFullNameInFile("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.CheckNumForFullName(light_fragprog.GetChars(), 0);
int pp_lump = fileSystem.CheckNumForFullNameInFile(light_fragprog.GetChars(), 0);
if (pp_lump == -1) I_Error("Unable to load '%s'", light_fragprog.GetChars());
fp_comb << GetStringFromLump(pp_lump) << "\n";
}

View file

@ -465,7 +465,7 @@ FString VkShaderManager::GetTargetGlslVersion()
FString VkShaderManager::LoadPublicShaderLump(const char *lumpname)
{
int lump = fileSystem.CheckNumForFullName(lumpname, 0);
int lump = fileSystem.CheckNumForFullNameInFile(lumpname, 0);
if (lump == -1) lump = fileSystem.CheckNumForFullName(lumpname);
if (lump == -1) I_Error("Unable to load '%s'", lumpname);
return GetStringFromLump(lump);
@ -473,7 +473,7 @@ FString VkShaderManager::LoadPublicShaderLump(const char *lumpname)
FString VkShaderManager::LoadPrivateShaderLump(const char *lumpname)
{
int lump = fileSystem.CheckNumForFullName(lumpname, 0);
int lump = fileSystem.CheckNumForFullNameInFile(lumpname, 0);
if (lump == -1) I_Error("Unable to load '%s'", lumpname);
return GetStringFromLump(lump);
}

View file

@ -304,7 +304,7 @@ static void ParseSingleFile(FScanner *pSC, const char *filename, int lump, void
{
if (filename != nullptr)
{
lump = fileSystem.CheckNumForFullName(filename, true);
lump = fileSystem.CheckNumForAnyName(filename);
if (lump >= 0)
{
lsc.OpenLumpNum(lump);
@ -480,7 +480,7 @@ PNamespace *ParseOneScript(const int baselump, ZCCParseState &state)
ParseSingleFile(&sc, nullptr, lumpnum, parser, state);
for (unsigned i = 0; i < Includes.Size(); i++)
{
lumpnum = fileSystem.CheckNumForFullName(Includes[i].GetChars(), true);
lumpnum = fileSystem.CheckNumForAnyName(Includes[i].GetChars());
if (lumpnum == -1)
{
IncludeLocs[i].Message(MSG_ERROR, "Include script lump %s not found", Includes[i].GetChars());

View file

@ -153,7 +153,7 @@ int RunEndoom()
return 0;
}
int endoom_lump = fileSystem.CheckNumForFullName (endoomName.GetChars(), true);
int endoom_lump = fileSystem.CheckNumForAnyName (endoomName.GetChars());
if (endoom_lump < 0 || fileSystem.FileLength (endoom_lump) != 4000)
{

View file

@ -72,7 +72,7 @@ FGenericStartScreen::FGenericStartScreen(int max_progress)
: FStartScreen(max_progress)
{
// at this point we do not have a working texture manager yet, so we have to do the lookup via the file system
int startup_lump = fileSystem.CheckNumForName("BOOTLOGO", FileSys::ns_graphics);
int startup_lump = fileSystem.CheckNumForName("BOOTLOGO", ns_graphics);
StartupBitmap.Create(640 * 2, 480 * 2);
ClearBlock(StartupBitmap, { 0, 0, 0, 255 }, 0, 0, 640 * 2, 480 * 2);

View file

@ -81,9 +81,9 @@ FHexenStartScreen::FHexenStartScreen(int max_progress)
: FStartScreen(max_progress)
{
// at this point we do not have a working texture manager yet, so we have to do the lookup via the file system
int startup_lump = fileSystem.CheckNumForName("STARTUP", FileSys::ns_graphics);
int netnotch_lump = fileSystem.CheckNumForName("NETNOTCH", FileSys::ns_graphics);
int notch_lump = fileSystem.CheckNumForName("NOTCH", FileSys::ns_graphics);
int startup_lump = fileSystem.CheckNumForName("STARTUP", ns_graphics);
int netnotch_lump = fileSystem.CheckNumForName("NETNOTCH", ns_graphics);
int notch_lump = fileSystem.CheckNumForName("NOTCH", ns_graphics);
// For backwards compatibility we also need to look in the default namespace, because these were previously not handled as graphics.
if (startup_lump == -1) startup_lump = fileSystem.CheckNumForName("STARTUP");

View file

@ -111,7 +111,7 @@ FStrifeStartScreen::FStrifeStartScreen(int max_progress)
// Load the background and animated overlays.
for (size_t i = 0; i < countof(StrifeStartupPicNames); ++i)
{
int lumpnum = fileSystem.CheckNumForName(StrifeStartupPicNames[i], FileSys::ns_graphics);
int lumpnum = fileSystem.CheckNumForName(StrifeStartupPicNames[i], ns_graphics);
if (lumpnum < 0) lumpnum = fileSystem.CheckNumForName(StrifeStartupPicNames[i]);
if (lumpnum >= 0)

View file

@ -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(), false, FileSys::ns_global, true);
auto lump = fileSystem.CheckNumForFullName(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(), false, FileSys::ns_global, true);
auto lump = fileSystem.CheckNumForFullName(lookup.GetChars(), true);
if (lump != -1)
{
auto bmtex = TexMan.FindGameTexture(fileSystem.GetFileName(lump), ETextureType::Any, FTextureManager::TEXMAN_TryAny);

View file

@ -723,8 +723,8 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
FName texname = sc.String;
sc.MustGetString();
int lumpnum = fileSystem.CheckNumForFullName(sc.String, true, ns_patches);
if (lumpnum == -1) lumpnum = fileSystem.CheckNumForFullName(sc.String, true, ns_graphics);
int lumpnum = fileSystem.CheckNumForAnyName(sc.String, ns_patches);
if (lumpnum == -1) lumpnum = fileSystem.CheckNumForAnyName(sc.String, ns_graphics);
if (tlist.Size() == 0)
{
@ -779,8 +779,8 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
{
FString src = base.Left(8);
int lumpnum = fileSystem.CheckNumForFullName(sc.String, true, ns_patches);
if (lumpnum == -1) lumpnum = fileSystem.CheckNumForFullName(sc.String, true, ns_graphics);
int lumpnum = fileSystem.CheckNumForAnyName(sc.String, ns_patches);
if (lumpnum == -1) lumpnum = fileSystem.CheckNumForAnyName(sc.String, ns_graphics);
sc.GetString();
bool is32bit = !!sc.Compare("force32bit");
@ -854,7 +854,7 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
sc.MustGetString();
// This is not using sc.Open because it can print a more useful error message when done here
int includelump = fileSystem.CheckNumForFullName(sc.String, true);
int includelump = fileSystem.CheckNumForAnyName(sc.String);
if (includelump == -1)
{
sc.ScriptError("Lump '%s' not found", sc.String);
@ -971,7 +971,7 @@ void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &b
if (ns == ns_global)
{
// In Zips all graphics must be in a separate namespace.
if (fileSystem.GetFileFlags(i) & RESFF_FULLPATH) continue;
if (fileSystem.GetFileFlags(i) & FileSys::RESFF_FULLPATH) continue;
// Ignore lumps with empty names.
if (fileSystem.CheckFileName(i, "")) continue;
@ -1109,7 +1109,7 @@ void FTextureManager::SortTexturesByType(int start, int end)
void FTextureManager::AddLocalizedVariants()
{
std::vector<FolderEntry> content;
std::vector<FileSys::FolderEntry> content;
fileSystem.GetFilesInFolder("localized/textures/", content, false);
for (auto &entry : content)
{

View file

@ -1984,8 +1984,8 @@ 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.CheckNumForFullName("maps/map01.wad", fileSystem.GetIwadNum());
int lump_map = fileSystem.CheckNumForFullName("maps/map01.map", fileSystem.GetIwadNum());
int lump_wad = fileSystem.CheckNumForFullNameInFile("maps/map01.wad", fileSystem.GetIwadNum());
int lump_map = fileSystem.CheckNumForFullNameInFile("maps/map01.map", fileSystem.GetIwadNum());
if (lump_name >= 0 || lump_wad >= 0 || lump_map >= 0) gameinfo.flags |= GI_MAPxx;
}

View file

@ -2909,7 +2909,7 @@ void G_DoPlayDemo (void)
gameaction = ga_nothing;
// [RH] Allow for demos not loaded as lumps
demolump = fileSystem.CheckNumForFullName (defdemoname.GetChars(), true);
demolump = fileSystem.CheckNumForAnyName (defdemoname.GetChars());
if (demolump >= 0)
{
int demolen = fileSystem.FileLength (demolump);

View file

@ -443,7 +443,7 @@ void SBarInfo::Load()
{
if(gameinfo.statusbar.IsNotEmpty())
{
int lump = fileSystem.CheckNumForFullName(gameinfo.statusbar.GetChars(), true);
int lump = fileSystem.CheckNumForAnyName(gameinfo.statusbar.GetChars());
if(lump != -1)
{
if (!batchrun) Printf ("ParseSBarInfo: Loading default status bar definition.\n");
@ -481,7 +481,7 @@ void SBarInfo::ParseSBarInfo(int lump)
if(sc.TokenType == TK_Include)
{
sc.MustGetToken(TK_StringConst);
int lump = fileSystem.CheckNumForFullName(sc.String, true);
int lump = fileSystem.CheckNumForAnyName(sc.String);
if (lump == -1)
sc.ScriptError("Lump '%s' not found", sc.String);
ParseSBarInfo(lump);
@ -496,15 +496,15 @@ void SBarInfo::ParseSBarInfo(int lump)
sc.MustGetToken(TK_Identifier);
if(sc.Compare("Doom"))
{
baselump = fileSystem.CheckNumForFullName("sbarinfo/doom.txt", true);
baselump = fileSystem.CheckNumForFullName("sbarinfo/doom.txt");
}
else if(sc.Compare("Heretic"))
{
baselump = fileSystem.CheckNumForFullName("sbarinfo/heretic.txt", true);
baselump = fileSystem.CheckNumForFullName("sbarinfo/heretic.txt");
}
else if(sc.Compare("Hexen"))
{
baselump = fileSystem.CheckNumForFullName("sbarinfo/hexen.txt", true);
baselump = fileSystem.CheckNumForFullName("sbarinfo/hexen.txt");
}
else if(sc.Compare("Strife"))
gameType = GAME_Strife;

View file

@ -168,7 +168,7 @@ static void ReplaceSoundName(int index, const char* newname)
if (snd == NO_SOUND) return;
auto sfx = soundEngine->GetWritableSfx(snd);
FStringf dsname("ds%s", newname);
sfx->lumpnum = fileSystem.CheckNumForName(dsname.GetChars(), FileSys::ns_sounds);
sfx->lumpnum = fileSystem.CheckNumForName(dsname.GetChars(), ns_sounds);
sfx->bTentative = false;
sfx->bRandomHeader = false;
sfx->bLoadRAW = false;
@ -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, true);
int lumpnum = fileSystem.CheckNumForFullName(patchfile);
if (lumpnum < 0)
{
// Compatibility fallback. It's just here because

View file

@ -397,7 +397,7 @@ void FDecalLib::ParseDecal (FScanner &sc)
case DECAL_PIC:
sc.MustGetString ();
picnum = TexMan.CheckForTexture (sc.String, ETextureType::Any);
if (!picnum.Exists() && (lumpnum = fileSystem.CheckNumForName (sc.String, FileSys::ns_graphics)) >= 0)
if (!picnum.Exists() && (lumpnum = fileSystem.CheckNumForName (sc.String, ns_graphics)) >= 0)
{
picnum = TexMan.CreateTexture (lumpnum, ETextureType::Decal);
}

View file

@ -18,7 +18,7 @@ void InitDoomFonts()
if (fileSystem.CheckNumForName("FONTA_S") >= 0)
{
int wadfile = -1;
auto a = fileSystem.CheckNumForName("FONTA33", FileSys::ns_graphics);
auto a = fileSystem.CheckNumForName("FONTA33", ns_graphics);
if (a != -1) wadfile = fileSystem.GetFileContainer(a);
if (wadfile > fileSystem.GetIwadNum())
{
@ -32,10 +32,10 @@ void InitDoomFonts()
SmallFont->SetCursor('[');
}
}
else if (fileSystem.CheckNumForName("STCFN033", FileSys::ns_graphics) >= 0)
else if (fileSystem.CheckNumForName("STCFN033", ns_graphics) >= 0)
{
int wadfile = -1;
auto a = fileSystem.CheckNumForName("STCFN065", FileSys::ns_graphics);
auto a = fileSystem.CheckNumForName("STCFN065", ns_graphics);
if (a != -1) wadfile = fileSystem.GetFileContainer(a);
if (wadfile > fileSystem.GetIwadNum())
{
@ -55,7 +55,7 @@ void InitDoomFonts()
OriginalSmallFont = new FFont("OriginalSmallFont", "FONTA%02u", "defsmallfont", HU_FONTSTART, HU_FONTSIZE, 1, -1, -1, false, true);
OriginalSmallFont->SetCursor('[');
}
else if (fileSystem.CheckNumForName("STCFN033", FileSys::ns_graphics) >= 0)
else if (fileSystem.CheckNumForName("STCFN033", ns_graphics) >= 0)
{
OriginalSmallFont = new FFont("OriginalSmallFont", "STCFN%.3d", "defsmallfont", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1, -1, false, true, true);
}
@ -63,7 +63,7 @@ void InitDoomFonts()
if (!(SmallFont2 = V_GetFont("SmallFont2"))) // Only used by Strife
{
if (fileSystem.CheckNumForName("STBFN033", FileSys::ns_graphics) >= 0)
if (fileSystem.CheckNumForName("STBFN033", ns_graphics) >= 0)
{
SmallFont2 = new FFont("SmallFont2", "STBFN%.3d", "defsmallfont2", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1);
}

View file

@ -941,7 +941,7 @@ void FMapInfoParser::ParseCluster()
// Remap Hexen's CLUS?MSG lumps to the string table, if applicable. The code here only checks what can actually be in an IWAD.
if (clusterinfo->flags & CLUSTER_EXITTEXTINLUMP)
{
int lump = fileSystem.CheckNumForFullName(clusterinfo->ExitText.GetChars(), true);
int lump = fileSystem.CheckNumForAnyName(clusterinfo->ExitText.GetChars());
if (lump > 0)
{
// Check if this comes from either Hexen.wad or Hexdd.wad and if so, map to the string table.
@ -2447,7 +2447,7 @@ void FMapInfoParser::ParseMapInfo (int lump, level_info_t &gamedefaults, level_i
if (sc.Compare("include"))
{
sc.MustGetString();
int inclump = fileSystem.CheckNumForFullName(sc.String, true);
int inclump = fileSystem.CheckNumForAnyName(sc.String);
if (inclump < 0)
{
sc.ScriptError("include file '%s' not found", sc.String);
@ -2725,7 +2725,7 @@ void G_ParseMapInfo (FString basemapinfo)
// If that exists we need to skip this one.
int wad = fileSystem.GetFileContainer(lump);
int altlump = fileSystem.CheckNumForName("ZMAPINFO", FileSys::ns_global, wad, true);
int altlump = fileSystem.CheckNumForName("ZMAPINFO", ns_global, wad, true);
if (altlump >= 0) continue;
}
@ -2733,9 +2733,9 @@ void G_ParseMapInfo (FString basemapinfo)
{
// MAPINFO and ZMAPINFO will override UMAPINFO if in the same WAD.
int wad = fileSystem.GetFileContainer(lump);
int altlump = fileSystem.CheckNumForName("ZMAPINFO", FileSys::ns_global, wad, true);
int altlump = fileSystem.CheckNumForName("ZMAPINFO", ns_global, wad, true);
if (altlump >= 0) continue;
altlump = fileSystem.CheckNumForName("MAPINFO", FileSys::ns_global, wad, true);
altlump = fileSystem.CheckNumForName("MAPINFO", ns_global, wad, true);
if (altlump >= 0) continue;
}
if (nindex != 2)

View file

@ -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.CheckNumForFullName(artpath.GetChars(), fileSystem.GetFileContainer(i));
lumpnum = fileSystem.CheckNumForFullNameInFile(artpath.GetChars(), fileSystem.GetFileContainer(i));
if (lumpnum < 0)
{
break;

View file

@ -314,7 +314,7 @@ void FParseContext::ParseLump(const char *lumpname)
const char *SavedSourceFile = SourceFile;
FParseToken token;
int lumpno = fileSystem.CheckNumForFullName(lumpname, true);
int lumpno = fileSystem.CheckNumForAnyName(lumpname);
if (lumpno == -1)
{

View file

@ -303,7 +303,7 @@ bool FIntermissionActionTextscreen::ParseKey(FScanner &sc)
{
sc.MustGetToken('=');
sc.MustGetToken(TK_StringConst);
int lump = fileSystem.CheckNumForFullName(sc.String, true);
int lump = fileSystem.CheckNumForAnyName(sc.String);
bool done = false;
if (lump > 0)
{
@ -861,7 +861,7 @@ DIntermissionController* F_StartFinale (const char *music, int musicorder, int c
FIntermissionActionTextscreen *textscreen = new FIntermissionActionTextscreen;
if (textInLump)
{
int lump = fileSystem.CheckNumForFullName(text, true);
int lump = fileSystem.CheckNumForAnyName(text);
if (lump > 0)
{
textscreen->mText = GetStringFromLump(lump);

View file

@ -520,7 +520,7 @@ void MapLoader::InitED()
FScanner sc;
if (filename.IsEmpty()) return;
int lump = fileSystem.CheckNumForFullName(filename.GetChars(), true, FileSys::ns_global);
int lump = fileSystem.CheckNumForAnyName(filename.GetChars(), ns_global);
if (lump == -1) return;
sc.OpenLumpNum(lump);

View file

@ -730,14 +730,14 @@ static int FindGLNodesInWAD(int labellump)
glheader.Format("GL_%s", fileSystem.GetFileName(labellump));
if (glheader.Len()<=8)
{
int gllabel = fileSystem.CheckNumForName(glheader.GetChars(), FileSys::ns_global, wadfile);
int gllabel = fileSystem.CheckNumForName(glheader.GetChars(), ns_global, wadfile);
if (gllabel >= 0) return gllabel;
}
else
{
// Before scanning the entire WAD directory let's check first whether
// it is necessary.
int gllabel = fileSystem.CheckNumForName("GL_LEVEL", FileSys::ns_global, wadfile);
int gllabel = fileSystem.CheckNumForName("GL_LEVEL", ns_global, wadfile);
if (gllabel >= 0)
{

View file

@ -54,8 +54,6 @@
#include "s_music.h"
#include "texturemanager.h"
using namespace FileSys;
static FRandom pr_script("FScript");
// functions. FParser::SF_ means Script Function not, well.. heh, me

View file

@ -1930,7 +1930,7 @@ void FBehaviorContainer::LoadDefaultModules ()
FScanner sc(lump);
while (sc.GetString())
{
int acslump = fileSystem.CheckNumForName (sc.String, FileSys::ns_acslibrary);
int acslump = fileSystem.CheckNumForName (sc.String, ns_acslibrary);
if (acslump >= 0)
{
LoadModule (acslump);
@ -2567,7 +2567,7 @@ bool FBehavior::Init(FLevelLocals *Level, int lumpnum, FileReader * fr, int len,
if (parse[i])
{
FBehavior *module = NULL;
int lump = fileSystem.CheckNumForName (&parse[i], FileSys::ns_acslibrary);
int lump = fileSystem.CheckNumForName (&parse[i], ns_acslibrary);
if (lump < 0)
{
Printf (TEXTCOLOR_RED "Could not find ACS library %s.\n", &parse[i]);

View file

@ -874,16 +874,16 @@ static int SetupCrouchSprite(AActor *self, int crouchsprite)
FString normspritename = sprites[self->SpawnState->sprite].name;
FString crouchspritename = sprites[crouchsprite].name;
int spritenorm = fileSystem.CheckNumForName((normspritename + "A1").GetChars(), FileSys::ns_sprites);
int spritenorm = fileSystem.CheckNumForName((normspritename + "A1").GetChars(), ns_sprites);
if (spritenorm == -1)
{
spritenorm = fileSystem.CheckNumForName((normspritename + "A0").GetChars(), FileSys::ns_sprites);
spritenorm = fileSystem.CheckNumForName((normspritename + "A0").GetChars(), ns_sprites);
}
int spritecrouch = fileSystem.CheckNumForName((crouchspritename + "A1").GetChars(), FileSys::ns_sprites);
int spritecrouch = fileSystem.CheckNumForName((crouchspritename + "A1").GetChars(), ns_sprites);
if (spritecrouch == -1)
{
spritecrouch = fileSystem.CheckNumForName((crouchspritename + "A0").GetChars(), FileSys::ns_sprites);
spritecrouch = fileSystem.CheckNumForName((crouchspritename + "A0").GetChars(), ns_sprites);
}
if (spritenorm == -1 || spritecrouch == -1)

View file

@ -104,11 +104,11 @@ void R_InitColormaps (bool allowCustomColormap)
for (uint32_t i = 0; i < NumLumps; i++)
{
if (fileSystem.GetFileNamespace(i) == FileSys::ns_colormaps)
if (fileSystem.GetFileNamespace(i) == ns_colormaps)
{
auto name = fileSystem.GetFileShortName(i);
if (fileSystem.CheckNumForName (name, FileSys::ns_colormaps) == (int)i)
if (fileSystem.CheckNumForName (name, ns_colormaps) == (int)i)
{
strncpy(cm.name, name, 8);
cm.blend = 0;

View file

@ -134,7 +134,7 @@ static void ParseVavoomSkybox()
sc.MustGetStringName("map");
sc.MustGetString();
maplump = fileSystem.CheckNumForFullName(sc.String, true);
maplump = fileSystem.CheckNumForAnyName(sc.String);
auto tex = TexMan.FindGameTexture(sc.String, ETextureType::Wall, FTextureManager::TEXMAN_TryAny);
if (tex == NULL)
@ -1928,7 +1928,7 @@ public:
{
sc.MustGetString();
// This is not using sc.Open because it can print a more useful error message when done here
lump = fileSystem.CheckNumForFullName(sc.String, true);
lump = fileSystem.CheckNumForAnyName(sc.String);
if (lump==-1)
sc.ScriptError("Lump '%s' not found", sc.String);

View file

@ -1050,7 +1050,7 @@ void ParseModelDefLump(int Lump)
{
sc.MustGetString();
// This is not using sc.Open because it can print a more useful error message when done here
int includelump = fileSystem.CheckNumForFullName(sc.String, true);
int includelump = fileSystem.CheckNumForAnyName(sc.String);
if (includelump == -1)
{
if (strcmp(sc.String, "sentinel.modl") != 0) // Gene Tech mod has a broken #include statement

View file

@ -783,7 +783,7 @@ void R_ParseTrnslate()
do
{
sc.MustGetToken(TK_StringConst);
int pallump = fileSystem.CheckNumForFullName(sc.String, true, FileSys::ns_global);
int pallump = fileSystem.CheckNumForAnyName(sc.String, ns_global);
if (pallump >= 0) //
{
int start = 0;

View file

@ -349,7 +349,7 @@ void R_InitSpriteDefs ()
memset(vhashes.Data(), -1, sizeof(VHasher)*vmax);
for (i = 0; i < vmax; ++i)
{
if (fileSystem.GetFileNamespace(i) == FileSys::ns_voxels)
if (fileSystem.GetFileNamespace(i) == ns_voxels)
{
size_t namelen;
int spin;
@ -715,7 +715,7 @@ void R_InitSkins (void)
int lump = fileSystem.CheckNumForName (sc.String, Skins[i].namespc);
if (lump == -1)
{
lump = fileSystem.CheckNumForFullName (sc.String, true, FileSys::ns_sounds);
lump = fileSystem.CheckNumForAnyName (sc.String, ns_sounds);
}
if (lump != -1)
{
@ -748,7 +748,7 @@ void R_InitSkins (void)
sndlumps[j] = fileSystem.CheckNumForName (sc.String, Skins[i].namespc);
if (sndlumps[j] == -1)
{ // Replacement not found, try finding it in the global namespace
sndlumps[j] = fileSystem.CheckNumForFullName (sc.String, true, FileSys::ns_sounds);
sndlumps[j] = fileSystem.CheckNumForAnyName (sc.String, ns_sounds);
}
}
}
@ -946,7 +946,7 @@ CCMD (skins)
static void R_CreateSkinTranslation (const char *palname)
{
auto lump = fileSystem.ReadFile (palname);
auto lump = fileSystem.ReadFile (fileSystem.GetNumForName(palname));
auto otherPal = lump.bytes();
for (int i = 0; i < 256; ++i)
@ -1016,7 +1016,7 @@ void R_InitSprites ()
Skins[i].range0end = basetype->IntVar(NAME_ColorRangeEnd);
Skins[i].Scale = basetype->Scale;
Skins[i].sprite = basetype->SpawnState->sprite;
Skins[i].namespc = FileSys::ns_global;
Skins[i].namespc = ns_global;
PlayerClasses[i].Skins.Push (i);

View file

@ -44,8 +44,6 @@
#include "m_png.h"
#include "v_colortables.h"
using namespace FileSys;
/* Current color blending values */
int BlendR, BlendG, BlendB, BlendA;
@ -64,7 +62,7 @@ void InitPalette ()
if (lump == -1) lump = fileSystem.CheckNumForName("COLORMAP", ns_colormaps);
if (lump != -1)
{
FileData cmap = fileSystem.ReadFile(lump);
auto cmap = fileSystem.ReadFile(lump);
auto cmapdata = cmap.bytes();
GPalette.GenerateGlobalBrightmapFromColormap(cmapdata, 32);
MakeGoodRemap((uint32_t*)GPalette.BaseColors, GPalette.Remap, cmapdata + 7936); // last entry in colormap

View file

@ -50,8 +50,6 @@
#include "g_level.h"
#include "r_data/sprites.h"
using namespace FileSys;
struct VoxelOptions
{
int DroppedSpin = 0;
@ -282,7 +280,7 @@ void R_InitVoxels()
sc.SetCMode(true);
sc.MustGetToken(TK_StringConst);
voxelfile = fileSystem.CheckNumForFullName(sc.String, true, ns_voxels);
voxelfile = fileSystem.CheckNumForAnyName(sc.String, ns_voxels);
if (voxelfile < 0)
{
sc.ScriptMessage("Voxel \"%s\" not found.\n", sc.String);

View file

@ -346,9 +346,9 @@ void SetDefaultColormap (const char *name)
uint8_t unremap[256];
uint8_t remap[256];
lump = fileSystem.CheckNumForFullName (name, true, FileSys::ns_colormaps);
lump = fileSystem.CheckNumForAnyName (name, ns_colormaps);
if (lump == -1)
lump = fileSystem.CheckNumForName (name, FileSys::ns_global);
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)

View file

@ -1282,7 +1282,7 @@ void ParseDecorate (FScanner &sc, PNamespace *ns)
// This check needs to remain overridable for testing purposes.
if (fileSystem.GetFileContainer(sc.LumpNum) == 0 && !Args->CheckParm("-allowdecoratecrossincludes"))
{
int includefile = fileSystem.GetFileContainer(fileSystem.CheckNumForFullName(sc.String, true));
int includefile = fileSystem.GetFileContainer(fileSystem.CheckNumForAnyName(sc.String));
if (includefile != 0)
{
I_FatalError("File %s is overriding core lump %s.",

View file

@ -51,8 +51,6 @@
#include "s_music.h"
#include "i_music.h"
using namespace FileSys;
// MACROS ------------------------------------------------------------------
#define RANDOM 1
@ -416,7 +414,7 @@ DEFINE_ACTION_FUNCTION(DObject,S_GetLength)
FSoundID S_AddSound (const char *logicalname, const char *lumpname, FScanner *sc)
{
int lump = fileSystem.CheckNumForFullName (lumpname, true, ns_sounds);
int lump = fileSystem.CheckNumForAnyName (lumpname, ns_sounds);
return S_AddSound (logicalname, lump);
}
@ -482,7 +480,7 @@ FSoundID S_AddPlayerSound (const char *pclass, int gender, FSoundID refid, const
if (lumpname)
{
lump = fileSystem.CheckNumForFullName (lumpname, true, ns_sounds);
lump = fileSystem.CheckNumForAnyName (lumpname, ns_sounds);
}
return S_AddPlayerSound (pclass, gender, refid, lump);
@ -1071,7 +1069,7 @@ static void S_AddSNDINFO (int lump)
FName mapped = sc.String;
// only set the alias if the lump it maps to exists.
if (mapped == NAME_None || fileSystem.CheckNumForFullName(sc.String, true, ns_music) >= 0)
if (mapped == NAME_None || fileSystem.CheckNumForAnyName(sc.String, ns_music) >= 0)
{
MusicAliases[alias] = mapped;
}

View file

@ -186,7 +186,7 @@ static FString LookupMusic(const char* musicname, int& order)
static int FindMusic(const char* musicname)
{
int lumpnum = fileSystem.CheckNumForFullName(musicname);
if (lumpnum == -1) lumpnum = fileSystem.CheckNumForName(musicname, FileSys::ns_music);
if (lumpnum == -1) lumpnum = fileSystem.CheckNumForName(musicname, ns_music);
return lumpnum;
}
@ -295,7 +295,7 @@ void S_Start()
if (LocalSndInfo.IsNotEmpty())
{
// Now parse the local SNDINFO
int j = fileSystem.CheckNumForFullName(LocalSndInfo.GetChars(), true);
int j = fileSystem.CheckNumForAnyName(LocalSndInfo.GetChars());
if (j >= 0) S_AddLocalSndInfo(j);
}
@ -309,7 +309,7 @@ void S_Start()
if (parse_ss)
{
S_ParseSndSeq(LocalSndSeq.IsNotEmpty() ? fileSystem.CheckNumForFullName(LocalSndSeq.GetChars(), true) : -1);
S_ParseSndSeq(LocalSndSeq.IsNotEmpty() ? fileSystem.CheckNumForAnyName(LocalSndSeq.GetChars()) : -1);
}
LastLocalSndInfo = LocalSndInfo;

View file

@ -517,7 +517,7 @@ bool DInterBackground::LoadBackground(bool isenterpic)
{
try
{
int lumpnum = fileSystem.CheckNumForFullName(lumpname, true);
int lumpnum = fileSystem.CheckNumForAnyName(lumpname);
if (lumpnum == -1)
{
I_Error("Intermission animation lump %s not found!", lumpname);
@ -757,7 +757,7 @@ bool DInterBackground::LoadBackground(bool isenterpic)
}
else
{
int lumpnum = fileSystem.CheckNumForFullName(lumpname + 1, true);
int lumpnum = fileSystem.CheckNumForAnyName(lumpname + 1);
if (lumpnum >= 0)
{
FScanner sc(lumpnum);