- renamed FTexture's UseType flags and gave them a dedicated type.

This was done mainly to reduce the amount of occurences of the word FTexture but it immediately helped detect two small and mostly harmless bugs that were found due to the stricter type checks.
This commit is contained in:
Christoph Oelckers 2018-03-25 20:26:16 +02:00
parent 5c7f2e0217
commit e89a598b31
78 changed files with 348 additions and 352 deletions

View file

@ -952,7 +952,7 @@ void AM_StaticInit()
for (int i = 0; i < 10; i++)
{
mysnprintf (namebuf, countof(namebuf), "AMMNUM%d", i);
marknums[i] = TexMan.CheckForTexture (namebuf, FTexture::TEX_MiscPatch);
marknums[i] = TexMan.CheckForTexture (namebuf, ETextureType::MiscPatch);
}
markpointnum = 0;
mapback.SetInvalid();
@ -1356,11 +1356,11 @@ void AM_LevelInit ()
{
if (level.info->MapBackground.Len() == 0)
{
mapback = TexMan.CheckForTexture("AUTOPAGE", FTexture::TEX_MiscPatch);
mapback = TexMan.CheckForTexture("AUTOPAGE", ETextureType::MiscPatch);
}
else
{
mapback = TexMan.CheckForTexture(level.info->MapBackground, FTexture::TEX_MiscPatch);
mapback = TexMan.CheckForTexture(level.info->MapBackground, ETextureType::MiscPatch);
}
AM_clearMarks();
@ -2195,7 +2195,7 @@ void AM_drawSubsectors()
// Draw the polygon.
FTexture *pic = TexMan(maptex);
if (pic != NULL && pic->UseType != FTexture::TEX_Null)
if (pic != NULL && pic->UseType != ETextureType::Null)
{
screen->FillSimplePoly(TexMan(maptex),
&points[0], points.Size(),
@ -3069,7 +3069,7 @@ void AM_drawThings ()
static void DrawMarker (FTexture *tex, double x, double y, int yadjust,
INTBOOL flip, double xscale, double yscale, int translation, double alpha, uint32_t fillcolor, FRenderStyle renderstyle)
{
if (tex == NULL || tex->UseType == FTexture::TEX_Null)
if (tex == NULL || tex->UseType == ETextureType::Null)
{
return;
}

View file

@ -1060,7 +1060,7 @@ CCMD(changesky)
sky1name = argv[1];
if (sky1name[0] != 0)
{
FTextureID newsky = TexMan.GetTexture(sky1name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
FTextureID newsky = TexMan.GetTexture(sky1name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
if (newsky.Exists())
{
sky1texture = level.skytexture1 = newsky;

View file

@ -586,11 +586,11 @@ void DequeueConsoleText ()
void C_InitConback()
{
conback = TexMan.CheckForTexture ("CONBACK", FTexture::TEX_MiscPatch);
conback = TexMan.CheckForTexture ("CONBACK", ETextureType::MiscPatch);
if (!conback.isValid())
{
conback = TexMan.GetTexture (gameinfo.TitlePage, FTexture::TEX_MiscPatch);
conback = TexMan.GetTexture (gameinfo.TitlePage, ETextureType::MiscPatch);
conshade = MAKEARGB(175,0,0,0);
conline = true;
}

View file

@ -641,7 +641,7 @@ void SetCompatibilityParams()
if (side != NULL)
{
assert(TexNames.Size() > (unsigned int)CompatParams[i + 4]);
const FTextureID texID = TexMan.GetTexture(TexNames[CompatParams[i + 4]], FTexture::TEX_Any);
const FTextureID texID = TexMan.GetTexture(TexNames[CompatParams[i + 4]], ETextureType::Any);
side->SetTexture(CompatParams[i + 3], texID);
}
}
@ -713,7 +713,7 @@ void SetCompatibilityParams()
? sec->floorplane
: sec->ceilingplane;
assert(TexNames.Size() > (unsigned int)CompatParams[i + 3]);
const FTextureID texID = TexMan.GetTexture(TexNames[CompatParams[i + 3]], FTexture::TEX_Any);
const FTextureID texID = TexMan.GetTexture(TexNames[CompatParams[i + 3]], ETextureType::Any);
sec->SetTexture(CompatParams[i + 2], texID);
}

View file

@ -918,7 +918,7 @@ void D_Display ()
// [RH] Draw icon, if any
if (D_DrawIcon)
{
FTextureID picnum = TexMan.CheckForTexture (D_DrawIcon, FTexture::TEX_MiscPatch);
FTextureID picnum = TexMan.CheckForTexture (D_DrawIcon, ETextureType::MiscPatch);
D_DrawIcon = NULL;
if (picnum.isValid())

View file

@ -487,10 +487,10 @@ void FDecalLib::ParseDecal (FScanner &sc)
case DECAL_PIC:
sc.MustGetString ();
picnum = TexMan.CheckForTexture (sc.String, FTexture::TEX_Any);
picnum = TexMan.CheckForTexture (sc.String, ETextureType::Any);
if (!picnum.Exists() && (lumpnum = Wads.CheckNumForName (sc.String, ns_graphics)) >= 0)
{
picnum = TexMan.CreateTexture (lumpnum, FTexture::TEX_Decal);
picnum = TexMan.CreateTexture (lumpnum, ETextureType::Decal);
}
newdecal.PicNum = picnum;
break;

View file

@ -179,6 +179,25 @@ inline int Luminance(int r, int g, int b)
}
enum class ETextureType : uint8_t
{
Any,
Wall,
Flat,
Sprite,
WallPatch,
Build, // no longer used but needs to remain for ZScript
SkinSprite,
Decal,
MiscPatch,
FontChar,
Override, // For patches between TX_START/TX_END
Autopage, // Automap background - used to enable the use of FAutomapTexture
SkinGraphic,
Null,
FirstDefined,
};
class FTextureID
{
friend class FTextureManager;

View file

@ -1890,7 +1890,7 @@ void FParser::SF_FloorTexture(void)
if(t_argc > 1)
{
int i = -1;
FTextureID picnum = TexMan.GetTexture(t_argv[1].string, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
FTextureID picnum = TexMan.GetTexture(t_argv[1].string, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
// set all sectors with tag
FSSectorTagIterator itr(tagnum);
@ -1980,7 +1980,7 @@ void FParser::SF_CeilingTexture(void)
if(t_argc > 1)
{
int i = -1;
FTextureID picnum = TexMan.GetTexture(t_argv[1].string, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
FTextureID picnum = TexMan.GetTexture(t_argv[1].string, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
// set all sectors with tag
FSSectorTagIterator itr(tagnum);
@ -2233,7 +2233,7 @@ void FParser::SF_SetLineTexture(void)
position=3-position;
texture = stringvalue(t_argv[3]);
texturenum = TexMan.GetTexture(texture, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
texturenum = TexMan.GetTexture(texture, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
FLineIdIterator itr(tag);
while ((i = itr.Next()) >= 0)
@ -2250,7 +2250,7 @@ void FParser::SF_SetLineTexture(void)
}
else // and an improved legacy version
{
FTextureID picnum = TexMan.GetTexture(t_argv[1].string, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
FTextureID picnum = TexMan.GetTexture(t_argv[1].string, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
side = !!intvalue(t_argv[2]);
int sections = intvalue(t_argv[3]);

View file

@ -192,7 +192,7 @@ void FScriptLoader::ParseInfoCmd(char *line, FString &scriptsrc)
sc.MustGetStringName("=");
sc.MustGetString();
sky2texture = sky1texture = level.skytexture1 = level.skytexture2 = TexMan.GetTexture (sc.String, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
sky2texture = sky1texture = level.skytexture1 = level.skytexture2 = TexMan.GetTexture (sc.String, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
R_InitSkyMap ();
}
else if (sc.Compare("interpic"))

View file

@ -743,7 +743,7 @@ void G_DoCompleted (void)
AM_Stop ();
wminfo.finished_ep = level.cluster - 1;
wminfo.LName0 = TexMan.CheckForTexture(level.info->PName, FTexture::TEX_MiscPatch);
wminfo.LName0 = TexMan.CheckForTexture(level.info->PName, ETextureType::MiscPatch);
wminfo.current = level.MapName;
if (deathmatch &&
@ -764,7 +764,7 @@ void G_DoCompleted (void)
else
{
wminfo.next = nextinfo->MapName;
wminfo.LName1 = TexMan.CheckForTexture(nextinfo->PName, FTexture::TEX_MiscPatch);
wminfo.LName1 = TexMan.CheckForTexture(nextinfo->PName, ETextureType::MiscPatch);
}
}
@ -955,7 +955,7 @@ void G_DoLoadLevel (int position, bool autosave)
// 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, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
skyflatnum = TexMan.GetTexture (gameinfo.SkyFlatName, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
// DOOM determines the sky texture to be used
// depending on the current episode and the game version.
@ -1427,8 +1427,8 @@ void G_InitLevelLocals ()
level.info = info;
level.skyspeed1 = info->skyspeed1;
level.skyspeed2 = info->skyspeed2;
level.skytexture1 = TexMan.GetTexture(info->SkyPic1, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
level.skytexture2 = TexMan.GetTexture(info->SkyPic2, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
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.fadeto = info->fadeto;
level.cdtrack = info->cdtrack;
level.cdid = info->cdid;

View file

@ -354,7 +354,7 @@ static void DrawArmor(AInventory * barmor, AInventory * harmor, int x, int y)
case 3: icon[3] = '4'; break;
default: break;
}
DrawImageToBox(TexMan.FindTexture(icon, FTexture::TEX_Sprite), x, y, 31, 17);
DrawImageToBox(TexMan.FindTexture(icon, ETextureType::Sprite), x, y, 31, 17);
}
else if (barmor) DrawImageToBox(TexMan[barmor->Icon], x, y, 31, 17);
DrawHudNumber(HudFont, fontcolor, ap, x + 33, y + 17);
@ -1285,13 +1285,13 @@ void HUD_InitHud()
if (sc.Compare("Health"))
{
sc.MustGetString();
FTextureID tex = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
FTextureID tex = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch);
if (tex.isValid()) healthpic = TexMan[tex];
}
else if (sc.Compare("Berserk"))
{
sc.MustGetString();
FTextureID tex = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
FTextureID tex = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch);
if (tex.isValid()) berserkpic = TexMan[tex];
}
else
@ -1311,7 +1311,7 @@ void HUD_InitHud()
if (!sc.Compare("0") && !sc.Compare("NULL") && !sc.Compare(""))
{
tex = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
tex = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch);
}
else tex.SetInvalid();

View file

@ -99,7 +99,7 @@ FTexture *FMugShotFrame::GetTexture(const char *default_face, const char *skin_f
}
sprite.UnlockBuffer();
}
return TexMan[TexMan.CheckForTexture(sprite, 0, FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_AllowSkins)];
return TexMan[TexMan.CheckForTexture(sprite, ETextureType::Any, FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_AllowSkins)];
}
//===========================================================================

View file

@ -300,7 +300,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
if (flags & DI_ALTERNATEONFAIL)
{
SetTruth(texture == NULL || texture->UseType == FTexture::TEX_Null, block, statusBar);
SetTruth(texture == NULL || texture->UseType == ETextureType::Null, block, statusBar);
}
}
protected:

View file

@ -214,14 +214,14 @@ void ST_LoadCrosshair(bool alwaysload)
size = (SCREENWIDTH < 640) ? 'S' : 'B';
mysnprintf (name, countof(name), "XHAIR%c%d", size, num);
FTextureID texid = TexMan.CheckForTexture(name, FTexture::TEX_MiscPatch, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ShortNameOnly);
FTextureID texid = TexMan.CheckForTexture(name, ETextureType::MiscPatch, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ShortNameOnly);
if (!texid.isValid())
{
mysnprintf (name, countof(name), "XHAIR%c1", size);
texid = TexMan.CheckForTexture(name, FTexture::TEX_MiscPatch, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ShortNameOnly);
texid = TexMan.CheckForTexture(name, ETextureType::MiscPatch, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ShortNameOnly);
if (!texid.isValid())
{
texid = TexMan.CheckForTexture("XHAIRS1", FTexture::TEX_MiscPatch, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ShortNameOnly);
texid = TexMan.CheckForTexture("XHAIRS1", ETextureType::MiscPatch, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ShortNameOnly);
}
}
CrosshairNum = num;
@ -1670,7 +1670,7 @@ DEFINE_ACTION_FUNCTION(DBaseStatusBar, DrawImage)
PARAM_FLOAT_DEF(scaleX);
PARAM_FLOAT_DEF(scaleY);
if (!screen->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
self->DrawGraphic(TexMan.CheckForTexture(texid, FTexture::TEX_Any), x, y, flags, alpha, w, h, scaleX, scaleY);
self->DrawGraphic(TexMan.CheckForTexture(texid, ETextureType::Any), x, y, flags, alpha, w, h, scaleX, scaleY);
return 0;
}

View file

@ -92,7 +92,7 @@ void AdjustSpriteOffsets()
char str[9];
Wads.GetLumpName(str, i);
str[8] = 0;
FTextureID texid = TexMan.CheckForTexture(str, FTexture::TEX_Sprite, 0);
FTextureID texid = TexMan.CheckForTexture(str, ETextureType::Sprite, 0);
if (texid.isValid() && Wads.GetLumpFile(TexMan[texid]->SourceLump) > Wads.GetIwadNum())
{
// This texture has been replaced by some PWAD.
@ -114,7 +114,7 @@ void AdjustSpriteOffsets()
int x,y;
bool iwadonly = false;
bool forced = false;
FTextureID texno = TexMan.CheckForTexture(sc.String, FTexture::TEX_Sprite);
FTextureID texno = TexMan.CheckForTexture(sc.String, ETextureType::Sprite);
sc.MustGetStringName(",");
sc.MustGetNumber();
x=sc.Number;

View file

@ -50,7 +50,7 @@ void gl_InitGlow(FScanner &sc)
while (!sc.CheckString("}"))
{
sc.MustGetString();
FTextureID flump=TexMan.CheckForTexture(sc.String, FTexture::TEX_Flat,FTextureManager::TEXMAN_TryAny);
FTextureID flump=TexMan.CheckForTexture(sc.String, ETextureType::Flat,FTextureManager::TEXMAN_TryAny);
FTexture *tex = TexMan[flump];
if (tex) tex->gl_info.bAutoGlowing = tex->gl_info.bGlowing = tex->gl_info.bFullbright = true;
}
@ -61,7 +61,7 @@ void gl_InitGlow(FScanner &sc)
while (!sc.CheckString("}"))
{
sc.MustGetString();
FTextureID flump=TexMan.CheckForTexture(sc.String, FTexture::TEX_Wall,FTextureManager::TEXMAN_TryAny);
FTextureID flump=TexMan.CheckForTexture(sc.String, ETextureType::Wall,FTextureManager::TEXMAN_TryAny);
FTexture *tex = TexMan[flump];
if (tex) tex->gl_info.bAutoGlowing = tex->gl_info.bGlowing = tex->gl_info.bFullbright = true;
}
@ -70,7 +70,7 @@ void gl_InitGlow(FScanner &sc)
{
sc.SetCMode(true);
sc.MustGetString();
FTextureID flump=TexMan.CheckForTexture(sc.String, FTexture::TEX_Flat,FTextureManager::TEXMAN_TryAny);
FTextureID flump=TexMan.CheckForTexture(sc.String, ETextureType::Flat,FTextureManager::TEXMAN_TryAny);
FTexture *tex = TexMan[flump];
sc.MustGetStringName(",");
sc.MustGetString();

View file

@ -236,10 +236,10 @@ FGLRenderer::~FGLRenderer()
void FGLRenderer::GetSpecialTextures()
{
if (gl.legacyMode) glLight = TexMan.CheckForTexture("glstuff/gllight.png", FTexture::TEX_MiscPatch);
glPart2 = TexMan.CheckForTexture("glstuff/glpart2.png", FTexture::TEX_MiscPatch);
glPart = TexMan.CheckForTexture("glstuff/glpart.png", FTexture::TEX_MiscPatch);
mirrorTexture = TexMan.CheckForTexture("glstuff/mirror.png", FTexture::TEX_MiscPatch);
if (gl.legacyMode) glLight = TexMan.CheckForTexture("glstuff/gllight.png", ETextureType::MiscPatch);
glPart2 = TexMan.CheckForTexture("glstuff/glpart2.png", ETextureType::MiscPatch);
glPart = TexMan.CheckForTexture("glstuff/glpart.png", ETextureType::MiscPatch);
mirrorTexture = TexMan.CheckForTexture("glstuff/mirror.png", ETextureType::MiscPatch);
}

View file

@ -135,7 +135,7 @@ void GLSceneDrawer::AddLine (seg_t *seg, bool portalclip)
if (!seg->linedef->isVisualPortal())
{
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::mid));
if (!tex || tex->UseType==FTexture::TEX_Null)
if (!tex || tex->UseType==ETextureType::Null)
{
// nothing to do here!
seg->linedef->validcount=validcount;

View file

@ -114,7 +114,7 @@ bool gl_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto
if (bs_ceilingheight1 <= fs_floorheight1 && bs_ceilingheight2 <= fs_floorheight2)
{
FTexture * tex = TexMan(sidedef->GetTexture(side_t::top));
if (!tex || tex->UseType == FTexture::TEX_Null) return false;
if (!tex || tex->UseType == ETextureType::Null) return false;
if (backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
frontsector->GetTexture(sector_t::ceiling) == skyflatnum) return false;
return true;
@ -123,7 +123,7 @@ bool gl_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto
if (fs_ceilingheight1 <= bs_floorheight1 && fs_ceilingheight2 <= bs_floorheight2)
{
FTexture * tex = TexMan(sidedef->GetTexture(side_t::bottom));
if (!tex || tex->UseType == FTexture::TEX_Null) return false;
if (!tex || tex->UseType == ETextureType::Null) return false;
// properly render skies (consider door "open" if both floors are sky):
if (backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
@ -137,12 +137,12 @@ bool gl_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto
if (bs_ceilingheight1 < fs_ceilingheight1 || bs_ceilingheight2 < fs_ceilingheight2)
{
FTexture * tex = TexMan(sidedef->GetTexture(side_t::top));
if (!tex || tex->UseType == FTexture::TEX_Null) return false;
if (!tex || tex->UseType == ETextureType::Null) return false;
}
if (bs_floorheight1 > fs_floorheight1 || bs_floorheight2 > fs_floorheight2)
{
FTexture * tex = TexMan(sidedef->GetTexture(side_t::bottom));
if (!tex || tex->UseType == FTexture::TEX_Null) return false;
if (!tex || tex->UseType == ETextureType::Null) return false;
}
if (backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
frontsector->GetTexture(sector_t::ceiling) == skyflatnum) return false;

View file

@ -298,7 +298,7 @@ bool FDrawInfo::DoOneSectorUpper(subsector_t * subsec, float Planez)
{
// If there's a texture abort
FTexture * tex = TexMan[seg->sidedef->GetTexture(side_t::top)];
if (!tex || tex->UseType == FTexture::TEX_Null) continue;
if (!tex || tex->UseType == ETextureType::Null) continue;
else return false;
}
}
@ -356,7 +356,7 @@ bool FDrawInfo::DoOneSectorLower(subsector_t * subsec, float Planez)
{
// If there's a texture abort
FTexture * tex = TexMan[seg->sidedef->GetTexture(side_t::bottom)];
if (!tex || tex->UseType == FTexture::TEX_Null) continue;
if (!tex || tex->UseType == ETextureType::Null) continue;
else return false;
}
}

View file

@ -66,7 +66,7 @@ void GLSkyInfo::init(int sky1, PalEntry FadeColor)
FTextureID texno = s->GetTexture(pos);
texture[0] = FMaterial::ValidateTexture(texno, false, true);
if (!texture[0] || texture[0]->tex->UseType == FTexture::TEX_Null) goto normalsky;
if (!texture[0] || texture[0]->tex->UseType == ETextureType::Null) goto normalsky;
skytexno1 = texno;
x_offset[0] = s->GetTextureXOffset(pos) * (360.f/65536.f);
y_offset = s->GetTextureYOffset(pos);
@ -247,7 +247,7 @@ void GLWall::SkyTop(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex
if (bs->GetPlaneTexZ(sector_t::floor)==fs->GetPlaneTexZ(sector_t::floor)+1.)
{
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::bottom));
if (!tex || tex->UseType==FTexture::TEX_Null) return;
if (!tex || tex->UseType==ETextureType::Null) return;
// 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
@ -331,7 +331,7 @@ void GLWall::SkyBottom(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,ver
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::bottom));
// For lower skies the normal logic only applies to walls with no lower texture!
if (tex->UseType==FTexture::TEX_Null)
if (tex->UseType==ETextureType::Null)
{
if (bs->GetTexture(sector_t::floor)==skyflatnum)
{
@ -349,7 +349,7 @@ void GLWall::SkyBottom(seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,ver
}
zbottom[0]=zbottom[1]=-32768.0f;
if ((tex && tex->UseType!=FTexture::TEX_Null) || bs->GetTexture(sector_t::floor)!=skyflatnum)
if ((tex && tex->UseType!=ETextureType::Null) || bs->GetTexture(sector_t::floor)!=skyflatnum)
{
ztop[0]=zfloor[0];
ztop[1]=zfloor[1];

View file

@ -822,7 +822,7 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary,
//
//
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::top));
if (!tex || tex->UseType==FTexture::TEX_Null)
if (!tex || tex->UseType==ETextureType::Null)
{
if (front->GetTexture(sector_t::ceiling) == skyflatnum &&
back->GetTexture(sector_t::ceiling) == skyflatnum)
@ -858,7 +858,7 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary,
//
//
tex = TexMan(seg->sidedef->GetTexture(side_t::bottom));
if (!tex || tex->UseType==FTexture::TEX_Null)
if (!tex || tex->UseType==ETextureType::Null)
{
// texture is missing - use the lower plane
bottomleft = MIN(bfh1,ffh1);

View file

@ -223,8 +223,8 @@ void PostProcessShaderInstance::BindTextures()
continue;
FString name = pair->Value;
FTexture *tex = TexMan(TexMan.CheckForTexture(name, FTexture::TEX_Any));
if (tex && tex->UseType != FTexture::TEX_Null)
FTexture *tex = TexMan(TexMan.CheckForTexture(name, ETextureType::Any));
if (tex && tex->UseType != ETextureType::Null)
{
glUniform1i(location, textureUnit);

View file

@ -964,11 +964,11 @@ void gl_ParseHardwareShader(FScanner &sc, int deflump)
}
else
{
int type = FTexture::TEX_Any;
ETextureType type = ETextureType::Any;
if (sc.Compare("texture")) type = FTexture::TEX_Wall;
else if (sc.Compare("flat")) type = FTexture::TEX_Flat;
else if (sc.Compare("sprite")) type = FTexture::TEX_Sprite;
if (sc.Compare("texture")) type = ETextureType::Wall;
else if (sc.Compare("flat")) type = ETextureType::Flat;
else if (sc.Compare("sprite")) type = ETextureType::Sprite;
else sc.UnGet();
bool disable_fullbright = false;

View file

@ -243,7 +243,7 @@ bool FShaderLayer::ParseLayer(FScanner &sc)
if (sc.GetString())
{
texture = TexMan.CheckForTexture(sc.String, FTexture::TEX_Wall);
texture = TexMan.CheckForTexture(sc.String, ETextureType::Wall);
if (!texture.isValid())
{
sc.ScriptMessage("Unknown texture '%s'", sc.String);

View file

@ -111,14 +111,14 @@ int CheckDDPK3(FTexture *tex)
FString checkName;
const char ** checklist;
uint8_t useType=tex->UseType;
ETextureType useType=tex->UseType;
if (useType==FTexture::TEX_SkinSprite || useType==FTexture::TEX_Decal || useType==FTexture::TEX_FontChar)
if (useType==ETextureType::SkinSprite || useType==ETextureType::Decal || useType==ETextureType::FontChar)
{
return -3;
}
bool ispatch = (useType==FTexture::TEX_MiscPatch || useType==FTexture::TEX_Sprite) ;
bool ispatch = (useType==ETextureType::MiscPatch || useType==ETextureType::Sprite) ;
// for patches this doesn't work yet
if (ispatch) return -3;
@ -127,34 +127,34 @@ int CheckDDPK3(FTexture *tex)
{
if (!(gameinfo.flags & GI_MAPxx))
{
checklist = useType==FTexture::TEX_Flat? doomflatpath : doom1texpath;
checklist = useType==ETextureType::Flat? doomflatpath : doom1texpath;
}
else
{
SetDoom2Wad();
if (Doom2Wad == 1)
checklist = useType==FTexture::TEX_Flat? doomflatpath : pluttexpath;
checklist = useType==ETextureType::Flat? doomflatpath : pluttexpath;
else if (Doom2Wad == 2)
checklist = useType==FTexture::TEX_Flat? doomflatpath : tnttexpath;
checklist = useType==ETextureType::Flat? doomflatpath : tnttexpath;
else
checklist = useType==FTexture::TEX_Flat? doomflatpath : doom2texpath;
checklist = useType==ETextureType::Flat? doomflatpath : doom2texpath;
}
}
else if (!gameinfo.ConfigName.CompareNoCase("Heretic"))
{
checklist = useType==FTexture::TEX_Flat? hereticflatpath : heretictexpath;
checklist = useType==ETextureType::Flat? hereticflatpath : heretictexpath;
}
else if (!gameinfo.ConfigName.CompareNoCase("Hexen"))
{
checklist = useType==FTexture::TEX_Flat? hexenflatpath : hexentexpath;
checklist = useType==ETextureType::Flat? hexenflatpath : hexentexpath;
}
else if (!gameinfo.ConfigName.CompareNoCase("Strife"))
{
checklist = useType==FTexture::TEX_Flat? strifeflatpath : strifetexpath;
checklist = useType==ETextureType::Flat? strifeflatpath : strifetexpath;
}
else if (!gameinfo.ConfigName.CompareNoCase("Chex"))
{
checklist = useType==FTexture::TEX_Flat? chexflatpath : chextexpath;
checklist = useType==ETextureType::Flat? chexflatpath : chextexpath;
}
else
return -3;
@ -292,14 +292,14 @@ int CheckExternalFile(FTexture *tex, bool & hascolorkey)
FString checkName;
const char ** checklist;
uint8_t useType=tex->UseType;
ETextureType useType = tex->UseType;
if (useType==FTexture::TEX_SkinSprite || useType==FTexture::TEX_Decal || useType==FTexture::TEX_FontChar)
if (useType == ETextureType::SkinSprite || useType == ETextureType::Decal || useType == ETextureType::FontChar)
{
return -3;
}
bool ispatch = (useType==FTexture::TEX_MiscPatch || useType==FTexture::TEX_Sprite) ;
bool ispatch = (useType==ETextureType::MiscPatch || useType==ETextureType::Sprite) ;
// for patches this doesn't work yet
if (ispatch) return -3;
@ -308,34 +308,34 @@ int CheckExternalFile(FTexture *tex, bool & hascolorkey)
{
if (!(gameinfo.flags & GI_MAPxx))
{
checklist = ispatch ? doom1patchpath : useType==FTexture::TEX_Flat? doom1flatpath : doom1texpath;
checklist = ispatch ? doom1patchpath : useType==ETextureType::Flat? doom1flatpath : doom1texpath;
}
else
{
SetDoom2Wad();
if (Doom2Wad == 1)
checklist = ispatch ? plutpatchpath : useType==FTexture::TEX_Flat? plutflatpath : pluttexpath;
checklist = ispatch ? plutpatchpath : useType==ETextureType::Flat? plutflatpath : pluttexpath;
else if (Doom2Wad == 2)
checklist = ispatch ? tntpatchpath : useType==FTexture::TEX_Flat? tntflatpath : tnttexpath;
checklist = ispatch ? tntpatchpath : useType==ETextureType::Flat? tntflatpath : tnttexpath;
else
checklist = ispatch ? doom2patchpath : useType==FTexture::TEX_Flat? doom2flatpath : doom2texpath;
checklist = ispatch ? doom2patchpath : useType==ETextureType::Flat? doom2flatpath : doom2texpath;
}
}
else if (!gameinfo.ConfigName.CompareNoCase("Heretic"))
{
checklist = ispatch ? hereticpatchpath : useType==FTexture::TEX_Flat? hereticflatpath : heretictexpath;
checklist = ispatch ? hereticpatchpath : useType==ETextureType::Flat? hereticflatpath : heretictexpath;
}
else if (!gameinfo.ConfigName.CompareNoCase("Hexen"))
{
checklist = ispatch ? hexenpatchpath : useType==FTexture::TEX_Flat? hexenflatpath : hexentexpath;
checklist = ispatch ? hexenpatchpath : useType==ETextureType::Flat? hexenflatpath : hexentexpath;
}
else if (!gameinfo.ConfigName.CompareNoCase("Strife"))
{
checklist = ispatch ?strifepatchpath : useType==FTexture::TEX_Flat? strifeflatpath : strifetexpath;
checklist = ispatch ?strifepatchpath : useType==ETextureType::Flat? strifeflatpath : strifetexpath;
}
else if (!gameinfo.ConfigName.CompareNoCase("Chex"))
{
checklist = ispatch ?chexpatchpath : useType==FTexture::TEX_Flat? chexflatpath : chextexpath;
checklist = ispatch ?chexpatchpath : useType==ETextureType::Flat? chexflatpath : chextexpath;
}
else
return -3;

View file

@ -339,12 +339,12 @@ unsigned char *gl_CreateUpsampledTextureBuffer ( const FTexture *inputTexture, u
switch (inputTexture->UseType)
{
case FTexture::TEX_Sprite:
case FTexture::TEX_SkinSprite:
case ETextureType::Sprite:
case ETextureType::SkinSprite:
if (!(gl_texture_hqresize_targets & 2)) return inputBuffer;
break;
case FTexture::TEX_FontChar:
case ETextureType::FontChar:
if (!(gl_texture_hqresize_targets & 4)) return inputBuffer;
break;

View file

@ -110,7 +110,7 @@ unsigned char *FGLTexture::LoadHiresTexture(FTexture *tex, int *width, int *heig
if (HiresLump >=0)
{
hirestexture = FTexture::CreateTexture(HiresLump, FTexture::TEX_Any);
hirestexture = FTexture::CreateTexture(HiresLump, ETextureType::Any);
}
}
if (hirestexture != NULL)
@ -261,7 +261,7 @@ unsigned char * FGLTexture::CreateTexBuffer(int translation, int & w, int & h, F
FHardwareTexture *FGLTexture::CreateHwTexture()
{
if (tex->UseType==FTexture::TEX_Null) return NULL; // Cannot register a NULL texture
if (tex->UseType==ETextureType::Null) return NULL; // Cannot register a NULL texture
if (mHwTexture == NULL)
{
mHwTexture = new FHardwareTexture(tex->GetWidth() + bExpandFlag*2, tex->GetHeight() + bExpandFlag*2, tex->gl_info.bNoCompress);
@ -418,7 +418,7 @@ float FTexCoordInfo::TextureAdjustWidth() const
//===========================================================================
FGLTexture * FMaterial::ValidateSysTexture(FTexture * tex, bool expand)
{
if (tex && tex->UseType!=FTexture::TEX_Null)
if (tex && tex->UseType!=ETextureType::Null)
{
FGLTexture *gltex = tex->gl_info.SystemTexture[expand];
if (gltex == NULL)
@ -870,7 +870,7 @@ void FMaterial::BindToFrameBuffer()
FMaterial * FMaterial::ValidateTexture(FTexture * tex, bool expand)
{
again:
if (tex && tex->UseType!=FTexture::TEX_Null)
if (tex && tex->UseType!=ETextureType::Null)
{
if (tex->gl_info.bNoExpand) expand = false;

View file

@ -233,7 +233,7 @@ void FTexture::CreateDefaultBrightmap()
{
// Check for brightmaps
if (UseBasePalette() && HasGlobalBrightmap &&
UseType != TEX_Decal && UseType != TEX_MiscPatch && UseType != TEX_FontChar &&
UseType != ETextureType::Decal && UseType != ETextureType::MiscPatch && UseType != ETextureType::FontChar &&
gl_info.Brightmap == NULL && bWarped == 0
)
{
@ -312,7 +312,7 @@ bool FTexture::FindHoles(const unsigned char * buffer, int w, int h)
// already done!
if (gl_info.areacount) return false;
if (UseType == TEX_Flat) return false; // flats don't have transparent parts
if (UseType == ETextureType::Flat) return false; // flats don't have transparent parts
gl_info.areacount=-1; //whatever happens next, it shouldn't be done twice!
// large textures are excluded for performance reasons
@ -544,7 +544,7 @@ int FBrightmapTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotat
void gl_ParseMaterial(FScanner &sc, int deflump)
{
int type = FTexture::TEX_Any;
ETextureType type = ETextureType::Any;
bool disable_fullbright = false;
bool disable_fullbright_specified = false;
bool thiswad = false;
@ -556,9 +556,9 @@ void gl_ParseMaterial(FScanner &sc, int deflump)
memset(textures, 0, sizeof(textures));
sc.MustGetString();
if (sc.Compare("texture")) type = FTexture::TEX_Wall;
else if (sc.Compare("flat")) type = FTexture::TEX_Flat;
else if (sc.Compare("sprite")) type = FTexture::TEX_Sprite;
if (sc.Compare("texture")) type = ETextureType::Wall;
else if (sc.Compare("flat")) type = ETextureType::Flat;
else if (sc.Compare("sprite")) type = ETextureType::Sprite;
else sc.UnGet();
sc.MustGetString();
@ -608,7 +608,7 @@ void gl_ParseMaterial(FScanner &sc, int deflump)
sc.MustGetString();
if (textures[i])
Printf("Multiple %s definitions in texture %s\n", keywords[i], tex? tex->Name.GetChars() : "(null)");
textures[i] = TexMan.FindTexture(sc.String, FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny);
textures[i] = TexMan.FindTexture(sc.String, ETextureType::Any, FTextureManager::TEXMAN_TryAny);
if (!textures[i])
Printf("%s '%s' not found in texture '%s'\n", notFound[i], sc.String, tex? tex->Name.GetChars() : "(null)");
break;
@ -663,16 +663,16 @@ void gl_ParseMaterial(FScanner &sc, int deflump)
void gl_ParseBrightmap(FScanner &sc, int deflump)
{
int type = FTexture::TEX_Any;
ETextureType type = ETextureType::Any;
bool disable_fullbright=false;
bool thiswad = false;
bool iwad = false;
FTexture *bmtex = NULL;
sc.MustGetString();
if (sc.Compare("texture")) type = FTexture::TEX_Wall;
else if (sc.Compare("flat")) type = FTexture::TEX_Flat;
else if (sc.Compare("sprite")) type = FTexture::TEX_Sprite;
if (sc.Compare("texture")) type = ETextureType::Wall;
else if (sc.Compare("flat")) type = ETextureType::Flat;
else if (sc.Compare("sprite")) type = ETextureType::Sprite;
else sc.UnGet();
sc.MustGetString();
@ -709,7 +709,7 @@ void gl_ParseBrightmap(FScanner &sc, int deflump)
Printf("Multiple brightmap definitions in texture %s\n", tex? tex->Name.GetChars() : "(null)");
}
bmtex = TexMan.FindTexture(sc.String, FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny);
bmtex = TexMan.FindTexture(sc.String, ETextureType::Any, FTextureManager::TEXMAN_TryAny);
if (bmtex == NULL)
Printf("Brightmap '%s' not found in texture '%s'\n", sc.String, tex? tex->Name.GetChars() : "(null)");
@ -789,7 +789,7 @@ void AddAutoMaterials()
TArray<FTextureID> list;
FString texname = ExtractFileBase(name, false);
TexMan.ListTextures(texname, list);
auto bmtex = TexMan.FindTexture(name, FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny);
auto bmtex = TexMan.FindTexture(name, ETextureType::Any, FTextureManager::TEXMAN_TryAny);
for (auto texid : list)
{
bmtex->bMasked = false;
@ -946,7 +946,7 @@ void gl_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitl
{
if (smf->skinIDs[i].isValid())
{
texhitlist[smf->skinIDs[i].GetIndex()] |= FTexture::TEX_Flat;
texhitlist[smf->skinIDs[i].GetIndex()] |= FTextureManager::HIT_Flat;
}
else if (smf->modelIDs[i] != -1)
{

View file

@ -117,7 +117,7 @@ void DIntermissionScreen::Init(FIntermissionAction *desc, bool first)
}
if (texname[0] != 0)
{
mBackground = TexMan.CheckForTexture(texname, FTexture::TEX_MiscPatch);
mBackground = TexMan.CheckForTexture(texname, ETextureType::MiscPatch);
mFlatfill = desc->mFlatfill;
}
S_Sound (CHAN_VOICE | CHAN_UI, desc->mSound, 1.0f, ATTN_NONE);
@ -147,7 +147,7 @@ void DIntermissionScreen::Init(FIntermissionAction *desc, bool first)
mOverlays[i].x = desc->mOverlays[i].x;
mOverlays[i].y = desc->mOverlays[i].y;
mOverlays[i].mCondition = desc->mOverlays[i].mCondition;
mOverlays[i].mPic = TexMan.CheckForTexture(desc->mOverlays[i].mName, FTexture::TEX_MiscPatch);
mOverlays[i].mPic = TexMan.CheckForTexture(desc->mOverlays[i].mName, ETextureType::MiscPatch);
}
mTicker = 0;
}
@ -640,7 +640,7 @@ void DIntermissionScreenScroller::Init(FIntermissionAction *desc, bool first)
{
Super::Init(desc, first);
mFirstPic = mBackground;
mSecondPic = TexMan.CheckForTexture(static_cast<FIntermissionActionScroller*>(desc)->mSecondPic, FTexture::TEX_MiscPatch);
mSecondPic = TexMan.CheckForTexture(static_cast<FIntermissionActionScroller*>(desc)->mSecondPic, ETextureType::MiscPatch);
mScrollDelay = static_cast<FIntermissionActionScroller*>(desc)->mScrollDelay;
mScrollTime = static_cast<FIntermissionActionScroller*>(desc)->mScrollTime;
mScrollDir = static_cast<FIntermissionActionScroller*>(desc)->mScrollDir;

View file

@ -161,7 +161,7 @@ void DeinitMenus()
static FTextureID GetMenuTexture(const char* const name)
{
const FTextureID texture = TexMan.CheckForTexture(name, FTexture::TEX_MiscPatch);
const FTextureID texture = TexMan.CheckForTexture(name, ETextureType::MiscPatch);
if (!texture.Exists() && mustPrintErrors)
{
@ -417,7 +417,7 @@ static void ParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc)
}
else if (args[i] == TypeTextureID)
{
auto f = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
auto f = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch);
if (!f.Exists())
{
sc.ScriptMessage("Unknown texture %s", sc.String);

View file

@ -3873,7 +3873,7 @@ void DLevelScript::ChangeFlat (int tag, int name, bool floorOrCeiling)
if (flatname == NULL)
return;
flat = TexMan.GetTexture (flatname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
flat = TexMan.GetTexture (flatname, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0)
@ -3905,7 +3905,7 @@ void DLevelScript::SetLineTexture (int lineid, int side, int position, int name)
side = !!side;
texture = TexMan.GetTexture (texname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
texture = TexMan.GetTexture (texname, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
FLineIdIterator itr(lineid);
while ((linenum = itr.Next()) >= 0)
@ -4700,7 +4700,7 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b
{
return 0;
}
FTexture *tex = TexMan.FindTexture(FBehavior::StaticLookupString(string), FTexture::TEX_Flat,
FTexture *tex = TexMan.FindTexture(FBehavior::StaticLookupString(string), ETextureType::Flat,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_DontCreate);
if (tex == NULL)
@ -10033,11 +10033,11 @@ scriptwait:
sky2name = FBehavior::StaticLookupString (STACK(1));
if (sky1name[0] != 0)
{
sky1texture = level.skytexture1 = TexMan.GetTexture (sky1name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
sky1texture = level.skytexture1 = TexMan.GetTexture (sky1name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
}
if (sky2name[0] != 0)
{
sky2texture = level.skytexture2 = TexMan.GetTexture (sky2name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
sky2texture = level.skytexture2 = TexMan.GetTexture (sky2name, ETextureType::Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
}
R_InitSkyMap ();
sp -= 2;
@ -10061,7 +10061,7 @@ scriptwait:
if (camera != NULL)
{
FTextureID picnum = TexMan.CheckForTexture (picname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
FTextureID picnum = TexMan.CheckForTexture (picname, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
if (!picnum.Exists())
{
Printf ("SetCameraToTexture: %s is not a texture\n", picname);

View file

@ -2250,8 +2250,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, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture(toname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
picnum1 = TexMan.GetTexture(fromname, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture(toname, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
for (auto &side : level.sides)
{
@ -2267,8 +2267,8 @@ void P_ReplaceTextures(const char *fromname, const char *toname, int flags)
}
if ((flags ^ (NOT_FLOOR | NOT_CEILING)) != 0)
{
picnum1 = TexMan.GetTexture(fromname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture(toname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
picnum1 = TexMan.GetTexture(fromname, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture(toname, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
for (auto &sec : level.sectors)
{

View file

@ -568,7 +568,7 @@ static void SetTexture (side_t *side, int position, const char *name, FMissingTe
static const char *positionnames[] = { "top", "middle", "bottom" };
static const char *sidenames[] = { "first", "second" };
FTextureID texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
FTextureID texture = TexMan.CheckForTexture (name, ETextureType::Wall,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
if (!texture.Exists())
@ -614,7 +614,7 @@ void SetTexture (sector_t *sector, int index, int position, const char *name, FM
name = name8;
}
FTextureID texture = TexMan.CheckForTexture (name, FTexture::TEX_Flat,
FTextureID texture = TexMan.CheckForTexture (name, ETextureType::Flat,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
if (!texture.Exists())
@ -668,7 +668,7 @@ static void SetTexture (side_t *side, int position, uint32_t *blend, const char
FTextureID texture;
if ((*blend = R_ColormapNumForName (name)) == 0)
{
texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
texture = TexMan.CheckForTexture (name, ETextureType::Wall,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
if (!texture.Exists())
{
@ -701,7 +701,7 @@ static void SetTextureNoErr (side_t *side, int position, uint32_t *color, const
{
FTextureID texture;
*validcolor = false;
texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
texture = TexMan.CheckForTexture (name, ETextureType::Wall,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
if (!texture.Exists())
{
@ -3482,12 +3482,12 @@ static void P_PrecacheLevel()
for (auto n : gameinfo.PrecachedTextures)
{
FTextureID tex = TexMan.CheckForTexture(n, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnFirst);
FTextureID tex = TexMan.CheckForTexture(n, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnFirst);
if (tex.Exists()) hitlist[tex.GetIndex()] |= FTextureManager::HIT_Wall;
}
for (unsigned i = 0; i < level.info->PrecacheTextures.Size(); i++)
{
FTextureID tex = TexMan.CheckForTexture(level.info->PrecacheTextures[i], FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnFirst);
FTextureID tex = TexMan.CheckForTexture(level.info->PrecacheTextures[i], ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnFirst);
if (tex.Exists()) hitlist[tex.GetIndex()] |= FTextureManager::HIT_Wall;
}

View file

@ -631,7 +631,7 @@ static void ParseFloor (FScanner &sc)
bool opt = sc.CheckString("optional");
sc.MustGetString ();
picnum = TexMan.CheckForTexture (sc.String, FTexture::TEX_Flat,
picnum = TexMan.CheckForTexture (sc.String, ETextureType::Flat,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
if (!picnum.Exists())

View file

@ -50,7 +50,7 @@ void RenderPolyDecal::Render(PolyRenderThread *thread, const TriMatrix &worldToC
return;
FTexture *tex = TexMan(decal->PicNum, true);
if (tex == nullptr || tex->UseType == FTexture::TEX_Null)
if (tex == nullptr || tex->UseType == ETextureType::Null)
return;
sector_t *front, *back;

View file

@ -67,7 +67,7 @@ void RenderPolyPlane::RenderNormal(PolyRenderThread *thread, const TriMatrix &wo
if (picnum != skyflatnum)
{
FTexture *tex = TexMan(picnum);
if (!tex || tex->UseType == FTexture::TEX_Null)
if (!tex || tex->UseType == ETextureType::Null)
return;
PolyPlaneUVTransform transform = PolyPlaneUVTransform(ceiling ? fakeflat.FrontSector->planes[sector_t::ceiling].xform : fakeflat.FrontSector->planes[sector_t::floor].xform, tex);
@ -516,7 +516,7 @@ void Render3DFloorPlane::Render(PolyRenderThread *thread, const TriMatrix &world
{
FTextureID picnum = ceiling ? *fakeFloor->bottom.texture : *fakeFloor->top.texture;
FTexture *tex = TexMan(picnum);
if (tex->UseType == FTexture::TEX_Null)
if (tex->UseType == ETextureType::Null)
return;
PolyCameraLight *cameraLight = PolyCameraLight::Instance();

View file

@ -224,7 +224,7 @@ void RenderPolyPlayerSprites::RenderSprite(PolyRenderThread *thread, DPSprite *p
flip = sprframe->Flip & 1;
tex = TexMan(picnum);
if (tex->UseType == FTexture::TEX_Null)
if (tex->UseType == ETextureType::Null)
return;
if (pspr->firstTic)

View file

@ -342,7 +342,7 @@ void PolySkySetup::Update()
}
frontskytex = TexMan(s->GetTexture(pos), true);
if (frontskytex == nullptr || frontskytex->UseType == FTexture::TEX_Null)
if (frontskytex == nullptr || frontskytex->UseType == ETextureType::Null)
{ // [RH] The blank texture: Use normal sky instead.
goto sky1;
}

View file

@ -104,7 +104,7 @@ void RenderPolySprite::Render(PolyRenderThread *thread, const TriMatrix &worldTo
bool flipTextureX = false;
FTexture *tex = GetSpriteTexture(thing, flipTextureX);
if (tex == nullptr || tex->UseType == FTexture::TEX_Null)
if (tex == nullptr || tex->UseType == ETextureType::Null)
return;
double thingyscalemul = thing->Scale.Y / tex->Scale.Y;
@ -315,7 +315,7 @@ FTexture *RenderPolySprite::GetSpriteTexture(AActor *thing, /*out*/ bool &flipX)
if (thing->picnum.isValid())
{
FTexture *tex = TexMan(thing->picnum);
if (tex->UseType == FTexture::TEX_Null)
if (tex->UseType == ETextureType::Null)
{
return nullptr;
}

View file

@ -173,7 +173,7 @@ bool RenderPolyWall::RenderLine(PolyRenderThread *thread, const TriMatrix &world
wall.FogBoundary = IsFogBoundary(frontsector, backsector);
FTexture *midtex = TexMan(line->sidedef->GetTexture(side_t::mid), true);
if ((midtex && midtex->UseType != FTexture::TEX_Null) || wall.FogBoundary)
if ((midtex && midtex->UseType != ETextureType::Null) || wall.FogBoundary)
translucentWallsOutput.push_back(thread->FrameMemory->NewObject<PolyTranslucentWall>(wall));
if (polyportal)
@ -519,7 +519,7 @@ void RenderPolyWall::ClampHeight(TriVertex &v1, TriVertex &v2)
FTexture *RenderPolyWall::GetTexture(const line_t *line, const side_t *side, side_t::ETexpart texpart)
{
FTexture *tex = TexMan(side->GetTexture(texpart), true);
if (tex == nullptr || tex->UseType == FTexture::TEX_Null)
if (tex == nullptr || tex->UseType == ETextureType::Null)
{
// Mapping error. Doom floodfills this with a plane.
// This code doesn't do that, but at least it uses the "right" texture..
@ -539,7 +539,7 @@ FTexture *RenderPolyWall::GetTexture(const line_t *line, const side_t *side, sid
tex = TexMan(line->frontsector->GetTexture(sector_t::floor), true);
}
if (tex == nullptr || tex->UseType == FTexture::TEX_Null)
if (tex == nullptr || tex->UseType == ETextureType::Null)
return nullptr;
}
return tex;

View file

@ -41,7 +41,7 @@ void RenderPolyWallSprite::Render(PolyRenderThread *thread, const TriMatrix &wor
bool flipTextureX = false;
FTexture *tex = RenderPolySprite::GetSpriteTexture(thing, flipTextureX);
if (tex == nullptr || tex->UseType == FTexture::TEX_Null)
if (tex == nullptr || tex->UseType == ETextureType::Null)
return;
DVector2 spriteScale = thing->Scale;

View file

@ -1462,7 +1462,7 @@ bool I_SetCursor(FTexture* cursorpic)
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSCursor* cursor = nil;
if (NULL != cursorpic && FTexture::TEX_Null != cursorpic->UseType)
if (NULL != cursorpic && ETextureType::Null != cursorpic->UseType)
{
// Create bitmap image representation

View file

@ -44,7 +44,7 @@ bool I_SetCursor(FTexture *cursorpic)
static SDL_Cursor *cursor;
static SDL_Surface *cursorSurface;
if (cursorpic != NULL && cursorpic->UseType != FTexture::TEX_Null)
if (cursorpic != NULL && cursorpic->UseType != ETextureType::Null)
{
// Must be no larger than 32x32.
if (cursorpic->GetWidth() > 32 || cursorpic->GetHeight() > 32)

View file

@ -356,7 +356,7 @@ FTextureID LoadSkin(const char * path, const char * fn)
int texlump = FindGFXFile(buffer);
const char * const texname = texlump < 0 ? fn : Wads.GetLumpFullName(texlump);
return TexMan.CheckForTexture(texname, FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny);
return TexMan.CheckForTexture(texname, ETextureType::Any, FTextureManager::TEXMAN_TryAny);
}
//===========================================================================

View file

@ -333,7 +333,7 @@ void FDMDModel::AddSkins(uint8_t *hitlist)
{
if (skins[i].isValid())
{
hitlist[skins[i].GetIndex()] |= FTexture::TEX_Flat;
hitlist[skins[i].GetIndex()] |= FTextureManager::HIT_Flat;
}
}
}

View file

@ -305,7 +305,7 @@ void FMD3Model::AddSkins(uint8_t *hitlist)
{
if (curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
{
hitlist[curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].GetIndex()] |= FTexture::TEX_Flat;
hitlist[curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].GetIndex()] |= FTextureManager::HIT_Flat;
}
MD3Surface * surf = &surfaces[i];
@ -313,7 +313,7 @@ void FMD3Model::AddSkins(uint8_t *hitlist)
{
if (surf->skins[j].isValid())
{
hitlist[surf->skins[j].GetIndex()] |= FTexture::TEX_Flat;
hitlist[surf->skins[j].GetIndex()] |= FTextureManager::HIT_Flat;
}
}
}

View file

@ -361,7 +361,7 @@ void FVoxelModel::BuildVertexBuffer(FModelRenderer *renderer)
void FVoxelModel::AddSkins(uint8_t *hitlist)
{
hitlist[mPalette.GetIndex()] |= FTexture::TEX_Flat;
hitlist[mPalette.GetIndex()] |= FTextureManager::HIT_Flat;
}
//===========================================================================

View file

@ -337,7 +337,7 @@ void R_InitSpriteDefs ()
for (i = 0; i < smax; ++i)
{
FTexture *tex = TexMan.ByIndex(i);
if (tex->UseType == FTexture::TEX_Sprite && strlen(tex->Name) >= 6)
if (tex->UseType == ETextureType::Sprite && strlen(tex->Name) >= 6)
{
size_t bucket = TEX_DWNAME(tex) % smax;
hashes[i].Next = hashes[bucket].Head;
@ -856,7 +856,7 @@ void R_InitSkins (void)
memcpy(&lnameint, lname, 4);
if (lnameint == intname)
{
FTextureID picnum = TexMan.CreateTexture(k, FTexture::TEX_SkinSprite);
FTextureID picnum = TexMan.CreateTexture(k, ETextureType::SkinSprite);
bool res = R_InstallSpriteLump (picnum, lname[4] - 'A', lname[5], false, sprtemp, maxframe);
if (lname[6] && res)

View file

@ -84,11 +84,11 @@ void R_InitSkyMap ()
// Do not allow the null texture which has no bitmap and will crash.
if (sky1texture.isNull())
{
sky1texture = TexMan.CheckForTexture("-noflat-", FTexture::TEX_Any);
sky1texture = TexMan.CheckForTexture("-noflat-", ETextureType::Any);
}
if (sky2texture.isNull())
{
sky2texture = TexMan.CheckForTexture("-noflat-", FTexture::TEX_Any);
sky2texture = TexMan.CheckForTexture("-noflat-", ETextureType::Any);
}
skytex1 = TexMan(sky1texture, true);

View file

@ -1062,7 +1062,7 @@ DEFINE_ACTION_FUNCTION(_TexMan, SetCameraToTexture)
PARAM_OBJECT(viewpoint, AActor);
PARAM_STRING(texturename); // [ZZ] there is no point in having this as FTextureID because it's easier to refer to a cameratexture by name and it isn't executed too often to cache it.
PARAM_FLOAT(fov);
FTextureID textureid = TexMan.CheckForTexture(texturename, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
FTextureID textureid = TexMan.CheckForTexture(texturename, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
FCanvasTextureInfo::Add(viewpoint, textureid, fov);
return 0;
}

View file

@ -1147,7 +1147,7 @@ static void SetIcon(FTextureID &icon, Baggage &bag, const char *i)
}
else
{
icon = TexMan.CheckForTexture(i, FTexture::TEX_MiscPatch);
icon = TexMan.CheckForTexture(i, ETextureType::MiscPatch);
if (!icon.isValid())
{
// Don't print warnings if the item is for another game or if this is a shareware IWAD.
@ -1609,7 +1609,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, sidemove, F_f, PlayerPawn)
DEFINE_CLASS_PROPERTY_PREFIX(player, scoreicon, S, PlayerPawn)
{
PROP_STRING_PARM(z, 0);
defaults->ScoreIcon = TexMan.CheckForTexture(z, FTexture::TEX_MiscPatch);
defaults->ScoreIcon = TexMan.CheckForTexture(z, ETextureType::MiscPatch);
if (!defaults->ScoreIcon.isValid())
{
bag.ScriptPosition.Message(MSG_WARNING,

View file

@ -1531,7 +1531,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FTextureID &value, FTe
arc.WriteKey(key);
arc.w->StartArray();
arc.w->String(name);
arc.w->Int(pic->UseType);
arc.w->Int(static_cast<int>(pic->UseType));
arc.w->EndArray();
}
}
@ -1547,7 +1547,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()), typeval.GetInt());
value = TexMan.GetTexture(UnicodeToString(nameval.GetString()), static_cast<ETextureType>(typeval.GetInt()));
}
else
{

View file

@ -424,7 +424,7 @@ namespace swrenderer
if (!onlyUpdatePlaneClip)
// allocate space for masked texture tables, if needed
// [RH] Don't just allocate the space; fill it in too.
if ((TexMan(sidedef->GetTexture(side_t::mid), true)->UseType != FTexture::TEX_Null || draw_segment->Has3DFloorWalls() || IsFogBoundary(mFrontSector, mBackSector)) &&
if ((TexMan(sidedef->GetTexture(side_t::mid), true)->UseType != ETextureType::Null || draw_segment->Has3DFloorWalls() || IsFogBoundary(mFrontSector, mBackSector)) &&
(mCeilingClipped != ProjectedWallCull::OutsideBelow || !sidedef->GetTexture(side_t::top).isValid()) &&
(mFloorClipped != ProjectedWallCull::OutsideAbove || !sidedef->GetTexture(side_t::bottom).isValid()) &&
(WallC.sz1 >= TOO_CLOSE_Z && WallC.sz2 >= TOO_CLOSE_Z))
@ -1100,7 +1100,7 @@ namespace swrenderer
}
else
{ // two sided line
if (mTopPart.Texture != NULL && mTopPart.Texture->UseType != FTexture::TEX_Null)
if (mTopPart.Texture != NULL && mTopPart.Texture->UseType != ETextureType::Null)
{ // top wall
for (int x = x1; x < x2; ++x)
{
@ -1113,7 +1113,7 @@ namespace swrenderer
memcpy(ceilingclip + x1, walltop.ScreenY + x1, (x2 - x1) * sizeof(short));
}
if (mBottomPart.Texture != NULL && mBottomPart.Texture->UseType != FTexture::TEX_Null)
if (mBottomPart.Texture != NULL && mBottomPart.Texture->UseType != ETextureType::Null)
{ // bottom wall
for (int x = x1; x < x2; ++x)
{
@ -1131,7 +1131,7 @@ namespace swrenderer
void SWRenderLine::RenderTopTexture(int x1, int x2)
{
if (mMiddlePart.Texture) return;
if (!mTopPart.Texture || mTopPart.Texture->UseType == FTexture::TEX_Null) return;
if (!mTopPart.Texture || mTopPart.Texture->UseType == ETextureType::Null) return;
if (!viewactive) return;
FTexture *rw_pic = mTopPart.Texture;
@ -1178,7 +1178,7 @@ namespace swrenderer
void SWRenderLine::RenderMiddleTexture(int x1, int x2)
{
if (!mMiddlePart.Texture || mMiddlePart.Texture->UseType == FTexture::TEX_Null) return;
if (!mMiddlePart.Texture || mMiddlePart.Texture->UseType == ETextureType::Null) return;
if (!viewactive) return;
FTexture *rw_pic = mMiddlePart.Texture;
@ -1226,7 +1226,7 @@ namespace swrenderer
void SWRenderLine::RenderBottomTexture(int x1, int x2)
{
if (mMiddlePart.Texture) return;
if (!mBottomPart.Texture || mBottomPart.Texture->UseType == FTexture::TEX_Null) return;
if (!mBottomPart.Texture || mBottomPart.Texture->UseType == ETextureType::Null) return;
if (!viewactive) return;
FTexture *rw_pic = mBottomPart.Texture;

View file

@ -327,7 +327,7 @@ namespace swrenderer
void RenderWallPart::ProcessWallWorker(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal)
{
if (rw_pic->UseType == FTexture::TEX_Null)
if (rw_pic->UseType == ETextureType::Null)
return;
int fracbits = 32 - rw_pic->HeightBits;

View file

@ -126,7 +126,7 @@ namespace swrenderer
}
frontskytex = TexMan(s->GetTexture(pos), true);
if (frontskytex == NULL || frontskytex->UseType == FTexture::TEX_Null)
if (frontskytex == NULL || frontskytex->UseType == ETextureType::Null)
{ // [RH] The blank texture: Use normal sky instead.
goto sky1;
}

View file

@ -115,7 +115,7 @@ namespace swrenderer
{
FTexture *tex = TexMan(picnum, true);
if (tex->UseType == FTexture::TEX_Null)
if (tex->UseType == ETextureType::Null)
{
return;
}

View file

@ -1042,7 +1042,7 @@ namespace swrenderer
sprite.picnum = thing->picnum;
sprite.tex = TexMan(sprite.picnum);
if (sprite.tex->UseType == FTexture::TEX_Null)
if (sprite.tex->UseType == ETextureType::Null)
{
return false;
}
@ -1114,7 +1114,7 @@ namespace swrenderer
return false;
}
if (sprite.voxel == nullptr && (sprite.tex == nullptr || sprite.tex->UseType == FTexture::TEX_Null))
if (sprite.voxel == nullptr && (sprite.tex == nullptr || sprite.tex->UseType == ETextureType::Null))
{
return false;
}

View file

@ -132,7 +132,7 @@ namespace swrenderer
FTexture *WallSpriteTile = TexMan(decal->PicNum, true);
flipx = (uint8_t)(decal->RenderFlags & RF_XFLIP);
if (WallSpriteTile == NULL || WallSpriteTile->UseType == FTexture::TEX_Null)
if (WallSpriteTile == NULL || WallSpriteTile->UseType == ETextureType::Null)
{
return;
}

View file

@ -228,7 +228,7 @@ namespace swrenderer
flip = sprframe->Flip & 1;
tex = TexMan(picnum);
if (tex->UseType == FTexture::TEX_Null)
if (tex->UseType == ETextureType::Null)
return;
if (pspr->firstTic)

View file

@ -81,13 +81,13 @@ void FTextureManager::InitSwitchList ()
continue;
}
// [RH] Skip this switch if its textures can't be found.
if (CheckForTexture (list_p /* .name1 */, FTexture::TEX_Wall, texflags).Exists() &&
CheckForTexture (list_p + 9 /* .name2 */, FTexture::TEX_Wall, texflags).Exists())
if (CheckForTexture (list_p /* .name1 */, ETextureType::Wall, texflags).Exists() &&
CheckForTexture (list_p + 9 /* .name2 */, ETextureType::Wall, texflags).Exists())
{
def1 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef));
def2 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef));
def1->PreTexture = def2->frames[0].Texture = CheckForTexture (list_p /* .name1 */, FTexture::TEX_Wall, texflags);
def2->PreTexture = def1->frames[0].Texture = CheckForTexture (list_p + 9, FTexture::TEX_Wall, texflags);
def1->PreTexture = def2->frames[0].Texture = CheckForTexture (list_p /* .name1 */, ETextureType::Wall, texflags);
def2->PreTexture = def1->frames[0].Texture = CheckForTexture (list_p + 9, ETextureType::Wall, texflags);
def1->Sound = def2->Sound = 0;
def1->NumFrames = def2->NumFrames = 1;
def1->frames[0].TimeMin = def2->frames[0].TimeMin = 0;
@ -148,7 +148,7 @@ void FTextureManager::ProcessSwitchDef (FScanner &sc)
}
sc.MustGetString ();
picnum = CheckForTexture (sc.String, FTexture::TEX_Wall, texflags);
picnum = CheckForTexture (sc.String, ETextureType::Wall, texflags);
picname = sc.String;
while (sc.GetString ())
{
@ -247,7 +247,7 @@ FSwitchDef *FTextureManager::ParseSwitchDef (FScanner &sc, bool ignoreBad)
else if (sc.Compare ("pic"))
{
sc.MustGetString ();
picnum = CheckForTexture (sc.String, FTexture::TEX_Wall, texflags);
picnum = CheckForTexture (sc.String, ETextureType::Wall, texflags);
if (!picnum.Exists() && !ignoreBad)
{
//Printf ("Unknown switch texture %s\n", sc.String);

View file

@ -206,8 +206,8 @@ void FTextureManager::InitAnimated (void)
if (*anim_p /* .istexture */ & 1)
{
// different episode ?
if (!(pic1 = CheckForTexture ((const char*)(anim_p + 10) /* .startname */, FTexture::TEX_Wall, texflags)).Exists() ||
!(pic2 = CheckForTexture ((const char*)(anim_p + 1) /* .endname */, FTexture::TEX_Wall, texflags)).Exists())
if (!(pic1 = CheckForTexture ((const char*)(anim_p + 10) /* .startname */, ETextureType::Wall, texflags)).Exists() ||
!(pic2 = CheckForTexture ((const char*)(anim_p + 1) /* .endname */, ETextureType::Wall, texflags)).Exists())
continue;
// [RH] Bit 1 set means allow decals on walls with this texture
@ -215,8 +215,8 @@ void FTextureManager::InitAnimated (void)
}
else
{
if (!(pic1 = CheckForTexture ((const char*)(anim_p + 10) /* .startname */, FTexture::TEX_Flat, texflags)).Exists() ||
!(pic2 = CheckForTexture ((const char*)(anim_p + 1) /* .startname */, FTexture::TEX_Flat, texflags)).Exists())
if (!(pic1 = CheckForTexture ((const char*)(anim_p + 10) /* .startname */, ETextureType::Flat, texflags)).Exists() ||
!(pic2 = CheckForTexture ((const char*)(anim_p + 1) /* .startname */, ETextureType::Flat, texflags)).Exists())
continue;
}
@ -291,11 +291,11 @@ void FTextureManager::InitAnimDefs ()
{
if (sc.Compare ("flat"))
{
ParseAnim (sc, FTexture::TEX_Flat);
ParseAnim (sc, ETextureType::Flat);
}
else if (sc.Compare ("texture"))
{
ParseAnim (sc, FTexture::TEX_Wall);
ParseAnim (sc, ETextureType::Wall);
}
else if (sc.Compare ("switch"))
{
@ -317,7 +317,7 @@ void FTextureManager::InitAnimDefs ()
else if (sc.Compare("skyoffset"))
{
sc.MustGetString ();
FTextureID picnum = CheckForTexture (sc.String, FTexture::TEX_Wall, texflags);
FTextureID picnum = CheckForTexture (sc.String, ETextureType::Wall, texflags);
sc.MustGetNumber();
if (picnum.Exists())
{
@ -341,7 +341,7 @@ void FTextureManager::InitAnimDefs ()
//
//==========================================================================
void FTextureManager::ParseAnim (FScanner &sc, int usetype)
void FTextureManager::ParseAnim (FScanner &sc, ETextureType usetype)
{
const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny;
TArray<FAnimDef::FAnimFrame> frames (32);
@ -463,7 +463,7 @@ void FTextureManager::ParseAnim (FScanner &sc, int usetype)
//
//==========================================================================
FAnimDef *FTextureManager::ParseRangeAnim (FScanner &sc, FTextureID picnum, int usetype, bool missing)
FAnimDef *FTextureManager::ParseRangeAnim (FScanner &sc, FTextureID picnum, ETextureType usetype, bool missing)
{
int type;
FTextureID framenum;
@ -504,7 +504,7 @@ FAnimDef *FTextureManager::ParseRangeAnim (FScanner &sc, FTextureID picnum, int
//
//==========================================================================
void FTextureManager::ParsePicAnim (FScanner &sc, FTextureID picnum, int usetype, bool missing, TArray<FAnimDef::FAnimFrame> &frames)
void FTextureManager::ParsePicAnim (FScanner &sc, FTextureID picnum, ETextureType usetype, bool missing, TArray<FAnimDef::FAnimFrame> &frames)
{
FTextureID framenum;
uint32_t min = 1, max = 1;
@ -532,7 +532,7 @@ void FTextureManager::ParsePicAnim (FScanner &sc, FTextureID picnum, int usetype
//
//==========================================================================
FTextureID FTextureManager::ParseFramenum (FScanner &sc, FTextureID basepicnum, int usetype, bool allowMissing)
FTextureID FTextureManager::ParseFramenum (FScanner &sc, FTextureID basepicnum, ETextureType usetype, bool allowMissing)
{
const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny;
FTextureID framenum;
@ -611,7 +611,7 @@ void FTextureManager::ParseWarp(FScanner &sc)
{
sc.ScriptError (NULL);
}
FTextureID picnum = CheckForTexture (sc.String, isflat ? FTexture::TEX_Flat : FTexture::TEX_Wall, texflags);
FTextureID picnum = CheckForTexture (sc.String, isflat ? ETextureType::Flat : ETextureType::Wall, texflags);
if (picnum.isValid())
{
@ -675,7 +675,7 @@ void FTextureManager::ParseCameraTexture(FScanner &sc)
width = sc.Number;
sc.MustGetNumber ();
height = sc.Number;
FTextureID picnum = CheckForTexture (picname, FTexture::TEX_Flat, texflags);
FTextureID picnum = CheckForTexture (picname, ETextureType::Flat, texflags);
FTexture *viewer = new FCanvasTexture (picname, width, height);
if (picnum.Exists())
{
@ -690,7 +690,7 @@ void FTextureManager::ParseCameraTexture(FScanner &sc)
fitwidth = width;
fitheight = height;
// [GRB] No need for oldtex
viewer->UseType = FTexture::TEX_Wall;
viewer->UseType = ETextureType::Wall;
AddTexture (viewer);
}
if (sc.GetString())
@ -791,7 +791,7 @@ void FTextureManager::ParseAnimatedDoor(FScanner &sc)
FTextureID v;
sc.MustGetString();
anim.BaseTexture = CheckForTexture (sc.String, FTexture::TEX_Wall, texflags);
anim.BaseTexture = CheckForTexture (sc.String, ETextureType::Wall, texflags);
if (!anim.BaseTexture.Exists())
{
@ -822,7 +822,7 @@ void FTextureManager::ParseAnimatedDoor(FScanner &sc)
}
else
{
v = CheckForTexture (sc.String, FTexture::TEX_Wall, texflags);
v = CheckForTexture (sc.String, ETextureType::Wall, texflags);
if (!v.Exists() && anim.BaseTexture.Exists() && !error)
{
sc.ScriptError ("Unknown texture %s", sc.String);

View file

@ -85,7 +85,7 @@ FBuildTexture::FBuildTexture(const FString &pathprefix, int tilenum, const uint8
TopOffset = top;
CalcBitSize ();
Name.Format("%sBTIL%04d", pathprefix.GetChars(), tilenum);
UseType = TEX_Override;
UseType = ETextureType::Override;
}
uint8_t *FBuildTexture::MakeTexture(FRenderStyle style)

View file

@ -52,7 +52,7 @@ FCanvasTexture::FCanvasTexture (const char *name, int width, int height)
DummySpans[0].Length = height;
DummySpans[1].TopOffset = 0;
DummySpans[1].Length = 0;
UseType = TEX_Wall;
UseType = ETextureType::Wall;
bNeedsUpdate = true;
bDidUpdate = false;
bHasCanvas = true;

View file

@ -289,7 +289,7 @@ FDDSTexture::FDDSTexture (FileReader &lump, int lumpnum, void *vsurfdesc)
{
DDSURFACEDESC2 *surf = (DDSURFACEDESC2 *)vsurfdesc;
UseType = TEX_MiscPatch;
UseType = ETextureType::MiscPatch;
LeftOffset = 0;
TopOffset = 0;
bMasked = false;

View file

@ -249,7 +249,7 @@ FTexture *JPEGTexture_TryCreate(FileReader & data, int lumpnum)
FJPEGTexture::FJPEGTexture (int lumpnum, int width, int height)
: FWorldTexture(NULL, lumpnum)
{
UseType = TEX_MiscPatch;
UseType = ETextureType::MiscPatch;
LeftOffset = 0;
TopOffset = 0;
bMasked = false;

View file

@ -152,7 +152,7 @@ class FMultiPatchTexture : public FWorldTexture
{
public:
FMultiPatchTexture (const void *texdef, FPatchLookup *patchlookup, int maxpatchnum, bool strife, int deflump);
FMultiPatchTexture (FScanner &sc, int usetype);
FMultiPatchTexture (FScanner &sc, ETextureType usetype);
~FMultiPatchTexture ();
FTextureFormat GetFormat() override;
@ -185,7 +185,7 @@ protected:
struct TexInit
{
FString TexName;
int UseType = TEX_Null;
ETextureType UseType = ETextureType::Null;
bool Silent = false;
bool HasLine = false;
bool UseOffsets = false;
@ -253,7 +253,7 @@ FMultiPatchTexture::FMultiPatchTexture (const void *texdef, FPatchLookup *patchl
I_FatalError ("Bad texture directory");
}
UseType = FTexture::TEX_Wall;
UseType = ETextureType::Wall;
Parts = NumParts > 0 ? new TexPart[NumParts] : nullptr;
Inits = NumParts > 0 ? new TexInit[NumParts] : nullptr;
Width = SAFESHORT(mtexture.d->width);
@ -289,7 +289,7 @@ FMultiPatchTexture::FMultiPatchTexture (const void *texdef, FPatchLookup *patchl
Parts[i].OriginY = LittleShort(mpatch.d->originy);
Parts[i].Texture = nullptr;
Inits[i].TexName = patchlookup[LittleShort(mpatch.d->patch)].Name;
Inits[i].UseType = TEX_WallPatch;
Inits[i].UseType = ETextureType::WallPatch;
if (strife)
mpatch.s++;
else
@ -847,7 +847,7 @@ void FTextureManager::AddTexturesLump (const void *lumpdata, int lumpsize, int d
FMultiPatchTexture *tex = new FMultiPatchTexture ((const uint8_t *)maptex + offset, patchlookup, numpatches, isStrife, deflumpnum);
if (i == 1 && texture1)
{
tex->UseType = FTexture::TEX_FirstDefined;
tex->UseType = ETextureType::FirstDefined;
}
TexMan.AddTexture (tex);
StartScreen->Progress();
@ -1067,7 +1067,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part, TexInit &init)
//
//==========================================================================
FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype)
FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, ETextureType usetype)
: Pixels (0), Spans(0), Parts(0), bRedirect(false), bTranslucentPatches(false)
{
TArray<TexPart> parts;
@ -1123,7 +1123,7 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype)
}
else if (sc.Compare("NullTexture"))
{
UseType = FTexture::TEX_Null;
UseType = ETextureType::Null;
}
else if (sc.Compare("NoDecals"))
{
@ -1137,7 +1137,7 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype)
if (init.TexName.IsNotEmpty())
{
parts.Push(part);
init.UseType = TEX_WallPatch;
init.UseType = ETextureType::WallPatch;
init.Silent = bSilent;
init.HasLine = true;
init.sc = sc;
@ -1154,7 +1154,7 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype)
if (init.TexName.IsNotEmpty())
{
parts.Push(part);
init.UseType = TEX_Sprite;
init.UseType = ETextureType::Sprite;
init.Silent = bSilent;
init.HasLine = true;
init.sc = sc;
@ -1171,7 +1171,7 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype)
if (init.TexName.IsNotEmpty())
{
parts.Push(part);
init.UseType = TEX_MiscPatch;
init.UseType = ETextureType::MiscPatch;
init.Silent = bSilent;
init.HasLine = true;
init.sc = sc;
@ -1206,7 +1206,7 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype)
if (Width <= 0 || Height <= 0)
{
UseType = FTexture::TEX_Null;
UseType = ETextureType::Null;
Printf("Texture %s has invalid dimensions (%d, %d)\n", Name.GetChars(), Width, Height);
Width = Height = 1;
}
@ -1301,7 +1301,7 @@ void FMultiPatchTexture::ResolvePatches()
}
void FTextureManager::ParseXTexture(FScanner &sc, int usetype)
void FTextureManager::ParseXTexture(FScanner &sc, ETextureType usetype)
{
FTexture *tex = new FMultiPatchTexture(sc, usetype);
TexMan.AddTexture (tex);

View file

@ -206,7 +206,7 @@ FPNGTexture::FPNGTexture (FileReader &lump, int lumpnum, const FString &filename
uint32_t len, id;
int i;
UseType = TEX_MiscPatch;
UseType = ETextureType::MiscPatch;
LeftOffset = 0;
TopOffset = 0;
bMasked = false;

View file

@ -37,7 +37,7 @@
FSkyBox::FSkyBox()
{
faces[0]=faces[1]=faces[2]=faces[3]=faces[4]=faces[5]=NULL;
UseType=TEX_Override;
UseType = ETextureType::Override;
gl_info.bSkybox = true;
fliptop = false;
}
@ -136,7 +136,7 @@ void ParseGldefSkybox(FScanner &sc)
sc.MustGetString();
if (facecount<6)
{
sb->faces[facecount] = TexMan[TexMan.GetTexture(sc.String, FTexture::TEX_Wall, FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_Overridable)];
sb->faces[facecount] = TexMan[TexMan.GetTexture(sc.String, ETextureType::Wall, FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_Overridable)];
}
facecount++;
}
@ -181,7 +181,7 @@ void ParseVavoomSkybox()
maplump = Wads.CheckNumForFullName(sc.String, true);
FTexture *tex = TexMan.FindTexture(sc.String, FTexture::TEX_Wall, FTextureManager::TEXMAN_TryAny);
FTexture *tex = TexMan.FindTexture(sc.String, ETextureType::Wall, FTextureManager::TEXMAN_TryAny);
if (tex == NULL)
{
sc.ScriptMessage("Texture '%s' not found in Vavoom skybox '%s'\n", sc.String, sb->Name.GetChars());

View file

@ -52,7 +52,7 @@ typedef FTexture * (*CreateFunc)(FileReader & file, int lumpnum);
struct TexCreateInfo
{
CreateFunc TryCreate;
int usetype;
ETextureType usetype;
};
uint8_t FTexture::GrayMap[256];
@ -80,20 +80,20 @@ FTexture *AutomapTexture_TryCreate(FileReader &, int lumpnum);
// Examines the lump contents to decide what type of texture to create,
// and creates the texture.
FTexture * FTexture::CreateTexture (int lumpnum, int usetype)
FTexture * FTexture::CreateTexture (int lumpnum, ETextureType usetype)
{
static TexCreateInfo CreateInfo[]={
{ IMGZTexture_TryCreate, TEX_Any },
{ PNGTexture_TryCreate, TEX_Any },
{ JPEGTexture_TryCreate, TEX_Any },
{ DDSTexture_TryCreate, TEX_Any },
{ PCXTexture_TryCreate, TEX_Any },
{ TGATexture_TryCreate, TEX_Any },
{ RawPageTexture_TryCreate, TEX_MiscPatch },
{ FlatTexture_TryCreate, TEX_Flat },
{ PatchTexture_TryCreate, TEX_Any },
{ EmptyTexture_TryCreate, TEX_Any },
{ AutomapTexture_TryCreate, TEX_MiscPatch },
{ IMGZTexture_TryCreate, ETextureType::Any },
{ PNGTexture_TryCreate, ETextureType::Any },
{ JPEGTexture_TryCreate, ETextureType::Any },
{ DDSTexture_TryCreate, ETextureType::Any },
{ PCXTexture_TryCreate, ETextureType::Any },
{ TGATexture_TryCreate, ETextureType::Any },
{ RawPageTexture_TryCreate, ETextureType::MiscPatch },
{ FlatTexture_TryCreate, ETextureType::Flat },
{ PatchTexture_TryCreate, ETextureType::Any },
{ EmptyTexture_TryCreate, ETextureType::Any },
{ AutomapTexture_TryCreate, ETextureType::MiscPatch },
};
if (lumpnum == -1) return NULL;
@ -102,13 +102,13 @@ FTexture * FTexture::CreateTexture (int lumpnum, int usetype)
for(size_t i = 0; i < countof(CreateInfo); i++)
{
if ((CreateInfo[i].usetype == usetype || CreateInfo[i].usetype == TEX_Any))
if ((CreateInfo[i].usetype == usetype || CreateInfo[i].usetype == ETextureType::Any))
{
FTexture * tex = CreateInfo[i].TryCreate(data, lumpnum);
if (tex != NULL)
{
tex->UseType = usetype;
if (usetype == FTexture::TEX_Flat)
if (usetype == ETextureType::Flat)
{
int w = tex->GetWidth();
int h = tex->GetHeight();
@ -134,7 +134,7 @@ FTexture * FTexture::CreateTexture (int lumpnum, int usetype)
return NULL;
}
FTexture * FTexture::CreateTexture (const char *name, int lumpnum, int usetype)
FTexture * FTexture::CreateTexture (const char *name, int lumpnum, ETextureType usetype)
{
FTexture *tex = CreateTexture(lumpnum, usetype);
if (tex != NULL && name != NULL) {
@ -148,7 +148,7 @@ FTexture * FTexture::CreateTexture (const char *name, int lumpnum, int usetype)
FTexture::FTexture (const char *name, int lumpnum)
: LeftOffset(0), TopOffset(0),
WidthBits(0), HeightBits(0), Scale(1,1), SourceLump(lumpnum),
UseType(TEX_Any), bNoDecals(false), bNoRemap0(false), bWorldPanning(false),
UseType(ETextureType::Any), bNoDecals(false), bNoRemap0(false), bWorldPanning(false),
bMasked(true), bAlphaTexture(false), bHasCanvas(false), bWarped(0), bComplex(false), bMultiPatch(false), bKeepAround(false),
Rotations(0xFFFF), SkyOffset(0), Width(0), Height(0), WidthMask(0)
{
@ -949,7 +949,7 @@ FDummyTexture::FDummyTexture ()
HeightBits = 6;
WidthBits = 6;
WidthMask = 63;
UseType = TEX_Null;
UseType = ETextureType::Null;
}
void FDummyTexture::SetSize (int width, int height)
@ -983,7 +983,7 @@ CCMD (printspans)
if (argv.argc() != 2)
return;
FTextureID picnum = TexMan.CheckForTexture (argv[1], FTexture::TEX_Any);
FTextureID picnum = TexMan.CheckForTexture (argv[1], ETextureType::Any);
if (!picnum.Exists())
{
Printf ("Unknown texture %s\n", argv[1]);

View file

@ -146,11 +146,11 @@ void FTextureManager::DeleteAll()
//
//==========================================================================
FTextureID FTextureManager::CheckForTexture (const char *name, int usetype, BITFIELD flags)
FTextureID FTextureManager::CheckForTexture (const char *name, ETextureType usetype, BITFIELD flags)
{
int i;
int firstfound = -1;
int firsttype = FTexture::TEX_Null;
auto firsttype = ETextureType::Null;
if (name == NULL || name[0] == '\0')
{
@ -172,14 +172,14 @@ FTextureID FTextureManager::CheckForTexture (const char *name, int usetype, BITF
if (stricmp (tex->Name, name) == 0)
{
// The name matches, so check the texture type
if (usetype == FTexture::TEX_Any)
if (usetype == ETextureType::Any)
{
// All NULL textures should actually return 0
if (tex->UseType == FTexture::TEX_FirstDefined && !(flags & TEXMAN_ReturnFirst)) return 0;
if (tex->UseType == FTexture::TEX_SkinGraphic && !(flags & TEXMAN_AllowSkins)) return 0;
return FTextureID(tex->UseType==FTexture::TEX_Null ? 0 : i);
if (tex->UseType == ETextureType::FirstDefined && !(flags & TEXMAN_ReturnFirst)) return 0;
if (tex->UseType == ETextureType::SkinGraphic && !(flags & TEXMAN_AllowSkins)) return 0;
return FTextureID(tex->UseType==ETextureType::Null ? 0 : i);
}
else if ((flags & TEXMAN_Overridable) && tex->UseType == FTexture::TEX_Override)
else if ((flags & TEXMAN_Overridable) && tex->UseType == ETextureType::Override)
{
return FTextureID(i);
}
@ -187,22 +187,22 @@ FTextureID FTextureManager::CheckForTexture (const char *name, int usetype, BITF
{
return FTextureID(i);
}
else if (tex->UseType == FTexture::TEX_FirstDefined && usetype == FTexture::TEX_Wall)
else if (tex->UseType == ETextureType::FirstDefined && usetype == ETextureType::Wall)
{
if (!(flags & TEXMAN_ReturnFirst)) return FTextureID(0);
else return FTextureID(i);
}
else if (tex->UseType == FTexture::TEX_Null && usetype == FTexture::TEX_Wall)
else if (tex->UseType == ETextureType::Null && usetype == ETextureType::Wall)
{
// We found a NULL texture on a wall -> return 0
return FTextureID(0);
}
else
{
if (firsttype == FTexture::TEX_Null ||
(firsttype == FTexture::TEX_MiscPatch &&
if (firsttype == ETextureType::Null ||
(firsttype == ETextureType::MiscPatch &&
tex->UseType != firsttype &&
tex->UseType != FTexture::TEX_Null)
tex->UseType != ETextureType::Null)
)
{
firstfound = i;
@ -213,13 +213,13 @@ FTextureID FTextureManager::CheckForTexture (const char *name, int usetype, BITF
i = Textures[i].HashNext;
}
if ((flags & TEXMAN_TryAny) && usetype != FTexture::TEX_Any)
if ((flags & TEXMAN_TryAny) && usetype != ETextureType::Any)
{
// Never return the index of NULL textures.
if (firstfound != -1)
{
if (firsttype == FTexture::TEX_Null) return FTextureID(0);
if (firsttype == FTexture::TEX_FirstDefined && !(flags & TEXMAN_ReturnFirst)) return FTextureID(0);
if (firsttype == ETextureType::Null) return FTextureID(0);
if (firsttype == ETextureType::FirstDefined && !(flags & TEXMAN_ReturnFirst)) return FTextureID(0);
return FTextureID(firstfound);
}
}
@ -239,7 +239,7 @@ FTextureID FTextureManager::CheckForTexture (const char *name, int usetype, BITF
if (tex == NO_TEXTURE) return FTextureID(-1);
if (tex != NULL) return tex->id;
if (flags & TEXMAN_DontCreate) return FTextureID(-1); // we only want to check, there's no need to create a texture if we don't have one yet.
tex = FTexture::CreateTexture("", lump, FTexture::TEX_Override);
tex = FTexture::CreateTexture("", lump, ETextureType::Override);
if (tex != NULL)
{
Wads.SetLinkedTexture(lump, tex);
@ -263,7 +263,7 @@ DEFINE_ACTION_FUNCTION(_TexMan, CheckForTexture)
PARAM_STRING(name);
PARAM_INT(type);
PARAM_INT_DEF(flags);
ACTION_RETURN_INT(TexMan.CheckForTexture(name, type, flags).GetIndex());
ACTION_RETURN_INT(TexMan.CheckForTexture(name, static_cast<ETextureType>(type), flags).GetIndex());
}
//==========================================================================
@ -296,7 +296,7 @@ int FTextureManager::ListTextures (const char *name, TArray<FTextureID> &list, b
if (stricmp (tex->Name, name) == 0)
{
// NULL textures must be ignored.
if (tex->UseType!=FTexture::TEX_Null)
if (tex->UseType!=ETextureType::Null)
{
unsigned int j = list.Size();
if (!listall)
@ -321,7 +321,7 @@ int FTextureManager::ListTextures (const char *name, TArray<FTextureID> &list, b
//
//==========================================================================
FTextureID FTextureManager::GetTexture (const char *name, int usetype, BITFIELD flags)
FTextureID FTextureManager::GetTexture (const char *name, ETextureType usetype, BITFIELD flags)
{
FTextureID i;
@ -349,7 +349,7 @@ FTextureID FTextureManager::GetTexture (const char *name, int usetype, BITFIELD
//
//==========================================================================
FTexture *FTextureManager::FindTexture(const char *texname, int usetype, BITFIELD flags)
FTexture *FTextureManager::FindTexture(const char *texname, ETextureType usetype, BITFIELD flags)
{
FTextureID texnum = CheckForTexture (texname, usetype, flags);
return !texnum.isValid()? NULL : Textures[texnum.GetIndex()].Texture;
@ -411,7 +411,7 @@ FTextureID FTextureManager::AddTexture (FTexture *texture)
//
//==========================================================================
FTextureID FTextureManager::CreateTexture (int lumpnum, int usetype)
FTextureID FTextureManager::CreateTexture (int lumpnum, ETextureType usetype)
{
if (lumpnum != -1)
{
@ -496,7 +496,7 @@ bool FTextureManager::AreTexturesCompatible (FTextureID picnum1, FTextureID picn
//
//==========================================================================
void FTextureManager::AddGroup(int wadnum, int ns, int usetype)
void FTextureManager::AddGroup(int wadnum, int ns, ETextureType usetype)
{
int firsttx = Wads.GetFirstLump(wadnum);
int lasttx = Wads.GetLastLump(wadnum);
@ -562,10 +562,10 @@ void FTextureManager::AddHiresTextures (int wadnum)
if (amount == 0)
{
// A texture with this name does not yet exist
FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any);
FTexture * newtex = FTexture::CreateTexture (firsttx, ETextureType::Any);
if (newtex != NULL)
{
newtex->UseType=FTexture::TEX_Override;
newtex->UseType=ETextureType::Override;
AddTexture(newtex);
}
}
@ -573,7 +573,7 @@ void FTextureManager::AddHiresTextures (int wadnum)
{
for(unsigned int i = 0; i < tlist.Size(); i++)
{
FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any);
FTexture * newtex = FTexture::CreateTexture (firsttx, ETextureType::Any);
if (newtex != NULL)
{
FTexture * oldtex = Textures[tlist[i].GetIndex()].Texture;
@ -605,7 +605,8 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
FString src;
bool is32bit;
int width, height;
int type, mode;
ETextureType type;
int mode;
TArray<FTextureID> tlist;
lastLump = 0;
@ -622,12 +623,12 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
sc.MustGetString();
// allow selection by type
if (sc.Compare("wall")) type=FTexture::TEX_Wall, mode=FTextureManager::TEXMAN_Overridable;
else if (sc.Compare("flat")) type=FTexture::TEX_Flat, mode=FTextureManager::TEXMAN_Overridable;
else if (sc.Compare("sprite")) type=FTexture::TEX_Sprite, mode=0;
else type = FTexture::TEX_Any, mode = 0;
if (sc.Compare("wall")) type=ETextureType::Wall, mode=FTextureManager::TEXMAN_Overridable;
else if (sc.Compare("flat")) type=ETextureType::Flat, mode=FTextureManager::TEXMAN_Overridable;
else if (sc.Compare("sprite")) type=ETextureType::Sprite, mode=0;
else type = ETextureType::Any, mode = 0;
if (type != FTexture::TEX_Any) sc.MustGetString();
if (type != ETextureType::Any) sc.MustGetString();
sc.String[8]=0;
@ -658,13 +659,13 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
// only replace matching types. For sprites also replace any MiscPatches
// based on the same lump. These can be created for icons.
if (oldtex->UseType == type || type == FTexture::TEX_Any ||
(mode == TEXMAN_Overridable && oldtex->UseType == FTexture::TEX_Override) ||
(type == FTexture::TEX_Sprite && oldtex->UseType == FTexture::TEX_MiscPatch &&
if (oldtex->UseType == type || type == ETextureType::Any ||
(mode == TEXMAN_Overridable && oldtex->UseType == ETextureType::Override) ||
(type == ETextureType::Sprite && oldtex->UseType == ETextureType::MiscPatch &&
(sl=oldtex->GetSourceLump()) >= 0 && Wads.GetLumpNamespace(sl) == ns_sprites)
)
{
FTexture * newtex = FTexture::CreateTexture (lumpnum, FTexture::TEX_Any);
FTexture * newtex = FTexture::CreateTexture (lumpnum, ETextureType::Any);
if (newtex != NULL)
{
// Replace the entire texture and adjust the scaling and offset factors.
@ -701,7 +702,7 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
if (lumpnum>=0)
{
FTexture *newtex = FTexture::CreateTexture(lumpnum, FTexture::TEX_Override);
FTexture *newtex = FTexture::CreateTexture(lumpnum, ETextureType::Override);
if (newtex != NULL)
{
@ -710,11 +711,11 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
newtex->SetScaledSize(width, height);
newtex->Name = src;
FTextureID oldtex = TexMan.CheckForTexture(src, FTexture::TEX_MiscPatch);
FTextureID oldtex = TexMan.CheckForTexture(src, ETextureType::MiscPatch);
if (oldtex.isValid())
{
ReplaceTexture(oldtex, newtex, true);
newtex->UseType = FTexture::TEX_Override;
newtex->UseType = ETextureType::Override;
}
else AddTexture(newtex);
}
@ -724,23 +725,23 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
}
else if (sc.Compare("texture"))
{
ParseXTexture(sc, FTexture::TEX_Override);
ParseXTexture(sc, ETextureType::Override);
}
else if (sc.Compare("sprite"))
{
ParseXTexture(sc, FTexture::TEX_Sprite);
ParseXTexture(sc, ETextureType::Sprite);
}
else if (sc.Compare("walltexture"))
{
ParseXTexture(sc, FTexture::TEX_Wall);
ParseXTexture(sc, ETextureType::Wall);
}
else if (sc.Compare("flat"))
{
ParseXTexture(sc, FTexture::TEX_Flat);
ParseXTexture(sc, ETextureType::Flat);
}
else if (sc.Compare("graphic"))
{
ParseXTexture(sc, FTexture::TEX_MiscPatch);
ParseXTexture(sc, ETextureType::MiscPatch);
}
else
{
@ -770,9 +771,9 @@ void FTextureManager::AddPatches (int lumpnum)
{
file.Read (name, 8);
if (CheckForTexture (name, FTexture::TEX_WallPatch, 0) == -1)
if (CheckForTexture (name, ETextureType::WallPatch, 0) == -1)
{
CreateTexture (Wads.CheckNumForName (name, ns_patches), FTexture::TEX_WallPatch);
CreateTexture (Wads.CheckNumForName (name, ns_patches), ETextureType::WallPatch);
}
StartScreen->Progress();
}
@ -822,20 +823,20 @@ void FTextureManager::AddTexturesForWad(int wadnum)
FirstTextureForFile.Push(firsttexture);
// First step: Load sprites
AddGroup(wadnum, ns_sprites, FTexture::TEX_Sprite);
AddGroup(wadnum, ns_sprites, ETextureType::Sprite);
// When loading a Zip, all graphics in the patches/ directory should be
// added as well.
AddGroup(wadnum, ns_patches, FTexture::TEX_WallPatch);
AddGroup(wadnum, ns_patches, ETextureType::WallPatch);
// Second step: TEXTUREx lumps
LoadTextureX(wadnum);
// Third step: Flats
AddGroup(wadnum, ns_flats, FTexture::TEX_Flat);
AddGroup(wadnum, ns_flats, ETextureType::Flat);
// Fourth step: Textures (TX_)
AddGroup(wadnum, ns_newtextures, FTexture::TEX_Override);
AddGroup(wadnum, ns_newtextures, ETextureType::Override);
// Sixth step: Try to find any lump in the WAD that may be a texture and load as a TEX_MiscPatch
int firsttx = Wads.GetFirstLump(wadnum);
@ -874,7 +875,7 @@ void FTextureManager::AddTexturesForWad(int wadnum)
if (Wads.CheckNumForName(Name, ns_graphics) != i) continue;
// skip this if it has already been added as a wall patch.
if (CheckForTexture(Name, FTexture::TEX_WallPatch, 0).Exists()) continue;
if (CheckForTexture(Name, ETextureType::WallPatch, 0).Exists()) continue;
}
else if (ns == ns_graphics)
{
@ -891,7 +892,7 @@ void FTextureManager::AddTexturesForWad(int wadnum)
// Try to create a texture from this lump and add it.
// Unfortunately we have to look at everything that comes through here...
FTexture *out = FTexture::CreateTexture(i, skin ? FTexture::TEX_SkinGraphic : FTexture::TEX_MiscPatch);
FTexture *out = FTexture::CreateTexture(i, skin ? ETextureType::SkinGraphic : ETextureType::MiscPatch);
if (out != NULL)
{
@ -937,10 +938,10 @@ void FTextureManager::SortTexturesByType(int start, int end)
Textures.Resize(start);
Translation.Resize(start);
static int texturetypes[] = {
FTexture::TEX_Sprite, FTexture::TEX_Null, FTexture::TEX_FirstDefined,
FTexture::TEX_WallPatch, FTexture::TEX_Wall, FTexture::TEX_Flat,
FTexture::TEX_Override, FTexture::TEX_MiscPatch, FTexture::TEX_SkinGraphic
static ETextureType texturetypes[] = {
ETextureType::Sprite, ETextureType::Null, ETextureType::FirstDefined,
ETextureType::WallPatch, ETextureType::Wall, ETextureType::Flat,
ETextureType::Override, ETextureType::MiscPatch, ETextureType::SkinGraphic
};
for(unsigned int i=0;i<countof(texturetypes);i++)
@ -1005,14 +1006,14 @@ void FTextureManager::Init()
InitBuildTiles ();
FirstTextureForFile.Push(Textures.Size());
DefaultTexture = CheckForTexture ("-NOFLAT-", FTexture::TEX_Override, 0);
DefaultTexture = CheckForTexture ("-NOFLAT-", ETextureType::Override, 0);
// The Hexen scripts use BLANK as a blank texture, even though it's really not.
// I guess the Doom renderer must have clipped away the line at the bottom of
// the texture so it wasn't visible. I'll just map it to 0, so it really is blank.
if (gameinfo.gametype == GAME_Hexen)
{
FTextureID tex = CheckForTexture ("BLANK", FTexture::TEX_Wall, false);
FTextureID tex = CheckForTexture ("BLANK", ETextureType::Wall, false);
if (tex.Exists())
{
SetTranslation (tex, 0);
@ -1026,7 +1027,7 @@ void FTextureManager::Init()
{
if (wadlevelinfos[i].flags & LEVEL_DOUBLESKY)
{
FTextureID picnum = CheckForTexture (wadlevelinfos[i].SkyPic1, FTexture::TEX_Wall, false);
FTextureID picnum = CheckForTexture (wadlevelinfos[i].SkyPic1, ETextureType::Wall, false);
if (picnum.isValid())
{
Textures[picnum.GetIndex()].Texture->SetFrontSkyLayer ();
@ -1058,13 +1059,13 @@ void FTextureManager::InitPalettedVersions()
while (sc.GetString())
{
FTextureID pic1 = CheckForTexture(sc.String, FTexture::TEX_Any);
FTextureID pic1 = CheckForTexture(sc.String, ETextureType::Any);
if (!pic1.isValid())
{
sc.ScriptMessage("Unknown texture %s to replace", sc.String);
}
sc.MustGetString();
FTextureID pic2 = CheckForTexture(sc.String, FTexture::TEX_Any);
FTextureID pic2 = CheckForTexture(sc.String, ETextureType::Any);
if (!pic2.isValid())
{
sc.ScriptMessage("Unknown texture %s to use as replacement", sc.String);

View file

@ -177,8 +177,8 @@ class FNativeTexture;
class FTexture
{
public:
static FTexture *CreateTexture(const char *name, int lumpnum, int usetype);
static FTexture *CreateTexture(int lumpnum, int usetype);
static FTexture *CreateTexture(const char *name, int lumpnum, ETextureType usetype);
static FTexture *CreateTexture(int lumpnum, ETextureType usetype);
virtual ~FTexture ();
int16_t LeftOffset, TopOffset;
@ -191,7 +191,7 @@ public:
FTextureID id;
FString Name;
uint8_t UseType; // This texture's primary purpose
ETextureType UseType; // This texture's primary purpose
uint8_t bNoDecals:1; // Decals should not stick to texture
uint8_t bNoRemap0:1; // Do not remap color 0 (used by front layer of parallax skies)
@ -209,24 +209,6 @@ public:
uint16_t Rotations;
int16_t SkyOffset;
enum // UseTypes
{
TEX_Any,
TEX_Wall,
TEX_Flat,
TEX_Sprite,
TEX_WallPatch,
TEX_Build, // no longer used but needs to remain for ZScript
TEX_SkinSprite,
TEX_Decal,
TEX_MiscPatch,
TEX_FontChar,
TEX_Override, // For patches between TX_START/TX_END
TEX_Autopage, // Automap background - used to enable the use of FAutomapTexture
TEX_SkinGraphic,
TEX_Null,
TEX_FirstDefined,
};
struct Span
{
@ -464,6 +446,7 @@ public:
~FTextureManager ();
// Get texture without translation
//private:
FTexture *operator[] (FTextureID texnum)
{
if ((unsigned)texnum.GetIndex() >= Textures.Size()) return NULL;
@ -471,7 +454,7 @@ public:
}
FTexture *operator[] (const char *texname)
{
FTextureID texnum = GetTexture (texname, FTexture::TEX_MiscPatch);
FTextureID texnum = GetTexture (texname, ETextureType::MiscPatch);
if (!texnum.Exists()) return NULL;
return Textures[texnum.GetIndex()].Texture;
}
@ -480,7 +463,7 @@ public:
if (unsigned(i) >= Textures.Size()) return NULL;
return Textures[i].Texture;
}
FTexture *FindTexture(const char *texname, int usetype = FTexture::TEX_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)
@ -495,7 +478,7 @@ public:
}
FTexture *operator() (const char *texname)
{
FTextureID texnum = GetTexture (texname, FTexture::TEX_MiscPatch);
FTextureID texnum = GetTexture (texname, ETextureType::MiscPatch);
if (texnum.texnum == -1) return NULL;
return Textures[Translation[texnum.texnum]].Texture;
}
@ -505,6 +488,7 @@ public:
if (unsigned(i) >= Textures.Size()) return NULL;
return Textures[Translation[i]].Texture;
}
//public:
FTextureID PalCheck(FTextureID tex);
@ -528,21 +512,21 @@ public:
HIT_Columnmode = HIT_Wall|HIT_Sky|HIT_Sprite
};
FTextureID CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny);
FTextureID GetTexture (const char *name, int usetype, BITFIELD flags=0);
FTextureID CheckForTexture (const char *name, ETextureType usetype, BITFIELD flags=TEXMAN_TryAny);
FTextureID GetTexture (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);
void AddTexturesLumps (int lump1, int lump2, int patcheslump);
void AddGroup(int wadnum, int ns, int usetype);
void AddGroup(int wadnum, int ns, ETextureType usetype);
void AddPatches (int lumpnum);
void AddHiresTextures (int wadnum);
void LoadTextureDefs(int wadnum, const char *lumpname);
void ParseXTexture(FScanner &sc, int usetype);
void ParseXTexture(FScanner &sc, ETextureType usetype);
void SortTexturesByType(int start, int end);
bool AreTexturesCompatible (FTextureID picnum1, FTextureID picnum2);
FTextureID CreateTexture (int lumpnum, int usetype=FTexture::TEX_Any); // Also calls AddTexture
FTextureID CreateTexture (int lumpnum, ETextureType usetype=ETextureType::Any); // Also calls AddTexture
FTextureID AddTexture (FTexture *texture);
FTextureID GetDefaultTexture() const { return DefaultTexture; }
@ -588,12 +572,12 @@ private:
void InitAnimDefs ();
FAnimDef *AddSimpleAnim (FTextureID picnum, int animcount, uint32_t speedmin, uint32_t speedrange=0);
FAnimDef *AddComplexAnim (FTextureID picnum, const TArray<FAnimDef::FAnimFrame> &frames);
void ParseAnim (FScanner &sc, int usetype);
FAnimDef *ParseRangeAnim (FScanner &sc, FTextureID picnum, int usetype, bool missing);
void ParsePicAnim (FScanner &sc, FTextureID picnum, int usetype, bool missing, TArray<FAnimDef::FAnimFrame> &frames);
void ParseAnim (FScanner &sc, ETextureType usetype);
FAnimDef *ParseRangeAnim (FScanner &sc, FTextureID picnum, ETextureType usetype, bool missing);
void ParsePicAnim (FScanner &sc, FTextureID picnum, ETextureType usetype, bool missing, TArray<FAnimDef::FAnimFrame> &frames);
void ParseWarp(FScanner &sc);
void ParseCameraTexture(FScanner &sc);
FTextureID ParseFramenum (FScanner &sc, FTextureID basepicnum, int usetype, bool allowMissing);
FTextureID ParseFramenum (FScanner &sc, FTextureID basepicnum, ETextureType usetype, bool allowMissing);
void ParseTime (FScanner &sc, uint32_t &min, uint32_t &max);
FTexture *Texture(FTextureID id) { return Textures[id.GetIndex()].Texture; }
void SetTranslation (FTextureID fromtexnum, FTextureID totexnum);

View file

@ -48,14 +48,14 @@ FImageCollection::FImageCollection (const char **patchNames, int numPatches)
Add (patchNames, numPatches);
}
void FImageCollection::Init (const char **patchNames, int numPatches, int namespc)
void FImageCollection::Init (const char **patchNames, int numPatches, ETextureType namespc)
{
ImageMap.Clear();
Add(patchNames, numPatches, namespc);
}
// [MH] Mainly for mugshots with skins and SBARINFO
void FImageCollection::Add (const char **patchNames, int numPatches, int namespc)
void FImageCollection::Add (const char **patchNames, int numPatches, ETextureType namespc)
{
int OldCount = ImageMap.Size();
@ -64,14 +64,6 @@ void FImageCollection::Add (const char **patchNames, int numPatches, int namespc
for (int i = 0; i < numPatches; ++i)
{
FTextureID picnum = TexMan.CheckForTexture(patchNames[i], namespc);
if (!picnum.isValid())
{
int lumpnum = Wads.CheckNumForName(patchNames[i], namespc);
if (lumpnum >= 0)
{
picnum = TexMan.CreateTexture(lumpnum, namespc);
}
}
ImageMap[OldCount + i] = picnum;
}
}

View file

@ -42,12 +42,12 @@ class FTexture;
class FImageCollection
{
public:
FImageCollection ();
FImageCollection (const char **patchNames, int numPatches);
FImageCollection();
FImageCollection(const char **patchNames, int numPatches);
void Init (const char **patchnames, int numPatches, int namespc=0);
void Add (const char **patchnames, int numPatches, int namespc=0);
void Uninit ();
void Init(const char **patchnames, int numPatches, ETextureType namespc = ETextureType::Any);
void Add(const char **patchnames, int numPatches, ETextureType namespc = ETextureType::Any);
void Uninit();
FTexture *operator[] (int index) const;

View file

@ -397,7 +397,7 @@ bool DCanvas::ParseDrawTextureTags(FTexture *img, double x, double y, uint32_t t
if (!fortext)
{
if (img == NULL || img->UseType == FTexture::TEX_Null)
if (img == NULL || img->UseType == ETextureType::Null)
{
ListEnd(tags);
return false;
@ -1304,11 +1304,11 @@ void V_DrawBorder (int x1, int y1, int x2, int y2)
if (level.info != NULL && level.info->BorderTexture.Len() != 0)
{
picnum = TexMan.CheckForTexture (level.info->BorderTexture, FTexture::TEX_Flat);
picnum = TexMan.CheckForTexture (level.info->BorderTexture, ETextureType::Flat);
}
else
{
picnum = TexMan.CheckForTexture (gameinfo.BorderFlat, FTexture::TEX_Flat);
picnum = TexMan.CheckForTexture (gameinfo.BorderFlat, ETextureType::Flat);
}
if (picnum.isValid())

View file

@ -332,7 +332,7 @@ FFont *V_GetFont(const char *name)
}
if (font == NULL)
{
FTextureID picnum = TexMan.CheckForTexture (name, FTexture::TEX_Any);
FTextureID picnum = TexMan.CheckForTexture (name, ETextureType::Any);
if (picnum.isValid())
{
font = new FSinglePicFont (name);
@ -390,15 +390,15 @@ FFont::FFont (const char *name, const char *nametemplate, int first, int count,
charlumps[i] = NULL;
mysnprintf (buffer, countof(buffer), nametemplate, i + start);
lump = TexMan.CheckForTexture(buffer, FTexture::TEX_MiscPatch);
lump = TexMan.CheckForTexture(buffer, ETextureType::MiscPatch);
if (doomtemplate && lump.isValid() && i + start == 121)
{ // HACKHACK: Don't load STCFN121 in doom(2), because
// it's not really a lower-case 'y' but a '|'.
// Because a lot of wads with their own font seem to foolishly
// copy STCFN121 and make it a '|' themselves, wads must
// provide STCFN120 (x) and STCFN122 (z) for STCFN121 to load as a 'y'.
if (!TexMan.CheckForTexture("STCFN120", FTexture::TEX_MiscPatch).isValid() ||
!TexMan.CheckForTexture("STCFN122", FTexture::TEX_MiscPatch).isValid())
if (!TexMan.CheckForTexture("STCFN120", ETextureType::MiscPatch).isValid() ||
!TexMan.CheckForTexture("STCFN122", ETextureType::MiscPatch).isValid())
{
// insert the incorrectly named '|' graphic in its correct position.
if (count > 124-start) charlumps[124-start] = TexMan[lump];
@ -1572,7 +1572,7 @@ void FSingleLumpFont::FixupPalette (uint8_t *identity, double *luminosity, const
FSinglePicFont::FSinglePicFont(const char *picname) :
FFont(-1) // Since lump is only needed for priority information we don't need to worry about this here.
{
FTextureID picnum = TexMan.CheckForTexture (picname, FTexture::TEX_Any);
FTextureID picnum = TexMan.CheckForTexture (picname, ETextureType::Any);
if (!picnum.isValid())
{
@ -1639,7 +1639,7 @@ int FSinglePicFont::GetCharWidth (int code) const
FFontChar1::FFontChar1 (FTexture *sourcelump)
: SourceRemap (NULL)
{
UseType = FTexture::TEX_FontChar;
UseType = ETextureType::FontChar;
BaseTexture = sourcelump;
// now copy all the properties from the base texture
@ -1758,7 +1758,7 @@ FFontChar1::~FFontChar1 ()
FFontChar2::FFontChar2 (int sourcelump, int sourcepos, int width, int height, int leftofs, int topofs)
: SourceLump (sourcelump), SourcePos (sourcepos), Pixels (0), Spans (0), SourceRemap(NULL)
{
UseType = TEX_FontChar;
UseType = ETextureType::FontChar;
Width = width;
Height = height;
LeftOffset = leftofs;
@ -2270,7 +2270,7 @@ void V_InitCustomFonts()
if (format == 1) goto wrong;
FTexture **p = &lumplist[*(unsigned char*)sc.String];
sc.MustGetString();
FTextureID texid = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
FTextureID texid = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch);
if (texid.Exists())
{
*p = TexMan[texid];

View file

@ -371,7 +371,7 @@ bool DInterBackground::LoadBackground(bool isenterpic)
// a name with a starting '$' indicates an intermission script
if (*lumpname != '$')
{
texture = TexMan.CheckForTexture(lumpname, FTexture::TEX_MiscPatch, FTextureManager::TEXMAN_TryAny);
texture = TexMan.CheckForTexture(lumpname, ETextureType::MiscPatch, FTextureManager::TEXMAN_TryAny);
}
else
{
@ -387,7 +387,7 @@ bool DInterBackground::LoadBackground(bool isenterpic)
{
case 0: // Background
sc.MustGetString();
texture = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch, FTextureManager::TEXMAN_TryAny);
texture = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch, FTextureManager::TEXMAN_TryAny);
break;
case 1: // Splat
@ -525,7 +525,7 @@ bool DInterBackground::LoadBackground(bool isenterpic)
else
{
Printf("Intermission script %s not found!\n", lumpname + 1);
texture = TexMan.GetTexture("INTERPIC", FTexture::TEX_MiscPatch);
texture = TexMan.GetTexture("INTERPIC", ETextureType::MiscPatch);
}
}
background = TexMan[texture];
@ -598,7 +598,7 @@ void DInterBackground::drawBackground(int state, bool drawsplat, bool snl_pointe
if (background)
{
// background
if (background->UseType == FTexture::TEX_MiscPatch)
if (background->UseType == ETextureType::MiscPatch)
{
// scale all animations below to fit the size of the base pic
// The base pic is always scaled to fit the screen so this allows

View file

@ -933,7 +933,7 @@ bool I_SetCursor(FTexture *cursorpic)
{
HCURSOR cursor;
if (cursorpic != NULL && cursorpic->UseType != FTexture::TEX_Null &&
if (cursorpic != NULL && cursorpic->UseType != ETextureType::Null &&
(screen == NULL || !screen->Is8BitMode()))
{
// Must be no larger than 32x32.