Refactorize check button pressed (#340)

This commit is contained in:
Yoann Fievez 2021-11-05 20:40:15 +01:00 committed by GitHub
parent b44a10a43a
commit 8349bfd8e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 71 additions and 71 deletions

View file

@ -174,9 +174,9 @@ DoBuySellQuitMenu:
ld [wd730], a
call HandleMenuInput
call PlaceUnfilledArrowMenuCursor
bit 0, a ; was A pressed?
bit BIT_A_BUTTON, a
jr nz, .pressedA
bit 1, a ; was B pressed? (always true since only A/B are watched)
bit BIT_B_BUTTON, a ; always true since only A/B are watched
jr z, .pressedA
ld a, CANCELLED_MENU
ld [wMenuExitMethod], a
@ -296,8 +296,8 @@ DisplayTwoOptionMenu:
pop hl
.noYesMenuInputLoop
call HandleMenuInput
bit 1, a ; A button pressed?
jr nz, .noYesMenuInputLoop ; try again if A was not pressed
bit BIT_B_BUTTON, a
jr nz, .noYesMenuInputLoop ; try again if B was not pressed
pop af
pop hl
ld [wFlags_0xcd60], a
@ -309,7 +309,7 @@ DisplayTwoOptionMenu:
ld [wTwoOptionMenuID], a
call HandleMenuInput
pop hl
bit 1, a ; A button pressed?
bit BIT_B_BUTTON, a
jr nz, .choseSecondMenuItem ; automatically choose the second option if B is pressed
.pressedAButton
ld a, [wCurrentMenuItem]