From 6afbb82e66b7aa82ffb72e4e33940f1019b66c46 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 2 Apr 2021 09:04:13 +0200 Subject: [PATCH] - fixed one-sided wall sprite checks. --- source/core/rendering/scene/hw_walls.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index 1b67cdabc..6693a42ba 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -1067,11 +1067,18 @@ void HWWall::ProcessWallSprite(HWDrawInfo* di, spritetype* spr, sectortype* sect vec2_t pos[2]; int sprz = spr->pos.z; + GetWallSpritePosition(spr, spr->pos.vec2, pos, true); + glseg.x1 = pos[0].x * (1 / 16.f); + glseg.y1 = pos[0].y * (1 / -16.f); + glseg.x2 = pos[1].x * (1 / 16.f); + glseg.y2 = pos[1].y * (1 / -16.f); + if (spr->cstat & CSTAT_SPRITE_ONE_SIDED) { - DAngle sprang = buildang(spr->ang).asdeg(); - DAngle lookang = bamang(di->Viewpoint.RotAngle).asdeg(); - if ((sprang.ToVector() | lookang.ToVector()) >= 0.) return; + if (PointOnLineSide(di->Viewpoint.Pos.X, di->Viewpoint.Pos.Y, glseg.x1, glseg.y1, glseg.x2 - glseg.x1, glseg.y2 - glseg.y1) <= 0) + { + return; + } } vertindex = 0; @@ -1101,8 +1108,6 @@ void HWWall::ProcessWallSprite(HWDrawInfo* di, spritetype* spr, sectortype* sect } - GetWallSpritePosition(spr, spr->pos.vec2, pos, true); - int height, topofs; if (hw_hightile && TileFiles.tiledata[spr->picnum].h_xsize) { @@ -1128,10 +1133,6 @@ void HWWall::ProcessWallSprite(HWDrawInfo* di, spritetype* spr, sectortype* sect glseg.fracleft = 0; glseg.fracright = 1; - glseg.x1 = pos[0].x * (1 / 16.f); - glseg.y1 = pos[0].y * (1 / -16.f); - glseg.x2 = pos[1].x * (1 / 16.f); - glseg.y2 = pos[1].y * (1 / -16.f); tcs[LOLFT].u = tcs[UPLFT].u = (spr->cstat & CSTAT_SPRITE_XFLIP) ? 1.f : 0.f; tcs[LORGT].u = tcs[UPRGT].u = (spr->cstat & CSTAT_SPRITE_XFLIP) ? 0.f : 1.f; tcs[UPLFT].v = tcs[UPRGT].v = (spr->cstat & CSTAT_SPRITE_YFLIP) ? 1.f : 0.f;