From e223a25863b204c3bb2b53a883d59cf97c145f94 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Tue, 9 Oct 2018 06:55:56 -0400 Subject: [PATCH] - fixed: smooth teleporters could fudge the player over an adjacent line, causing the player to appear on top of a cliff that is much higher than the original teleport. --- src/p_teleport.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index 2bb71f82b7..78f21b741f 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -523,18 +523,21 @@ bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBO // Is this really still necessary with real math instead of imprecise trig tables? #if 1 + const double fudgeamount = 1. / 65536.; + int side = reverse || (player && stepdown); int fudge = FUDGEFACTOR; double dx = line->Delta().X; double dy = line->Delta().Y; + // Make sure we are on correct side of exit linedef. while (P_PointOnLineSidePrecise(p, l) != side && --fudge >= 0) { if (fabs(dx) > fabs(dy)) - p.Y -= (dx < 0) != side ? -1 : 1; + p.Y -= (dx < 0) != side ? -fudgeamount : fudgeamount; else - p.X += (dy < 0) != side ? -1 : 1; + p.X += (dy < 0) != side ? -fudgeamount : fudgeamount; } #endif