mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
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
1 changed files with 10 additions and 5 deletions
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;
|
||||
INT32 deadzoneAppliedValue = 0;
|
||||
|
||||
if (jdeadzone > 0 && magnitude > jdeadzone && deadZone < FRACUNIT)
|
||||
if (jdeadzone > 0 && magnitude > jdeadzone)
|
||||
{
|
||||
INT32 adjustedMagnitude = abs(magnitude);
|
||||
adjustedMagnitude = min(adjustedMagnitude, JOYAXISRANGE);
|
||||
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);
|
||||
|
||||
adjustedMagnitude -= jdeadzone;
|
||||
adjustedMagnitude -= jdeadzone;
|
||||
|
||||
deadzoneAppliedValue = (adjustedMagnitude * JOYAXISRANGE) / (JOYAXISRANGE - jdeadzone);
|
||||
deadzoneAppliedValue = (adjustedMagnitude * JOYAXISRANGE) / (JOYAXISRANGE - jdeadzone);
|
||||
}
|
||||
}
|
||||
|
||||
return deadzoneAppliedValue;
|
||||
|
|
Loading…
Reference in a new issue