From 71ca2c46772fab94a84314adfe35403508880ebf Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 6 Dec 2022 22:30:52 +0100 Subject: [PATCH] - eliminate the last remaining references to the tile manager in the core renderer files. The only thing left is the sky which needs more refactoring first and the tileUpdatePicnum call for sprites which cannot be resolved by the texture manager because Blood has a randomization factor included here. --- source/core/automap.cpp | 13 ++++++------- source/core/rendering/scene/hw_drawstructs.h | 4 ++-- source/core/rendering/scene/hw_flats.cpp | 3 +-- source/core/rendering/scene/hw_sprites.cpp | 2 +- source/core/rendering/scene/hw_walls.cpp | 2 +- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/source/core/automap.cpp b/source/core/automap.cpp index 48eeb2364..0b6483ba4 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -373,7 +373,7 @@ bool ShowRedLine(int j, int i) if (((wal->cstat | wal->nextWall()->cstat) & (CSTAT_WALL_MASKED | CSTAT_WALL_1WAY)) == 0) if (sector[i].floorz == wal->nextSector()->floorz) return false; - if (sector[i].floorpicnum != wal->nextSector()->floorpicnum) + if (sector[i].floortexture() != wal->nextSector()->floortexture()) return false; if (sector[i].floorshade != wal->nextSector()->floorshade) return false; @@ -431,7 +431,7 @@ static void drawwhitelines(const DVector2& cpos, const DVector2& cangvect, const for (auto& wal : sector[i].walls) { if (wal.nextwall >= 0) continue; - if (!gFullMap && !tileGetTexture(wal.wallpicnum)->isValid()) continue; + if (!gFullMap && !wal.walltexture().isValid()) continue; if (isSWALL() && !gFullMap && !show2dwall[wallindex(&wal)]) continue; @@ -524,8 +524,8 @@ static void renderDrawMapView(const DVector2& cpos, const DVector2& cangvect, co if (sect->floorstat & CSTAT_SECTOR_SKY) continue; - int picnum = sect->floorpicnum; - if ((unsigned)picnum >= (unsigned)MAXTILES) continue; + auto flortex = sect->floortexture(); + if (!flortex.isValid()) continue; int translation = TRANSLATION(Translation_Remap + curbasepal, sector[i].floorpal); PalEntry light = shadeToLight(sector[i].floorshade); @@ -541,7 +541,7 @@ static void renderDrawMapView(const DVector2& cpos, const DVector2& cangvect, co vertices[j] = { float(v.X), float(v.Y), mesh->texcoords[j].X, mesh->texcoords[j].Y }; } - twod->AddPoly(tileGetTexture(picnum, true), vertices.Data(), vertices.Size(), (unsigned*)indices->Data(), indices->Size(), translation, light, + twod->AddPoly(TexMan.GetGameTexture(flortex, true), vertices.Data(), vertices.Size(), (unsigned*)indices->Data(), indices->Size(), translation, light, LegacyRenderStyles[STYLE_Translucent], &viewport3d); } } @@ -581,9 +581,8 @@ static void renderDrawMapView(const DVector2& cpos, const DVector2& cangvect, co } int translation = TRANSLATION(Translation_Remap + curbasepal, actor->spr.pal); - int picnum = actor->spr.picnum; const static unsigned indices[] = { 0, 1, 2, 0, 2, 3 }; - twod->AddPoly(tileGetTexture(picnum, true), vertices.Data(), vertices.Size(), indices, 6, translation, color, rs, &viewport3d); + twod->AddPoly(TexMan.GetGameTexture(actor->spr.spritetexture(), true), vertices.Data(), vertices.Size(), indices, 6, translation, color, rs, &viewport3d); } } diff --git a/source/core/rendering/scene/hw_drawstructs.h b/source/core/rendering/scene/hw_drawstructs.h index b85da7ddb..8daa76387 100644 --- a/source/core/rendering/scene/hw_drawstructs.h +++ b/source/core/rendering/scene/hw_drawstructs.h @@ -388,7 +388,7 @@ int checkTranslucentReplacement(FTextureID picnum, int pal); inline bool maskWallHasTranslucency(const walltype* wall) { - return (wall->cstat & CSTAT_WALL_TRANSLUCENT) || checkTranslucentReplacement(tileGetTexture(wall->wallpicnum)->GetID(), wall->pal); + return (wall->cstat & CSTAT_WALL_TRANSLUCENT) || checkTranslucentReplacement(wall->walltexture(), wall->pal); } inline bool spriteHasTranslucency(const tspritetype* tspr) @@ -397,7 +397,7 @@ inline bool spriteHasTranslucency(const tspritetype* tspr) (tspr->ownerActor->sprext.alpha)) return true; - return checkTranslucentReplacement(tileGetTexture(tspr->picnum)->GetID(), tspr->pal); + return checkTranslucentReplacement(tspr->spritetexture(), tspr->pal); } inline void SetSpriteTranslucency(const tspritetype* sprite, float& alpha, FRenderStyle& RenderStyle) diff --git a/source/core/rendering/scene/hw_flats.cpp b/source/core/rendering/scene/hw_flats.cpp index 10de0ef5f..6b76ab170 100644 --- a/source/core/rendering/scene/hw_flats.cpp +++ b/source/core/rendering/scene/hw_flats.cpp @@ -413,8 +413,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int section void HWFlat::ProcessFlatSprite(HWDrawInfo* di, tspritetype* sprite, sectortype* sector) { - int tilenum = sprite->picnum; - texture = tileGetTexture(tilenum); + texture = TexMan.GetGameTexture(sprite->spritetexture()); bool belowfloor = false; if (sprite->pos.Z > sprite->sectp->floorz) { diff --git a/source/core/rendering/scene/hw_sprites.cpp b/source/core/rendering/scene/hw_sprites.cpp index eef286c2a..ccf8bb331 100644 --- a/source/core/rendering/scene/hw_sprites.cpp +++ b/source/core/rendering/scene/hw_sprites.cpp @@ -318,7 +318,7 @@ void HWSprite::Process(HWDrawInfo* di, tspritetype* spr, sectortype* sector, int if (spr == nullptr) return; - auto tex = tileGetTexture(spr->picnum); + auto tex = TexMan.GetGameTexture(spr->spritetexture()); if (!tex || !tex->isValid()) return; texture = tex; diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index c9e40f38b..c3407156c 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -1126,7 +1126,7 @@ int HWWall::CheckWallSprite(tspritetype* spr, tspritetype* last) void HWWall::ProcessWallSprite(HWDrawInfo* di, tspritetype* spr, sectortype* sector) { - auto tex = tileGetTexture(spr->picnum); + auto tex = TexMan.GetGameTexture(spr->spritetexture()); if (!tex || !tex->isValid()) return; seg = nullptr;