From 42cbd10e1d156388bf4faf69e35609159c306abb Mon Sep 17 00:00:00 2001 From: ac-stef Date: Tue, 23 Aug 2016 11:44:09 +0200 Subject: [PATCH] fix cornerslide speed instead of using a constant (and always wrong) speed, use the same part of the movement vector that x- and y- slides use (sadly, this fix seems to raise problems with the previous "fix sliding along corners" commit, which seems to have liked the constant speed...) --- source/src/physics.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/src/physics.cpp b/source/src/physics.cpp index 91f64972..d3a22f96 100644 --- a/source/src/physics.cpp +++ b/source/src/physics.cpp @@ -653,10 +653,10 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime) { // along a corner wall float ct2f = cornersurface1 == 2 ? -1.0 : 1.0; - float diag = f*d.magnitudexy()*2; + float diag = fabs(d.x + ct2f * d.y) * 0.5f; vec vd = vec((d.y*ct2f+d.x >= 0.0f ? diag : -diag), (d.x*ct2f+d.y >= 0.0f ? diag : -diag), 0); - pl->o.x += vd.x; - pl->o.y += vd.y; + pl->o.x += f*vd.x; + pl->o.y += f*vd.y; if(!collide(pl, false, drop, rise)) { d.x = vd.x; d.y = vd.y;