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:
Zwip-Zwap Zapony 2020-03-04 21:11:55 +01:00
parent 27e084a827
commit df220aa2c2

View file

@ -1045,7 +1045,11 @@ static INT32 G_BasicDeadZoneCalculation(INT32 magnitude, fixed_t deadZone)
const INT32 jdeadzone = (JOYAXISRANGE * deadZone) / FRACUNIT;
INT32 deadzoneAppliedValue = 0;
if (jdeadzone > 0 && magnitude > jdeadzone && deadZone < FRACUNIT)
if (jdeadzone > 0 && magnitude > jdeadzone)
{
if (deadZone >= FRACUNIT) // If the deadzone value is at 100%...
return JOYAXISRANGE; // ...return 100% input directly, to avoid dividing by 0
else
{
INT32 adjustedMagnitude = abs(magnitude);
adjustedMagnitude = min(adjustedMagnitude, JOYAXISRANGE);
@ -1054,6 +1058,7 @@ static INT32 G_BasicDeadZoneCalculation(INT32 magnitude, fixed_t deadZone)
deadzoneAppliedValue = (adjustedMagnitude * JOYAXISRANGE) / (JOYAXISRANGE - jdeadzone);
}
}
return deadzoneAppliedValue;
}