From fcb3e43799ed2f3f38155992a9bd7422613bf598 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 1 Jan 2022 17:27:09 +0100 Subject: [PATCH] - fixed side check for sloped sprites. --- source/core/rendering/scene/hw_flats.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/core/rendering/scene/hw_flats.cpp b/source/core/rendering/scene/hw_flats.cpp index a3e68152d..35ff7aa91 100644 --- a/source/core/rendering/scene/hw_flats.cpp +++ b/source/core/rendering/scene/hw_flats.cpp @@ -406,8 +406,13 @@ void HWFlat::ProcessFlatSprite(HWDrawInfo* di, tspritetype* sprite, sectortype* visibility = sectorVisibility(sector) *(4.f / 5.f); // The factor comes directly from Polymost. What is it with Build and these magic factors? // Weird Build logic that really makes no sense. - if ((sprite->cstat & CSTAT_SPRITE_ONE_SIDE) != 0 && (di->Viewpoint.Pos.Z < z) == ((sprite->cstat & CSTAT_SPRITE_YFLIP) == 0)) - return; + if ((sprite->cstat & CSTAT_SPRITE_ONE_SIDE) != 0) + { + double myz = !(sprite->clipdist & TSPR_SLOPESPRITE) ? z : + tspriteGetZOfSlope(sprite, int(di->Viewpoint.Pos.X * 16), int(di->Viewpoint.Pos.Y * -16)) * -(1. / 256.); + if ((di->Viewpoint.Pos.Z < myz) == ((sprite->cstat & CSTAT_SPRITE_YFLIP) == 0)) + return; + } if (texture && texture->isValid()) {