Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analog binds #2924

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Analog binds #2924

wants to merge 5 commits into from

Conversation

TehRealSalt
Copy link
Contributor

@TehRealSalt TehRealSalt commented Jan 31, 2025

Removed the separated "axis map" from the gamepad menu. Analog input now piggy-backs off of binds, so you can bind analog movement directly in the controls menu.

Additionally, added a new client console variable, cl_analogstraferun. This rescales analog stick movement when moving diagonally to reach [1.0, 1.0], instead of [0.77, 0.77]. Turned off by default, because this does not match Linux Doom's axis behavior, and some weird devices may not play well with it.

I'm doing this for my IWAD's engine branch, since it makes control setup more accessible & straight-forward for new players. It probably needs additional work for inclusion in GZDoom.

Notes

  • cl_analogstraferun has not been added to the menus yet. I'm not actually sure what all needs done for this, or where it should go; does localization need finished for this?
  • Backwards compatibility with ZScript is "handled" by dummying out the existing joystick menu action functions to either be NOPs, or return 0. The old menu item class has been left alone, and the menu code simply doesn't create it anymore. Is that OK? Is doing that too much for a GZDoom patch? Should deprecation warnings be placed on anything? etc...
  • This tosses around a float array of NUM_KEYS size a lot. This feels quite wasteful to me, since only a small fraction of the total keys can have analog input. I've thought about adding a unique lookup table to convert a axis representation integer into the actual key, but I didn't do it because this was more straight-forward for maintenance if new keys need to be added. Thoughts? (I didn't search the codebase for another dictionary-style class I could use, so maybe the answer's straight-forward.)
  • Probably needs testing with a lot of controllers! I've tested with a bunch that I have, but there's some very weird controllers out there.
  • Definitely needs testing with Mac / Linux! I'm away from my usual setup right now so I will be doing lots of my own stress-testing on Linux later (marking as draft until I do), but I straight-up don't have a Mac.

The main benefit of this is to remove the requirement of going to the gamepad menu for binding analog sticks, and going to a keybinds menu for binding literally everything else; now it's all bound in the same location.

This also means that axes can both register as a digital button press, and be used as an analog value for movement separately. Before, using analog movement would not register BT_FORWARD, BT_BACK, etc

Currently, only the code that creates the JoyMap menu items has been removed, and action functions relating to them have been dummied out. I'm not quite sure how backwards compatibility is supposed to be handled here, or if it's OK to break.
@TehRealSalt TehRealSalt marked this pull request as draft January 31, 2025 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant