From 889f4dfc9f8ff7885731b53bea5e26ab84ceb891 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sun, 5 Nov 2023 03:16:59 -0700 Subject: [PATCH 1/2] Diagonal-back for shallow digital turns --- src/g_build_ticcmd.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/g_build_ticcmd.cpp b/src/g_build_ticcmd.cpp index 7f41eb865..fc74ecf4c 100644 --- a/src/g_build_ticcmd.cpp +++ b/src/g_build_ticcmd.cpp @@ -372,6 +372,16 @@ class TiccmdBuilder } kart_analog_input(); + + // Digital users can input diagonal-back for shallow turns. + // + // There's probably some principled way of doing this in the gamepad handler itself, + // by only applying this filtering to inputs sourced from an axis. This is a little + // ugly with the current abstractions, though, and there's a fortunate trick here: + // if you can input full strength turns on both axes, either you're using a fucking + // square gate, or you're not on an analog device. + if (joystickvector.yaxis > 1020 && abs(cmd->turning) == KART_FULLTURN) // My keyboard hits 1024 but my keyboard only hits 1023, video games + cmd->turning /= 2; } void common_button_input() From a805847086c07bd06c53ad211f2a48647b6766f2 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sun, 5 Nov 2023 03:56:25 -0700 Subject: [PATCH 2/2] Use JOYAXISRANGE for digital detection --- src/g_build_ticcmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_build_ticcmd.cpp b/src/g_build_ticcmd.cpp index fc74ecf4c..81d431a12 100644 --- a/src/g_build_ticcmd.cpp +++ b/src/g_build_ticcmd.cpp @@ -380,7 +380,7 @@ class TiccmdBuilder // ugly with the current abstractions, though, and there's a fortunate trick here: // if you can input full strength turns on both axes, either you're using a fucking // square gate, or you're not on an analog device. - if (joystickvector.yaxis > 1020 && abs(cmd->turning) == KART_FULLTURN) // My keyboard hits 1024 but my keyboard only hits 1023, video games + if (joystickvector.yaxis >= JOYAXISRANGE && abs(cmd->turning) == KART_FULLTURN) // >= beacuse some analog devices can go past JOYAXISRANGE (?!) cmd->turning /= 2; }