diff --git a/source/blood/src/_functio.h b/source/blood/src/_functio.h index b3b3dea50e..e2c9aea972 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 joystickanalogisolateddeaddefaults[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..8c21f8015c 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 JoystickAnalogueIsolatedDeadZone[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]); + + JoystickAnalogueIsolatedDeadZone[i] = joystickanalogisolateddeaddefaults[i]; + JOYSTICK_SetAxisIsolatedDeadZone(i, JoystickAnalogueIsolatedDeadZone[i]); } #else for (int i=0; inValue = JoystickAnalogueDead[nAxis]; pItemOptionsControlJoystickAxisSaturate[nAxis]->nValue = JoystickAnalogueSaturate[nAxis]; + pItemOptionsControlJoystickAxisIsolatedDeadzone[nAxis]->at20 = JoystickAnalogueIsolatedDeadZone[nAxis]; } } @@ -2500,6 +2507,19 @@ void SetJoystickSaturate(CGameMenuItemSlider* pItem) } } +void SetJoystickIsolatedDeadzone(CGameMenuItemZBool* pItem) +{ + for (int nAxis = 0; nAxis < MAXJOYAXES; nAxis++) + { + if (pItem == pItemOptionsControlJoystickAxisIsolatedDeadzone[nAxis]) + { + JoystickAnalogueIsolatedDeadZone[nAxis] = pItem->at20; + JOYSTICK_SetAxisIsolatedDeadZone(nAxis, JoystickAnalogueIsolatedDeadZone[nAxis]); + break; + } + } +} + void PreDrawControlMouse(CGameMenuItem *pItem) { if (pItem == &itemOptionsControlMouseVerticalAim) diff --git a/source/mact/include/_control.h b/source/mact/include/_control.h index e43c2c931c..7333da59d8 100644 --- a/source/mact/include/_control.h +++ b/source/mact/include/_control.h @@ -126,6 +126,7 @@ typedef struct ControllerAxis uint16_t deadzone; uint16_t saturation; bool invert; + bool isolateddeadzone; } ControllerAxis_t; typedef struct UserInputState diff --git a/source/mact/include/joystick.h b/source/mact/include/joystick.h index 671a6b3c7e..ce1e0f926e 100644 --- a/source/mact/include/joystick.h +++ b/source/mact/include/joystick.h @@ -54,6 +54,7 @@ int32_t JOYSTICK_GetControllerButtons( void ); void JOYSTICK_ClearAllButtons( void ); int32_t JOYSTICK_GetHat( int32_t h ); void JOYSTICK_SetDeadZone(int32_t axis, uint16_t dead, uint16_t satur); +void JOYSTICK_SetAxisIsolatedDeadZone(int32_t axis, bool dead); #ifdef __cplusplus } diff --git a/source/mact/src/control.cpp b/source/mact/src/control.cpp index bf31ced274..de120457f9 100644 --- a/source/mact/src/control.cpp +++ b/source/mact/src/control.cpp @@ -267,6 +267,11 @@ void JOYSTICK_SetDeadZone(int32_t axis, uint16_t dead, uint16_t satur) joyAxes[axis].saturation = satur; } +void JOYSTICK_SetAxisIsolatedDeadZone(int32_t axis, bool dead) +{ + joyAxes[axis].isolateddeadzone = dead; +} + void CONTROL_SetAnalogAxisScale(int32_t whichaxis, int32_t axisscale, controldevice device) { float *set; @@ -488,7 +493,7 @@ static void controlUpdateAxisState(int index, ControlInfo *const info) else { // this assumes there are two sticks comprised of axes 0 and 1, and 2 and 3... because when isGameController is true, there are - if (index <= CONTROLLER_AXIS_LEFTY || (joystick.isGameController && (index <= CONTROLLER_AXIS_RIGHTY))) + if (!a.isolateddeadzone && (index <= CONTROLLER_AXIS_LEFTY || (joystick.isGameController && (index <= CONTROLLER_AXIS_RIGHTY)))) axisScaled10k = min(10000, joydist(joystick.pAxis[index & ~1], joystick.pAxis[index | 1]) * 10000 / 32767); if (axisScaled10k < a.deadzone)