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

Make arrows (camera controls) work in options menu #407

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/game/options_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,46 @@ void optmenu_check_buttons(void) {
#endif
optmenu_opt_change(&currentMenu->opts[currentMenu->select], 0);
}
} else if (gPlayer1Controller->buttonPressed & D_CBUTTONS) {
Copy link

@mkst mkst Sep 7, 2020

Choose a reason for hiding this comment

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

not my branch, but I'd suggest combining the U/D with the stickY, and L/R with stickX.

something like

if (ABS(gPlayer1Controller->stickY) > 60 || (gPlayer1Controller->buttonPressed & (D_CBUTTONS|U_CBUTTONS)) { 

...

if (gPlayer1Controller->stickY >= 60 || gPlayer1Controller->buttonPressed & D_CBUTTONS) {

as you're copying/pasting a lot of common code this way

Copy link
Author

@enigma9o7 enigma9o7 Sep 8, 2020

Choose a reason for hiding this comment

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

I'm not really a skilled c programmer and really wanted this to work, so just copy pasted to do it myself. Of course if there is a cleaner way to implement the same functionality that is great. Just hope it gets committed in any form! And I completely understand what you're suggesting to change. This was my first attempt at a PR so not sure how to update it but may look into that...

Copy link
Author

Choose a reason for hiding this comment

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

#435

I have updated and resubmitted this. Not sure how to do things completely right with github so going to cancel this one.

if (allowInput) {
#ifndef nosound
play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs);
#endif
currentMenu->select++;
if (currentMenu->select >= currentMenu->numOpts)
currentMenu->select = 0;
if (currentMenu->select < currentMenu->scroll)
currentMenu->scroll = currentMenu->select;
else if (currentMenu->select > currentMenu->scroll + 3)
currentMenu->scroll = currentMenu->select - 3;
}
} else if (gPlayer1Controller->buttonPressed & U_CBUTTONS) {
if (allowInput) {
#ifndef nosound
play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs);
#endif
currentMenu->select--;
if (currentMenu->select < 0)
currentMenu->select = currentMenu->numOpts-1;
if (currentMenu->select < currentMenu->scroll)
currentMenu->scroll = currentMenu->select;
else if (currentMenu->select > currentMenu->scroll + 3)
currentMenu->scroll = currentMenu->select - 3;
}
} else if (gPlayer1Controller->buttonPressed & R_CBUTTONS) {
if (allowInput) {
#ifndef nosound
play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs);
#endif
optmenu_opt_change(&currentMenu->opts[currentMenu->select], 1);
}
} else if (gPlayer1Controller->buttonPressed & L_CBUTTONS) {
if (allowInput) {
#ifndef nosound
play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs);
#endif
optmenu_opt_change(&currentMenu->opts[currentMenu->select], -1);
}
} else if (gPlayer1Controller->buttonPressed & B_BUTTON) {
if (allowInput) {
if (currentMenu->prev) {
Expand Down