From 524df20d269a2d6834422aec82b16e0ef8db33c9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 31 Dec 2022 15:14:29 +0100 Subject: [PATCH] - renamed most local picnum variables in shaded code to reduce search noise. --- source/core/defparser.cpp | 16 ++++----- source/core/precache.cpp | 2 +- source/core/rendering/scene/hw_drawstructs.h | 2 +- source/core/savegamehelp.cpp | 4 +-- source/core/textures/hightile.cpp | 36 ++++++++++---------- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/source/core/defparser.cpp b/source/core/defparser.cpp index 975cf8a4e..ea9eba6f6 100644 --- a/source/core/defparser.cpp +++ b/source/core/defparser.cpp @@ -50,9 +50,9 @@ #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 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; - auto tex = tbuild->tile[picnum].tileimage; + auto tex = tbuild->tile[tilenum].tileimage; 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 } FTextureID texid = TexMan.CheckForTexture(filename, ETextureType::Any, FTextureManager::TEXMAN_ForceLookup); 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; } - tileSetHightileReplacement(picnum, palnum, texid, alphacut, xscale, yscale, specpower, specfactor, indexed); + tileSetHightileReplacement(tilenum, palnum, texid, alphacut, xscale, yscale, specpower, specfactor, indexed); return 0; } diff --git a/source/core/precache.cpp b/source/core/precache.cpp index 37c7b2a82..af32529d8 100644 --- a/source/core/precache.cpp +++ b/source/core/precache.cpp @@ -67,7 +67,7 @@ static void doprecache(FTextureID texid, int palette) auto tex = TexMan.GetGameTexture(texid); 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) { diff --git a/source/core/rendering/scene/hw_drawstructs.h b/source/core/rendering/scene/hw_drawstructs.h index 893b85848..3f4edb4c8 100644 --- a/source/core/rendering/scene/hw_drawstructs.h +++ b/source/core/rendering/scene/hw_drawstructs.h @@ -384,7 +384,7 @@ inline float sectorVisibility(sectortype* sec) 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) { diff --git a/source/core/savegamehelp.cpp b/source/core/savegamehelp.cpp index 7590dec26..1d1563acd 100644 --- a/source/core/savegamehelp.cpp +++ b/source/core/savegamehelp.cpp @@ -552,8 +552,8 @@ FSerializer &Serialize(FSerializer &arc, const char *key, walltype &c, walltype ("nextwall", c.nextwall, def->nextwall) ("nextsector", c.nextsector, def->nextsector) ("cstat", c.cstat, def->cstat) - ("picnum", c.walltexture, def->walltexture) - ("overpicnum", c.overtexture, def->overtexture) + ("texture", c.walltexture, def->walltexture) + ("overtexture", c.overtexture, def->overtexture) ("shade", c.shade, def->shade) ("pal", c.pal, def->pal) ("xrepeat", c.xrepeat, def->xrepeat) diff --git a/source/core/textures/hightile.cpp b/source/core/textures/hightile.cpp index a4de25d19..0c1757803 100644 --- a/source/core/textures/hightile.cpp +++ b/source/core/textures/hightile.cpp @@ -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) { 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; for (;;) { @@ -142,18 +142,18 @@ static HightileReplacement* FindReplacement(FTextureID picnum, int palnum, bool return nullptr; // no replacement found } -int checkTranslucentReplacement(FTextureID picnum, int pal) +int checkTranslucentReplacement(FTextureID texid, int pal) { FGameTexture* tex = nullptr; - auto si = FindReplacement(picnum, pal, 0); + auto si = FindReplacement(texid, pal, 0); if (si && hw_hightile) tex = si->image; if (!tex || tex->GetTexelWidth() == 0 || tex->GetTexelHeight() == 0) return false; 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; 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. HightileReplacement replace = {}; @@ -263,7 +263,7 @@ int tileSetHightileReplacement(int picnum, int palnum, FTextureID texid, float a replace.issky = 0; replace.indexed = indexed; replace.palnum = (uint16_t)palnum; - AddReplacement(picnum, replace); + AddReplacement(tilenum, replace); 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; - auto tex = tileGetTexture(picnum); + auto tex = tileGetTexture(tilenum); 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 } 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); 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; } faces[i] = TexMan.GetGameTexture(texid); @@ -307,7 +307,7 @@ int tileSetSkybox(int picnum, int palnum, FString* facenames, bool indexed) replace.issky = 1; replace.indexed = indexed; replace.palnum = (uint16_t)palnum; - AddReplacement(picnum, replace); + AddReplacement(tilenum, replace); return 0; }