From f0ab74b18854beb7a0e0b7a6f0991f527e121479 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 25 Oct 2022 08:34:41 +0200 Subject: [PATCH] - fixed coordinate setup in processClipSlopeSprite --- source/core/gamefuncs.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index 213ff1fbf..0d7c75f3f 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -1530,10 +1530,11 @@ static void processClipSlopeSprite(MoveClipper& clip, DCoreActor* actor) for (int k = 0; k < 3; k++) { - double factor = (zz[k] - heights[0]) / (heights[2] - heights[0]); + double factor = (zz[k] - heights[0]) / (heights[1] - heights[0]); if (factor < 0 || factor > 1) continue; // sprite never hits the desired height. - lpoints[0] = points[0] + (points[2] - points[0]) * factor; - lpoints[1] = lpoints[0] + (points[1] - points[0]); + auto dist = (points[1] - points[0]) * factor; + lpoints[0] = points[0] + dist; + lpoints[1] = points[3] + dist; // The rest is just the same as the main part of the wall sprite collector. if (IsCloseToLine(clip.center, lpoints[0], lpoints[1], clip.movedist) == EClose::Outside) continue; // out of reach