commit 23a4e8f21de86a1ce2684f4021d9b8acc82d5614
Author: Michael Day <contact@michaelcday.com>
AuthorDate: Thu Nov 2 10:46:34 2023 -0400
Commit: Michael Day <contact@michaelcday.com>
CommitDate: Thu Nov 2 10:46:34 2023 -0400
Allow analog control for any controller
---
src/i_joystick.c | 2 ++
src/setup/joystick.c | 4 +---
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/i_joystick.c b/src/i_joystick.c
index 403e5e9b..575073bd 100644
--- a/src/i_joystick.c
+++ b/src/i_joystick.c
@@ -625,6 +625,8 @@ static int GetAxisState(int axis, int invert, int dead_zone)
result = -result;
}
+ result *= FRACUNIT / 32768; // Want FXP number between -1 and 1
+
return result;
}
diff --git a/src/setup/joystick.c b/src/setup/joystick.c
index 61358eca..a9ae5920 100644
--- a/src/setup/joystick.c
+++ b/src/setup/joystick.c
@@ -1008,7 +1008,6 @@ static int CalibrationEventCallback(SDL_Event *event, void *user_data)
// joystick is being configured and which button the user is pressing.
usejoystick = 1;
use_gamepad = 0;
- use_analog = 0;
gamepad_type = SDL_CONTROLLER_TYPE_UNKNOWN;
calibrate_button = event->jbutton.button;
@@ -1236,8 +1235,7 @@ void ConfigJoystick(TXT_UNCAST_ARG(widget), void *user_data)
TXT_AddWidget(window, TXT_TABLE_EOL);
TXT_AddWidget(window,
- TXT_NewConditional(&use_gamepad, 1,
- TXT_NewButton2("Analog settings", AdjustAnalog, NULL)));
+ TXT_NewButton2("Analog settings", AdjustAnalog, NULL));
TXT_AddWidget(window, TXT_TABLE_EOL);
TXT_AddWidget(window, TXT_NewSeparator("Buttons"));