From 3577b53c4dde9624c237b47c55a2f70d2ddf2d37 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 4 Oct 2022 18:50:15 +0200 Subject: [PATCH] - GetWallSpritePosition also benefits from using .dot --- source/core/gamefuncs.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index 6d5b286bf..fe03013b3 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -227,16 +227,13 @@ void GetWallSpritePosition(const spritetypebase* spr, const DVector2& pos, DVect xoffset = tex->GetDisplayLeftOffset() + spr->xoffset; } - double x = spr->angle.Sin() * spr->xrepeat * REPEAT_SCALE; - double y = -spr->angle.Cos() * spr->xrepeat * REPEAT_SCALE; + auto p = spr->angle.ToVector().Rotated90CW() * spr->xrepeat * REPEAT_SCALE; if (spr->cstat & CSTAT_SPRITE_XFLIP) xoffset = -xoffset; double origin = (width * 0.5) + xoffset; - out[0].X = pos.X - x * origin; - out[0].Y = pos.Y - y * origin; - out[1].X = out[0].X + x * width; - out[1].Y = out[0].Y + y * width; + out[0] = pos - p * origin; + out[1] = out[0] + p * width; }