Skip to content

Commit

Permalink
- replaced the last access operator, too
Browse files Browse the repository at this point in the history
Now everything uses a function.
This really wasn't what operators are supposef to be used for.
  • Loading branch information
coelckers committed Dec 7, 2018
1 parent 42b18e6 commit 9409843
Show file tree
Hide file tree
Showing 30 changed files with 71 additions and 79 deletions.
8 changes: 4 additions & 4 deletions src/am_map.cpp
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand All @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion src/c_console.cpp
Expand Up @@ -1083,7 +1083,7 @@ void C_DrawConsole ()
else if (ConBottom)
{
int visheight;
FTexture *conpic = TexMan[conback];
FTexture *conpic = TexMan.GetTexture(conback);

visheight = ConBottom;

Expand Down
2 changes: 1 addition & 1 deletion src/d_main.cpp
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/fragglescript/t_func.cpp
Expand Up @@ -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() : "";
}
}
Expand Down Expand Up @@ -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() : "";
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/g_shared/a_decals.cpp
Expand Up @@ -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())
{
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/g_shared/a_dynlight.cpp
Expand Up @@ -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());
}


Expand Down
2 changes: 1 addition & 1 deletion src/g_statusbar/sbar_mugshot.cpp
Expand Up @@ -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));
}

//===========================================================================
Expand Down
2 changes: 1 addition & 1 deletion src/g_statusbar/shared_sbar.cpp
Expand Up @@ -203,7 +203,7 @@ void ST_LoadCrosshair(bool alwaysload)
}
}
CrosshairNum = num;
CrosshairImage = TexMan[texid];
CrosshairImage = TexMan.GetTexture(texid);
}

//---------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/hu_scores.cpp
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/hwrenderer/scene/hw_decal.cpp
Expand Up @@ -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;


Expand Down
4 changes: 2 additions & 2 deletions src/hwrenderer/scene/hw_renderhacks.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
14 changes: 7 additions & 7 deletions src/intermission/intermission.cpp
Expand Up @@ -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
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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)
{

Expand Down
8 changes: 4 additions & 4 deletions src/p_acs.cpp
Expand Up @@ -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;
Expand All @@ -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;
}


Expand Down Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions src/p_doors.cpp
Expand Up @@ -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')
{
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions src/p_sectors.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/polyrenderer/scene/poly_playersprite.cpp
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/polyrenderer/scene/poly_sprite.cpp
Expand Up @@ -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())
{
Expand Down Expand Up @@ -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();
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/r_data/gldefs.cpp
Expand Up @@ -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++;
}
Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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;
}
}
Expand All @@ -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);
Expand Down Expand Up @@ -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('}'))
Expand Down Expand Up @@ -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('}'))
Expand Down Expand Up @@ -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('}'))
Expand Down

0 comments on commit 9409843

Please sign in to comment.