- replaced TexMan.operator() with two functions.

This was done to make reviewing easier, again because it is virtually impossible to search for the operators in the code.

Going through this revealed quite a few places where texture animations were on but shouldn't and even more places that did not check PASLVERS, although they were preparing some paletted rendering.
This commit is contained in:
Christoph Oelckers 2018-12-07 02:53:18 +01:00
parent 3dc9eab743
commit 79a0f76801
41 changed files with 115 additions and 116 deletions

View file

@ -2234,7 +2234,7 @@ void AM_drawSubsectors()
} }
else indices.clear(); else indices.clear();
screen->FillSimplePoly(TexMan(maptex), screen->FillSimplePoly(TexMan.GetTexture(maptex, true),
&points[0], points.Size(), &points[0], points.Size(),
originx, originy, originx, originy,
scale / scalex, scale / scalex,
@ -3019,7 +3019,7 @@ void AM_drawThings ()
rotation = int((angle.Normalized360() * (16. / 360.)).Degrees); rotation = int((angle.Normalized360() * (16. / 360.)).Degrees);
const FTextureID textureID = frame->Texture[show > 2 ? rotation : 0]; const FTextureID textureID = frame->Texture[show > 2 ? rotation : 0];
texture = TexMan(textureID); texture = TexMan.GetTexture(textureID, true);
} }
if (texture == NULL) goto drawTriangle; // fall back to standard display if no sprite can be found. if (texture == NULL) goto drawTriangle; // fall back to standard display if no sprite can be found.
@ -3150,7 +3150,7 @@ void AM_drawMarks ()
{ {
if (markpoints[i].x != -1) if (markpoints[i].x != -1)
{ {
DrawMarker (TexMan(marknums[i]), markpoints[i].x, markpoints[i].y, -3, 0, DrawMarker (TexMan.GetTexture(marknums[i], true), markpoints[i].x, markpoints[i].y, -3, 0,
1, 1, 0, 1, 0, LegacyRenderStyles[STYLE_Normal]); 1, 1, 0, 1, 0, LegacyRenderStyles[STYLE_Normal]);
} }
} }
@ -3183,7 +3183,7 @@ void AM_drawAuthorMarkers ()
if (mark->picnum.isValid()) if (mark->picnum.isValid())
{ {
tex = TexMan(mark->picnum); tex = TexMan.GetTexture(mark->picnum, true);
if (tex->GetRotations() != 0xFFFF) if (tex->GetRotations() != 0xFFFF)
{ {
spriteframe_t *sprframe = &SpriteFrames[tex->GetRotations()]; spriteframe_t *sprframe = &SpriteFrames[tex->GetRotations()];

View file

@ -1052,7 +1052,7 @@ void D_PageDrawer (void)
screen->Clear(0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0); screen->Clear(0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0);
if (Page.Exists()) if (Page.Exists())
{ {
screen->DrawTexture (TexMan(Page), 0, 0, screen->DrawTexture (TexMan.GetTexture(Page, true), 0, 0,
DTA_Fullscreen, true, DTA_Fullscreen, true,
DTA_Masked, false, DTA_Masked, false,
DTA_BilinearFilter, true, DTA_BilinearFilter, true,

View file

@ -241,7 +241,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
applyscale = false; applyscale = false;
} }
if(type == PLAYERICON) if(type == PLAYERICON)
texture = TexMan(statusBar->CPlayer->mo->ScoreIcon); texture = TexMan.GetTexture(statusBar->CPlayer->mo->ScoreIcon, true);
else if(type == AMMO1) else if(type == AMMO1)
{ {
auto ammo = statusBar->ammo1; auto ammo = statusBar->ammo1;
@ -270,7 +270,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
{ {
auto item = statusBar->CPlayer->mo->FindInventory(NAME_Sigil); auto item = statusBar->CPlayer->mo->FindInventory(NAME_Sigil);
if (item != NULL) if (item != NULL)
texture = TexMan(item->TextureIDVar(NAME_Icon)); texture = TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true);
} }
else if(type == HEXENARMOR_ARMOR || type == HEXENARMOR_SHIELD || type == HEXENARMOR_HELM || type == HEXENARMOR_AMULET) else if(type == HEXENARMOR_ARMOR || type == HEXENARMOR_SHIELD || type == HEXENARMOR_HELM || type == HEXENARMOR_AMULET)
{ {
@ -292,9 +292,9 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
} }
} }
else if(type == INVENTORYICON) else if(type == INVENTORYICON)
texture = TexMan(sprite); texture = TexMan.GetTexture(sprite, true);
else if(type == SELECTEDINVENTORYICON && statusBar->CPlayer->mo->InvSel != NULL) else if(type == SELECTEDINVENTORYICON && statusBar->CPlayer->mo->InvSel != NULL)
texture = TexMan(statusBar->CPlayer->mo->InvSel->TextureIDVar(NAME_Icon)); texture = TexMan.GetTexture(statusBar->CPlayer->mo->InvSel->TextureIDVar(NAME_Icon), true);
else if(image >= 0) else if(image >= 0)
texture = statusBar->Images[image]; texture = statusBar->Images[image];
@ -316,7 +316,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
spawnScaleY = item->Scale.Y; spawnScaleY = item->Scale.Y;
} }
texture = TexMan(icon); texture = TexMan.GetTexture(icon, true);
} }
enum ImageType enum ImageType
@ -2131,7 +2131,7 @@ class CommandDrawInventoryBar : public SBarInfoCommand
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgARTIBOX], rx, ry, block->XOffset(), block->YOffset(), bgalpha, block->FullScreenOffsets()); statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgARTIBOX], rx, ry, block->XOffset(), block->YOffset(), bgalpha, block->FullScreenOffsets());
if(style != STYLE_Strife) //Strife draws the cursor before the icons if(style != STYLE_Strife) //Strife draws the cursor before the icons
statusBar->DrawGraphic(TexMan(item->TextureIDVar(NAME_Icon)), rx - (style == STYLE_HexenStrict ? 2 : 0), ry - (style == STYLE_HexenStrict ? 1 : 0), block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), false, item->IntVar(NAME_Amount) <= 0); statusBar->DrawGraphic(TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true), rx - (style == STYLE_HexenStrict ? 2 : 0), ry - (style == STYLE_HexenStrict ? 1 : 0), block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), false, item->IntVar(NAME_Amount) <= 0);
if(item == statusBar->CPlayer->mo->InvSel) if(item == statusBar->CPlayer->mo->InvSel)
{ {
if(style == STYLE_Heretic) if(style == STYLE_Heretic)
@ -2146,7 +2146,7 @@ class CommandDrawInventoryBar : public SBarInfoCommand
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgSELECTBOX], rx, ry, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets()); statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgSELECTBOX], rx, ry, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
} }
if(style == STYLE_Strife) if(style == STYLE_Strife)
statusBar->DrawGraphic(TexMan(item->TextureIDVar(NAME_Icon)), rx, ry, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), false, item->IntVar(NAME_Amount) <= 0); statusBar->DrawGraphic(TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true), rx, ry, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), false, item->IntVar(NAME_Amount) <= 0);
if(counters != NULL && (alwaysShowCounter || item->IntVar(NAME_Amount) != 1)) if(counters != NULL && (alwaysShowCounter || item->IntVar(NAME_Amount) != 1))
{ {
counters[i]->valueArgument = item->IntVar(NAME_Amount); counters[i]->valueArgument = item->IntVar(NAME_Amount);
@ -2369,22 +2369,22 @@ class CommandDrawKeyBar : public SBarInfoCommand
{ {
if(!vertical) if(!vertical)
{ {
statusBar->DrawGraphic(TexMan(item->TextureIDVar(NAME_Icon)), x+slotOffset, y+rowOffset, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets()); statusBar->DrawGraphic(TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true), x+slotOffset, y+rowOffset, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
rowWidth = rowIconSize == -1 ? TexMan(item->TextureIDVar(NAME_Icon))->GetDisplayHeight()+2 : rowIconSize; rowWidth = rowIconSize == -1 ? TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true)->GetDisplayHeight()+2 : rowIconSize;
} }
else else
{ {
statusBar->DrawGraphic(TexMan(item->TextureIDVar(NAME_Icon)), x+rowOffset, y+slotOffset, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets()); statusBar->DrawGraphic(TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true), x+rowOffset, y+slotOffset, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
rowWidth = rowIconSize == -1 ? TexMan(item->TextureIDVar(NAME_Icon))->GetDisplayWidth()+2 : rowIconSize; rowWidth = rowIconSize == -1 ? TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true)->GetDisplayWidth()+2 : rowIconSize;
} }
// If cmd.special is -1 then the slot size is auto detected // If cmd.special is -1 then the slot size is auto detected
if(iconSize == -1) if(iconSize == -1)
{ {
if(!vertical) if(!vertical)
slotOffset += (reverse ? -1 : 1) * (TexMan(item->TextureIDVar(NAME_Icon))->GetDisplayWidth() + 2); slotOffset += (reverse ? -1 : 1) * (TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true)->GetDisplayWidth() + 2);
else else
slotOffset += (reverse ? -1 : 1) * (TexMan(item->TextureIDVar(NAME_Icon))->GetDisplayHeight() + 2); slotOffset += (reverse ? -1 : 1) * (TexMan.GetTexture(item->TextureIDVar(NAME_Icon), true)->GetDisplayHeight() + 2);
} }
else else
slotOffset += (reverse ? -iconSize : iconSize); slotOffset += (reverse ? -iconSize : iconSize);

View file

@ -1323,7 +1323,7 @@ void DBaseStatusBar::DrawGraphic(FTextureID texture, double x, double y, int fla
if (!texture.isValid()) if (!texture.isValid())
return; return;
FTexture *tex = (flags & DI_DONTANIMATE)? TexMan[texture] : TexMan(texture); FTexture *tex = TexMan.GetTexture(texture, !(flags & DI_DONTANIMATE));
double texwidth = tex->GetDisplayWidthDouble() * scaleX; double texwidth = tex->GetDisplayWidthDouble() * scaleX;
double texheight = tex->GetDisplayHeightDouble() * scaleY; double texheight = tex->GetDisplayHeightDouble() * scaleY;

View file

@ -216,7 +216,7 @@ void PostProcessShaderInstance::BindTextures()
continue; continue;
FString name = pair->Value; FString name = pair->Value;
FTexture *tex = TexMan(TexMan.CheckForTexture(name, ETextureType::Any)); FTexture *tex = TexMan.GetTexture(TexMan.CheckForTexture(name, ETextureType::Any), true);
if (tex && tex->isValid()) if (tex && tex->isValid())
{ {
glUniform1i(location, textureUnit); glUniform1i(location, textureUnit);

View file

@ -277,7 +277,7 @@ void HWDrawInfo::AddLine (seg_t *seg, bool portalclip)
{ {
if (!seg->linedef->isVisualPortal()) if (!seg->linedef->isVisualPortal())
{ {
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::mid)); FTexture * tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::mid), true);
if (!tex || !tex->isValid()) if (!tex || !tex->isValid())
{ {
// nothing to do here! // nothing to do here!

View file

@ -117,7 +117,7 @@ bool hw_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto
// now check for closed sectors! // now check for closed sectors!
if (bs_ceilingheight1 <= fs_floorheight1 && bs_ceilingheight2 <= fs_floorheight2) if (bs_ceilingheight1 <= fs_floorheight1 && bs_ceilingheight2 <= fs_floorheight2)
{ {
FTexture * tex = TexMan(sidedef->GetTexture(side_t::top)); FTexture * tex = TexMan.GetTexture(sidedef->GetTexture(side_t::top), true);
if (!tex || !tex->isValid()) return false; if (!tex || !tex->isValid()) return false;
if (backsector->GetTexture(sector_t::ceiling) == skyflatnum && if (backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
frontsector->GetTexture(sector_t::ceiling) == skyflatnum) return false; frontsector->GetTexture(sector_t::ceiling) == skyflatnum) return false;
@ -126,7 +126,7 @@ bool hw_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto
if (fs_ceilingheight1 <= bs_floorheight1 && fs_ceilingheight2 <= bs_floorheight2) if (fs_ceilingheight1 <= bs_floorheight1 && fs_ceilingheight2 <= bs_floorheight2)
{ {
FTexture * tex = TexMan(sidedef->GetTexture(side_t::bottom)); FTexture * tex = TexMan.GetTexture(sidedef->GetTexture(side_t::bottom), true);
if (!tex || !tex->isValid()) return false; if (!tex || !tex->isValid()) return false;
// properly render skies (consider door "open" if both floors are sky): // properly render skies (consider door "open" if both floors are sky):
@ -140,12 +140,12 @@ bool hw_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto
// preserve a kind of transparent door/lift special effect: // preserve a kind of transparent door/lift special effect:
if (bs_ceilingheight1 < fs_ceilingheight1 || bs_ceilingheight2 < fs_ceilingheight2) if (bs_ceilingheight1 < fs_ceilingheight1 || bs_ceilingheight2 < fs_ceilingheight2)
{ {
FTexture * tex = TexMan(sidedef->GetTexture(side_t::top)); FTexture * tex = TexMan.GetTexture(sidedef->GetTexture(side_t::top), true);
if (!tex || !tex->isValid()) return false; if (!tex || !tex->isValid()) return false;
} }
if (bs_floorheight1 > fs_floorheight1 || bs_floorheight2 > fs_floorheight2) if (bs_floorheight1 > fs_floorheight1 || bs_floorheight2 > fs_floorheight2)
{ {
FTexture * tex = TexMan(sidedef->GetTexture(side_t::bottom)); FTexture * tex = TexMan.GetTexture(sidedef->GetTexture(side_t::bottom), true);
if (!tex || !tex->isValid()) return false; if (!tex || !tex->isValid()) return false;
} }
if (backsector->GetTexture(sector_t::ceiling) == skyflatnum && if (backsector->GetTexture(sector_t::ceiling) == skyflatnum &&

View file

@ -243,13 +243,13 @@ void GLWall::SkyTop(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,vert
{ {
if (bs->GetPlaneTexZ(sector_t::floor)==fs->GetPlaneTexZ(sector_t::floor)+1.) if (bs->GetPlaneTexZ(sector_t::floor)==fs->GetPlaneTexZ(sector_t::floor)+1.)
{ {
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::bottom)); FTexture * tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::bottom), true);
if (!tex || !tex->isValid()) return; if (!tex || !tex->isValid()) return;
// very, very, very ugly special case (See Icarus MAP14) // very, very, very ugly special case (See Icarus MAP14)
// It is VERY important that this is only done for a floor height difference of 1 // It is VERY important that this is only done for a floor height difference of 1
// or it will cause glitches elsewhere. // or it will cause glitches elsewhere.
tex = TexMan(seg->sidedef->GetTexture(side_t::mid)); tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::mid), true);
if (tex != NULL && !(seg->linedef->flags & ML_DONTPEGTOP) && if (tex != NULL && !(seg->linedef->flags & ML_DONTPEGTOP) &&
seg->sidedef->GetTextureYOffset(side_t::mid) > 0) seg->sidedef->GetTextureYOffset(side_t::mid) > 0)
{ {
@ -265,7 +265,7 @@ void GLWall::SkyTop(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,vert
ztop[0]=ztop[1]=32768.0f; ztop[0]=ztop[1]=32768.0f;
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::top)); FTexture * tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::top), true);
if (bs->GetTexture(sector_t::ceiling) != skyflatnum) if (bs->GetTexture(sector_t::ceiling) != skyflatnum)
{ {
@ -325,7 +325,7 @@ void GLWall::SkyBottom(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,v
if (fs->GetTexture(sector_t::floor)==skyflatnum) if (fs->GetTexture(sector_t::floor)==skyflatnum)
{ {
if (bs->special == GLSector_NoSkyDraw) return; if (bs->special == GLSector_NoSkyDraw) return;
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::bottom)); FTexture * tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::bottom), true);
// For lower skies the normal logic only applies to walls with no lower texture. // For lower skies the normal logic only applies to walls with no lower texture.
if (!tex->isValid()) if (!tex->isValid())

View file

@ -789,7 +789,7 @@ void GLSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
if (isPicnumOverride) if (isPicnumOverride)
{ {
// Animate picnum overrides. // Animate picnum overrides.
auto tex = TexMan(thing->picnum); auto tex = TexMan.GetTexture(thing->picnum, true);
if (tex == nullptr) return; if (tex == nullptr) return;
patch = tex->GetID(); patch = tex->GetID();
mirror = false; mirror = false;

View file

@ -1222,7 +1222,7 @@ void GLWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
// Set up the top // Set up the top
// //
// //
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::top)); FTexture * tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::top), true);
if (!tex || !tex->isValid()) if (!tex || !tex->isValid())
{ {
if (front->GetTexture(sector_t::ceiling) == skyflatnum && if (front->GetTexture(sector_t::ceiling) == skyflatnum &&
@ -1258,7 +1258,7 @@ void GLWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
// Set up the bottom // Set up the bottom
// //
// //
tex = TexMan(seg->sidedef->GetTexture(side_t::bottom)); tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::bottom), true);
if (!tex || !tex->isValid()) if (!tex || !tex->isValid())
{ {
// texture is missing - use the lower plane // texture is missing - use the lower plane
@ -2057,7 +2057,7 @@ void GLWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
sector_t *backsec = isportal? seg->linedef->getPortalDestination()->frontsector : backsector; sector_t *backsec = isportal? seg->linedef->getPortalDestination()->frontsector : backsector;
bool drawfogboundary = !di->isFullbrightScene() && hw_CheckFog(frontsector, backsec); bool drawfogboundary = !di->isFullbrightScene() && hw_CheckFog(frontsector, backsec);
FTexture *tex = TexMan(seg->sidedef->GetTexture(side_t::mid)); FTexture *tex = TexMan.GetTexture(seg->sidedef->GetTexture(side_t::mid), true);
if (tex != NULL) if (tex != NULL)
{ {
if (i_compatflags & COMPATF_MASKEDMIDTEX) if (i_compatflags & COMPATF_MASKEDMIDTEX)

View file

@ -131,7 +131,7 @@ static bool isBright(DPSprite *psp)
FTextureID lump = sprites[psp->GetSprite()].GetSpriteFrame(psp->GetFrame(), 0, 0., nullptr); FTextureID lump = sprites[psp->GetSprite()].GetSpriteFrame(psp->GetFrame(), 0, 0., nullptr);
if (lump.isValid()) if (lump.isValid())
{ {
FTexture * tex = TexMan(lump); FTexture * tex = TexMan.GetTexture(lump, true);
if (tex) disablefullbright = tex->isFullbrightDisabled(); if (tex) disablefullbright = tex->isFullbrightDisabled();
} }
return psp->GetState()->GetFullbright() && !disablefullbright; return psp->GetState()->GetFullbright() && !disablefullbright;

View file

@ -519,7 +519,7 @@ again:
FMaterial * FMaterial::ValidateTexture(FTextureID no, bool expand, bool translate, bool create) FMaterial * FMaterial::ValidateTexture(FTextureID no, bool expand, bool translate, bool create)
{ {
return ValidateTexture(translate? TexMan(no) : TexMan[no], expand, create); return ValidateTexture(TexMan.GetTexture(no, translate), expand, create);
} }

View file

@ -568,7 +568,7 @@ void DIntermissionScreenCast::Drawer ()
} }
sprframe = &SpriteFrames[sprites[castsprite].spriteframes + caststate->GetFrame()]; sprframe = &SpriteFrames[sprites[castsprite].spriteframes + caststate->GetFrame()];
pic = TexMan(sprframe->Texture[0]); pic = TexMan.GetTexture(sprframe->Texture[0], true);
screen->DrawTexture (pic, 160, 170, screen->DrawTexture (pic, 160, 170,
DTA_320x200, true, DTA_320x200, true,

View file

@ -229,7 +229,7 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, do
side_t *side = line->sidedef[sideno]; side_t *side = line->sidedef[sideno];
FTextureID texnum = side->GetTexture(side_t::mid); FTextureID texnum = side->GetTexture(side_t::mid);
if (!texnum.isValid()) return false; if (!texnum.isValid()) return false;
FTexture * tex= TexMan(texnum); FTexture * tex= TexMan.GetTexture(texnum, true);
if (!tex) return false; if (!tex) return false;
FTexCoordInfo tci; FTexCoordInfo tci;

View file

@ -1147,7 +1147,7 @@ double GetFriction(const sector_t *self, int plane, double *pMoveFac)
FTexture *tex = TexMan[GetTexture(sector_t::floor)]; FTexture *tex = TexMan[GetTexture(sector_t::floor)];
if (tex != NULL && tex->isGlowing()) if (tex != NULL && tex->isGlowing())
{ {
if (!tex->isAutoGlowing()) tex = TexMan(GetTexture(sector_t::floor)); if (!tex->isAutoGlowing()) tex = TexMan.GetTexture(GetTexture(sector_t::floor), true);
if (tex->isGlowing()) // recheck the current animation frame. if (tex->isGlowing()) // recheck the current animation frame.
{ {
tex->GetGlowColor(bottomglowcolor); tex->GetGlowColor(bottomglowcolor);
@ -1192,7 +1192,7 @@ double GetFriction(const sector_t *self, int plane, double *pMoveFac)
FTexture *tex = TexMan[GetTexture(sector_t::ceiling)]; FTexture *tex = TexMan[GetTexture(sector_t::ceiling)];
if (tex != NULL && tex->isGlowing()) if (tex != NULL && tex->isGlowing())
{ {
if (!tex->isAutoGlowing()) tex = TexMan(GetTexture(sector_t::ceiling)); if (!tex->isAutoGlowing()) tex = TexMan.GetTexture(GetTexture(sector_t::ceiling), true);
if (tex->isGlowing()) // recheck the current animation frame. if (tex->isGlowing()) // recheck the current animation frame.
{ {
ret = true; ret = true;
@ -1216,7 +1216,7 @@ double GetFriction(const sector_t *self, int plane, double *pMoveFac)
FTexture *tex = TexMan[GetTexture(sector_t::floor)]; FTexture *tex = TexMan[GetTexture(sector_t::floor)];
if (tex != NULL && tex->isGlowing()) if (tex != NULL && tex->isGlowing())
{ {
if (!tex->isAutoGlowing()) tex = TexMan(GetTexture(sector_t::floor)); if (!tex->isAutoGlowing()) tex = TexMan.GetTexture(GetTexture(sector_t::floor), true);
if (tex->isGlowing()) // recheck the current animation frame. if (tex->isGlowing()) // recheck the current animation frame.
{ {
ret = true; ret = true;

View file

@ -49,7 +49,7 @@ void RenderPolyDecal::Render(PolyRenderThread *thread, DBaseDecal *decal, const
if (decal->RenderFlags & RF_INVISIBLE || !viewactive || !decal->PicNum.isValid()) if (decal->RenderFlags & RF_INVISIBLE || !viewactive || !decal->PicNum.isValid())
return; return;
FTexture *ttex = TexMan(decal->PicNum, true); FTexture *ttex = TexMan.GetPalettedTexture(decal->PicNum, true);
if (ttex == nullptr || !ttex->isValid()) if (ttex == nullptr || !ttex->isValid())
return; return;

View file

@ -66,7 +66,7 @@ static bool isBright(DPSprite *psp)
FTextureID lump = sprites[psp->GetSprite()].GetSpriteFrame(psp->GetFrame(), 0, 0., nullptr); FTextureID lump = sprites[psp->GetSprite()].GetSpriteFrame(psp->GetFrame(), 0, 0., nullptr);
if (lump.isValid()) if (lump.isValid())
{ {
FTexture * tex = TexMan(lump); FTexture * tex = TexMan.GetPalettedTexture(lump, true);
if (tex) disablefullbright = tex->isFullbrightDisabled(); if (tex) disablefullbright = tex->isFullbrightDisabled();
} }
return psp->GetState()->GetFullbright() && !disablefullbright; return psp->GetState()->GetFullbright() && !disablefullbright;

View file

@ -66,7 +66,7 @@ void RenderPolyPlane::RenderNormal(PolyRenderThread *thread, const PolyTransferH
FTextureID picnum = fakeflat.FrontSector->GetTexture(ceiling ? sector_t::ceiling : sector_t::floor); FTextureID picnum = fakeflat.FrontSector->GetTexture(ceiling ? sector_t::ceiling : sector_t::floor);
if (picnum != skyflatnum) if (picnum != skyflatnum)
{ {
FTexture *tex = TexMan(picnum); FTexture *tex = TexMan.GetPalettedTexture(picnum, true);
if (!tex || !tex->isValid()) if (!tex || !tex->isValid())
return; return;
@ -510,7 +510,7 @@ void Render3DFloorPlane::RenderPlanes(PolyRenderThread *thread, subsector_t *sub
void Render3DFloorPlane::Render(PolyRenderThread *thread) void Render3DFloorPlane::Render(PolyRenderThread *thread)
{ {
FTextureID picnum = ceiling ? *fakeFloor->bottom.texture : *fakeFloor->top.texture; FTextureID picnum = ceiling ? *fakeFloor->bottom.texture : *fakeFloor->top.texture;
auto tex = TexMan(picnum); auto tex = TexMan.GetPalettedTexture(picnum, true);
if (!tex->isValid()) if (!tex->isValid())
return; return;

View file

@ -227,7 +227,7 @@ void RenderPolyPlayerSprites::RenderSprite(PolyRenderThread *thread, DPSprite *p
picnum = sprframe->Texture[0]; picnum = sprframe->Texture[0];
flip = sprframe->Flip & 1; flip = sprframe->Flip & 1;
ttex = TexMan(picnum); ttex = TexMan.GetPalettedTexture(picnum, true);
if (!ttex->isValid()) if (!ttex->isValid())
return; return;

View file

@ -284,7 +284,7 @@ Mat4f PolySkyDome::GLSkyMath()
static FSoftwareTexture *GetSWTex(FTextureID texid, bool allownull = true) static FSoftwareTexture *GetSWTex(FTextureID texid, bool allownull = true)
{ {
auto tex = TexMan(texid, true); auto tex = TexMan.GetPalettedTexture(texid, true);
if (tex == nullptr) return nullptr; if (tex == nullptr) return nullptr;
if (!allownull && !tex->isValid()) return nullptr; if (!allownull && !tex->isValid()) return nullptr;
return tex->GetSoftwareTexture(); return tex->GetSoftwareTexture();

View file

@ -312,7 +312,7 @@ FSoftwareTexture *RenderPolySprite::GetSpriteTexture(AActor *thing, /*out*/ bool
if (thing->picnum.isValid()) if (thing->picnum.isValid())
{ {
FTexture *ttex = TexMan(thing->picnum); FTexture *ttex = TexMan.GetPalettedTexture(thing->picnum, true);
if (!ttex || !ttex->isValid()) if (!ttex || !ttex->isValid())
{ {
return nullptr; return nullptr;

View file

@ -171,7 +171,7 @@ bool RenderPolyWall::RenderLine(PolyRenderThread *thread, seg_t *line, sector_t
wall.Alpha = wall.Line->alpha; wall.Alpha = wall.Line->alpha;
wall.FogBoundary = IsFogBoundary(frontsector, backsector); wall.FogBoundary = IsFogBoundary(frontsector, backsector);
FTexture *midtex = TexMan(line->sidedef->GetTexture(side_t::mid), true); FTexture *midtex = TexMan.GetPalettedTexture(line->sidedef->GetTexture(side_t::mid), true);
if ((midtex && midtex->isValid()) || wall.FogBoundary) if ((midtex && midtex->isValid()) || wall.FogBoundary)
translucentWallsOutput.push_back(thread->FrameMemory->NewObject<PolyTranslucentWall>(wall)); translucentWallsOutput.push_back(thread->FrameMemory->NewObject<PolyTranslucentWall>(wall));
@ -528,7 +528,7 @@ void RenderPolyWall::ClampHeight(TriVertex &v1, TriVertex &v2)
FSoftwareTexture *RenderPolyWall::GetTexture(const line_t *line, const side_t *side, side_t::ETexpart texpart) FSoftwareTexture *RenderPolyWall::GetTexture(const line_t *line, const side_t *side, side_t::ETexpart texpart)
{ {
FTexture *tex = TexMan(side->GetTexture(texpart), true); FTexture *tex = TexMan.GetPalettedTexture(side->GetTexture(texpart), true);
if (tex == nullptr || !tex->isValid()) if (tex == nullptr || !tex->isValid())
{ {
// Mapping error. Doom floodfills this with a plane. // Mapping error. Doom floodfills this with a plane.
@ -537,16 +537,16 @@ FSoftwareTexture *RenderPolyWall::GetTexture(const line_t *line, const side_t *s
if (line && line->backsector && line->sidedef[0] == side) if (line && line->backsector && line->sidedef[0] == side)
{ {
if (texpart == side_t::top) if (texpart == side_t::top)
tex = TexMan(line->backsector->GetTexture(sector_t::ceiling), true); tex = TexMan.GetPalettedTexture(line->backsector->GetTexture(sector_t::ceiling), true);
else if (texpart == side_t::bottom) else if (texpart == side_t::bottom)
tex = TexMan(line->backsector->GetTexture(sector_t::floor), true); tex = TexMan.GetPalettedTexture(line->backsector->GetTexture(sector_t::floor), true);
} }
if (line && line->backsector && line->sidedef[1] == side) if (line && line->backsector && line->sidedef[1] == side)
{ {
if (texpart == side_t::top) if (texpart == side_t::top)
tex = TexMan(line->frontsector->GetTexture(sector_t::ceiling), true); tex = TexMan.GetPalettedTexture(line->frontsector->GetTexture(sector_t::ceiling), true);
else if (texpart == side_t::bottom) else if (texpart == side_t::bottom)
tex = TexMan(line->frontsector->GetTexture(sector_t::floor), true); tex = TexMan.GetPalettedTexture(line->frontsector->GetTexture(sector_t::floor), true);
} }
if (tex == nullptr || !tex->isValid()) if (tex == nullptr || !tex->isValid())

View file

@ -268,7 +268,7 @@ void FModelRenderer::RenderFrameModels(const FSpriteModelFrame *smf, const FStat
if (smf->modelIDs[i] != -1) if (smf->modelIDs[i] != -1)
{ {
FModel * mdl = Models[smf->modelIDs[i]]; FModel * mdl = Models[smf->modelIDs[i]];
FTexture *tex = smf->skinIDs[i].isValid() ? TexMan(smf->skinIDs[i]) : nullptr; FTexture *tex = smf->skinIDs[i].isValid() ? TexMan.GetTexture(smf->skinIDs[i], true) : nullptr;
mdl->BuildVertexBuffer(this); mdl->BuildVertexBuffer(this);
mdl->PushSpriteMDLFrame(smf, i); mdl->PushSpriteMDLFrame(smf, i);

View file

@ -364,7 +364,7 @@ void FDMDModel::RenderFrame(FModelRenderer *renderer, FTexture * skin, int frame
if (!skin) if (!skin)
{ {
if (info.numSkins == 0 || !skins[0].isValid()) return; if (info.numSkins == 0 || !skins[0].isValid()) return;
skin = TexMan(skins[0]); skin = TexMan.GetTexture(skins[0], true);
if (!skin) return; if (!skin) return;
} }

View file

@ -356,11 +356,11 @@ void FMD3Model::RenderFrame(FModelRenderer *renderer, FTexture * skin, int frame
{ {
if (curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid()) if (curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
{ {
surfaceSkin = TexMan(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i]); surfaceSkin = TexMan.GetTexture(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i], true);
} }
else if(surf->numSkins > 0 && surf->skins[0].isValid()) else if(surf->numSkins > 0 && surf->skins[0].isValid())
{ {
surfaceSkin = TexMan(surf->skins[0]); surfaceSkin = TexMan.GetTexture(surf->skins[0], true);
} }
if (!surfaceSkin) if (!surfaceSkin)

View file

@ -636,11 +636,11 @@ void FOBJModel::RenderFrame(FModelRenderer *renderer, FTexture * skin, int frame
{ {
if (i < MD3_MAX_SURFACES && curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid()) if (i < MD3_MAX_SURFACES && curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
{ {
userSkin = TexMan(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i]); userSkin = TexMan.GetTexture(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i], true);
} }
else if (surf->skin.isValid()) else if (surf->skin.isValid())
{ {
userSkin = TexMan(surf->skin); userSkin = TexMan.GetTexture(surf->skin, true);
} }
} }

View file

@ -235,7 +235,7 @@ void FUE1Model::RenderFrame( FModelRenderer *renderer, FTexture *skin, int frame
if ( !sskin ) if ( !sskin )
{ {
if ( curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum].isValid() ) if ( curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum].isValid() )
sskin = TexMan(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum]); sskin = TexMan.GetTexture(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum], true);
if ( !sskin ) if ( !sskin )
{ {
vofs += vsize; vofs += vsize;

View file

@ -80,8 +80,8 @@ void R_InitSkyMap()
sky2texture = TexMan.CheckForTexture("-noflat-", ETextureType::Any); sky2texture = TexMan.CheckForTexture("-noflat-", ETextureType::Any);
} }
skytex1 = TexMan(sky1texture, true); skytex1 = TexMan.GetTexture(sky1texture, false);
skytex2 = TexMan(sky2texture, true); skytex2 = TexMan.GetTexture(sky2texture, false);
if (skytex1 == nullptr) if (skytex1 == nullptr)
return; return;

View file

@ -451,7 +451,7 @@ namespace swrenderer
lwal = draw_segment->maskedtexturecol; lwal = draw_segment->maskedtexturecol;
swal = draw_segment->swall; swal = draw_segment->swall;
FTexture *tex = TexMan(sidedef->GetTexture(side_t::mid), true); FTexture *tex = TexMan.GetPalettedTexture(sidedef->GetTexture(side_t::mid), true);
FSoftwareTexture *pic = tex && tex->isValid()? tex->GetSoftwareTexture() : nullptr; FSoftwareTexture *pic = tex && tex->isValid()? tex->GetSoftwareTexture() : nullptr;
double yscale = pic->GetScale().Y * sidedef->GetTextureYScale(side_t::mid); double yscale = pic->GetScale().Y * sidedef->GetTextureYScale(side_t::mid);
fixed_t xoffset = FLOAT2FIXED(sidedef->GetTextureXOffset(side_t::mid)); fixed_t xoffset = FLOAT2FIXED(sidedef->GetTextureXOffset(side_t::mid));
@ -770,7 +770,7 @@ namespace swrenderer
} }
} }
FTexture *ftex = TexMan(sidedef->GetTexture(side_t::mid), true); FTexture *ftex = TexMan.GetPalettedTexture(sidedef->GetTexture(side_t::mid), true);
FSoftwareTexture *midtex = ftex && ftex->isValid() ? ftex->GetSoftwareTexture() : nullptr; FSoftwareTexture *midtex = ftex && ftex->isValid() ? ftex->GetSoftwareTexture() : nullptr;
bool segtextured = midtex != NULL || mTopPart.Texture != NULL || mBottomPart.Texture != NULL; bool segtextured = midtex != NULL || mTopPart.Texture != NULL || mBottomPart.Texture != NULL;
@ -816,7 +816,7 @@ namespace swrenderer
// No top texture for skyhack lines // No top texture for skyhack lines
if (mFrontSector->GetTexture(sector_t::ceiling) == skyflatnum && mBackSector->GetTexture(sector_t::ceiling) == skyflatnum) return; if (mFrontSector->GetTexture(sector_t::ceiling) == skyflatnum && mBackSector->GetTexture(sector_t::ceiling) == skyflatnum) return;
FTexture *tex = TexMan(sidedef->GetTexture(side_t::top), true); FTexture *tex = TexMan.GetPalettedTexture(sidedef->GetTexture(side_t::top), true);
mTopPart.Texture = tex && tex->isValid() ? tex->GetSoftwareTexture() : nullptr; mTopPart.Texture = tex && tex->isValid() ? tex->GetSoftwareTexture() : nullptr;
mTopPart.TextureOffsetU = FLOAT2FIXED(sidedef->GetTextureXOffset(side_t::top)); mTopPart.TextureOffsetU = FLOAT2FIXED(sidedef->GetTextureXOffset(side_t::top));
@ -874,7 +874,7 @@ namespace swrenderer
if (linedef->isVisualPortal()) return; if (linedef->isVisualPortal()) return;
if (linedef->special == Line_Horizon) return; if (linedef->special == Line_Horizon) return;
auto tex = TexMan(sidedef->GetTexture(side_t::mid), true); auto tex = TexMan.GetPalettedTexture(sidedef->GetTexture(side_t::mid), true);
mMiddlePart.Texture = tex && tex->isValid() ? tex->GetSoftwareTexture() : nullptr; mMiddlePart.Texture = tex && tex->isValid() ? tex->GetSoftwareTexture() : nullptr;
mMiddlePart.TextureOffsetU = FLOAT2FIXED(sidedef->GetTextureXOffset(side_t::mid)); mMiddlePart.TextureOffsetU = FLOAT2FIXED(sidedef->GetTextureXOffset(side_t::mid));
double rowoffset = sidedef->GetTextureYOffset(side_t::mid); double rowoffset = sidedef->GetTextureYOffset(side_t::mid);
@ -939,7 +939,7 @@ namespace swrenderer
frontlowertop = mBackSector->GetPlaneTexZ(sector_t::ceiling); frontlowertop = mBackSector->GetPlaneTexZ(sector_t::ceiling);
} }
FTexture *tex = TexMan(sidedef->GetTexture(side_t::bottom), true);; FTexture *tex = TexMan.GetPalettedTexture(sidedef->GetTexture(side_t::bottom), true);
mBottomPart.Texture = tex && tex->isValid() ? tex->GetSoftwareTexture() : nullptr; mBottomPart.Texture = tex && tex->isValid() ? tex->GetSoftwareTexture() : nullptr;
if (!mBottomPart.Texture) return; if (!mBottomPart.Texture) return;

View file

@ -162,7 +162,7 @@ namespace swrenderer
if (curline->sidedef->GetTexture(side_t::mid).isNull()) if (curline->sidedef->GetTexture(side_t::mid).isNull())
return false; return false;
FTexture *ttex = TexMan(curline->sidedef->GetTexture(side_t::mid), true); FTexture *ttex = TexMan.GetPalettedTexture(curline->sidedef->GetTexture(side_t::mid), true);
if (i_compatflags & COMPATF_MASKEDMIDTEX) if (i_compatflags & COMPATF_MASKEDMIDTEX)
{ {
ttex = ttex->GetRawTexture(); ttex = ttex->GetRawTexture();
@ -643,15 +643,15 @@ namespace swrenderer
FTexture *rw_tex = nullptr; FTexture *rw_tex = nullptr;
if (fover->flags & FF_UPPERTEXTURE) if (fover->flags & FF_UPPERTEXTURE)
{ {
rw_tex = TexMan(curline->sidedef->GetTexture(side_t::top), true); rw_tex = TexMan.GetPalettedTexture(curline->sidedef->GetTexture(side_t::top), true);
} }
else if (fover->flags & FF_LOWERTEXTURE) else if (fover->flags & FF_LOWERTEXTURE)
{ {
rw_tex = TexMan(curline->sidedef->GetTexture(side_t::bottom), true); rw_tex = TexMan.GetPalettedTexture(curline->sidedef->GetTexture(side_t::bottom), true);
} }
else else
{ {
rw_tex = TexMan(fover->master->sidedef[0]->GetTexture(side_t::mid), true); rw_tex = TexMan.GetPalettedTexture(fover->master->sidedef[0]->GetTexture(side_t::mid), true);
} }
rw_pic = rw_tex && rw_tex->isValid() ? rw_tex->GetSoftwareTexture() : nullptr; rw_pic = rw_tex && rw_tex->isValid() ? rw_tex->GetSoftwareTexture() : nullptr;
} }
@ -705,15 +705,15 @@ namespace swrenderer
FTexture *rw_tex; FTexture *rw_tex;
if (rover->flags & FF_UPPERTEXTURE) if (rover->flags & FF_UPPERTEXTURE)
{ {
rw_tex = TexMan(curline->sidedef->GetTexture(side_t::top), true); rw_tex = TexMan.GetPalettedTexture(curline->sidedef->GetTexture(side_t::top), true);
} }
else if (rover->flags & FF_LOWERTEXTURE) else if (rover->flags & FF_LOWERTEXTURE)
{ {
rw_tex = TexMan(curline->sidedef->GetTexture(side_t::bottom), true); rw_tex = TexMan.GetPalettedTexture(curline->sidedef->GetTexture(side_t::bottom), true);
} }
else else
{ {
rw_tex = TexMan(rover->master->sidedef[0]->GetTexture(side_t::mid), true); rw_tex = TexMan.GetPalettedTexture(rover->master->sidedef[0]->GetTexture(side_t::mid), true);
} }
rw_pic = rw_tex && rw_tex->isValid() ? rw_tex->GetSoftwareTexture() : nullptr; rw_pic = rw_tex && rw_tex->isValid() ? rw_tex->GetSoftwareTexture() : nullptr;
} }
@ -832,15 +832,15 @@ namespace swrenderer
FTexture *rw_tex; FTexture *rw_tex;
if (fover->flags & FF_UPPERTEXTURE) if (fover->flags & FF_UPPERTEXTURE)
{ {
rw_tex = TexMan(curline->sidedef->GetTexture(side_t::top), true); rw_tex = TexMan.GetPalettedTexture(curline->sidedef->GetTexture(side_t::top), true);
} }
else if (fover->flags & FF_LOWERTEXTURE) else if (fover->flags & FF_LOWERTEXTURE)
{ {
rw_tex = TexMan(curline->sidedef->GetTexture(side_t::bottom), true); rw_tex = TexMan.GetPalettedTexture(curline->sidedef->GetTexture(side_t::bottom), true);
} }
else else
{ {
rw_tex = TexMan(fover->master->sidedef[0]->GetTexture(side_t::mid), true); rw_tex = TexMan.GetPalettedTexture(fover->master->sidedef[0]->GetTexture(side_t::mid), true);
} }
rw_pic = rw_tex && rw_tex->isValid() ? rw_tex->GetSoftwareTexture() : nullptr; rw_pic = rw_tex && rw_tex->isValid() ? rw_tex->GetSoftwareTexture() : nullptr;
} }
@ -891,15 +891,15 @@ namespace swrenderer
FTexture *rw_tex; FTexture *rw_tex;
if (rover->flags & FF_UPPERTEXTURE) if (rover->flags & FF_UPPERTEXTURE)
{ {
rw_tex = TexMan(curline->sidedef->GetTexture(side_t::top), true); rw_tex = TexMan.GetPalettedTexture(curline->sidedef->GetTexture(side_t::top), true);
} }
else if (rover->flags & FF_LOWERTEXTURE) else if (rover->flags & FF_LOWERTEXTURE)
{ {
rw_tex = TexMan(curline->sidedef->GetTexture(side_t::bottom), true); rw_tex = TexMan.GetPalettedTexture(curline->sidedef->GetTexture(side_t::bottom), true);
} }
else else
{ {
rw_tex = TexMan(rover->master->sidedef[0]->GetTexture(side_t::mid), true); rw_tex = TexMan.GetPalettedTexture(rover->master->sidedef[0]->GetTexture(side_t::mid), true);
} }
rw_pic = rw_tex && rw_tex->isValid() ? rw_tex->GetSoftwareTexture() : nullptr; rw_pic = rw_tex && rw_tex->isValid() ? rw_tex->GetSoftwareTexture() : nullptr;
} }

View file

@ -65,8 +65,8 @@ fixed_t sky1cyl, sky2cyl;
void InitSoftwareSky() void InitSoftwareSky()
{ {
auto skytex1 = TexMan(sky1texture, true); auto skytex1 = TexMan.GetPalettedTexture(sky1texture, true);
auto skytex2 = TexMan(sky2texture, true); auto skytex2 = TexMan.GetPalettedTexture(sky2texture, true);
if (skytex1 == nullptr) if (skytex1 == nullptr)
return; return;
@ -118,7 +118,7 @@ namespace swrenderer
static FSoftwareTexture *GetSWTex(FTextureID texid, bool allownull = true) static FSoftwareTexture *GetSWTex(FTextureID texid, bool allownull = true)
{ {
auto tex = TexMan(texid, true); auto tex = TexMan.GetPalettedTexture(texid, true);
if (tex == nullptr) return nullptr; if (tex == nullptr) return nullptr;
if (!allownull && !tex->isValid()) return nullptr; if (!allownull && !tex->isValid()) return nullptr;
return tex->GetSoftwareTexture(); return tex->GetSoftwareTexture();

View file

@ -113,7 +113,7 @@ namespace swrenderer
} }
else // regular flat else // regular flat
{ {
FTexture *ttex = TexMan(picnum, true); FTexture *ttex = TexMan.GetPalettedTexture(picnum, true);
if (!ttex->isValid()) if (!ttex->isValid())
{ {

View file

@ -1023,7 +1023,7 @@ namespace swrenderer
{ {
sprite.picnum = thing->picnum; sprite.picnum = thing->picnum;
sprite.tex = TexMan(sprite.picnum); sprite.tex = TexMan.GetPalettedTexture(sprite.picnum, true);
if (!sprite.tex->isValid()) if (!sprite.tex->isValid())
{ {
return false; return false;

View file

@ -129,7 +129,7 @@ namespace swrenderer
} }
} }
FTexture *tex = TexMan(decal->PicNum, true); FTexture *tex = TexMan.GetPalettedTexture(decal->PicNum, true);
flipx = (uint8_t)(decal->RenderFlags & RF_XFLIP); flipx = (uint8_t)(decal->RenderFlags & RF_XFLIP);
if (tex == NULL || !tex->isValid()) if (tex == NULL || !tex->isValid())

View file

@ -106,7 +106,7 @@ namespace swrenderer
FTextureID lump = sprites[psp->GetSprite()].GetSpriteFrame(psp->GetFrame(), 0, 0., nullptr); FTextureID lump = sprites[psp->GetSprite()].GetSpriteFrame(psp->GetFrame(), 0, 0., nullptr);
if (lump.isValid()) if (lump.isValid())
{ {
FTexture * tex = TexMan(lump); FTexture * tex = TexMan.GetTexture(lump, true);
if (tex) disablefullbright = tex->isFullbrightDisabled(); if (tex) disablefullbright = tex->isFullbrightDisabled();
} }
return psp->GetState()->GetFullbright() && !disablefullbright; return psp->GetState()->GetFullbright() && !disablefullbright;

View file

@ -224,7 +224,7 @@ namespace swrenderer
picnum = sprframe->Texture[0]; picnum = sprframe->Texture[0];
flip = sprframe->Flip & 1; flip = sprframe->Flip & 1;
tex = TexMan(picnum); tex = TexMan.GetTexture(picnum, true);
if (!tex->isValid()) if (!tex->isValid())
return; return;

View file

@ -566,41 +566,40 @@ public:
return Textures[texnum.GetIndex()].Texture; 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) FTexture *GetTextureByName(const char *name, bool animate = false)
{ {
FTextureID texnum = GetTextureID (name, ETextureType::MiscPatch); FTextureID texnum = GetTextureID (name, ETextureType::MiscPatch);
if (!texnum.Exists()) return nullptr; if (!texnum.Exists()) return nullptr;
if (!animate) return Textures[texnum.GetIndex()].Texture; if (!animate) return Textures[texnum.GetIndex()].Texture;
else return Textures[Translation[texnum.GetIndex()]].Texture; else return Textures[Translation[texnum.GetIndex()]].Texture;
} }
FTexture *ByIndex(int i) FTexture *GetTexture(FTextureID texnum, bool animate)
{
if ((size_t)texnum.texnum >= Textures.Size()) return nullptr;
if (animate) texnum = Translation[texnum.GetIndex()];
return Textures[texnum.GetIndex()].Texture;
}
// This is the only access function that should be used inside the software renderer.
FTexture *GetPalettedTexture(FTextureID texnum, bool animate)
{
if ((size_t)texnum.texnum >= Textures.Size()) return nullptr;
if (animate) texnum = Translation[texnum.GetIndex()];
texnum = PalCheck(texnum).GetIndex();
return Textures[texnum.GetIndex()].Texture;
}
FTexture *ByIndex(int i, bool animate = false)
{ {
if (unsigned(i) >= Textures.Size()) return NULL; if (unsigned(i) >= Textures.Size()) return NULL;
if (animate) i = Translation[i];
return Textures[i].Texture; return Textures[i].Texture;
} }
FTexture *FindTexture(const char *texname, ETextureType usetype = ETextureType::MiscPatch, BITFIELD flags = TEXMAN_TryAny); FTexture *FindTexture(const char *texname, ETextureType usetype = ETextureType::MiscPatch, BITFIELD flags = TEXMAN_TryAny);
// Get texture with translation
FTexture *operator() (FTextureID texnum, bool withpalcheck=false)
{
if ((size_t)texnum.texnum >= Textures.Size()) return NULL;
int picnum = Translation[texnum.texnum];
if (withpalcheck)
{
picnum = PalCheck(picnum).GetIndex();
}
return Textures[picnum].Texture;
}
/*
FTexture *operator() (const char *texname)
{
FTextureID texnum = GetTextureID (texname, ETextureType::MiscPatch);
if (texnum.texnum == -1) return NULL;
return Textures[Translation[texnum.texnum]].Texture;
}
*/
//public: //public:

View file

@ -77,5 +77,5 @@ FTexture *FImageCollection::operator[] (int index) const
{ {
return NULL; return NULL;
} }
return ImageMap[index].Exists()? TexMan(ImageMap[index]) : NULL; return ImageMap[index].Exists()? TexMan.GetPalettedTexture(ImageMap[index], true) : NULL;
} }

View file

@ -175,7 +175,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawTexture)
if (!screen->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function"); if (!screen->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
FTexture *tex = animate ? TexMan(FSetTextureID(texid)) : TexMan[FSetTextureID(texid)]; FTexture *tex = TexMan.ByIndex(texid, animate);
VMVa_List args = { param + 4, 0, numparam - 5, va_reginfo + 4 }; VMVa_List args = { param + 4, 0, numparam - 5, va_reginfo + 4 };
screen->DrawTexture(tex, x, y, args); screen->DrawTexture(tex, x, y, args);
return 0; return 0;
@ -231,7 +231,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawShape)
if (!screen->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function"); if (!screen->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
FTexture *tex = animate ? TexMan(FSetTextureID(texid)) : TexMan[FSetTextureID(texid)]; FTexture *tex = TexMan.ByIndex(texid, animate);
VMVa_List args = { param + 3, 0, numparam - 4, va_reginfo + 3 }; VMVa_List args = { param + 3, 0, numparam - 4, va_reginfo + 3 };
screen->DrawShape(tex, shape, args); screen->DrawShape(tex, shape, args);
@ -1354,7 +1354,7 @@ void DFrameBuffer::DrawBorder (int x1, int y1, int x2, int y2)
if (picnum.isValid()) if (picnum.isValid())
{ {
FlatFill (x1, y1, x2, y2, TexMan(picnum)); FlatFill (x1, y1, x2, y2, TexMan.GetTexture(picnum, false));
} }
else else
{ {

View file

@ -1519,7 +1519,7 @@ FTexture *FSinglePicFont::GetChar (int code, int *const width) const
*width = SpaceWidth; *width = SpaceWidth;
if (code == 'a' || code == 'A') if (code == 'a' || code == 'A')
{ {
return TexMan(PicNum); return TexMan.GetPalettedTexture(PicNum, true);
} }
else else
{ {

View file

@ -674,7 +674,7 @@ class AltHud ui
{ {
double trans = rover == CPlayer.mo.InvSel ? 1.0 : 0.4; double trans = rover == CPlayer.mo.InvSel ? 1.0 : 0.4;
DrawImageToBox(AltIcon.isValid()? AltIcon : rover.Icon, x, y, 19, 25, trans); DrawImageToBox(AltIcon.isValid()? AltIcon : rover.Icon, x, y, 19, 25, trans, true);
if (rover.Amount > 1) if (rover.Amount > 1)
{ {
int xx; int xx;
@ -989,4 +989,4 @@ class AltHud ui
} }
} }
} }