diff --git a/src/am_map.cpp b/src/am_map.cpp index 2f6c04c6d8..df4b79b76b 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -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; } diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index f74eae569b..8e8612dec5 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -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; diff --git a/src/c_console.cpp b/src/c_console.cpp index 9cbb5623fe..bebd6a52cf 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -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; } diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index cb1fb47e1d..6ebc0be997 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -243,7 +243,7 @@ void DWaitingCommand::Tick () { if (--TicsLeft == 0) { - UnsafeExecutionScope scope; + UnsafeExecutionScope scope(IsUnsafe); AddCommandString (Command); Destroy (); } diff --git a/src/compatibility.cpp b/src/compatibility.cpp index b99f2a51b0..ff36f9434b 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -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); } diff --git a/src/d_main.cpp b/src/d_main.cpp index 007af39d51..69298aa4d4 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -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()) diff --git a/src/decallib.cpp b/src/decallib.cpp index c4af2cbe6a..6950b1967a 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -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; diff --git a/src/doomtype.h b/src/doomtype.h index 640aa2d6ec..8235e08f3e 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -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; diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 127a5ba9d9..2bda23ec8f 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -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]); diff --git a/src/fragglescript/t_load.cpp b/src/fragglescript/t_load.cpp index 3fca69aadc..bb3e84f1de 100644 --- a/src/fragglescript/t_load.cpp +++ b/src/fragglescript/t_load.cpp @@ -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")) diff --git a/src/g_level.cpp b/src/g_level.cpp index cdb08ab674..59ba0a07b3 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -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; diff --git a/src/g_shared/shared_hud.cpp b/src/g_shared/shared_hud.cpp index 9dc90d908a..34f5c3b65a 100644 --- a/src/g_shared/shared_hud.cpp +++ b/src/g_shared/shared_hud.cpp @@ -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(); diff --git a/src/g_statusbar/sbar_mugshot.cpp b/src/g_statusbar/sbar_mugshot.cpp index 650a37063c..4bec24f1b9 100644 --- a/src/g_statusbar/sbar_mugshot.cpp +++ b/src/g_statusbar/sbar_mugshot.cpp @@ -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)]; } //=========================================================================== diff --git a/src/g_statusbar/sbarinfo_commands.cpp b/src/g_statusbar/sbarinfo_commands.cpp index 63c9d9ed85..199a0fe9d8 100644 --- a/src/g_statusbar/sbarinfo_commands.cpp +++ b/src/g_statusbar/sbarinfo_commands.cpp @@ -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: diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index 8ba00dd7df..ecbf2bd51a 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -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; } diff --git a/src/gl/data/gl_data.cpp b/src/gl/data/gl_data.cpp index ca3e25ab97..6a7747e365 100644 --- a/src/gl/data/gl_data.cpp +++ b/src/gl/data/gl_data.cpp @@ -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; diff --git a/src/gl/dynlights/gl_glow.cpp b/src/gl/dynlights/gl_glow.cpp index db988ea52d..030ec21885 100644 --- a/src/gl/dynlights/gl_glow.cpp +++ b/src/gl/dynlights/gl_glow.cpp @@ -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(); diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index 212fc704c7..1c0cf40acf 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -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); } diff --git a/src/gl/scene/gl_bsp.cpp b/src/gl/scene/gl_bsp.cpp index 5222e46f3d..8f44b4fb78 100644 --- a/src/gl/scene/gl_bsp.cpp +++ b/src/gl/scene/gl_bsp.cpp @@ -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; diff --git a/src/gl/scene/gl_fakeflat.cpp b/src/gl/scene/gl_fakeflat.cpp index 6d0183f0e2..a8726b273b 100644 --- a/src/gl/scene/gl_fakeflat.cpp +++ b/src/gl/scene/gl_fakeflat.cpp @@ -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; diff --git a/src/gl/scene/gl_renderhacks.cpp b/src/gl/scene/gl_renderhacks.cpp index 3e3f23dca7..827842cfd5 100644 --- a/src/gl/scene/gl_renderhacks.cpp +++ b/src/gl/scene/gl_renderhacks.cpp @@ -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; } } diff --git a/src/gl/scene/gl_sky.cpp b/src/gl/scene/gl_sky.cpp index 3186dc987c..d1781dacce 100644 --- a/src/gl/scene/gl_sky.cpp +++ b/src/gl/scene/gl_sky.cpp @@ -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]; diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index af7eec06cf..c7efe1eb8d 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -819,7 +819,10 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal) // [ZZ] add direct picnum override if (isPicnumOverride) { - patch = thing->picnum; + // Animate picnum overrides. + auto tex = TexMan(thing->picnum); + if (tex == nullptr) return; + patch = tex->id; mirror = false; } else diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index 7b9d47c3fe..c78c23eff1 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -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); @@ -1392,12 +1392,6 @@ void GLWall::DoFFloorBlocks(seg_t * seg, sector_t * frontsector, sector_t * back ff_topleft = topleft; ff_topright = topright; } - if (ff_bottomleft < bottomleft && ff_bottomright < bottomright) - { - // the new section extends into the floor. - ff_bottomleft = bottomleft; - ff_bottomright = bottomright; - } // do all inverse floors above the current one it there is a gap between the // last 3D floor and this one. diff --git a/src/gl/shaders/gl_postprocessshader.cpp b/src/gl/shaders/gl_postprocessshader.cpp index 1b62b1b143..2d96da90cc 100644 --- a/src/gl/shaders/gl_postprocessshader.cpp +++ b/src/gl/shaders/gl_postprocessshader.cpp @@ -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); diff --git a/src/gl/shaders/gl_shader.cpp b/src/gl/shaders/gl_shader.cpp index 141ee333a8..f4ebfa26a4 100644 --- a/src/gl/shaders/gl_shader.cpp +++ b/src/gl/shaders/gl_shader.cpp @@ -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; diff --git a/src/gl/shaders/gl_texshader.cpp b/src/gl/shaders/gl_texshader.cpp index 6276d7a4fc..2d8ca3f046 100644 --- a/src/gl/shaders/gl_texshader.cpp +++ b/src/gl/shaders/gl_texshader.cpp @@ -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); diff --git a/src/gl/textures/gl_hirestex.cpp b/src/gl/textures/gl_hirestex.cpp index 151ca5660d..51e66ad9b9 100644 --- a/src/gl/textures/gl_hirestex.cpp +++ b/src/gl/textures/gl_hirestex.cpp @@ -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; diff --git a/src/gl/textures/gl_hqresize.cpp b/src/gl/textures/gl_hqresize.cpp index aa3065441d..7995c910de 100644 --- a/src/gl/textures/gl_hqresize.cpp +++ b/src/gl/textures/gl_hqresize.cpp @@ -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; diff --git a/src/gl/textures/gl_material.cpp b/src/gl/textures/gl_material.cpp index 6ac7eb05ac..6ec03a3d5f 100644 --- a/src/gl/textures/gl_material.cpp +++ b/src/gl/textures/gl_material.cpp @@ -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; diff --git a/src/gl/textures/gl_texture.cpp b/src/gl/textures/gl_texture.cpp index f228d21235..c313611172 100644 --- a/src/gl/textures/gl_texture.cpp +++ b/src/gl/textures/gl_texture.cpp @@ -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 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 &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) { diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index bc052b5dde..3115e81693 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -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(desc)->mSecondPic, FTexture::TEX_MiscPatch); + mSecondPic = TexMan.CheckForTexture(static_cast(desc)->mSecondPic, ETextureType::MiscPatch); mScrollDelay = static_cast(desc)->mScrollDelay; mScrollTime = static_cast(desc)->mScrollTime; mScrollDir = static_cast(desc)->mScrollDir; diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index c0c5380889..67d9d0a9f0 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -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); diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 200df28c5e..fe96415ac5 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -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); diff --git a/src/p_map.cpp b/src/p_map.cpp index 50397d8522..e9ba84132d 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -4888,8 +4888,8 @@ bool P_LineTrace(AActor *t1, DAngle angle, double distance, ActorFlags aflags = (flags & TRF_ALLACTORS) ? ActorFlags::FromInt(0xFFFFFFFF) : MF_SHOOTABLE; int lflags = 0; - if ( !(lflags & TRF_THRUBLOCK) ) lflags |= ML_BLOCKEVERYTHING; - if ( !(lflags & TRF_THRUHITSCAN) ) lflags |= ML_BLOCKHITSCAN; + if ( !(flags & TRF_THRUBLOCK) ) lflags |= ML_BLOCKEVERYTHING; + if ( !(flags & TRF_THRUHITSCAN) ) lflags |= ML_BLOCKHITSCAN; int tflags = TRACE_ReportPortals; if ( flags & TRF_NOSKY ) tflags |= TRACE_NoSky; diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index fb4789e17e..f26c7e229a 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -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) { diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 4a74800c34..648502542a 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -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; } diff --git a/src/p_terrain.cpp b/src/p_terrain.cpp index 717747a8a2..8219e37a33 100644 --- a/src/p_terrain.cpp +++ b/src/p_terrain.cpp @@ -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()) diff --git a/src/polyrenderer/scene/poly_decal.cpp b/src/polyrenderer/scene/poly_decal.cpp index 6c20e24afc..c158144603 100644 --- a/src/polyrenderer/scene/poly_decal.cpp +++ b/src/polyrenderer/scene/poly_decal.cpp @@ -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; diff --git a/src/polyrenderer/scene/poly_plane.cpp b/src/polyrenderer/scene/poly_plane.cpp index 874fe26306..e2cbf1ccd7 100644 --- a/src/polyrenderer/scene/poly_plane.cpp +++ b/src/polyrenderer/scene/poly_plane.cpp @@ -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(); diff --git a/src/polyrenderer/scene/poly_playersprite.cpp b/src/polyrenderer/scene/poly_playersprite.cpp index 3c17941ba3..faf2f2a9a3 100644 --- a/src/polyrenderer/scene/poly_playersprite.cpp +++ b/src/polyrenderer/scene/poly_playersprite.cpp @@ -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) diff --git a/src/polyrenderer/scene/poly_sky.cpp b/src/polyrenderer/scene/poly_sky.cpp index eafa4c94c0..3306d4c8a3 100644 --- a/src/polyrenderer/scene/poly_sky.cpp +++ b/src/polyrenderer/scene/poly_sky.cpp @@ -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; } diff --git a/src/polyrenderer/scene/poly_sprite.cpp b/src/polyrenderer/scene/poly_sprite.cpp index f3ce12a5e6..1db0fc9510 100644 --- a/src/polyrenderer/scene/poly_sprite.cpp +++ b/src/polyrenderer/scene/poly_sprite.cpp @@ -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; } diff --git a/src/polyrenderer/scene/poly_wall.cpp b/src/polyrenderer/scene/poly_wall.cpp index fb75f7bf45..545eb92320 100644 --- a/src/polyrenderer/scene/poly_wall.cpp +++ b/src/polyrenderer/scene/poly_wall.cpp @@ -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(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; diff --git a/src/polyrenderer/scene/poly_wallsprite.cpp b/src/polyrenderer/scene/poly_wallsprite.cpp index 7da68c5e54..4f0e2ba52f 100644 --- a/src/polyrenderer/scene/poly_wallsprite.cpp +++ b/src/polyrenderer/scene/poly_wallsprite.cpp @@ -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; diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index fdc3522d3b..c963e50b2a 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -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 diff --git a/src/posix/sdl/i_gui.cpp b/src/posix/sdl/i_gui.cpp index a2d89c067c..1a895a6766 100644 --- a/src/posix/sdl/i_gui.cpp +++ b/src/posix/sdl/i_gui.cpp @@ -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) diff --git a/src/r_data/models/models.cpp b/src/r_data/models/models.cpp index 3198afd7f6..b8068f2fd4 100644 --- a/src/r_data/models/models.cpp +++ b/src/r_data/models/models.cpp @@ -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); } //=========================================================================== diff --git a/src/r_data/models/models_md2.cpp b/src/r_data/models/models_md2.cpp index 11cc8783d9..df187a69df 100644 --- a/src/r_data/models/models_md2.cpp +++ b/src/r_data/models/models_md2.cpp @@ -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; } } } diff --git a/src/r_data/models/models_md3.cpp b/src/r_data/models/models_md3.cpp index 8a649f7137..a399ccb72d 100644 --- a/src/r_data/models/models_md3.cpp +++ b/src/r_data/models/models_md3.cpp @@ -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; } } } diff --git a/src/r_data/models/models_voxel.cpp b/src/r_data/models/models_voxel.cpp index 9533aca690..087b80657a 100644 --- a/src/r_data/models/models_voxel.cpp +++ b/src/r_data/models/models_voxel.cpp @@ -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; } //=========================================================================== diff --git a/src/r_data/sprites.cpp b/src/r_data/sprites.cpp index 9b2da567b8..2380e597a3 100644 --- a/src/r_data/sprites.cpp +++ b/src/r_data/sprites.cpp @@ -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) diff --git a/src/r_sky.cpp b/src/r_sky.cpp index cc84f9fbb2..7a45bff503 100644 --- a/src/r_sky.cpp +++ b/src/r_sky.cpp @@ -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); diff --git a/src/r_utility.cpp b/src/r_utility.cpp index fc3e963c7b..9461e30461 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -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; } diff --git a/src/scripting/thingdef_properties.cpp b/src/scripting/thingdef_properties.cpp index 76339417fb..4a98b50974 100644 --- a/src/scripting/thingdef_properties.cpp +++ b/src/scripting/thingdef_properties.cpp @@ -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, diff --git a/src/serializer.cpp b/src/serializer.cpp index 75f96d581b..02219544d9 100644 --- a/src/serializer.cpp +++ b/src/serializer.cpp @@ -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(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(typeval.GetInt())); } else { diff --git a/src/sound/mididevices/music_fluidsynth_mididevice.cpp b/src/sound/mididevices/music_fluidsynth_mididevice.cpp index 97282299f0..9e3d9d4307 100644 --- a/src/sound/mididevices/music_fluidsynth_mididevice.cpp +++ b/src/sound/mididevices/music_fluidsynth_mididevice.cpp @@ -105,7 +105,7 @@ const char *BaseFileSearch(const char *file, const char *ext, bool lookfirstinpr CVAR(String, fluid_lib, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG) -CUSTOM_CVAR(String, fluid_patchset, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +CUSTOM_CVAR(String, fluid_patchset, "gzdoom", CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { if (currSong != nullptr && currSong->GetDeviceType() == MDEV_FLUIDSYNTH) { diff --git a/src/sound/mididevices/music_timiditypp_mididevice.cpp b/src/sound/mididevices/music_timiditypp_mididevice.cpp index 40205840f7..df91d1d44d 100644 --- a/src/sound/mididevices/music_timiditypp_mididevice.cpp +++ b/src/sound/mididevices/music_timiditypp_mididevice.cpp @@ -78,7 +78,7 @@ protected: TimidityPlus::Instruments *TimidityPPMIDIDevice::instruments; // Config file to use -CUSTOM_CVAR(String, timidity_config, "timidity.cfg", CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +CUSTOM_CVAR(String, timidity_config, "gzdoom", CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { if (currSong != nullptr && currSong->GetDeviceType() == MDEV_TIMIDITY) { diff --git a/src/sound/timidity/timidity.cpp b/src/sound/timidity/timidity.cpp index 104407e2a3..ecc46c77f5 100644 --- a/src/sound/timidity/timidity.cpp +++ b/src/sound/timidity/timidity.cpp @@ -36,7 +36,7 @@ #include "v_text.h" #include "timidity.h" -CUSTOM_CVAR(String, midi_config, CONFIG_FILE, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +CUSTOM_CVAR(String, midi_config, "gzdoom", CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { Timidity::FreeAll(); if (currSong != nullptr && currSong->GetDeviceType() == MDEV_GUS) diff --git a/src/sound/timidity/timidity.h b/src/sound/timidity/timidity.h index f297f35bb7..385a62896a 100644 --- a/src/sound/timidity/timidity.h +++ b/src/sound/timidity/timidity.h @@ -86,9 +86,6 @@ config.h #define MAX_AMPLIFICATION 800 -/* The TiMiditiy configuration file */ -#define CONFIG_FILE "timidity.cfg" - typedef float sample_t; typedef float final_volume_t; #define FINAL_VOLUME(v) (v) diff --git a/src/swrenderer/line/r_line.cpp b/src/swrenderer/line/r_line.cpp index b2c1fee72d..8865199f3a 100644 --- a/src/swrenderer/line/r_line.cpp +++ b/src/swrenderer/line/r_line.cpp @@ -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; diff --git a/src/swrenderer/line/r_walldraw.cpp b/src/swrenderer/line/r_walldraw.cpp index 0b9c9131d9..64f14135f4 100644 --- a/src/swrenderer/line/r_walldraw.cpp +++ b/src/swrenderer/line/r_walldraw.cpp @@ -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; diff --git a/src/swrenderer/plane/r_skyplane.cpp b/src/swrenderer/plane/r_skyplane.cpp index e95abbd463..526be96e77 100644 --- a/src/swrenderer/plane/r_skyplane.cpp +++ b/src/swrenderer/plane/r_skyplane.cpp @@ -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; } diff --git a/src/swrenderer/plane/r_visibleplane.cpp b/src/swrenderer/plane/r_visibleplane.cpp index 185b567109..ac4e070796 100644 --- a/src/swrenderer/plane/r_visibleplane.cpp +++ b/src/swrenderer/plane/r_visibleplane.cpp @@ -115,7 +115,7 @@ namespace swrenderer { FTexture *tex = TexMan(picnum, true); - if (tex->UseType == FTexture::TEX_Null) + if (tex->UseType == ETextureType::Null) { return; } diff --git a/src/swrenderer/scene/r_opaque_pass.cpp b/src/swrenderer/scene/r_opaque_pass.cpp index 4b0c6f1faa..b9484f6245 100644 --- a/src/swrenderer/scene/r_opaque_pass.cpp +++ b/src/swrenderer/scene/r_opaque_pass.cpp @@ -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; } diff --git a/src/swrenderer/things/r_decal.cpp b/src/swrenderer/things/r_decal.cpp index 8361a8061f..ee5b10aebe 100644 --- a/src/swrenderer/things/r_decal.cpp +++ b/src/swrenderer/things/r_decal.cpp @@ -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; } diff --git a/src/swrenderer/things/r_playersprite.cpp b/src/swrenderer/things/r_playersprite.cpp index 924c7a7d82..b0021ca328 100644 --- a/src/swrenderer/things/r_playersprite.cpp +++ b/src/swrenderer/things/r_playersprite.cpp @@ -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) diff --git a/src/textures/anim_switches.cpp b/src/textures/anim_switches.cpp index 14fb4db84c..ab53210fe0 100644 --- a/src/textures/anim_switches.cpp +++ b/src/textures/anim_switches.cpp @@ -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); diff --git a/src/textures/animations.cpp b/src/textures/animations.cpp index a9fa4c1bf5..e250e1b5c4 100644 --- a/src/textures/animations.cpp +++ b/src/textures/animations.cpp @@ -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 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 &frames) +void FTextureManager::ParsePicAnim (FScanner &sc, FTextureID picnum, ETextureType usetype, bool missing, TArray &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); diff --git a/src/textures/buildtexture.cpp b/src/textures/buildtexture.cpp index b807803172..25c7868957 100644 --- a/src/textures/buildtexture.cpp +++ b/src/textures/buildtexture.cpp @@ -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) @@ -104,7 +104,7 @@ int FBuildTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, F { PalEntry *Remap = translationtables[TRANSLATION_Standard][Translation]->Palette; bmp->CopyPixelData(x, y, RawPixels, Width, Height, Height, 1, rotate, Remap, inf); - return 0; + return -1; } diff --git a/src/textures/canvastexture.cpp b/src/textures/canvastexture.cpp index e13dd6d3d3..85f9812af6 100644 --- a/src/textures/canvastexture.cpp +++ b/src/textures/canvastexture.cpp @@ -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; diff --git a/src/textures/ddstexture.cpp b/src/textures/ddstexture.cpp index 32f9183b38..0ad95f4b85 100644 --- a/src/textures/ddstexture.cpp +++ b/src/textures/ddstexture.cpp @@ -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; diff --git a/src/textures/jpegtexture.cpp b/src/textures/jpegtexture.cpp index e20ce77597..a9658014df 100644 --- a/src/textures/jpegtexture.cpp +++ b/src/textures/jpegtexture.cpp @@ -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; diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index b2e684eff2..1fe6637b53 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -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 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); diff --git a/src/textures/pngtexture.cpp b/src/textures/pngtexture.cpp index 6dbd169aa1..95dc3f3a63 100644 --- a/src/textures/pngtexture.cpp +++ b/src/textures/pngtexture.cpp @@ -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; diff --git a/src/textures/skyboxtexture.cpp b/src/textures/skyboxtexture.cpp index 5270af9374..c851a91a11 100644 --- a/src/textures/skyboxtexture.cpp +++ b/src/textures/skyboxtexture.cpp @@ -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()); diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index 60b8b84b8c..2d0349f86a 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -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]); diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index b16b5bd5ef..6902170cca 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -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(type), flags).GetIndex()); } //========================================================================== @@ -296,7 +296,7 @@ int FTextureManager::ListTextures (const char *name, TArray &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 &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 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;iSetFrontSkyLayer (); @@ -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); diff --git a/src/textures/textures.h b/src/textures/textures.h index b9a9b82998..0cd5bcf71e 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -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 &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 &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 &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 &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); diff --git a/src/v_collection.cpp b/src/v_collection.cpp index a9e1772a3a..418f7e1ea3 100644 --- a/src/v_collection.cpp +++ b/src/v_collection.cpp @@ -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; } } diff --git a/src/v_collection.h b/src/v_collection.h index 9e2800319e..697e6bb078 100644 --- a/src/v_collection.h +++ b/src/v_collection.h @@ -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; diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 32f908d034..35670abf93 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -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()) diff --git a/src/v_font.cpp b/src/v_font.cpp index 6375e5d1fc..d8826d11c6 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -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]; diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index 113253f953..d60af2165f 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -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 diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 50bc7d8d0f..75c63025ea 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -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. diff --git a/wadsrc/static/shaders/glsl/material_pbr.fp b/wadsrc/static/shaders/glsl/material_pbr.fp index 5212177e17..895b6183ba 100644 --- a/wadsrc/static/shaders/glsl/material_pbr.fp +++ b/wadsrc/static/shaders/glsl/material_pbr.fp @@ -181,7 +181,7 @@ vec3 ProcessMaterial(vec3 albedo, vec3 ambientLight) //vec3 ambient = (kD * diffuse + specular) * ao; vec3 ambient = (kD * diffuse) * ao; - vec3 color = ambient + Lo; + vec3 color = max(ambient + Lo, vec3(0.0)); // Tonemap (reinhard) and apply sRGB gamma //color = color / (color + vec3(1.0)); diff --git a/wadsrc/static/zscript/mapdata.txt b/wadsrc/static/zscript/mapdata.txt index 011400f86e..e219e835a7 100644 --- a/wadsrc/static/zscript/mapdata.txt +++ b/wadsrc/static/zscript/mapdata.txt @@ -57,9 +57,9 @@ struct Side native play WALLF_LIGHT_FOG = 128, // This wall's Light is used even in fog. }; - native Sector sector; // Sector the SideDef is facing. + native readonly Sector sector; // Sector the SideDef is facing. //DBaseDecal* AttachedDecals; // [RH] Decals bound to the wall - native Line linedef; + native readonly Line linedef; native int16 Light; native uint8 Flags;