summaryrefslogtreecommitdiff
path: root/engine/menus/main_menu.asm
diff options
context:
space:
mode:
authorYoann Fievez <yoann.fievez@gmail.com>2021-11-05 20:40:15 +0100
committerGitHub <noreply@github.com>2021-11-05 15:40:15 -0400
commit8349bfd8e646002105dfd6a7f997c26cf0e0624b (patch)
tree8586363ba32075ec9c7ddf07e384507679658b11 /engine/menus/main_menu.asm
parentb44a10a43a1fa4a558b4c593d0a610571ecb3a50 (diff)
Refactorize check button pressed (#340)
Diffstat (limited to 'engine/menus/main_menu.asm')
-rw-r--r--engine/menus/main_menu.asm14
1 files changed, 7 insertions, 7 deletions
diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm
index 95404cce..c3366b8e 100644
--- a/engine/menus/main_menu.asm
+++ b/engine/menus/main_menu.asm
@@ -66,7 +66,7 @@ MainMenu:
ld a, [wSaveFileStatus]
ld [wMaxMenuItem], a
call HandleMenuInput
- bit 1, a ; pressed B?
+ bit BIT_B_BUTTON, a
jp nz, DisplayTitleScreen ; if so, go back to the title screen
ld c, 20
call DelayFrames
@@ -477,11 +477,11 @@ DisplayOptionMenu:
ld b, a
and A_BUTTON | B_BUTTON | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ; any key besides select pressed?
jr z, .getJoypadStateLoop
- bit 1, b ; B button pressed?
+ bit BIT_B_BUTTON, b
jr nz, .exitMenu
- bit 3, b ; Start button pressed?
+ bit BIT_START, b
jr nz, .exitMenu
- bit 0, b ; A button pressed?
+ bit BIT_A_BUTTON, b
jr z, .checkDirectionKeys
ld a, [wTopMenuItemY]
cp 16 ; is the cursor on Cancel?
@@ -496,9 +496,9 @@ DisplayOptionMenu:
jp .loop
.checkDirectionKeys
ld a, [wTopMenuItemY]
- bit 7, b ; Down pressed?
+ bit BIT_D_DOWN, b
jr nz, .downPressed
- bit 6, b ; Up pressed?
+ bit BIT_D_UP, b
jr nz, .upPressed
cp 8 ; cursor in Battle Animation section?
jr z, .cursorInBattleAnimation
@@ -507,7 +507,7 @@ DisplayOptionMenu:
cp 16 ; cursor on Cancel?
jr z, .loop
.cursorInTextSpeed
- bit 5, b ; Left pressed?
+ bit BIT_D_LEFT, b
jp nz, .pressedLeftInTextSpeed
jp .pressedRightInTextSpeed
.downPressed