diff --git a/src/am_map.cpp b/src/am_map.cpp index 932ec42edba..4357136ebda 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -1194,7 +1194,7 @@ static void AM_ScrollParchment (double dmapx, double dmapy) if (mapback.isValid()) { - FTexture *backtex = TexMan[mapback]; + FTexture *backtex = TexMan.GetTexture(mapback); if (backtex != NULL) { @@ -1689,7 +1689,7 @@ void AM_clearFB (const AMColor &color) } else { - FTexture *backtex = TexMan[mapback]; + FTexture *backtex = TexMan.GetTexture(mapback); if (backtex != NULL) { int pwidth = backtex->GetDisplayWidth(); @@ -3189,7 +3189,7 @@ void AM_drawAuthorMarkers () spriteframe_t *sprframe = &SpriteFrames[tex->GetRotations()]; picnum = sprframe->Texture[0]; flip = sprframe->Flip & 1; - tex = TexMan[picnum]; + tex = TexMan.GetTexture(picnum); } } else @@ -3204,7 +3204,7 @@ void AM_drawAuthorMarkers () spriteframe_t *sprframe = &SpriteFrames[sprdef->spriteframes + mark->frame]; picnum = sprframe->Texture[0]; flip = sprframe->Flip & 1; - tex = TexMan[picnum]; + tex = TexMan.GetTexture(picnum); } } FActorIterator it (mark->args[0]); diff --git a/src/c_console.cpp b/src/c_console.cpp index b5f1a3cb252..caea2a741dd 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -1083,7 +1083,7 @@ void C_DrawConsole () else if (ConBottom) { int visheight; - FTexture *conpic = TexMan[conback]; + FTexture *conpic = TexMan.GetTexture(conback); visheight = ConBottom; diff --git a/src/d_main.cpp b/src/d_main.cpp index 3f503683165..b4f4c5b35ba 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -856,7 +856,7 @@ void D_Display () D_DrawIcon = NULL; if (picnum.isValid()) { - FTexture *tex = TexMan[picnum]; + FTexture *tex = TexMan.GetTexture(picnum); screen->DrawTexture (tex, 160 - tex->GetDisplayWidth()/2, 100 - tex->GetDisplayHeight()/2, DTA_320x200, true, TAG_DONE); } diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 579201a3ad0..87858f91f0a 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -1903,7 +1903,7 @@ void FParser::SF_FloorTexture(void) } t_return.type = svt_string; - FTexture * tex = TexMan[sector->GetTexture(sector_t::floor)]; + FTexture * tex = TexMan.GetTexture(sector->GetTexture(sector_t::floor)); t_return.string = tex? tex->GetName() : ""; } } @@ -1993,7 +1993,7 @@ void FParser::SF_CeilingTexture(void) } t_return.type = svt_string; - FTexture * tex = TexMan[sector->GetTexture(sector_t::ceiling)]; + FTexture * tex = TexMan.GetTexture(sector->GetTexture(sector_t::ceiling)); t_return.string = tex? tex->GetName() : ""; } } diff --git a/src/g_shared/a_decals.cpp b/src/g_shared/a_decals.cpp index 7837ade7460..09110bf75bc 100644 --- a/src/g_shared/a_decals.cpp +++ b/src/g_shared/a_decals.cpp @@ -262,7 +262,7 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, double x, double y, F3DFloor * else return FNullTextureID(); CalcFracPos (wall, x, y); - FTexture *texture = TexMan[tex]; + FTexture *texture = TexMan.GetTexture(tex); if (texture == NULL || texture->allowNoDecals()) { @@ -492,7 +492,7 @@ void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, double x, doub GetWallStuff (wall, v1, ldx, ldy); rorg = Length (x - v1->fX(), y - v1->fY()); - if ((tex = TexMan[PicNum]) == NULL) + if ((tex = TexMan.GetTexture(PicNum)) == NULL) { return; } diff --git a/src/g_shared/a_dynlight.cpp b/src/g_shared/a_dynlight.cpp index 3434d73af60..64d294aab92 100644 --- a/src/g_shared/a_dynlight.cpp +++ b/src/g_shared/a_dynlight.cpp @@ -937,7 +937,7 @@ CCMD(listlights) if (dl->target) { FTextureID spr = sprites[dl->target->sprite].GetSpriteFrame(dl->target->frame, 0, 0., nullptr); - Printf(", frame = %s ", TexMan[spr]->GetName().GetChars()); + Printf(", frame = %s ", TexMan.GetTexture(spr)->GetName().GetChars()); } diff --git a/src/g_statusbar/sbar_mugshot.cpp b/src/g_statusbar/sbar_mugshot.cpp index 950438f2173..cf3c1f00958 100644 --- a/src/g_statusbar/sbar_mugshot.cpp +++ b/src/g_statusbar/sbar_mugshot.cpp @@ -96,7 +96,7 @@ FTexture *FMugShotFrame::GetTexture(const char *default_face, const char *skin_f } sprite.UnlockBuffer(); } - return TexMan[TexMan.CheckForTexture(sprite, ETextureType::Any, FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_AllowSkins)]; + return TexMan.GetTexture(TexMan.CheckForTexture(sprite, ETextureType::Any, FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_AllowSkins)); } //=========================================================================== diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index 37d30d176e0..1ed349d3a4e 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -203,7 +203,7 @@ void ST_LoadCrosshair(bool alwaysload) } } CrosshairNum = num; - CrosshairImage = TexMan[texid]; + CrosshairImage = TexMan.GetTexture(texid); } //--------------------------------------------------------------------------- diff --git a/src/hu_scores.cpp b/src/hu_scores.cpp index 435acc8f012..c9ed444aff5 100644 --- a/src/hu_scores.cpp +++ b/src/hu_scores.cpp @@ -209,7 +209,7 @@ void HU_GetPlayerWidths(int &maxnamewidth, int &maxscorewidth, int &maxiconheigh } if (players[i].mo->ScoreIcon.isValid()) { - FTexture *pic = TexMan[players[i].mo->ScoreIcon]; + FTexture *pic = TexMan.GetTexture(players[i].mo->ScoreIcon); width = pic->GetDisplayWidth() - pic->GetDisplayLeftOffset() + 2; if (width > maxscorewidth) { @@ -422,7 +422,7 @@ static void HU_DrawPlayer (player_t *player, bool highlight, int col1, int col2, if (player->mo->ScoreIcon.isValid()) { - FTexture *pic = TexMan[player->mo->ScoreIcon]; + FTexture *pic = TexMan.GetTexture(player->mo->ScoreIcon); screen->DrawTexture (pic, col3, y, DTA_CleanNoMove, true, TAG_DONE); diff --git a/src/hwrenderer/scene/hw_decal.cpp b/src/hwrenderer/scene/hw_decal.cpp index 815032314ff..9bce744c4b8 100644 --- a/src/hwrenderer/scene/hw_decal.cpp +++ b/src/hwrenderer/scene/hw_decal.cpp @@ -208,7 +208,7 @@ void GLWall::ProcessDecal(HWDrawInfo *di, DBaseDecal *decal, const FVector3 &nor flipy = !!(decal->RenderFlags & RF_YFLIP); - FTexture *texture = TexMan[decalTile]; + FTexture *texture = TexMan.GetTexture(decalTile); if (texture == NULL) return; diff --git a/src/hwrenderer/scene/hw_renderhacks.cpp b/src/hwrenderer/scene/hw_renderhacks.cpp index 8f75bb02f18..59d71231d1a 100644 --- a/src/hwrenderer/scene/hw_renderhacks.cpp +++ b/src/hwrenderer/scene/hw_renderhacks.cpp @@ -350,7 +350,7 @@ bool HWDrawInfo::DoOneSectorUpper(subsector_t * subsec, float Planez, area_t in_ if (sec->GetPlaneTexZ(sector_t::ceiling) == Planez) { // If there's a texture abort - FTexture * tex = TexMan[seg->sidedef->GetTexture(side_t::top)]; + FTexture * tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::top)); if (!tex || !tex->isValid()) continue; else return false; } @@ -408,7 +408,7 @@ bool HWDrawInfo::DoOneSectorLower(subsector_t * subsec, float Planez, area_t in_ if (sec->GetPlaneTexZ(sector_t::floor) == Planez) { // If there's a texture abort - FTexture * tex = TexMan[seg->sidedef->GetTexture(side_t::bottom)]; + FTexture * tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::bottom)); if (!tex || !tex->isValid()) continue; else return false; } diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 1cec8dbaa6f..e4cd6ac3029 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -162,11 +162,11 @@ void DIntermissionScreen::Drawer () { if (!mFlatfill) { - screen->DrawTexture (TexMan[mBackground], 0, 0, DTA_Fullscreen, true, TAG_DONE); + screen->DrawTexture (TexMan.GetTexture(mBackground), 0, 0, DTA_Fullscreen, true, TAG_DONE); } else { - screen->FlatFill (0,0, SCREENWIDTH, SCREENHEIGHT, TexMan[mBackground]); + screen->FlatFill (0,0, SCREENWIDTH, SCREENHEIGHT, TexMan.GetTexture(mBackground)); } } else @@ -176,7 +176,7 @@ void DIntermissionScreen::Drawer () for (unsigned i=0; i < mOverlays.Size(); i++) { if (CheckOverlay(i)) - screen->DrawTexture (TexMan[mOverlays[i].mPic], mOverlays[i].x, mOverlays[i].y, DTA_320x200, true, TAG_DONE); + screen->DrawTexture (TexMan.GetTexture(mOverlays[i].mPic), mOverlays[i].x, mOverlays[i].y, DTA_320x200, true, TAG_DONE); } if (!mFlatfill) screen->FillBorder (NULL); } @@ -229,11 +229,11 @@ void DIntermissionScreenFader::Drawer () if (mType == FADE_In) factor = 1.0 - factor; int color = MAKEARGB(int(factor*255), 0,0,0); - screen->DrawTexture (TexMan[mBackground], 0, 0, DTA_Fullscreen, true, DTA_ColorOverlay, color, TAG_DONE); + screen->DrawTexture (TexMan.GetTexture(mBackground), 0, 0, DTA_Fullscreen, true, DTA_ColorOverlay, color, TAG_DONE); for (unsigned i=0; i < mOverlays.Size(); i++) { if (CheckOverlay(i)) - screen->DrawTexture (TexMan[mOverlays[i].mPic], mOverlays[i].x, mOverlays[i].y, DTA_320x200, true, DTA_ColorOverlay, color, TAG_DONE); + screen->DrawTexture (TexMan.GetTexture(mOverlays[i].mPic), mOverlays[i].x, mOverlays[i].y, DTA_320x200, true, DTA_ColorOverlay, color, TAG_DONE); } screen->FillBorder (NULL); } @@ -611,8 +611,8 @@ int DIntermissionScreenScroller::Responder (event_t *ev) void DIntermissionScreenScroller::Drawer () { - FTexture *tex = TexMan[mFirstPic]; - FTexture *tex2 = TexMan[mSecondPic]; + FTexture *tex = TexMan.GetTexture(mFirstPic); + FTexture *tex2 = TexMan.GetTexture(mSecondPic); if (mTicker >= mScrollDelay && mTicker < mScrollDelay + mScrollTime && tex != NULL && tex2 != NULL) { diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 708b100aa5d..2456e4a8f80 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4574,10 +4574,10 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b { return 0; } - FTexture *tex = TexMan.FindTexture(FBehavior::StaticLookupString(string), ETextureType::Flat, + FTextureID tex = TexMan.CheckForTexture(FBehavior::StaticLookupString(string), ETextureType::Flat, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_DontCreate); - if (tex == NULL) + if (!tex.Exists()) { // If the texture we want to check against doesn't exist, then // they're obviously not the same. return 0; @@ -4596,7 +4596,7 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b NextHighestCeilingAt(actor->Sector, actor->X(), actor->Y(), actor->Z(), actor->Top(), 0, &resultsec, &resffloor); secpic = resffloor ? *resffloor->bottom.texture : resultsec->planes[sector_t::ceiling].Texture; } - return tex == TexMan[secpic]; + return tex == secpic; } @@ -6690,7 +6690,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) auto a = SingleActorFromTID(args[0], activator); if (a != nullptr) { - return GlobalACSStrings.AddString(TexMan[a->floorpic]->GetName()); + return GlobalACSStrings.AddString(TexMan.GetTexture(a->floorpic)->GetName()); } else { diff --git a/src/p_doors.cpp b/src/p_doors.cpp index aac4097f996..da7d1336e00 100644 --- a/src/p_doors.cpp +++ b/src/p_doors.cpp @@ -293,7 +293,7 @@ void DDoor::DoorSound(bool raise, DSeqNode *curseq) const if (line->backsector == NULL) continue; - FTexture *tex = TexMan[line->sidedef[0]->GetTexture(side_t::top)]; + FTexture *tex = TexMan.GetTexture(line->sidedef[0]->GetTexture(side_t::top)); texname = tex ? tex->GetName().GetChars() : NULL; if (texname != NULL && texname[0] == 'D' && texname[1] == 'O' && texname[2] == 'R') { @@ -715,7 +715,7 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay, picnum = tex1[side_t::top].texture; - FTexture *tex = TexMan[picnum]; + FTexture *tex = TexMan.GetTexture(picnum); topdist = tex ? tex->GetDisplayHeight() : 64; topdist = m_Sector->ceilingplane.fD() - topdist * m_Sector->ceilingplane.fC(); diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index 43da7038f1e..d716fd8bfbd 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -477,7 +477,7 @@ static inline void CheckShortestTex (FTextureID texnum, double &minsize) { if (texnum.isValid() || (texnum.isNull() && (i_compatflags & COMPATF_SHORTTEX))) { - FTexture *tex = TexMan[texnum]; + FTexture *tex = TexMan.GetTexture(texnum); if (tex != NULL) { double h = tex->GetDisplayHeight(); @@ -1144,7 +1144,7 @@ double GetFriction(const sector_t *self, int plane, double *pMoveFac) auto c = planes[sector_t::floor].GlowColor; if (c == 0) { - FTexture *tex = TexMan[GetTexture(sector_t::floor)]; + FTexture *tex = TexMan.GetTexture(GetTexture(sector_t::floor)); if (tex != NULL && tex->isGlowing()) { if (!tex->isAutoGlowing()) tex = TexMan.GetTexture(GetTexture(sector_t::floor), true); @@ -1189,7 +1189,7 @@ double GetFriction(const sector_t *self, int plane, double *pMoveFac) auto c = planes[sector_t::ceiling].GlowColor; if (c == 0) { - FTexture *tex = TexMan[GetTexture(sector_t::ceiling)]; + FTexture *tex = TexMan.GetTexture(GetTexture(sector_t::ceiling)); if (tex != NULL && tex->isGlowing()) { if (!tex->isAutoGlowing()) tex = TexMan.GetTexture(GetTexture(sector_t::ceiling), true); @@ -1213,7 +1213,7 @@ double GetFriction(const sector_t *self, int plane, double *pMoveFac) c = planes[sector_t::floor].GlowColor; if (c == 0) { - FTexture *tex = TexMan[GetTexture(sector_t::floor)]; + FTexture *tex = TexMan.GetTexture(GetTexture(sector_t::floor)); if (tex != NULL && tex->isGlowing()) { if (!tex->isAutoGlowing()) tex = TexMan.GetTexture(GetTexture(sector_t::floor), true); diff --git a/src/polyrenderer/scene/poly_playersprite.cpp b/src/polyrenderer/scene/poly_playersprite.cpp index a0a5dd597b3..64a11529079 100644 --- a/src/polyrenderer/scene/poly_playersprite.cpp +++ b/src/polyrenderer/scene/poly_playersprite.cpp @@ -227,7 +227,7 @@ void RenderPolyPlayerSprites::RenderSprite(PolyRenderThread *thread, DPSprite *p picnum = sprframe->Texture[0]; flip = sprframe->Flip & 1; - ttex = TexMan.GetPalettedTexture(picnum, true); + ttex = TexMan.GetTexture(picnum); if (!ttex->isValid()) return; diff --git a/src/polyrenderer/scene/poly_sprite.cpp b/src/polyrenderer/scene/poly_sprite.cpp index 79ddf2312ad..be5b85f00ad 100644 --- a/src/polyrenderer/scene/poly_sprite.cpp +++ b/src/polyrenderer/scene/poly_sprite.cpp @@ -336,7 +336,7 @@ FSoftwareTexture *RenderPolySprite::GetSpriteTexture(AActor *thing, /*out*/ bool rot = (ang - thing->Angles.Yaw + (45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28; } flipX = (sprframe->Flip & (1 << rot)) != 0; - ttex = TexMan[sprframe->Texture[rot]]; // Do not animate the rotation + ttex = TexMan.GetPalettedTexture(sprframe->Texture[rot], false); // Do not animate the rotation tex = ttex->GetSoftwareTexture(); if (!ttex || !ttex->isValid()) { @@ -371,7 +371,7 @@ FSoftwareTexture *RenderPolySprite::GetSpriteTexture(AActor *thing, /*out*/ bool DAngle sprangle = thing->GetSpriteAngle((pos - viewpoint.Pos).Angle(), viewpoint.TicFrac); FTextureID tex = sprdef->GetSpriteFrame(thing->frame, -1, sprangle, &flipX); if (!tex.isValid()) return nullptr; - return TexMan[tex]->GetSoftwareTexture(); + return TexMan.GetPalettedTexture(tex, false)->GetSoftwareTexture(); } } } diff --git a/src/r_data/gldefs.cpp b/src/r_data/gldefs.cpp index 2baa54ec114..fa67b9c558c 100644 --- a/src/r_data/gldefs.cpp +++ b/src/r_data/gldefs.cpp @@ -977,7 +977,7 @@ class GLDefsParser sc.MustGetString(); if (facecount<6) { - sb->faces[facecount] = TexMan[TexMan.GetTextureID(sc.String, ETextureType::Wall, FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_Overridable)]; + sb->faces[facecount] = TexMan.GetTexture(TexMan.GetTextureID(sc.String, ETextureType::Wall, FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_Overridable)); } facecount++; } @@ -1008,7 +1008,7 @@ class GLDefsParser { sc.MustGetString(); FTextureID flump=TexMan.CheckForTexture(sc.String, ETextureType::Flat,FTextureManager::TEXMAN_TryAny); - FTexture *tex = TexMan[flump]; + FTexture *tex = TexMan.GetTexture(flump); if (tex) tex->bAutoGlowing = tex->bGlowing = tex->bFullbright = true; } } @@ -1019,7 +1019,7 @@ class GLDefsParser { sc.MustGetString(); FTextureID flump=TexMan.CheckForTexture(sc.String, ETextureType::Wall,FTextureManager::TEXMAN_TryAny); - FTexture *tex = TexMan[flump]; + FTexture *tex = TexMan.GetTexture(flump); if (tex) tex->bAutoGlowing = tex->bGlowing = tex->bFullbright = true; } } @@ -1028,7 +1028,7 @@ class GLDefsParser sc.SetCMode(true); sc.MustGetString(); FTextureID flump=TexMan.CheckForTexture(sc.String, ETextureType::Flat,FTextureManager::TEXMAN_TryAny); - FTexture *tex = TexMan[flump]; + FTexture *tex = TexMan.GetTexture(flump); sc.MustGetStringName(","); sc.MustGetString(); PalEntry color = V_GetColor(NULL, sc.String); @@ -1081,7 +1081,7 @@ class GLDefsParser sc.MustGetString(); FTextureID no = TexMan.CheckForTexture(sc.String, type, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_Overridable); - FTexture *tex = TexMan[no]; + FTexture *tex = TexMan.GetTexture(no); sc.MustGetToken('{'); while (!sc.CheckToken('}')) @@ -1186,7 +1186,7 @@ class GLDefsParser sc.MustGetString(); FTextureID no = TexMan.CheckForTexture(sc.String, type, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_Overridable); - FTexture *tex = TexMan[no]; + FTexture *tex = TexMan.GetTexture(no); sc.MustGetToken('{'); while (!sc.CheckToken('}')) @@ -1489,7 +1489,7 @@ class GLDefsParser sc.MustGetString(); FTextureID no = TexMan.CheckForTexture(sc.String, type); - FTexture *tex = TexMan[no]; + FTexture *tex = TexMan.GetTexture(no); sc.MustGetToken('{'); while (!sc.CheckToken('}')) diff --git a/src/r_data/sprites.cpp b/src/r_data/sprites.cpp index 6af8f5bdadd..f8a53cf7ddc 100644 --- a/src/r_data/sprites.cpp +++ b/src/r_data/sprites.cpp @@ -122,7 +122,7 @@ static bool R_InstallSpriteLump (FTextureID lump, unsigned frame, char rot, bool if (frame >= MAX_SPRITE_FRAMES || rotation > 16) { - Printf (TEXTCOLOR_RED "R_InstallSpriteLump: Bad frame characters in lump %s\n", TexMan[lump]->GetName().GetChars()); + Printf (TEXTCOLOR_RED "R_InstallSpriteLump: Bad frame characters in lump %s\n", TexMan.GetTexture(lump)->GetName().GetChars()); return false; } @@ -286,7 +286,7 @@ void R_InstallSprite (int num, spriteframewithrotate *sprtemp, int &maxframe) { for (int rot = 0; rot < 16; ++rot) { - TexMan[sprtemp[frame].Texture[rot]]->Rotations = framestart + frame; + TexMan.GetTexture(sprtemp[frame].Texture[rot])->Rotations = framestart + frame; } } } @@ -414,7 +414,7 @@ void R_InitSpriteDefs () int hash = hashes[intname % smax].Head; while (hash != -1) { - FTexture *tex = TexMan[hash]; + FTexture *tex = TexMan.GetTexture(hash); if (TEX_DWNAME(tex) == intname) { bool res = R_InstallSpriteLump (FTextureID(hash), tex->Name[4] - 'A', tex->Name[5], false, sprtemp, maxframe); diff --git a/src/r_utility.cpp b/src/r_utility.cpp index d12f3bf4db5..bce73181c34 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -1069,7 +1069,7 @@ void FCanvasTextureInfo::Add (AActor *viewpoint, FTextureID picnum, double fov) { return; } - texture = static_cast(TexMan[picnum]); + texture = static_cast(TexMan.GetTexture(picnum)); if (!texture->bHasCanvas) { Printf ("%s is not a valid target for a camera\n", texture->Name.GetChars()); @@ -1109,7 +1109,7 @@ void SetCameraToTexture(AActor *viewpoint, const FString &texturename, double fo if (textureid.isValid()) { // Only proceed if the texture actually has a canvas. - FTexture *tex = TexMan[textureid]; + FTexture *tex = TexMan.GetTexture(textureid); if (tex && tex->isCanvas()) { FCanvasTextureInfo::Add(viewpoint, textureid, fov); diff --git a/src/scripting/vm/jit_move.cpp b/src/scripting/vm/jit_move.cpp index 0706f37b6bd..54c055cb2c9 100644 --- a/src/scripting/vm/jit_move.cpp +++ b/src/scripting/vm/jit_move.cpp @@ -53,7 +53,7 @@ static void CastCo2S(FString *a, int b) { PalEntry c(b); a->Format("%02x %02x %0 static int CastS2So(FString *b) { return FSoundID(*b); } static void CastSo2S(FString *a, int b) { *a = S_sfx[b].name; } static void CastSID2S(FString *a, unsigned int b) { *a = (b >= sprites.Size()) ? "TNT1" : sprites[b].name; } -static void CastTID2S(FString *a, int b) { auto tex = TexMan[*(FTextureID*)&b]; *a = (tex == nullptr) ? "(null)" : tex->GetName().GetChars(); } +static void CastTID2S(FString *a, int b) { auto tex = TexMan.GetTexture(*(FTextureID*)&b); *a = (tex == nullptr) ? "(null)" : tex->GetName().GetChars(); } void JitCompiler::EmitCAST() { diff --git a/src/scripting/vm/vmexec.h b/src/scripting/vm/vmexec.h index d2453498752..97996376d92 100644 --- a/src/scripting/vm/vmexec.h +++ b/src/scripting/vm/vmexec.h @@ -1874,7 +1874,7 @@ static void DoCast(const VMRegisters ®, const VMFrame *f, int a, int b, int c case CAST_TID2S: { ASSERTS(a); ASSERTD(b); - auto tex = TexMan[*(FTextureID*)&(reg.d[b])]; + auto tex = TexMan.GetTexture(*(FTextureID*)&(reg.d[b])); reg.s[a] = tex == nullptr ? "(null)" : tex->GetName().GetChars(); break; } diff --git a/src/serializer.cpp b/src/serializer.cpp index c6a0191bfd7..535c739e755 100644 --- a/src/serializer.cpp +++ b/src/serializer.cpp @@ -1515,7 +1515,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FTextureID &value, FTe } FTextureID chk = value; if (chk.GetIndex() >= TexMan.NumTextures()) chk.SetNull(); - FTexture *pic = TexMan[chk]; + FTexture *pic = TexMan.GetTexture(chk); const char *name; if (Wads.GetLinkedTexture(pic->SourceLump) == pic) diff --git a/src/swrenderer/scene/r_opaque_pass.cpp b/src/swrenderer/scene/r_opaque_pass.cpp index e2a8c7877d4..1b03361ef18 100644 --- a/src/swrenderer/scene/r_opaque_pass.cpp +++ b/src/swrenderer/scene/r_opaque_pass.cpp @@ -1054,7 +1054,7 @@ namespace swrenderer { sprite.renderflags ^= RF_XFLIP; } - sprite.tex = TexMan[sprite.picnum]; // Do not animate the rotation + sprite.tex = TexMan.GetPalettedTexture(sprite.picnum, false); // Do not animate the rotation } } else @@ -1084,7 +1084,7 @@ namespace swrenderer { sprite.renderflags ^= RF_XFLIP; } - sprite.tex = TexMan[tex]; // Do not animate the rotation + sprite.tex = TexMan.GetPalettedTexture(tex, false); // Do not animate the rotation } if (r_drawvoxels) diff --git a/src/swrenderer/things/r_playersprite.cpp b/src/swrenderer/things/r_playersprite.cpp index 3020ce07c3a..548bb5c8a94 100644 --- a/src/swrenderer/things/r_playersprite.cpp +++ b/src/swrenderer/things/r_playersprite.cpp @@ -224,7 +224,7 @@ namespace swrenderer picnum = sprframe->Texture[0]; flip = sprframe->Flip & 1; - tex = TexMan.GetTexture(picnum, true); + tex = TexMan.GetTexture(picnum); if (!tex->isValid()) return; diff --git a/src/textures/formats/multipatchtexture.cpp b/src/textures/formats/multipatchtexture.cpp index 31c8ffd21a4..e89c66ddefe 100644 --- a/src/textures/formats/multipatchtexture.cpp +++ b/src/textures/formats/multipatchtexture.cpp @@ -1234,7 +1234,7 @@ void FMultiPatchTexture::ResolvePatches() TexMan.ListTextures(Inits[i].TexName, list, true); for (int i = list.Size() - 1; i >= 0; i--) { - if (list[i] != id && !TexMan[list[i]]->bMultiPatch) + if (list[i] != id && !TexMan.GetTexture(list[i])->bMultiPatch) { texno = list[i]; break; @@ -1263,7 +1263,7 @@ void FMultiPatchTexture::ResolvePatches() } else { - Parts[i].Texture = TexMan[texno]; + Parts[i].Texture = TexMan.GetTexture(texno); bComplex |= Parts[i].Texture->bComplex; Parts[i].Texture->bKeepAround = true; if (Inits[i].UseOffsets) diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index 76e512cdfce..e470cff66cd 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -1116,8 +1116,8 @@ void FTextureManager::InitPalettedVersions() } if (pic1.isValid() && pic2.isValid()) { - FTexture *owner = TexMan[pic1]; - FTexture *owned = TexMan[pic2]; + FTexture *owner = GetTexture(pic1); + FTexture *owned = GetTexture(pic2); if (owner && owned) owner->PalVersion = owned; } @@ -1135,7 +1135,7 @@ FTextureID FTextureManager::PalCheck(FTextureID tex) { // In any true color mode this shouldn't do anything. if (vid_nopalsubstitutions || V_IsTrueColor()) return tex; - auto ftex = operator[](tex); + auto ftex = GetTexture(tex); if (ftex != nullptr && ftex->PalVersion != nullptr) return ftex->PalVersion->id; return tex; } @@ -1259,7 +1259,7 @@ void FTextureManager::AdjustSpriteOffsets() Wads.GetLumpName(str, i); str[8] = 0; FTextureID texid = TexMan.CheckForTexture(str, ETextureType::Sprite, 0); - if (texid.isValid() && Wads.GetLumpFile(TexMan[texid]->SourceLump) > Wads.GetIwadNum()) + if (texid.isValid() && Wads.GetLumpFile(GetTexture(texid)->SourceLump) > Wads.GetIwadNum()) { // This texture has been replaced by some PWAD. memcpy(&sprid, str, 4); @@ -1294,7 +1294,7 @@ void FTextureManager::AdjustSpriteOffsets() } if (texno.isValid()) { - FTexture * tex = TexMan[texno]; + FTexture * tex = GetTexture(texno); int lumpnum = tex->GetSourceLump(); // We only want to change texture offsets for sprites in the IWAD or the file this lump originated from. diff --git a/src/textures/textures.h b/src/textures/textures.h index e8eca3b0d9d..a7b80e58f5a 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -558,14 +558,6 @@ class FTextureManager FTextureManager (); ~FTextureManager (); - // Get texture without translation -//private: - FTexture *operator[] (FTextureID texnum) - { - if ((unsigned)texnum.GetIndex() >= Textures.Size()) return NULL; - return Textures[texnum.GetIndex()].Texture; - } - // This only gets used in UI code so we do not need PALVERS handling. FTexture *GetTextureByName(const char *name, bool animate = false) { @@ -575,9 +567,9 @@ class FTextureManager else return Textures[Translation[texnum.GetIndex()]].Texture; } - FTexture *GetTexture(FTextureID texnum, bool animate) + FTexture *GetTexture(FTextureID texnum, bool animate = false) { - if ((size_t)texnum.texnum >= Textures.Size()) return nullptr; + if ((size_t)texnum.GetIndex() >= Textures.Size()) return nullptr; if (animate) texnum = Translation[texnum.GetIndex()]; return Textures[texnum.GetIndex()].Texture; } diff --git a/src/v_font.cpp b/src/v_font.cpp index c875c6eec35..276b7cb629e 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -384,7 +384,7 @@ FFont::FFont (const char *name, const char *nametemplate, int first, int count, !TexMan.CheckForTexture("STCFN122", ETextureType::MiscPatch).isValid()) { // insert the incorrectly named '|' graphic in its correct position. - if (count > 124-start) charLumps[124-start] = TexMan[lump]; + if (count > 124-start) charLumps[124-start] = TexMan.GetTexture(lump); lump.SetInvalid(); stcfn121 = true; } @@ -392,7 +392,7 @@ FFont::FFont (const char *name, const char *nametemplate, int first, int count, if (lump.isValid()) { - FTexture *pic = TexMan[lump]; + FTexture *pic = TexMan.GetTexture(lump); if (pic != NULL) { // set the lump here only if it represents a valid texture @@ -994,7 +994,7 @@ FSingleLumpFont::FSingleLumpFont (const char *name, int lump) : FFont(lump) void FSingleLumpFont::CreateFontFromPic (FTextureID picnum) { - FTexture *pic = TexMan[picnum]; + FTexture *pic = TexMan.GetTexture(picnum); FontHeight = pic->GetDisplayHeight (); SpaceWidth = pic->GetDisplayWidth (); @@ -1492,7 +1492,7 @@ FSinglePicFont::FSinglePicFont(const char *picname) : I_FatalError ("%s is not a font or texture", picname); } - FTexture *pic = TexMan[picnum]; + FTexture *pic = TexMan.GetTexture(picnum); FontName = picname; FontHeight = pic->GetDisplayHeight(); @@ -2143,7 +2143,7 @@ void V_InitCustomFonts() FTextureID texid = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch); if (texid.Exists()) { - *p = TexMan[texid]; + *p = TexMan.GetTexture(texid); } else if (Wads.GetLumpFile(sc.LumpNum) >= Wads.GetIwadNum()) { diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index 17f6a913a87..905a272877d 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -519,7 +519,7 @@ bool DInterBackground::LoadBackground(bool isenterpic) texture = TexMan.GetTextureID("INTERPIC", ETextureType::MiscPatch); } } - background = TexMan[texture]; + background = TexMan.GetTexture(texture); return noautostartmap; }