From 75c0bb40274faddb46417b52d79b37e2be828e93 Mon Sep 17 00:00:00 2001 From: skd988 <85232653+skd988@users.noreply.github.com> Date: Wed, 2 Jun 2021 16:45:49 +0300 Subject: [PATCH] Fixed bottom-left deadzone There used to be a problem where moving the joystick to bottom-left will not make the cursor move. This was caused by an overflow in the calculation of lengthsq in handleMouseMovement. I added unsigned int to solve it. --- Windows/Gopher/Gopher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Windows/Gopher/Gopher.cpp b/Windows/Gopher/Gopher.cpp index 32b47f0..9ec3f25 100644 --- a/Windows/Gopher/Gopher.cpp +++ b/Windows/Gopher/Gopher.cpp @@ -522,7 +522,7 @@ void Gopher::handleMouseMovement() float dy = 0; // Handle dead zone - float lengthsq = tx * tx + ty * ty; + float lengthsq = unsigned int(tx * tx + ty * ty); if (lengthsq > DEAD_ZONE * DEAD_ZONE) { float mult = speed * getMult(lengthsq, DEAD_ZONE, acceleration_factor);