From 3fc96e8840bd77927c0788eed101bec0d298ebd2 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 14 Sep 2020 18:54:03 +1000 Subject: [PATCH] - SW: Stop keyboard fvel/svel from allowing `loc.fvel`/`loc.svel` like Duke. * Stops overshooting keymove when playing with `cl_syncinput 0`. * Keymove is never as high as MAXFVEL/MAXSVEL, which is used as a thrash point for controller input. * Fixes #390. --- source/sw/src/input.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index c3fb1bb47..27a69a885 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -265,17 +265,22 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool } } - if (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !pp->sop) - svel += keymove; + if (abs(loc.svel) < keymove) + { + if (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !pp->sop) + svel += keymove; - if (buttonMap.ButtonDown(gamefunc_Strafe_Right) && !pp->sop) - svel -= keymove; + if (buttonMap.ButtonDown(gamefunc_Strafe_Right) && !pp->sop) + svel -= keymove; + } + if (abs(loc.fvel) < keymove) + { + if (buttonMap.ButtonDown(gamefunc_Move_Forward)) + fvel += keymove; - if (buttonMap.ButtonDown(gamefunc_Move_Forward)) - fvel += keymove; - - if (buttonMap.ButtonDown(gamefunc_Move_Backward)) - fvel -= keymove; + if (buttonMap.ButtonDown(gamefunc_Move_Backward)) + fvel -= keymove; + } if (!cl_syncinput) {