- renamed most local picnum variables in shaded code to reduce search noise.

This commit is contained in:
Christoph Oelckers 2022-12-31 15:14:29 +01:00
parent 5df33ae089
commit 524df20d26
5 changed files with 30 additions and 30 deletions

View file

@ -50,9 +50,9 @@
#include "texturemanager.h" #include "texturemanager.h"
int tileSetHightileReplacement(int picnum, int palnum, FTextureID texid, float alphacut, float xscale, float yscale, float specpower, float specfactor, bool indexed); int tileSetHightileReplacement(int tilenum, int palnum, FTextureID texid, float alphacut, float xscale, float yscale, float specpower, float specfactor, bool indexed);
int tileSetSkybox(int picnum, int palnum, FString* facenames, bool indexed = false); int tileSetSkybox(int tilenum, int palnum, FString* facenames, bool indexed = false);
void tileRemoveReplacement(int num); void tileRemoveReplacement(int num);
void AddUserMapHack(const FString& title, const FString& mhkfile, uint8_t* md4); void AddUserMapHack(const FString& title, const FString& mhkfile, uint8_t* md4);
@ -129,26 +129,26 @@ bool ValidateTilenum(const char* cmd, int tile, FScriptPosition pos)
// //
//=========================================================================== //===========================================================================
static int tileSetHightileReplacement(FScanner& sc, int picnum, int palnum, const char* filename, float alphacut, float xscale, float yscale, float specpower, float specfactor, bool indexed = false) static int tileSetHightileReplacement(FScanner& sc, int tilenum, int palnum, const char* filename, float alphacut, float xscale, float yscale, float specpower, float specfactor, bool indexed = false)
{ {
if ((uint32_t)picnum >= (uint32_t)MAXTILES) return -1; if ((uint32_t)tilenum >= (uint32_t)MAXTILES) return -1;
if ((uint32_t)palnum >= (uint32_t)MAXPALOOKUPS) return -1; if ((uint32_t)palnum >= (uint32_t)MAXPALOOKUPS) return -1;
auto tex = tbuild->tile[picnum].tileimage; auto tex = tbuild->tile[tilenum].tileimage;
if (tex == nullptr || tex->GetWidth() <= 0 || tex->GetHeight() <= 0) if (tex == nullptr || tex->GetWidth() <= 0 || tex->GetHeight() <= 0)
{ {
sc.ScriptMessage("Warning: defined hightile replacement for empty tile %d.", picnum); sc.ScriptMessage("Warning: defined hightile replacement for empty tile %d.", tilenum);
return -1; // cannot add replacements to empty tiles, must create one beforehand return -1; // cannot add replacements to empty tiles, must create one beforehand
} }
FTextureID texid = TexMan.CheckForTexture(filename, ETextureType::Any, FTextureManager::TEXMAN_ForceLookup); FTextureID texid = TexMan.CheckForTexture(filename, ETextureType::Any, FTextureManager::TEXMAN_ForceLookup);
if (!texid.isValid()) if (!texid.isValid())
{ {
sc.ScriptMessage("%s: Replacement for tile %d does not exist or is invalid\n", filename, picnum); sc.ScriptMessage("%s: Replacement for tile %d does not exist or is invalid\n", filename, tilenum);
return -1; return -1;
} }
tileSetHightileReplacement(picnum, palnum, texid, alphacut, xscale, yscale, specpower, specfactor, indexed); tileSetHightileReplacement(tilenum, palnum, texid, alphacut, xscale, yscale, specpower, specfactor, indexed);
return 0; return 0;
} }

View file

@ -67,7 +67,7 @@ static void doprecache(FTextureID texid, int palette)
auto tex = TexMan.GetGameTexture(texid); auto tex = TexMan.GetGameTexture(texid);
PrecacheTex(tex, palid); PrecacheTex(tex, palid);
int const mid = -1;// hw_models ? modelManager.CheckModel(picnum, palette) : -1; int const mid = -1;// hw_models ? modelManager.CheckModel(texid, palette) : -1;
if (mid < 0) if (mid < 0)
{ {

View file

@ -384,7 +384,7 @@ inline float sectorVisibility(sectortype* sec)
inline const float hw_density = 0.35f; inline const float hw_density = 0.35f;
int checkTranslucentReplacement(FTextureID picnum, int pal); int checkTranslucentReplacement(FTextureID texid, int pal);
inline bool maskWallHasTranslucency(const walltype* wall) inline bool maskWallHasTranslucency(const walltype* wall)
{ {

View file

@ -552,8 +552,8 @@ FSerializer &Serialize(FSerializer &arc, const char *key, walltype &c, walltype
("nextwall", c.nextwall, def->nextwall) ("nextwall", c.nextwall, def->nextwall)
("nextsector", c.nextsector, def->nextsector) ("nextsector", c.nextsector, def->nextsector)
("cstat", c.cstat, def->cstat) ("cstat", c.cstat, def->cstat)
("picnum", c.walltexture, def->walltexture) ("texture", c.walltexture, def->walltexture)
("overpicnum", c.overtexture, def->overtexture) ("overtexture", c.overtexture, def->overtexture)
("shade", c.shade, def->shade) ("shade", c.shade, def->shade)
("pal", c.pal, def->pal) ("pal", c.pal, def->pal)
("xrepeat", c.xrepeat, def->xrepeat) ("xrepeat", c.xrepeat, def->xrepeat)

View file

@ -95,9 +95,9 @@ void FontCharCreated(FGameTexture* base, FGameTexture* glyph)
// //
//=========================================================================== //===========================================================================
static void AddReplacement(int picnum, const HightileReplacement& replace) static void AddReplacement(int tilenum, const HightileReplacement& replace)
{ {
auto& Hightiles = tileReplacements[picnum]; auto& Hightiles = tileReplacements[tilenum];
for (auto& ht : Hightiles) for (auto& ht : Hightiles)
{ {
if (replace.palnum == ht.palnum && replace.issky == ht.issky) if (replace.palnum == ht.palnum && replace.issky == ht.issky)
@ -115,9 +115,9 @@ static void AddReplacement(int picnum, const HightileReplacement& replace)
// //
//========================================================================== //==========================================================================
void tileRemoveReplacement(int picnum) void tileRemoveReplacement(int tilenum)
{ {
tileReplacements.Remove(picnum); tileReplacements.Remove(tilenum);
} }
//=========================================================================== //===========================================================================
@ -126,9 +126,9 @@ void tileRemoveReplacement(int picnum)
// //
//=========================================================================== //===========================================================================
static HightileReplacement* FindReplacement(FTextureID picnum, int palnum, bool skybox) static HightileReplacement* FindReplacement(FTextureID texid, int palnum, bool skybox)
{ {
auto Hightiles = textureReplacements.CheckKey(picnum.GetIndex()); auto Hightiles = textureReplacements.CheckKey(texid.GetIndex());
if (!Hightiles) return nullptr; if (!Hightiles) return nullptr;
for (;;) for (;;)
{ {
@ -142,18 +142,18 @@ static HightileReplacement* FindReplacement(FTextureID picnum, int palnum, bool
return nullptr; // no replacement found return nullptr; // no replacement found
} }
int checkTranslucentReplacement(FTextureID picnum, int pal) int checkTranslucentReplacement(FTextureID texid, int pal)
{ {
FGameTexture* tex = nullptr; FGameTexture* tex = nullptr;
auto si = FindReplacement(picnum, pal, 0); auto si = FindReplacement(texid, pal, 0);
if (si && hw_hightile) tex = si->image; if (si && hw_hightile) tex = si->image;
if (!tex || tex->GetTexelWidth() == 0 || tex->GetTexelHeight() == 0) return false; if (!tex || tex->GetTexelWidth() == 0 || tex->GetTexelHeight() == 0) return false;
return tex && tex->GetTranslucency(); return tex && tex->GetTranslucency();
} }
FGameTexture* SkyboxReplacement(FTextureID picnum, int palnum) FGameTexture* SkyboxReplacement(FTextureID texid, int palnum)
{ {
auto hr = FindReplacement(picnum, palnum, true); auto hr = FindReplacement(texid, palnum, true);
if (!hr) return nullptr; if (!hr) return nullptr;
return hr->image; return hr->image;
} }
@ -251,7 +251,7 @@ void highTileSetup()
// //
//========================================================================== //==========================================================================
int tileSetHightileReplacement(int picnum, int palnum, FTextureID texid, float alphacut, float xscale, float yscale, float specpower, float specfactor, bool indexed) int tileSetHightileReplacement(int tilenum, int palnum, FTextureID texid, float alphacut, float xscale, float yscale, float specpower, float specfactor, bool indexed)
{ {
// assumes the texture was already validated. // assumes the texture was already validated.
HightileReplacement replace = {}; HightileReplacement replace = {};
@ -263,7 +263,7 @@ int tileSetHightileReplacement(int picnum, int palnum, FTextureID texid, float a
replace.issky = 0; replace.issky = 0;
replace.indexed = indexed; replace.indexed = indexed;
replace.palnum = (uint16_t)palnum; replace.palnum = (uint16_t)palnum;
AddReplacement(picnum, replace); AddReplacement(tilenum, replace);
return 0; return 0;
} }
@ -274,15 +274,15 @@ int tileSetHightileReplacement(int picnum, int palnum, FTextureID texid, float a
// //
//========================================================================== //==========================================================================
int tileSetSkybox(int picnum, int palnum, FString* facenames, bool indexed) int tileSetSkybox(int tilenum, int palnum, FString* facenames, bool indexed)
{ {
if ((uint32_t)picnum >= (uint32_t)MAXTILES) return -1; if ((uint32_t)tilenum >= (uint32_t)MAXTILES) return -1;
if ((uint32_t)palnum >= (uint32_t)MAXPALOOKUPS) return -1; if ((uint32_t)palnum >= (uint32_t)MAXPALOOKUPS) return -1;
auto tex = tileGetTexture(picnum); auto tex = tileGetTexture(tilenum);
if (tex->GetTexelWidth() <= 0 || tex->GetTexelHeight() <= 0) if (tex->GetTexelWidth() <= 0 || tex->GetTexelHeight() <= 0)
{ {
Printf("Warning: defined skybox replacement for empty tile %d.", picnum); Printf("Warning: defined skybox replacement for empty tile %d.", tilenum);
return -1; // cannot add replacements to empty tiles, must create one beforehand return -1; // cannot add replacements to empty tiles, must create one beforehand
} }
HightileReplacement replace = {}; HightileReplacement replace = {};
@ -293,7 +293,7 @@ int tileSetSkybox(int picnum, int palnum, FString* facenames, bool indexed)
FTextureID texid = TexMan.CheckForTexture(facenames[i], ETextureType::Any, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ForceLookup); FTextureID texid = TexMan.CheckForTexture(facenames[i], ETextureType::Any, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ForceLookup);
if (!texid.isValid()) if (!texid.isValid())
{ {
Printf("%s: Skybox image for tile %d does not exist or is invalid\n", facenames[i].GetChars(), picnum); Printf("%s: Skybox image for tile %d does not exist or is invalid\n", facenames[i].GetChars(), tilenum);
return -1; return -1;
} }
faces[i] = TexMan.GetGameTexture(texid); faces[i] = TexMan.GetGameTexture(texid);
@ -307,7 +307,7 @@ int tileSetSkybox(int picnum, int palnum, FString* facenames, bool indexed)
replace.issky = 1; replace.issky = 1;
replace.indexed = indexed; replace.indexed = indexed;
replace.palnum = (uint16_t)palnum; replace.palnum = (uint16_t)palnum;
AddReplacement(picnum, replace); AddReplacement(tilenum, replace);
return 0; return 0;
} }