mdsteele / azimuth

A metroidvania with vector graphics
https://mdsteele.games/azimuth/
GNU General Public License v3.0
51 stars 15 forks source link

Allowing overloads for weapon slots 0-9 #13

Closed lowagner closed 4 years ago

lowagner commented 4 years ago

Hi again :).

I took your idea to heart, and decided to allow overloads for 0-9 (not just 0 and 9). I say "overloads", since 0-9 still work to switch to those weapons, which means I don't have to come up with changes everywhere in the UI. Still, in the UI, I try to make it clear in the upgrade dialogs and menus that e.g. "[0] or [$0]" is allowed, if there is an overload (i.e. if "$0" is different than "0").

While there are a few ways to go about doing the overloads, I added a mapping key_for_control (control -> key) and control_for_key (key -> control) to the user preferences, but it's not exactly 1-1 (since the AZ_KEY_0 will always map to AZ_CONTROL_BOMBS, but you can specify another key which will do so as well). So of course the "az_control_id_t" (AZCONTROL...) is new, which enumerates the possible controls that can be mapped to. The danger is that the two mappings could go out of sync, but we manage somehow for now...

I'm happy to add tests and otherwise change/rename things according to your tastes/preferences/style.

Here's a screenshot of the UI: https://pasteboard.co/IQWG924.png

and an example of the UI menu text change: https://pasteboard.co/IQWHbKk.png

mdsteele commented 4 years ago

Looking good! I finally got a chance today to patch in the changes and try them out, and it seems pretty slick. I added a couple more nitpicks above, but I think we're getting close to being able to merge.

lowagner commented 4 years ago

i think everything is an order, but let me know if there's anything else you need!

mdsteele commented 4 years ago

Looks good to me!