From f679b61a30c66c9a14fa927c5f94242c50b8491e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 30 Dec 2021 22:56:33 +0100 Subject: [PATCH] - fixed issue with wall sprite angle check. The resulting value had no sign, so 'abs' did not work. It now uses some bit shifting magic to get a proper sign. --- source/core/rendering/scene/hw_walls.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index c16d5ef73..2dc9a2bc3 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -61,7 +61,7 @@ static walltype* IsOnWall(tspritetype* tspr, int height, DVector2& outpos) // Intentionally include two sided walls. Even on them the sprite should be projected onto the wall for better results. auto d = wal.delta(); int walang = getangle(d.X, d.Y); - int deltaang = abs(walang - tspr->ang) & 2047; + int deltaang = abs((((walang - tspr->ang) & 2047) << 21) >> 21); const int maxangdelta = 1; // angle of the sprite must either be the wall's normal or the negative wall's normal to be aligned.