From ebc63dca426d8af1d088280cd9300916fe12321a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20De=20Grandpr=C3=A9?= Date: Tue, 3 Mar 2026 09:08:07 -0500 Subject: [PATCH] Fix disabled analog steering and aiming at 0 input deadzone --- src/g_game.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 07695fd2f..d3755faa2 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1290,7 +1290,7 @@ retrygetcontrol: value = gamekeydown[deviceID][key]; - if (value >= deadzone) + if (value > deadzone) { return value; } @@ -1451,15 +1451,29 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) return; } + fixed_t deadZoneY = cv_deadzoney[forplayer].value; + const double deadZoneYDecimal = (double) deadZoneY / FRACUNIT; joystickvector.xaxis = G_PlayerInputAnalog(forplayer, gc_turnright, false, DEADZONE_X) - G_PlayerInputAnalog(forplayer, gc_turnleft, false, DEADZONE_X); - joystickvector.yaxis = 0; + if (deadZoneYDecimal <= 0) + { + joystickvector.yaxis = G_PlayerInputAnalog(forplayer, gc_aimbackward, false, DEADZONE_Y) - G_PlayerInputAnalog(forplayer, gc_aimforward, false, DEADZONE_Y); + } + else + { + joystickvector.yaxis = 0; + } G_HandleAxisDeadZone(forplayer, &joystickvector); // For kart, I've turned the aim axis into a digital axis because we only // use it for aiming to throw items forward/backward and the vote screen // This mean that the turn axis will still be gradient but up/down will be 0 // until the stick is pushed far enough - joystickvector.yaxis = G_PlayerInputAnalog(forplayer, gc_aimbackward, false, DEADZONE_Y) - G_PlayerInputAnalog(forplayer, gc_aimforward, false, DEADZONE_Y); + // + // When the deadzone is set to 0 or lower, the aim axis returns to analog to avoid breaking the chasecam and freecam controls + if (deadZoneYDecimal > 0) + { + joystickvector.yaxis = G_PlayerInputAnalog(forplayer, gc_aimbackward, false, DEADZONE_Y) - G_PlayerInputAnalog(forplayer, gc_aimforward, false, DEADZONE_Y); + } if (encoremode) {