Skip to content

Added support for extra buttons to be used as walk speed modifiers#449

Merged
dcvz merged 39 commits intoHarbourMasters:developfrom
jbodner09:slowwalk
Oct 10, 2022
Merged

Added support for extra buttons to be used as walk speed modifiers#449
dcvz merged 39 commits intoHarbourMasters:developfrom
jbodner09:slowwalk

Conversation

@jbodner09
Copy link
Contributor

@jbodner09 jbodner09 commented Jun 6, 2022

Potentially closes #178.

It's been discussed before that we shouldn't be held to the limitations of the N64 controller, and that previous mods that have tried to add a walk speed modifier have been limited by the number of buttons available on the standard N64 controller. Therefore, I decided to go ahead and add two more buttons to the default controller bindings to serve the purpose of walk speed modifiers, although now that they're there, they could be used for anything else in the future.

The enumeration of N64 buttons had space for two more buttons in its 16-bit field, so I added two buttons and called them MODIFIER1 and MODIFIER2. On a standard Xbox controller, there were also room for 2 more buttons in the default mapping, if the C buttons are assumed to use standard buttons and not the right stick. These new buttons are mapped to the left stick button and the back button respectively. On a keyboard, these are mapped to left and right shift respectively.

As implemented, holding these buttons while walking will multiply the walk speed by the value shown in the slider. I'm open to suggestions as to the range of the sliders, particularly if one slider is desired to have greater granularity. These modifiers are also not controller type-agnostic; they apply to both keyboard and standard controller, even though the initial issue only specified wanting them for keyboard. You can even hold the keyboard button while walking with a controller joystick if the controller type is set to "auto", as is the default.

Currently, the speed modifier is limited only to when walking without targeting, which mirrors the behavior of the Bunny Hood speed enhancement. Additionally, the Bunny Hood speed enhancement will take priority if that option is enabled and the Bunny Hood is currently being worn. If there are more situations where having speed modification would be helpful, I will gladly add them. For example, it doesn't work in buildings when certain buttons are disabled since I didn't disable the disabling.

Example behavior (plays fine offline in VLC):

capture0002.mp4

Additionally, since the Game Control Editor window that the modifier button mapping UI lives in is brand new and has other PRs out for it, this PR fixes some white space formatting and an issue with tooltips not working instead of using another PR in order to prevent merge conflicts.

Copy link
Contributor

@briaguya0 briaguya0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems really cool! a couple things come to mind

  • not sure how i feel about the BTN_MODIFIER naming. i like the gWalkModifier naming, the BTN_MODIFIER stuff just leaves me asking "modify what?"
  • allowing players to set the modifier to over 1.0x speed kind of puts this in a strange place where it can be both a QoL thing and a cheat, part of me thinks the move is to just limit the slider to have a max of 1.0 but idk

@jbodner09
Copy link
Contributor Author

I have no problem renaming the buttons or moving the sliders to the cheats menu, since even the slow movement was specifically requested to be able to easily set up glitches like ESS. Any recommendation for what to name the buttons? There's no equivalent N64 button, which is why since I was using them as walk modifiers, I named them "modifier", but maybe something more generic like UTILITY or EXTRA would be better?

@Kenix3
Copy link
Collaborator

Kenix3 commented Jul 12, 2022

It looks like I didn't post here yet, but this is waiting on the controller binding UI to be merged.

@jbodner09
Copy link
Contributor Author

Ah, that makes sense. I wondered if we were also waiting for Rachael.

@jbodner09 jbodner09 changed the base branch from develop-rachael to develop-zhora July 20, 2022 18:16
@jbodner09 jbodner09 marked this pull request as draft July 21, 2022 05:07
@Kenix3
Copy link
Collaborator

Kenix3 commented Jul 21, 2022

Also, a lot of these changes are game specific. I don't know yet how I want to handle game specific controller changes. The PR to invert axis controls is also waiting in the same limbo.

@jbodner09
Copy link
Contributor Author

Also, a lot of these changes are game specific.

If it helps, I'd be happy to split this into a change to just add the buttons to the mapping, since any game could then use the extra buttons, and then a separate change to use the new buttons for the walk speed modifiers.

@jbodner09 jbodner09 marked this pull request as ready for review August 17, 2022 06:35
Comment on lines +443 to +444
profile->Mappings[SDL_CONTROLLER_BUTTON_LEFTSTICK] = BTN_MODIFIER1;
profile->Mappings[SDL_CONTROLLER_BUTTON_RIGHTSTICK] = BTN_MODIFIER2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be nice to add a comment explaining why the modifiers are being mapped to the sticks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny enough, the real reason isn't even relevant anymore! Back when I first made this PR, the C buttons had that commented out double-mapping that also took up the X, Y, Right Shoulder, and Select buttons (I believe), so the two stick buttons were the only ones left unmapped! The default mapping has since removed that entirely, but because people might still be using some version of that mapping (hint hint ME, lol), I didn't want to potentially conflict with them. I'm curious if you think people will be more likely to already have something mapped to the stick buttons though, since I know I've seen some people put Up C on right stick click.

Plus, in my testing, it actually ended up being kind of useful to just click and then aim the left stick with a single finger, kind of like Metroid Dread ended up doing, and I've never felt like the imprecision of the stick buttons lent themselves well to use as actual items.

Copy link
Contributor

@briaguya0 briaguya0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@dcvz dcvz merged commit 8df4d64 into HarbourMasters:develop Oct 10, 2022
@jbodner09 jbodner09 deleted the slowwalk branch October 10, 2022 07:01
leggettc18 pushed a commit to leggettc18/Shipwright that referenced this pull request Oct 19, 2022
leggettc18 pushed a commit to leggettc18/Shipwright that referenced this pull request Oct 19, 2022
dcvz pushed a commit to briaguya0/Shipwright that referenced this pull request Nov 12, 2022
th-2021 pushed a commit to th-2021/Shipwright-cmake that referenced this pull request Nov 28, 2022
th-2021 pushed a commit to th-2021/Shipwright-cmake that referenced this pull request Nov 28, 2022
th-2021 pushed a commit to th-2021/Shipwright-cmake that referenced this pull request Nov 28, 2022
th-2021 pushed a commit to th-2021/Shipwright-cmake that referenced this pull request Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for a Walking button for Keyboard users

4 participants