Hotfix for 100% deadzone returning 0 input
It makes more sense for 100% deadzone to just make it so that you have to push the axis all the way to trigger it, rather than 100% deadzone resulting in no axis input ever happening... So, let's make it be the former way instead
This commit is contained in:
parent
27e084a827
commit
df220aa2c2
15
src/g_game.c
15
src/g_game.c
|
@ -1045,14 +1045,19 @@ static INT32 G_BasicDeadZoneCalculation(INT32 magnitude, fixed_t deadZone)
|
||||||
const INT32 jdeadzone = (JOYAXISRANGE * deadZone) / FRACUNIT;
|
const INT32 jdeadzone = (JOYAXISRANGE * deadZone) / FRACUNIT;
|
||||||
INT32 deadzoneAppliedValue = 0;
|
INT32 deadzoneAppliedValue = 0;
|
||||||
|
|
||||||
if (jdeadzone > 0 && magnitude > jdeadzone && deadZone < FRACUNIT)
|
if (jdeadzone > 0 && magnitude > jdeadzone)
|
||||||
{
|
{
|
||||||
INT32 adjustedMagnitude = abs(magnitude);
|
if (deadZone >= FRACUNIT) // If the deadzone value is at 100%...
|
||||||
adjustedMagnitude = min(adjustedMagnitude, JOYAXISRANGE);
|
return JOYAXISRANGE; // ...return 100% input directly, to avoid dividing by 0
|
||||||
|
else
|
||||||
|
{
|
||||||
|
INT32 adjustedMagnitude = abs(magnitude);
|
||||||
|
adjustedMagnitude = min(adjustedMagnitude, JOYAXISRANGE);
|
||||||
|
|
||||||
adjustedMagnitude -= jdeadzone;
|
adjustedMagnitude -= jdeadzone;
|
||||||
|
|
||||||
deadzoneAppliedValue = (adjustedMagnitude * JOYAXISRANGE) / (JOYAXISRANGE - jdeadzone);
|
deadzoneAppliedValue = (adjustedMagnitude * JOYAXISRANGE) / (JOYAXISRANGE - jdeadzone);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return deadzoneAppliedValue;
|
return deadzoneAppliedValue;
|
||||||
|
|
Loading…
Reference in a new issue