Repository navigation
Add per-axis joystick deadzone and sensitivity options - #7857
Open
dustinspace217 wants to merge 2 commits into
Open
dustinspace217 wants to merge 2 commits into
dustinspace217 wants to merge 2 commits into
Conversation
Adds Heading, Pitch, Bank and Relative Throttle deadzone and sensitivity options. Each defaults to Use Global, which keeps the existing global Deadzone and Sensitivity settings; a value set for an axis action overrides them for whatever stick axis is bound to that action, and an axis deadzone also takes precedence over -deadzone. Absolute throttle is unaffected because it never used a deadzone or sensitivity. Addresses scp-fs2open#4480
Options sort by importance from highest to lowest, so the eight per-axis rows now sit below Sensitivity and Deadzone as one block, heading first. The -deadzone help now says a per-axis deadzone still applies to its axis.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Adds Heading, Pitch, Bank and Relative Throttle deadzone and sensitivity options. Each defaults to "Use Global", which keeps using the existing Deadzone and Sensitivity settings; a value set for one of them applies to whatever stick axis is bound to that action. Addresses #4480.
Why?
Different axes on the same device often need different settings. The example in #4480 is a twist axis that needs a bigger deadzone than the main X and Y axes, which today means either living with a drifting twist or a mushy stick. MjnMixael asked that the new settings go through the options manager like the global ones, so that's how they're exposed.
How?
joy_get_scaled_reading()takes the axis action as an optional argument. When a per-action deadzone or sensitivity is set, it's used; otherwise the global value is, exactly as before. A per-action deadzone also takes precedence over-deadzone, since it's the more specific setting. Absolute throttle isn't included because it never used deadzone or sensitivity.The settings are per action rather than per physical device and axis: a value applies to every joystick axis bound to that action (an action has a primary and a secondary binding). That covers the twist case in the issue, and it keeps the list to eight options with names players recognize, instead of thirty-two "Joystick 2, axis 5" entries. If per-device settings are still wanted, they could sit underneath these later.
-deadzoneis on the command line; the global slider is the one-deadzonereplaces.Testing?
JoyScalingTest, 8 tests).JoyScalingTestcovers: a per-axis deadzone overriding the global one and beating-deadzone; a per-axis sensitivity overriding the global one and falling back when unset; a per-axis deadzone using exactly the global deadzone's scale; actions outside the range using the global settings; a stick axis bound throughscale_invert()picking up its action's deadzone; and each of the eight options binding to its own action and being an integer range. Removing the call-site change, changing the deadzone scale, binding one option to another action, or dropping the integer flag each fails a named test.Anything Else?
I used Claude Code to trace the joystick scaling path and to write the feature and tests.