Skip to content

Commit

Permalink
Renamed FTextureManager::GetTexture to GetTextureID
Browse files Browse the repository at this point in the history
It doesn't return a texture after all and I want to repurpose the name for something else.
  • Loading branch information
coelckers committed Dec 7, 2018
1 parent 3491182 commit 9fedecb
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/c_cmds.cpp
Expand Up @@ -1052,7 +1052,7 @@ CCMD(changesky)
sky1name = argv[1];
if (sky1name[0] != 0)
{
FTextureID newsky = TexMan.GetTexture(sky1name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
FTextureID newsky = TexMan.GetTextureID(sky1name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
if (newsky.Exists())
{
sky1texture = level.skytexture1 = newsky;
Expand Down
2 changes: 1 addition & 1 deletion src/c_console.cpp
Expand Up @@ -555,7 +555,7 @@ void C_InitConback()

if (!conback.isValid())
{
conback = TexMan.GetTexture (gameinfo.TitlePage, ETextureType::MiscPatch);
conback = TexMan.GetTextureID (gameinfo.TitlePage, ETextureType::MiscPatch);
conshade = MAKEARGB(175,0,0,0);
conline = true;
}
Expand Down
8 changes: 4 additions & 4 deletions src/fragglescript/t_func.cpp
Expand Up @@ -1892,7 +1892,7 @@ void FParser::SF_FloorTexture(void)
if(t_argc > 1)
{
int i = -1;
FTextureID picnum = TexMan.GetTexture(t_argv[1].string, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
FTextureID picnum = TexMan.GetTextureID(t_argv[1].string, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);

// set all sectors with tag
FSSectorTagIterator itr(tagnum);
Expand Down Expand Up @@ -1982,7 +1982,7 @@ void FParser::SF_CeilingTexture(void)
if(t_argc > 1)
{
int i = -1;
FTextureID picnum = TexMan.GetTexture(t_argv[1].string, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
FTextureID picnum = TexMan.GetTextureID(t_argv[1].string, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);

// set all sectors with tag
FSSectorTagIterator itr(tagnum);
Expand Down Expand Up @@ -2235,7 +2235,7 @@ void FParser::SF_SetLineTexture(void)
position=3-position;

texture = stringvalue(t_argv[3]);
texturenum = TexMan.GetTexture(texture, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
texturenum = TexMan.GetTextureID(texture, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);

FLineIdIterator itr(tag);
while ((i = itr.Next()) >= 0)
Expand All @@ -2252,7 +2252,7 @@ void FParser::SF_SetLineTexture(void)
}
else // and an improved legacy version
{
FTextureID picnum = TexMan.GetTexture(t_argv[1].string, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
FTextureID picnum = TexMan.GetTextureID(t_argv[1].string, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
side = !!intvalue(t_argv[2]);
int sections = intvalue(t_argv[3]);

Expand Down
2 changes: 1 addition & 1 deletion src/fragglescript/t_load.cpp
Expand Up @@ -189,7 +189,7 @@ void FScriptLoader::ParseInfoCmd(char *line, FString &scriptsrc)
sc.MustGetStringName("=");
sc.MustGetString();

sky2texture = sky1texture = level.skytexture1 = level.skytexture2 = TexMan.GetTexture (sc.String, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
sky2texture = sky1texture = level.skytexture1 = level.skytexture2 = TexMan.GetTextureID (sc.String, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
R_InitSkyMap ();
}
else if (sc.Compare("interpic"))
Expand Down
6 changes: 3 additions & 3 deletions src/g_level.cpp
Expand Up @@ -968,7 +968,7 @@ void G_DoLoadLevel (int position, bool autosave, bool newGame)
// a flat. The data is in the WAD only because
// we look for an actual index, instead of simply
// setting one.
skyflatnum = TexMan.GetTexture (gameinfo.SkyFlatName, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
skyflatnum = TexMan.GetTextureID (gameinfo.SkyFlatName, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);

// DOOM determines the sky texture to be used
// depending on the current episode and the game version.
Expand Down Expand Up @@ -1455,8 +1455,8 @@ void G_InitLevelLocals ()
level.info = info;
level.skyspeed1 = info->skyspeed1;
level.skyspeed2 = info->skyspeed2;
level.skytexture1 = TexMan.GetTexture(info->SkyPic1, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
level.skytexture2 = TexMan.GetTexture(info->SkyPic2, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
level.skytexture1 = TexMan.GetTextureID(info->SkyPic1, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
level.skytexture2 = TexMan.GetTextureID(info->SkyPic2, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
level.fadeto = info->fadeto;
level.cdtrack = info->cdtrack;
level.cdid = info->cdid;
Expand Down
8 changes: 4 additions & 4 deletions src/p_acs.cpp
Expand Up @@ -3747,7 +3747,7 @@ void DLevelScript::ChangeFlat (int tag, int name, bool floorOrCeiling)
if (flatname == NULL)
return;

flat = TexMan.GetTexture (flatname, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
flat = TexMan.GetTextureID(flatname, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);

FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0)
Expand Down Expand Up @@ -3779,7 +3779,7 @@ void DLevelScript::SetLineTexture (int lineid, int side, int position, int name)

side = !!side;

texture = TexMan.GetTexture (texname, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
texture = TexMan.GetTextureID(texname, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);

FLineIdIterator itr(lineid);
while ((linenum = itr.Next()) >= 0)
Expand Down Expand Up @@ -9865,11 +9865,11 @@ int DLevelScript::RunScript ()
sky2name = FBehavior::StaticLookupString (STACK(1));
if (sky1name[0] != 0)
{
sky1texture = level.skytexture1 = TexMan.GetTexture (sky1name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
sky1texture = level.skytexture1 = TexMan.GetTextureID(sky1name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
}
if (sky2name[0] != 0)
{
sky2texture = level.skytexture2 = TexMan.GetTexture (sky2name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
sky2texture = level.skytexture2 = TexMan.GetTextureID(sky2name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
}
R_InitSkyMap ();
sp -= 2;
Expand Down
8 changes: 4 additions & 4 deletions src/p_sectors.cpp
Expand Up @@ -1397,8 +1397,8 @@ void P_ReplaceTextures(const char *fromname, const char *toname, int flags)

if ((flags ^ (NOT_BOTTOM | NOT_MIDDLE | NOT_TOP)) != 0)
{
picnum1 = TexMan.GetTexture(fromname, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture(toname, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
picnum1 = TexMan.GetTextureID(fromname, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTextureID(toname, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);

for (auto &side : level.sides)
{
Expand All @@ -1414,8 +1414,8 @@ void P_ReplaceTextures(const char *fromname, const char *toname, int flags)
}
if ((flags ^ (NOT_FLOOR | NOT_CEILING)) != 0)
{
picnum1 = TexMan.GetTexture(fromname, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture(toname, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
picnum1 = TexMan.GetTextureID(fromname, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTextureID(toname, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);

for (auto &sec : level.sectors)
{
Expand Down
2 changes: 1 addition & 1 deletion src/r_data/gldefs.cpp
Expand Up @@ -977,7 +977,7 @@ class GLDefsParser
sc.MustGetString();
if (facecount<6)
{
sb->faces[facecount] = TexMan[TexMan.GetTexture(sc.String, ETextureType::Wall, FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_Overridable)];
sb->faces[facecount] = TexMan[TexMan.GetTextureID(sc.String, ETextureType::Wall, FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_Overridable)];
}
facecount++;
}
Expand Down
2 changes: 1 addition & 1 deletion src/serializer.cpp
Expand Up @@ -1545,7 +1545,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FTextureID &value, FTe
assert(nameval.IsString() && typeval.IsInt());
if (nameval.IsString() && typeval.IsInt())
{
value = TexMan.GetTexture(UnicodeToString(nameval.GetString()), static_cast<ETextureType>(typeval.GetInt()));
value = TexMan.GetTextureID(UnicodeToString(nameval.GetString()), static_cast<ETextureType>(typeval.GetInt()));
}
else
{
Expand Down
1 change: 1 addition & 0 deletions src/textures/texture.cpp
Expand Up @@ -1211,3 +1211,4 @@ void FTexCoordInfo::GetFromTexture(FTexture *tex, float x, float y)
mWorldPanning = tex->bWorldPanning;
mWidth = tex->GetWidth();
}

2 changes: 1 addition & 1 deletion src/textures/texturemanager.cpp
Expand Up @@ -329,7 +329,7 @@ int FTextureManager::ListTextures (const char *name, TArray<FTextureID> &list, b
//
//==========================================================================

FTextureID FTextureManager::GetTexture (const char *name, ETextureType usetype, BITFIELD flags)
FTextureID FTextureManager::GetTextureID (const char *name, ETextureType usetype, BITFIELD flags)
{
FTextureID i;

Expand Down
11 changes: 8 additions & 3 deletions src/textures/textures.h
Expand Up @@ -298,6 +298,11 @@ class FTexture
bool isFullbright() const { return bFullbright; }
void CreateDefaultBrightmap();
bool FindHoles(const unsigned char * buffer, int w, int h);
uint64_t CacheID()
{
// Just a temporary placeholder. This needs to be done differently as things progress.
return (uint64_t)(intptr_t)GetRedirect();
}

public:
static void FlipSquareBlock (uint8_t *block, int x, int y);
Expand Down Expand Up @@ -562,7 +567,7 @@ class FTextureManager
}
FTexture *operator[] (const char *texname)
{
FTextureID texnum = GetTexture (texname, ETextureType::MiscPatch);
FTextureID texnum = GetTextureID (texname, ETextureType::MiscPatch);
if (!texnum.Exists()) return NULL;
return Textures[texnum.GetIndex()].Texture;
}
Expand All @@ -586,7 +591,7 @@ class FTextureManager
}
FTexture *operator() (const char *texname)
{
FTextureID texnum = GetTexture (texname, ETextureType::MiscPatch);
FTextureID texnum = GetTextureID (texname, ETextureType::MiscPatch);
if (texnum.texnum == -1) return NULL;
return Textures[Translation[texnum.texnum]].Texture;
}
Expand Down Expand Up @@ -621,7 +626,7 @@ class FTextureManager
};

FTextureID CheckForTexture (const char *name, ETextureType usetype, BITFIELD flags=TEXMAN_TryAny);
FTextureID GetTexture (const char *name, ETextureType usetype, BITFIELD flags=0);
FTextureID GetTextureID (const char *name, ETextureType usetype, BITFIELD flags=0);
int ListTextures (const char *name, TArray<FTextureID> &list, bool listall = false);

void AddTexturesLump (const void *lumpdata, int lumpsize, int deflumpnum, int patcheslump, int firstdup=0, bool texture1=false);
Expand Down
2 changes: 1 addition & 1 deletion src/wi_stuff.cpp
Expand Up @@ -516,7 +516,7 @@ bool DInterBackground::LoadBackground(bool isenterpic)
else
{
Printf("Intermission script %s not found!\n", lumpname + 1);
texture = TexMan.GetTexture("INTERPIC", ETextureType::MiscPatch);
texture = TexMan.GetTextureID("INTERPIC", ETextureType::MiscPatch);
}
}
background = TexMan[texture];
Expand Down

0 comments on commit 9fedecb

Please sign in to comment.