summaryrefslogtreecommitdiff
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
parentb44a10a43a1fa4a558b4c593d0a610571ecb3a50 (diff)
Refactorize check button pressed (#340)
-rw-r--r--engine/battle/core.asm6
-rw-r--r--engine/events/cinnabar_lab.asm2
-rw-r--r--engine/events/hidden_objects/bills_house_pc.asm2
-rw-r--r--engine/events/hidden_objects/school_blackboard.asm8
-rw-r--r--engine/events/prize_menu.asm2
-rw-r--r--engine/events/vending_machine.asm2
-rw-r--r--engine/link/cable_club.asm22
-rw-r--r--engine/menus/main_menu.asm14
-rw-r--r--engine/menus/pc.asm2
-rw-r--r--engine/menus/pokedex.asm12
-rw-r--r--engine/menus/save.asm2
-rw-r--r--engine/menus/start_sub_menus.asm4
-rw-r--r--engine/menus/text_box.asm10
-rw-r--r--engine/pokemon/bills_pc.asm6
-rw-r--r--engine/pokemon/learn_move.asm2
-rw-r--r--home/hidden_objects.asm2
-rw-r--r--home/list_menu.asm16
-rw-r--r--home/overworld.asm12
-rw-r--r--home/pokemon.asm2
-rw-r--r--home/print_text.asm4
-rw-r--r--home/start_menu.asm6
-rw-r--r--home/text_script.asm2
-rw-r--r--home/window.asm2
23 files changed, 71 insertions, 71 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 57303776..6c0585b6 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -2087,7 +2087,7 @@ DisplayBattleMenu::
ld [hli], a ; wMaxMenuItem
ld [hl], D_RIGHT | A_BUTTON ; wMenuWatchedKeys
call HandleMenuInput
- bit 4, a ; check if right was pressed
+ bit BIT_D_RIGHT, a
jr nz, .rightColumn
jr .AButtonPressed ; the A button was pressed
.rightColumn ; put cursor in right column of menu
@@ -2350,7 +2350,7 @@ PartyMenuOrRockOrRun:
xor a
ld [hl], a ; wLastMenuItem
call HandleMenuInput
- bit 1, a ; was A pressed?
+ bit BIT_B_BUTTON, a
jr nz, .partyMonDeselected ; if B was pressed, jump
; A was pressed
call PlaceUnfilledArrowMenuCursor
@@ -6745,7 +6745,7 @@ DetermineWildOpponent:
bit 1, a
jr z, .asm_3ef2f
ldh a, [hJoyHeld]
- bit 1, a ; B button pressed?
+ bit BIT_B_BUTTON, a
ret nz
.asm_3ef2f
ld a, [wNumberOfNoRandomBattleStepsLeft]
diff --git a/engine/events/cinnabar_lab.asm b/engine/events/cinnabar_lab.asm
index 7cbb2cd5..547f782e 100644
--- a/engine/events/cinnabar_lab.asm
+++ b/engine/events/cinnabar_lab.asm
@@ -27,7 +27,7 @@ GiveFossilToCinnabarLab::
ld hl, wd730
res 6, [hl]
call HandleMenuInput
- bit 1, a ; pressed B?
+ bit BIT_B_BUTTON, a
jr nz, .cancelledGivingFossil
ld hl, wFilteredBagItems
ld a, [wCurrentMenuItem]
diff --git a/engine/events/hidden_objects/bills_house_pc.asm b/engine/events/hidden_objects/bills_house_pc.asm
index a73596b4..6147387a 100644
--- a/engine/events/hidden_objects/bills_house_pc.asm
+++ b/engine/events/hidden_objects/bills_house_pc.asm
@@ -95,7 +95,7 @@ BillsHousePokemonList::
call PrintText
call SaveScreenTilesToBuffer2
call HandleMenuInput
- bit 1, a ; pressed b
+ bit BIT_B_BUTTON, a
jr nz, .cancel
ld a, [wCurrentMenuItem]
add EEVEE
diff --git a/engine/events/hidden_objects/school_blackboard.asm b/engine/events/hidden_objects/school_blackboard.asm
index de4700d4..fd3c0b8f 100644
--- a/engine/events/hidden_objects/school_blackboard.asm
+++ b/engine/events/hidden_objects/school_blackboard.asm
@@ -36,7 +36,7 @@ LinkCableHelp::
ld hl, LinkCableHelpText2
call PrintText
call HandleMenuInput
- bit 1, a ; pressed b
+ bit BIT_B_BUTTON, a
jr nz, .exit
ld a, [wCurrentMenuItem]
cp 3 ; pressed a on "STOP READING"
@@ -122,9 +122,9 @@ ViridianSchoolBlackboard::
ld hl, ViridianSchoolBlackboardText2
call PrintText
call HandleMenuInput ; pressing up and down is handled in here
- bit 1, a ; pressed b
+ bit BIT_B_BUTTON, a ; pressed b
jr nz, .exitBlackboard
- bit 4, a ; pressed right
+ bit BIT_D_RIGHT, a
jr z, .didNotPressRight
; move cursor to right column
ld a, 2
@@ -137,7 +137,7 @@ ViridianSchoolBlackboard::
ld [wMenuItemOffset], a
jr .blackboardLoop
.didNotPressRight
- bit 5, a ; pressed left
+ bit BIT_D_LEFT, a
jr z, .didNotPressLeftOrRight
; move cursor to left column
ld a, 2
diff --git a/engine/events/prize_menu.asm b/engine/events/prize_menu.asm
index d9320fe7..bc3aab9a 100644
--- a/engine/events/prize_menu.asm
+++ b/engine/events/prize_menu.asm
@@ -31,7 +31,7 @@ CeladonPrizeMenu::
ld hl, WhichPrizeTextPtr
call PrintText
call HandleMenuInput ; menu choice handler
- bit 1, a ; keypress = B (Cancel)
+ bit BIT_B_BUTTON, a
jr nz, .noChoice
ld a, [wCurrentMenuItem]
cp 3 ; "NO,THANKS" choice
diff --git a/engine/events/vending_machine.asm b/engine/events/vending_machine.asm
index a67f1c07..980a45c5 100644
--- a/engine/events/vending_machine.asm
+++ b/engine/events/vending_machine.asm
@@ -31,7 +31,7 @@ VendingMachineMenu::
ld hl, wd730
res 6, [hl]
call HandleMenuInput
- bit 1, a ; pressed B?
+ bit BIT_B_BUTTON, a
jr nz, .notThirsty
ld a, [wCurrentMenuItem]
cp 3 ; chose Cancel?
diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm
index f3bf3b5d..cabc19ab 100644
--- a/engine/link/cable_club.asm
+++ b/engine/link/cable_club.asm
@@ -345,7 +345,7 @@ TradeCenter_SelectMon:
res 1, [hl]
and a
jp z, .getNewInput
- bit 0, a ; A button pressed?
+ bit BIT_A_BUTTON, a
jr z, .enemyMonMenu_ANotPressed
; if A button pressed
ld a, [wMaxMenuItem]
@@ -364,7 +364,7 @@ TradeCenter_SelectMon:
call TradeCenter_DisplayStats
jp .getNewInput
.enemyMonMenu_ANotPressed
- bit 5, a ; Left pressed?
+ bit BIT_D_LEFT, a
jr z, .enemyMonMenu_LeftNotPressed
; if Left pressed, switch back to the player mon menu
xor a ; player mon menu
@@ -384,7 +384,7 @@ TradeCenter_SelectMon:
ld [wCurrentMenuItem], a
jr .playerMonMenu
.enemyMonMenu_LeftNotPressed
- bit 7, a ; Down pressed?
+ bit BIT_D_DOWN, a
jp z, .getNewInput
jp .selectedCancelMenuItem ; jump if Down pressed
.playerMonMenu
@@ -412,7 +412,7 @@ TradeCenter_SelectMon:
jr nz, .playerMonMenu_SomethingPressed
jp .getNewInput
.playerMonMenu_SomethingPressed
- bit 0, a ; A button pressed?
+ bit BIT_A_BUTTON, a
jr z, .playerMonMenu_ANotPressed
jp .chosePlayerMon ; jump if A button pressed
; unreachable code
@@ -422,7 +422,7 @@ TradeCenter_SelectMon:
call TradeCenter_DisplayStats
jp .getNewInput
.playerMonMenu_ANotPressed
- bit 4, a ; Right pressed?
+ bit BIT_D_RIGHT, a
jr z, .playerMonMenu_RightNotPressed
; if Right pressed, switch to the enemy mon menu
ld a, $1 ; enemy mon menu
@@ -444,7 +444,7 @@ TradeCenter_SelectMon:
.notPastLastEnemyMon
jp .enemyMonMenu
.playerMonMenu_RightNotPressed
- bit 7, a ; Down pressed?
+ bit BIT_D_DOWN, a
jr z, .getNewInput
jp .selectedCancelMenuItem ; jump if Down pressed
.getNewInput
@@ -488,7 +488,7 @@ TradeCenter_SelectMon:
call HandleMenuInput
bit 4, a ; Right pressed?
jr nz, .selectTradeMenuItem
- bit 1, a ; B button pressed?
+ bit BIT_B_BUTTON, a
jr z, .displayPlayerMonStats
.cancelPlayerMonChoice
pop af
@@ -503,9 +503,9 @@ TradeCenter_SelectMon:
ld a, 11
ld [wTopMenuItemX], a
call HandleMenuInput
- bit 5, a ; Left pressed?
+ bit BIT_D_LEFT, a
jr nz, .selectStatsMenuItem
- bit 1, a ; B button pressed?
+ bit BIT_B_BUTTON, a
jr nz, .cancelPlayerMonChoice
jr .choseTrade
.displayPlayerMonStats
@@ -554,9 +554,9 @@ TradeCenter_SelectMon:
ldh a, [hJoy5]
and a ; pressed anything?
jr z, .cancelMenuItem_JoypadLoop
- bit 0, a ; A button pressed?
+ bit BIT_A_BUTTON, a
jr nz, .cancelMenuItem_APressed
- bit 6, a ; Up pressed?
+ bit BIT_D_UP, a
jr z, .cancelMenuItem_JoypadLoop
; if Up pressed
ld a, " "
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
diff --git a/engine/menus/pc.asm b/engine/menus/pc.asm
index 4c340e7b..6a15eaa5 100644
--- a/engine/menus/pc.asm
+++ b/engine/menus/pc.asm
@@ -14,7 +14,7 @@ PCMainMenu:
ld hl, wFlags_0xcd60
set 5, [hl]
call HandleMenuInput
- bit 1, a ;if player pressed B
+ bit BIT_B_BUTTON, a
jp nz, LogOff
ld a, [wMaxMenuItem]
cp 2
diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm
index 2af8d714..3411f729 100644
--- a/engine/menus/pokedex.asm
+++ b/engine/menus/pokedex.asm
@@ -95,7 +95,7 @@ HandlePokedexSideMenu:
ld [wMenuWatchMovingOutOfBounds], a
.handleMenuInput
call HandleMenuInput
- bit 1, a ; was the B button pressed?
+ bit BIT_B_BUTTON, a
ld b, 2
jr nz, .buttonBPressed
ld a, [wCurrentMenuItem]
@@ -284,10 +284,10 @@ HandlePokedexListMenu:
call Delay3
call GBPalNormal
call HandleMenuInput
- bit 1, a ; was the B button pressed?
+ bit BIT_B_BUTTON, a
jp nz, .buttonBPressed
.checkIfUpPressed
- bit 6, a ; was Up pressed?
+ bit BIT_D_UP, a
jr z, .checkIfDownPressed
.upPressed ; scroll up one row
ld a, [wListScrollOffset]
@@ -297,7 +297,7 @@ HandlePokedexListMenu:
ld [wListScrollOffset], a
jp .loop
.checkIfDownPressed
- bit 7, a ; was Down pressed?
+ bit BIT_D_DOWN, a
jr z, .checkIfRightPressed
.downPressed ; scroll down one row
ld a, [wDexMaxSeenMon]
@@ -312,7 +312,7 @@ HandlePokedexListMenu:
ld [wListScrollOffset], a
jp .loop
.checkIfRightPressed
- bit 4, a ; was Right pressed?
+ bit BIT_D_RIGHT, a
jr z, .checkIfLeftPressed
.rightPressed ; scroll down 7 rows
ld a, [wDexMaxSeenMon]
@@ -330,7 +330,7 @@ HandlePokedexListMenu:
ld [wListScrollOffset], a
jp .loop
.checkIfLeftPressed ; scroll up 7 rows
- bit 5, a ; was Left pressed?
+ bit BIT_D_LEFT, a
jr z, .buttonAPressed
.leftPressed
ld a, [wListScrollOffset]
diff --git a/engine/menus/save.asm b/engine/menus/save.asm
index 07eb5acb..83a5ca9b 100644
--- a/engine/menus/save.asm
+++ b/engine/menus/save.asm
@@ -356,7 +356,7 @@ ChangeBox::
call HandleMenuInput
ld hl, hUILayoutFlags
res 1, [hl]
- bit 1, a ; pressed b
+ bit BIT_B_BUTTON, a
ret nz
call GetBoxSRAMLocation
ld e, l
diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm
index cd1e6da6..dbc6ab89 100644
--- a/engine/menus/start_sub_menus.asm
+++ b/engine/menus/start_sub_menus.asm
@@ -65,7 +65,7 @@ StartMenu_Pokemon::
push af
call LoadScreenTilesFromBuffer1 ; restore saved screen
pop af
- bit 1, a ; was the B button pressed?
+ bit BIT_B_BUTTON, a
jp nz, .loop
; if the B button wasn't pressed
ld a, [wMaxMenuItem]
@@ -360,7 +360,7 @@ StartMenu_Item::
ld [hl], a ; old menu item id
call HandleMenuInput
call PlaceUnfilledArrowMenuCursor
- bit 1, a ; was the B button pressed?
+ bit BIT_B_BUTTON, a
jr z, .useOrTossItem
jp ItemMenuLoop
.useOrTossItem ; if the player made the choice to use or toss the item
diff --git a/engine/menus/text_box.asm b/engine/menus/text_box.asm
index 5253ec48..cdb8841d 100644
--- a/engine/menus/text_box.asm
+++ b/engine/menus/text_box.asm
@@ -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]
diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm
index 7aba8001..8684b761 100644
--- a/engine/pokemon/bills_pc.asm
+++ b/engine/pokemon/bills_pc.asm
@@ -171,8 +171,8 @@ BillsPCMenu:
ldh [hAutoBGTransferEnabled], a
call Delay3
call HandleMenuInput
- bit 1, a
- jp nz, ExitBillsPC ; b button
+ bit BIT_B_BUTTON, a
+ jp nz, ExitBillsPC
call PlaceUnfilledArrowMenuCursor
ld a, [wCurrentMenuItem]
ld [wParentMenuItem], a
@@ -416,7 +416,7 @@ DisplayDepositWithdrawMenu:
ld [wPartyAndBillsPCSavedMenuItem], a
.loop
call HandleMenuInput
- bit 1, a ; pressed B?
+ bit BIT_B_BUTTON, a
jr nz, .exit
ld a, [wCurrentMenuItem]
and a
diff --git a/engine/pokemon/learn_move.asm b/engine/pokemon/learn_move.asm
index fd92ec57..0377caa4 100644
--- a/engine/pokemon/learn_move.asm
+++ b/engine/pokemon/learn_move.asm
@@ -155,7 +155,7 @@ TryingToLearn:
call LoadScreenTilesFromBuffer1
pop af
pop hl
- bit 1, a ; pressed b
+ bit BIT_B_BUTTON, a
jr nz, .cancel
push hl
ld a, [wCurrentMenuItem]
diff --git a/home/hidden_objects.asm b/home/hidden_objects.asm
index eccf1c8f..6e7d980a 100644
--- a/home/hidden_objects.asm
+++ b/home/hidden_objects.asm
@@ -5,7 +5,7 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor::
ldh a, [hLoadedROMBank]
push af
ldh a, [hJoyHeld]
- bit 0, a ; A button
+ bit BIT_A_BUTTON, a
jr z, .nothingFound
; A button is pressed
ld a, BANK(CheckForHiddenObject)
diff --git a/home/list_menu.asm b/home/list_menu.asm
index d6bf43b2..77e75012 100644
--- a/home/list_menu.asm
+++ b/home/list_menu.asm
@@ -84,7 +84,7 @@ DisplayListMenuIDLoop::
push af
call PlaceMenuCursor
pop af
- bit 0, a ; was the A button pressed?
+ bit BIT_A_BUTTON, a
jp z, .checkOtherKeys
.buttonAPressed
ld a, [wCurrentMenuItem]
@@ -168,12 +168,12 @@ DisplayListMenuIDLoop::
res 6, [hl] ; turn on letter printing delay
jp BankswitchBack
.checkOtherKeys ; check B, SELECT, Up, and Down keys
- bit 1, a ; was the B button pressed?
+ bit BIT_B_BUTTON, a
jp nz, ExitListMenu ; if so, exit the menu
- bit 2, a ; was the select button pressed?
+ bit BIT_SELECT, a
jp nz, HandleItemListSwapping ; if so, allow the player to swap menu entries
ld b, a
- bit 7, b ; was Down pressed?
+ bit BIT_D_DOWN, b
ld hl, wListScrollOffset
jr z, .upPressed
.downPressed
@@ -220,13 +220,13 @@ DisplayChooseQuantityMenu::
.waitForKeyPressLoop
call JoypadLowSensitivity
ldh a, [hJoyPressed] ; newly pressed buttons
- bit 0, a ; was the A button pressed?
+ bit BIT_A_BUTTON, a
jp nz, .buttonAPressed
- bit 1, a ; was the B button pressed?
+ bit BIT_B_BUTTON, a
jp nz, .buttonBPressed
- bit 6, a ; was Up pressed?
+ bit BIT_D_UP, a
jr nz, .incrementQuantity
- bit 7, a ; was Down pressed?
+ bit BIT_D_DOWN, a
jr nz, .decrementQuantity
jr .waitForKeyPressLoop
.incrementQuantity
diff --git a/home/overworld.asm b/home/overworld.asm
index eb6f2ddb..74c97cb7 100644
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -72,14 +72,14 @@ OverworldLoopLessDelay::
.notSimulating
ldh a, [hJoyPressed]
.checkIfStartIsPressed
- bit 3, a ; start button
+ bit BIT_START, a
jr z, .startButtonNotPressed
; if START is pressed
xor a ; TEXT_START_MENU
ldh [hSpriteIndexOrTextID], a
jp .displayDialogue
.startButtonNotPressed
- bit 0, a ; A button
+ bit BIT_A_BUTTON, a
jp z, .checkIfDownButtonIsPressed
; if A is pressed
ld a, [wd730]
@@ -146,7 +146,7 @@ OverworldLoopLessDelay::
.checkIfDownButtonIsPressed
ldh a, [hJoyHeld] ; current joypad state
- bit 7, a ; down button
+ bit BIT_D_DOWN, a
jr z, .checkIfUpButtonIsPressed
ld a, 1
ld [wSpritePlayerStateData1YStepVector], a
@@ -154,7 +154,7 @@ OverworldLoopLessDelay::
jr .handleDirectionButtonPress
.checkIfUpButtonIsPressed
- bit 6, a ; up button
+ bit BIT_D_UP, a
jr z, .checkIfLeftButtonIsPressed
ld a, -1
ld [wSpritePlayerStateData1YStepVector], a
@@ -162,7 +162,7 @@ OverworldLoopLessDelay::
jr .handleDirectionButtonPress
.checkIfLeftButtonIsPressed
- bit 5, a ; left button
+ bit BIT_D_LEFT, a
jr z, .checkIfRightButtonIsPressed
ld a, -1
ld [wSpritePlayerStateData1XStepVector], a
@@ -170,7 +170,7 @@ OverworldLoopLessDelay::
jr .handleDirectionButtonPress
.checkIfRightButtonIsPressed
- bit 4, a ; right button
+ bit BIT_D_RIGHT, a
jr z, .noDirectionButtonsPressed
ld a, 1
ld [wSpritePlayerStateData1XStepVector], a
diff --git a/home/pokemon.asm b/home/pokemon.asm
index 4e6e080b..3e63de35 100644
--- a/home/pokemon.asm
+++ b/home/pokemon.asm
@@ -274,7 +274,7 @@ HandlePartyMenuInput::
scf
ret
.swappingPokemon
- bit 1, b ; was the B button pressed?
+ bit BIT_B_BUTTON, b
jr z, .handleSwap ; if not, handle swapping the pokemon
.cancelSwap ; if the B button was pressed
farcall ErasePartyMenuCursors
diff --git a/home/print_text.asm b/home/print_text.asm
index 049ddfb4..962ae519 100644
--- a/home/print_text.asm
+++ b/home/print_text.asm
@@ -25,11 +25,11 @@ PrintLetterDelay::
call Joypad
ldh a, [hJoyHeld]
.checkAButton
- bit 0, a ; is the A button pressed?
+ bit BIT_A_BUTTON, a
jr z, .checkBButton
jr .endWait
.checkBButton
- bit 1, a ; is the B button pressed?
+ bit BIT_B_BUTTON, a
jr z, .buttonsNotPressed
.endWait
call DelayFrame
diff --git a/home/start_menu.asm b/home/start_menu.asm
index 5b29f67a..ed3d9470 100644
--- a/home/start_menu.asm
+++ b/home/start_menu.asm
@@ -15,7 +15,7 @@ RedisplayStartMenu::
call HandleMenuInput
ld b, a
.checkIfUpPressed
- bit 6, a ; was Up pressed?
+ bit BIT_D_UP, a
jr z, .checkIfDownPressed
ld a, [wCurrentMenuItem] ; menu selection
and a
@@ -54,7 +54,7 @@ RedisplayStartMenu::
ld a, [wCurrentMenuItem]
ld [wBattleAndStartSavedMenuItem], a ; save current menu selection
ld a, b
- and %00001010 ; was the Start button or B button pressed?
+ and B_BUTTON | START ; was the Start button or B button pressed?
jp nz, CloseStartMenu
call SaveScreenTilesToBuffer2 ; copy background from wTileMap to wTileMapBackup2
CheckEvent EVENT_GOT_POKEDEX
@@ -79,7 +79,7 @@ RedisplayStartMenu::
CloseStartMenu::
call Joypad
ldh a, [hJoyPressed]
- bit 0, a ; was A button newly pressed?
+ bit BIT_A_BUTTON, a
jr nz, CloseStartMenu
call LoadTextBoxTilePatterns
jp CloseTextDisplay
diff --git a/home/text_script.asm b/home/text_script.asm
index a6881dc5..39bc3f5b 100644
--- a/home/text_script.asm
+++ b/home/text_script.asm
@@ -98,7 +98,7 @@ AfterDisplayingTextID::
HoldTextDisplayOpen::
call Joypad
ldh a, [hJoyHeld]
- bit 0, a ; is the A button being pressed?
+ bit BIT_A_BUTTON, a
jr nz, HoldTextDisplayOpen
CloseTextDisplay::
diff --git a/home/window.asm b/home/window.asm
index 0182bdd3..45b207a8 100644
--- a/home/window.asm
+++ b/home/window.asm
@@ -50,7 +50,7 @@ HandleMenuInput_::
ld [wCheckFor180DegreeTurn], a
ldh a, [hJoy5]
ld b, a
- bit 6, a ; pressed Up key?
+ bit BIT_D_UP, a
jr z, .checkIfDownPressed
.upPressed
ld a, [wCurrentMenuItem] ; selected menu item