From e2872c51793c107001c22c02bc3814b42a3eefff Mon Sep 17 00:00:00 2001 From: tmyqlfpir <80724828+tmyqlfpir@users.noreply.github.com> Date: Fri, 13 Sep 2024 08:14:19 +1000 Subject: [PATCH] Blood: Add support for solo axis deadzones --- source/blood/src/_functio.h | 15 ++++++++++++--- source/blood/src/config.cpp | 16 ++++++++++++++++ source/blood/src/config.h | 1 + source/blood/src/menu.cpp | 26 +++++++++++++++++++++++--- 4 files changed, 52 insertions(+), 6 deletions(-) diff --git a/source/blood/src/_functio.h b/source/blood/src/_functio.h index b3b3dea50e..780010dfad 100644 --- a/source/blood/src/_functio.h +++ b/source/blood/src/_functio.h @@ -343,7 +343,7 @@ static const int32_t joystickanalogscaledefaults[MAXJOYAXES] = DEFAULTJOYSTICKANALOGUESCALE, DEFAULTJOYSTICKANALOGUESCALE, DEFAULTJOYSTICKANALOGUESCALE/2, - DEFAULTJOYSTICKANALOGUESCALE/4 + DEFAULTJOYSTICKANALOGUESCALE/4, }; @@ -352,7 +352,16 @@ static const int32_t joystickanalogdeaddefaults[MAXJOYAXES] = DEFAULTJOYSTICKANALOGUEDEAD*5, DEFAULTJOYSTICKANALOGUEDEAD*4, DEFAULTJOYSTICKANALOGUEDEAD*2, - DEFAULTJOYSTICKANALOGUEDEAD*2 + DEFAULTJOYSTICKANALOGUEDEAD*2, + }; + + +static const int32_t joystickanalogaxissolodeadzone[MAXJOYAXES] = + { + 1, + 0, + 0, + 0, }; @@ -361,7 +370,7 @@ static const int32_t joystickanalogsaturatedefaults[MAXJOYAXES] = DEFAULTJOYSTICKANALOGUESATURATE*3, DEFAULTJOYSTICKANALOGUESATURATE*3, DEFAULTJOYSTICKANALOGUESATURATE*2, - DEFAULTJOYSTICKANALOGUESATURATE*2 + DEFAULTJOYSTICKANALOGUESATURATE*2, }; diff --git a/source/blood/src/config.cpp b/source/blood/src/config.cpp index 54a4e81990..6bceb75c67 100644 --- a/source/blood/src/config.cpp +++ b/source/blood/src/config.cpp @@ -65,6 +65,7 @@ int32_t JoystickAnalogueScale[MAXJOYAXES]; int32_t JoystickAnalogueDead[MAXJOYAXES]; int32_t JoystickAnalogueSaturate[MAXJOYAXES]; int32_t JoystickAnalogueInvert[MAXJOYAXES]; +int32_t JoystickAnalogueAxisSoloDeadZone[MAXJOYAXES]; uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2]; int32_t scripthandle; int32_t setupread; @@ -479,6 +480,9 @@ void CONFIG_SetDefaults(void) JoystickAnalogueInvert[i] = 0; CONTROL_SetAnalogAxisInvert(i, JoystickAnalogueInvert[i]); + + JoystickAnalogueAxisSoloDeadZone[i] = 0; + JOYSTICK_SetAxisSoloDeadZone(i, JoystickAnalogueAxisSoloDeadZone[i]); } #else for (int i=0; inValue = JoystickAnalogueDead[nAxis]; pItemOptionsControlJoystickAxisSaturate[nAxis]->nValue = JoystickAnalogueSaturate[nAxis]; + pItemOptionsControlJoystickAxisSoloDeadzone[nAxis]->at20 = JoystickAnalogueAxisSoloDeadZone[nAxis]; } } @@ -2500,6 +2507,19 @@ void SetJoystickSaturate(CGameMenuItemSlider* pItem) } } +void SetJoystickSoloDeadzone(CGameMenuItemZBool* pItem) +{ + for (int nAxis = 0; nAxis < MAXJOYAXES; nAxis++) + { + if (pItem == pItemOptionsControlJoystickAxisSoloDeadzone[nAxis]) + { + JoystickAnalogueAxisSoloDeadZone[nAxis] = pItem->at20; + JOYSTICK_SetAxisSoloDeadZone(nAxis, JoystickAnalogueAxisSoloDeadZone[nAxis]); + break; + } + } +} + void PreDrawControlMouse(CGameMenuItem *pItem) { if (pItem == &itemOptionsControlMouseVerticalAim)