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
commit 634a646c2d
51 changed files with 118 additions and 122 deletions

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);