mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-06 15:45:24 +13:00
Refactorize check button pressed (#340)
This commit is contained in:
parent
b44a10a43a
commit
8349bfd8e6
23 changed files with 71 additions and 71 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue