mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-17 02:40:50 +12:00
Refactorize check button pressed (#340)
This commit is contained in:
parent
b44a10a43a
commit
8349bfd8e6
|
@ -2087,7 +2087,7 @@ DisplayBattleMenu::
|
||||||
ld [hli], a ; wMaxMenuItem
|
ld [hli], a ; wMaxMenuItem
|
||||||
ld [hl], D_RIGHT | A_BUTTON ; wMenuWatchedKeys
|
ld [hl], D_RIGHT | A_BUTTON ; wMenuWatchedKeys
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
bit 4, a ; check if right was pressed
|
bit BIT_D_RIGHT, a
|
||||||
jr nz, .rightColumn
|
jr nz, .rightColumn
|
||||||
jr .AButtonPressed ; the A button was pressed
|
jr .AButtonPressed ; the A button was pressed
|
||||||
.rightColumn ; put cursor in right column of menu
|
.rightColumn ; put cursor in right column of menu
|
||||||
|
@ -2350,7 +2350,7 @@ PartyMenuOrRockOrRun:
|
||||||
xor a
|
xor a
|
||||||
ld [hl], a ; wLastMenuItem
|
ld [hl], a ; wLastMenuItem
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
bit 1, a ; was A pressed?
|
bit BIT_B_BUTTON, a
|
||||||
jr nz, .partyMonDeselected ; if B was pressed, jump
|
jr nz, .partyMonDeselected ; if B was pressed, jump
|
||||||
; A was pressed
|
; A was pressed
|
||||||
call PlaceUnfilledArrowMenuCursor
|
call PlaceUnfilledArrowMenuCursor
|
||||||
|
@ -6745,7 +6745,7 @@ DetermineWildOpponent:
|
||||||
bit 1, a
|
bit 1, a
|
||||||
jr z, .asm_3ef2f
|
jr z, .asm_3ef2f
|
||||||
ldh a, [hJoyHeld]
|
ldh a, [hJoyHeld]
|
||||||
bit 1, a ; B button pressed?
|
bit BIT_B_BUTTON, a
|
||||||
ret nz
|
ret nz
|
||||||
.asm_3ef2f
|
.asm_3ef2f
|
||||||
ld a, [wNumberOfNoRandomBattleStepsLeft]
|
ld a, [wNumberOfNoRandomBattleStepsLeft]
|
||||||
|
|
|
@ -27,7 +27,7 @@ GiveFossilToCinnabarLab::
|
||||||
ld hl, wd730
|
ld hl, wd730
|
||||||
res 6, [hl]
|
res 6, [hl]
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
bit 1, a ; pressed B?
|
bit BIT_B_BUTTON, a
|
||||||
jr nz, .cancelledGivingFossil
|
jr nz, .cancelledGivingFossil
|
||||||
ld hl, wFilteredBagItems
|
ld hl, wFilteredBagItems
|
||||||
ld a, [wCurrentMenuItem]
|
ld a, [wCurrentMenuItem]
|
||||||
|
|
|
@ -95,7 +95,7 @@ BillsHousePokemonList::
|
||||||
call PrintText
|
call PrintText
|
||||||
call SaveScreenTilesToBuffer2
|
call SaveScreenTilesToBuffer2
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
bit 1, a ; pressed b
|
bit BIT_B_BUTTON, a
|
||||||
jr nz, .cancel
|
jr nz, .cancel
|
||||||
ld a, [wCurrentMenuItem]
|
ld a, [wCurrentMenuItem]
|
||||||
add EEVEE
|
add EEVEE
|
||||||
|
|
|
@ -36,7 +36,7 @@ LinkCableHelp::
|
||||||
ld hl, LinkCableHelpText2
|
ld hl, LinkCableHelpText2
|
||||||
call PrintText
|
call PrintText
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
bit 1, a ; pressed b
|
bit BIT_B_BUTTON, a
|
||||||
jr nz, .exit
|
jr nz, .exit
|
||||||
ld a, [wCurrentMenuItem]
|
ld a, [wCurrentMenuItem]
|
||||||
cp 3 ; pressed a on "STOP READING"
|
cp 3 ; pressed a on "STOP READING"
|
||||||
|
@ -122,9 +122,9 @@ ViridianSchoolBlackboard::
|
||||||
ld hl, ViridianSchoolBlackboardText2
|
ld hl, ViridianSchoolBlackboardText2
|
||||||
call PrintText
|
call PrintText
|
||||||
call HandleMenuInput ; pressing up and down is handled in here
|
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
|
jr nz, .exitBlackboard
|
||||||
bit 4, a ; pressed right
|
bit BIT_D_RIGHT, a
|
||||||
jr z, .didNotPressRight
|
jr z, .didNotPressRight
|
||||||
; move cursor to right column
|
; move cursor to right column
|
||||||
ld a, 2
|
ld a, 2
|
||||||
|
@ -137,7 +137,7 @@ ViridianSchoolBlackboard::
|
||||||
ld [wMenuItemOffset], a
|
ld [wMenuItemOffset], a
|
||||||
jr .blackboardLoop
|
jr .blackboardLoop
|
||||||
.didNotPressRight
|
.didNotPressRight
|
||||||
bit 5, a ; pressed left
|
bit BIT_D_LEFT, a
|
||||||
jr z, .didNotPressLeftOrRight
|
jr z, .didNotPressLeftOrRight
|
||||||
; move cursor to left column
|
; move cursor to left column
|
||||||
ld a, 2
|
ld a, 2
|
||||||
|
|
|
@ -31,7 +31,7 @@ CeladonPrizeMenu::
|
||||||
ld hl, WhichPrizeTextPtr
|
ld hl, WhichPrizeTextPtr
|
||||||
call PrintText
|
call PrintText
|
||||||
call HandleMenuInput ; menu choice handler
|
call HandleMenuInput ; menu choice handler
|
||||||
bit 1, a ; keypress = B (Cancel)
|
bit BIT_B_BUTTON, a
|
||||||
jr nz, .noChoice
|
jr nz, .noChoice
|
||||||
ld a, [wCurrentMenuItem]
|
ld a, [wCurrentMenuItem]
|
||||||
cp 3 ; "NO,THANKS" choice
|
cp 3 ; "NO,THANKS" choice
|
||||||
|
|
|
@ -31,7 +31,7 @@ VendingMachineMenu::
|
||||||
ld hl, wd730
|
ld hl, wd730
|
||||||
res 6, [hl]
|
res 6, [hl]
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
bit 1, a ; pressed B?
|
bit BIT_B_BUTTON, a
|
||||||
jr nz, .notThirsty
|
jr nz, .notThirsty
|
||||||
ld a, [wCurrentMenuItem]
|
ld a, [wCurrentMenuItem]
|
||||||
cp 3 ; chose Cancel?
|
cp 3 ; chose Cancel?
|
||||||
|
|
|
@ -345,7 +345,7 @@ TradeCenter_SelectMon:
|
||||||
res 1, [hl]
|
res 1, [hl]
|
||||||
and a
|
and a
|
||||||
jp z, .getNewInput
|
jp z, .getNewInput
|
||||||
bit 0, a ; A button pressed?
|
bit BIT_A_BUTTON, a
|
||||||
jr z, .enemyMonMenu_ANotPressed
|
jr z, .enemyMonMenu_ANotPressed
|
||||||
; if A button pressed
|
; if A button pressed
|
||||||
ld a, [wMaxMenuItem]
|
ld a, [wMaxMenuItem]
|
||||||
|
@ -364,7 +364,7 @@ TradeCenter_SelectMon:
|
||||||
call TradeCenter_DisplayStats
|
call TradeCenter_DisplayStats
|
||||||
jp .getNewInput
|
jp .getNewInput
|
||||||
.enemyMonMenu_ANotPressed
|
.enemyMonMenu_ANotPressed
|
||||||
bit 5, a ; Left pressed?
|
bit BIT_D_LEFT, a
|
||||||
jr z, .enemyMonMenu_LeftNotPressed
|
jr z, .enemyMonMenu_LeftNotPressed
|
||||||
; if Left pressed, switch back to the player mon menu
|
; if Left pressed, switch back to the player mon menu
|
||||||
xor a ; player mon menu
|
xor a ; player mon menu
|
||||||
|
@ -384,7 +384,7 @@ TradeCenter_SelectMon:
|
||||||
ld [wCurrentMenuItem], a
|
ld [wCurrentMenuItem], a
|
||||||
jr .playerMonMenu
|
jr .playerMonMenu
|
||||||
.enemyMonMenu_LeftNotPressed
|
.enemyMonMenu_LeftNotPressed
|
||||||
bit 7, a ; Down pressed?
|
bit BIT_D_DOWN, a
|
||||||
jp z, .getNewInput
|
jp z, .getNewInput
|
||||||
jp .selectedCancelMenuItem ; jump if Down pressed
|
jp .selectedCancelMenuItem ; jump if Down pressed
|
||||||
.playerMonMenu
|
.playerMonMenu
|
||||||
|
@ -412,7 +412,7 @@ TradeCenter_SelectMon:
|
||||||
jr nz, .playerMonMenu_SomethingPressed
|
jr nz, .playerMonMenu_SomethingPressed
|
||||||
jp .getNewInput
|
jp .getNewInput
|
||||||
.playerMonMenu_SomethingPressed
|
.playerMonMenu_SomethingPressed
|
||||||
bit 0, a ; A button pressed?
|
bit BIT_A_BUTTON, a
|
||||||
jr z, .playerMonMenu_ANotPressed
|
jr z, .playerMonMenu_ANotPressed
|
||||||
jp .chosePlayerMon ; jump if A button pressed
|
jp .chosePlayerMon ; jump if A button pressed
|
||||||
; unreachable code
|
; unreachable code
|
||||||
|
@ -422,7 +422,7 @@ TradeCenter_SelectMon:
|
||||||
call TradeCenter_DisplayStats
|
call TradeCenter_DisplayStats
|
||||||
jp .getNewInput
|
jp .getNewInput
|
||||||
.playerMonMenu_ANotPressed
|
.playerMonMenu_ANotPressed
|
||||||
bit 4, a ; Right pressed?
|
bit BIT_D_RIGHT, a
|
||||||
jr z, .playerMonMenu_RightNotPressed
|
jr z, .playerMonMenu_RightNotPressed
|
||||||
; if Right pressed, switch to the enemy mon menu
|
; if Right pressed, switch to the enemy mon menu
|
||||||
ld a, $1 ; enemy mon menu
|
ld a, $1 ; enemy mon menu
|
||||||
|
@ -444,7 +444,7 @@ TradeCenter_SelectMon:
|
||||||
.notPastLastEnemyMon
|
.notPastLastEnemyMon
|
||||||
jp .enemyMonMenu
|
jp .enemyMonMenu
|
||||||
.playerMonMenu_RightNotPressed
|
.playerMonMenu_RightNotPressed
|
||||||
bit 7, a ; Down pressed?
|
bit BIT_D_DOWN, a
|
||||||
jr z, .getNewInput
|
jr z, .getNewInput
|
||||||
jp .selectedCancelMenuItem ; jump if Down pressed
|
jp .selectedCancelMenuItem ; jump if Down pressed
|
||||||
.getNewInput
|
.getNewInput
|
||||||
|
@ -488,7 +488,7 @@ TradeCenter_SelectMon:
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
bit 4, a ; Right pressed?
|
bit 4, a ; Right pressed?
|
||||||
jr nz, .selectTradeMenuItem
|
jr nz, .selectTradeMenuItem
|
||||||
bit 1, a ; B button pressed?
|
bit BIT_B_BUTTON, a
|
||||||
jr z, .displayPlayerMonStats
|
jr z, .displayPlayerMonStats
|
||||||
.cancelPlayerMonChoice
|
.cancelPlayerMonChoice
|
||||||
pop af
|
pop af
|
||||||
|
@ -503,9 +503,9 @@ TradeCenter_SelectMon:
|
||||||
ld a, 11
|
ld a, 11
|
||||||
ld [wTopMenuItemX], a
|
ld [wTopMenuItemX], a
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
bit 5, a ; Left pressed?
|
bit BIT_D_LEFT, a
|
||||||
jr nz, .selectStatsMenuItem
|
jr nz, .selectStatsMenuItem
|
||||||
bit 1, a ; B button pressed?
|
bit BIT_B_BUTTON, a
|
||||||
jr nz, .cancelPlayerMonChoice
|
jr nz, .cancelPlayerMonChoice
|
||||||
jr .choseTrade
|
jr .choseTrade
|
||||||
.displayPlayerMonStats
|
.displayPlayerMonStats
|
||||||
|
@ -554,9 +554,9 @@ TradeCenter_SelectMon:
|
||||||
ldh a, [hJoy5]
|
ldh a, [hJoy5]
|
||||||
and a ; pressed anything?
|
and a ; pressed anything?
|
||||||
jr z, .cancelMenuItem_JoypadLoop
|
jr z, .cancelMenuItem_JoypadLoop
|
||||||
bit 0, a ; A button pressed?
|
bit BIT_A_BUTTON, a
|
||||||
jr nz, .cancelMenuItem_APressed
|
jr nz, .cancelMenuItem_APressed
|
||||||
bit 6, a ; Up pressed?
|
bit BIT_D_UP, a
|
||||||
jr z, .cancelMenuItem_JoypadLoop
|
jr z, .cancelMenuItem_JoypadLoop
|
||||||
; if Up pressed
|
; if Up pressed
|
||||||
ld a, " "
|
ld a, " "
|
||||||
|
|
|
@ -66,7 +66,7 @@ MainMenu:
|
||||||
ld a, [wSaveFileStatus]
|
ld a, [wSaveFileStatus]
|
||||||
ld [wMaxMenuItem], a
|
ld [wMaxMenuItem], a
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
bit 1, a ; pressed B?
|
bit BIT_B_BUTTON, a
|
||||||
jp nz, DisplayTitleScreen ; if so, go back to the title screen
|
jp nz, DisplayTitleScreen ; if so, go back to the title screen
|
||||||
ld c, 20
|
ld c, 20
|
||||||
call DelayFrames
|
call DelayFrames
|
||||||
|
@ -477,11 +477,11 @@ DisplayOptionMenu:
|
||||||
ld b, a
|
ld b, a
|
||||||
and A_BUTTON | B_BUTTON | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ; any key besides select pressed?
|
and A_BUTTON | B_BUTTON | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ; any key besides select pressed?
|
||||||
jr z, .getJoypadStateLoop
|
jr z, .getJoypadStateLoop
|
||||||
bit 1, b ; B button pressed?
|
bit BIT_B_BUTTON, b
|
||||||
jr nz, .exitMenu
|
jr nz, .exitMenu
|
||||||
bit 3, b ; Start button pressed?
|
bit BIT_START, b
|
||||||
jr nz, .exitMenu
|
jr nz, .exitMenu
|
||||||
bit 0, b ; A button pressed?
|
bit BIT_A_BUTTON, b
|
||||||
jr z, .checkDirectionKeys
|
jr z, .checkDirectionKeys
|
||||||
ld a, [wTopMenuItemY]
|
ld a, [wTopMenuItemY]
|
||||||
cp 16 ; is the cursor on Cancel?
|
cp 16 ; is the cursor on Cancel?
|
||||||
|
@ -496,9 +496,9 @@ DisplayOptionMenu:
|
||||||
jp .loop
|
jp .loop
|
||||||
.checkDirectionKeys
|
.checkDirectionKeys
|
||||||
ld a, [wTopMenuItemY]
|
ld a, [wTopMenuItemY]
|
||||||
bit 7, b ; Down pressed?
|
bit BIT_D_DOWN, b
|
||||||
jr nz, .downPressed
|
jr nz, .downPressed
|
||||||
bit 6, b ; Up pressed?
|
bit BIT_D_UP, b
|
||||||
jr nz, .upPressed
|
jr nz, .upPressed
|
||||||
cp 8 ; cursor in Battle Animation section?
|
cp 8 ; cursor in Battle Animation section?
|
||||||
jr z, .cursorInBattleAnimation
|
jr z, .cursorInBattleAnimation
|
||||||
|
@ -507,7 +507,7 @@ DisplayOptionMenu:
|
||||||
cp 16 ; cursor on Cancel?
|
cp 16 ; cursor on Cancel?
|
||||||
jr z, .loop
|
jr z, .loop
|
||||||
.cursorInTextSpeed
|
.cursorInTextSpeed
|
||||||
bit 5, b ; Left pressed?
|
bit BIT_D_LEFT, b
|
||||||
jp nz, .pressedLeftInTextSpeed
|
jp nz, .pressedLeftInTextSpeed
|
||||||
jp .pressedRightInTextSpeed
|
jp .pressedRightInTextSpeed
|
||||||
.downPressed
|
.downPressed
|
||||||
|
|
|
@ -14,7 +14,7 @@ PCMainMenu:
|
||||||
ld hl, wFlags_0xcd60
|
ld hl, wFlags_0xcd60
|
||||||
set 5, [hl]
|
set 5, [hl]
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
bit 1, a ;if player pressed B
|
bit BIT_B_BUTTON, a
|
||||||
jp nz, LogOff
|
jp nz, LogOff
|
||||||
ld a, [wMaxMenuItem]
|
ld a, [wMaxMenuItem]
|
||||||
cp 2
|
cp 2
|
||||||
|
|
|
@ -95,7 +95,7 @@ HandlePokedexSideMenu:
|
||||||
ld [wMenuWatchMovingOutOfBounds], a
|
ld [wMenuWatchMovingOutOfBounds], a
|
||||||
.handleMenuInput
|
.handleMenuInput
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
bit 1, a ; was the B button pressed?
|
bit BIT_B_BUTTON, a
|
||||||
ld b, 2
|
ld b, 2
|
||||||
jr nz, .buttonBPressed
|
jr nz, .buttonBPressed
|
||||||
ld a, [wCurrentMenuItem]
|
ld a, [wCurrentMenuItem]
|
||||||
|
@ -284,10 +284,10 @@ HandlePokedexListMenu:
|
||||||
call Delay3
|
call Delay3
|
||||||
call GBPalNormal
|
call GBPalNormal
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
bit 1, a ; was the B button pressed?
|
bit BIT_B_BUTTON, a
|
||||||
jp nz, .buttonBPressed
|
jp nz, .buttonBPressed
|
||||||
.checkIfUpPressed
|
.checkIfUpPressed
|
||||||
bit 6, a ; was Up pressed?
|
bit BIT_D_UP, a
|
||||||
jr z, .checkIfDownPressed
|
jr z, .checkIfDownPressed
|
||||||
.upPressed ; scroll up one row
|
.upPressed ; scroll up one row
|
||||||
ld a, [wListScrollOffset]
|
ld a, [wListScrollOffset]
|
||||||
|
@ -297,7 +297,7 @@ HandlePokedexListMenu:
|
||||||
ld [wListScrollOffset], a
|
ld [wListScrollOffset], a
|
||||||
jp .loop
|
jp .loop
|
||||||
.checkIfDownPressed
|
.checkIfDownPressed
|
||||||
bit 7, a ; was Down pressed?
|
bit BIT_D_DOWN, a
|
||||||
jr z, .checkIfRightPressed
|
jr z, .checkIfRightPressed
|
||||||
.downPressed ; scroll down one row
|
.downPressed ; scroll down one row
|
||||||
ld a, [wDexMaxSeenMon]
|
ld a, [wDexMaxSeenMon]
|
||||||
|
@ -312,7 +312,7 @@ HandlePokedexListMenu:
|
||||||
ld [wListScrollOffset], a
|
ld [wListScrollOffset], a
|
||||||
jp .loop
|
jp .loop
|
||||||
.checkIfRightPressed
|
.checkIfRightPressed
|
||||||
bit 4, a ; was Right pressed?
|
bit BIT_D_RIGHT, a
|
||||||
jr z, .checkIfLeftPressed
|
jr z, .checkIfLeftPressed
|
||||||
.rightPressed ; scroll down 7 rows
|
.rightPressed ; scroll down 7 rows
|
||||||
ld a, [wDexMaxSeenMon]
|
ld a, [wDexMaxSeenMon]
|
||||||
|
@ -330,7 +330,7 @@ HandlePokedexListMenu:
|
||||||
ld [wListScrollOffset], a
|
ld [wListScrollOffset], a
|
||||||
jp .loop
|
jp .loop
|
||||||
.checkIfLeftPressed ; scroll up 7 rows
|
.checkIfLeftPressed ; scroll up 7 rows
|
||||||
bit 5, a ; was Left pressed?
|
bit BIT_D_LEFT, a
|
||||||
jr z, .buttonAPressed
|
jr z, .buttonAPressed
|
||||||
.leftPressed
|
.leftPressed
|
||||||
ld a, [wListScrollOffset]
|
ld a, [wListScrollOffset]
|
||||||
|
|
|
@ -356,7 +356,7 @@ ChangeBox::
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
ld hl, hUILayoutFlags
|
ld hl, hUILayoutFlags
|
||||||
res 1, [hl]
|
res 1, [hl]
|
||||||
bit 1, a ; pressed b
|
bit BIT_B_BUTTON, a
|
||||||
ret nz
|
ret nz
|
||||||
call GetBoxSRAMLocation
|
call GetBoxSRAMLocation
|
||||||
ld e, l
|
ld e, l
|
||||||
|
|
|
@ -65,7 +65,7 @@ StartMenu_Pokemon::
|
||||||
push af
|
push af
|
||||||
call LoadScreenTilesFromBuffer1 ; restore saved screen
|
call LoadScreenTilesFromBuffer1 ; restore saved screen
|
||||||
pop af
|
pop af
|
||||||
bit 1, a ; was the B button pressed?
|
bit BIT_B_BUTTON, a
|
||||||
jp nz, .loop
|
jp nz, .loop
|
||||||
; if the B button wasn't pressed
|
; if the B button wasn't pressed
|
||||||
ld a, [wMaxMenuItem]
|
ld a, [wMaxMenuItem]
|
||||||
|
@ -360,7 +360,7 @@ StartMenu_Item::
|
||||||
ld [hl], a ; old menu item id
|
ld [hl], a ; old menu item id
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
call PlaceUnfilledArrowMenuCursor
|
call PlaceUnfilledArrowMenuCursor
|
||||||
bit 1, a ; was the B button pressed?
|
bit BIT_B_BUTTON, a
|
||||||
jr z, .useOrTossItem
|
jr z, .useOrTossItem
|
||||||
jp ItemMenuLoop
|
jp ItemMenuLoop
|
||||||
.useOrTossItem ; if the player made the choice to use or toss the item
|
.useOrTossItem ; if the player made the choice to use or toss the item
|
||||||
|
|
|
@ -174,9 +174,9 @@ DoBuySellQuitMenu:
|
||||||
ld [wd730], a
|
ld [wd730], a
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
call PlaceUnfilledArrowMenuCursor
|
call PlaceUnfilledArrowMenuCursor
|
||||||
bit 0, a ; was A pressed?
|
bit BIT_A_BUTTON, a
|
||||||
jr nz, .pressedA
|
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
|
jr z, .pressedA
|
||||||
ld a, CANCELLED_MENU
|
ld a, CANCELLED_MENU
|
||||||
ld [wMenuExitMethod], a
|
ld [wMenuExitMethod], a
|
||||||
|
@ -296,8 +296,8 @@ DisplayTwoOptionMenu:
|
||||||
pop hl
|
pop hl
|
||||||
.noYesMenuInputLoop
|
.noYesMenuInputLoop
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
bit 1, a ; A button pressed?
|
bit BIT_B_BUTTON, a
|
||||||
jr nz, .noYesMenuInputLoop ; try again if A was not pressed
|
jr nz, .noYesMenuInputLoop ; try again if B was not pressed
|
||||||
pop af
|
pop af
|
||||||
pop hl
|
pop hl
|
||||||
ld [wFlags_0xcd60], a
|
ld [wFlags_0xcd60], a
|
||||||
|
@ -309,7 +309,7 @@ DisplayTwoOptionMenu:
|
||||||
ld [wTwoOptionMenuID], a
|
ld [wTwoOptionMenuID], a
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
pop hl
|
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
|
jr nz, .choseSecondMenuItem ; automatically choose the second option if B is pressed
|
||||||
.pressedAButton
|
.pressedAButton
|
||||||
ld a, [wCurrentMenuItem]
|
ld a, [wCurrentMenuItem]
|
||||||
|
|
|
@ -171,8 +171,8 @@ BillsPCMenu:
|
||||||
ldh [hAutoBGTransferEnabled], a
|
ldh [hAutoBGTransferEnabled], a
|
||||||
call Delay3
|
call Delay3
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
bit 1, a
|
bit BIT_B_BUTTON, a
|
||||||
jp nz, ExitBillsPC ; b button
|
jp nz, ExitBillsPC
|
||||||
call PlaceUnfilledArrowMenuCursor
|
call PlaceUnfilledArrowMenuCursor
|
||||||
ld a, [wCurrentMenuItem]
|
ld a, [wCurrentMenuItem]
|
||||||
ld [wParentMenuItem], a
|
ld [wParentMenuItem], a
|
||||||
|
@ -416,7 +416,7 @@ DisplayDepositWithdrawMenu:
|
||||||
ld [wPartyAndBillsPCSavedMenuItem], a
|
ld [wPartyAndBillsPCSavedMenuItem], a
|
||||||
.loop
|
.loop
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
bit 1, a ; pressed B?
|
bit BIT_B_BUTTON, a
|
||||||
jr nz, .exit
|
jr nz, .exit
|
||||||
ld a, [wCurrentMenuItem]
|
ld a, [wCurrentMenuItem]
|
||||||
and a
|
and a
|
||||||
|
|
|
@ -155,7 +155,7 @@ TryingToLearn:
|
||||||
call LoadScreenTilesFromBuffer1
|
call LoadScreenTilesFromBuffer1
|
||||||
pop af
|
pop af
|
||||||
pop hl
|
pop hl
|
||||||
bit 1, a ; pressed b
|
bit BIT_B_BUTTON, a
|
||||||
jr nz, .cancel
|
jr nz, .cancel
|
||||||
push hl
|
push hl
|
||||||
ld a, [wCurrentMenuItem]
|
ld a, [wCurrentMenuItem]
|
||||||
|
|
|
@ -5,7 +5,7 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor::
|
||||||
ldh a, [hLoadedROMBank]
|
ldh a, [hLoadedROMBank]
|
||||||
push af
|
push af
|
||||||
ldh a, [hJoyHeld]
|
ldh a, [hJoyHeld]
|
||||||
bit 0, a ; A button
|
bit BIT_A_BUTTON, a
|
||||||
jr z, .nothingFound
|
jr z, .nothingFound
|
||||||
; A button is pressed
|
; A button is pressed
|
||||||
ld a, BANK(CheckForHiddenObject)
|
ld a, BANK(CheckForHiddenObject)
|
||||||
|
|
|
@ -84,7 +84,7 @@ DisplayListMenuIDLoop::
|
||||||
push af
|
push af
|
||||||
call PlaceMenuCursor
|
call PlaceMenuCursor
|
||||||
pop af
|
pop af
|
||||||
bit 0, a ; was the A button pressed?
|
bit BIT_A_BUTTON, a
|
||||||
jp z, .checkOtherKeys
|
jp z, .checkOtherKeys
|
||||||
.buttonAPressed
|
.buttonAPressed
|
||||||
ld a, [wCurrentMenuItem]
|
ld a, [wCurrentMenuItem]
|
||||||
|
@ -168,12 +168,12 @@ DisplayListMenuIDLoop::
|
||||||
res 6, [hl] ; turn on letter printing delay
|
res 6, [hl] ; turn on letter printing delay
|
||||||
jp BankswitchBack
|
jp BankswitchBack
|
||||||
.checkOtherKeys ; check B, SELECT, Up, and Down keys
|
.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
|
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
|
jp nz, HandleItemListSwapping ; if so, allow the player to swap menu entries
|
||||||
ld b, a
|
ld b, a
|
||||||
bit 7, b ; was Down pressed?
|
bit BIT_D_DOWN, b
|
||||||
ld hl, wListScrollOffset
|
ld hl, wListScrollOffset
|
||||||
jr z, .upPressed
|
jr z, .upPressed
|
||||||
.downPressed
|
.downPressed
|
||||||
|
@ -220,13 +220,13 @@ DisplayChooseQuantityMenu::
|
||||||
.waitForKeyPressLoop
|
.waitForKeyPressLoop
|
||||||
call JoypadLowSensitivity
|
call JoypadLowSensitivity
|
||||||
ldh a, [hJoyPressed] ; newly pressed buttons
|
ldh a, [hJoyPressed] ; newly pressed buttons
|
||||||
bit 0, a ; was the A button pressed?
|
bit BIT_A_BUTTON, a
|
||||||
jp nz, .buttonAPressed
|
jp nz, .buttonAPressed
|
||||||
bit 1, a ; was the B button pressed?
|
bit BIT_B_BUTTON, a
|
||||||
jp nz, .buttonBPressed
|
jp nz, .buttonBPressed
|
||||||
bit 6, a ; was Up pressed?
|
bit BIT_D_UP, a
|
||||||
jr nz, .incrementQuantity
|
jr nz, .incrementQuantity
|
||||||
bit 7, a ; was Down pressed?
|
bit BIT_D_DOWN, a
|
||||||
jr nz, .decrementQuantity
|
jr nz, .decrementQuantity
|
||||||
jr .waitForKeyPressLoop
|
jr .waitForKeyPressLoop
|
||||||
.incrementQuantity
|
.incrementQuantity
|
||||||
|
|
|
@ -72,14 +72,14 @@ OverworldLoopLessDelay::
|
||||||
.notSimulating
|
.notSimulating
|
||||||
ldh a, [hJoyPressed]
|
ldh a, [hJoyPressed]
|
||||||
.checkIfStartIsPressed
|
.checkIfStartIsPressed
|
||||||
bit 3, a ; start button
|
bit BIT_START, a
|
||||||
jr z, .startButtonNotPressed
|
jr z, .startButtonNotPressed
|
||||||
; if START is pressed
|
; if START is pressed
|
||||||
xor a ; TEXT_START_MENU
|
xor a ; TEXT_START_MENU
|
||||||
ldh [hSpriteIndexOrTextID], a
|
ldh [hSpriteIndexOrTextID], a
|
||||||
jp .displayDialogue
|
jp .displayDialogue
|
||||||
.startButtonNotPressed
|
.startButtonNotPressed
|
||||||
bit 0, a ; A button
|
bit BIT_A_BUTTON, a
|
||||||
jp z, .checkIfDownButtonIsPressed
|
jp z, .checkIfDownButtonIsPressed
|
||||||
; if A is pressed
|
; if A is pressed
|
||||||
ld a, [wd730]
|
ld a, [wd730]
|
||||||
|
@ -146,7 +146,7 @@ OverworldLoopLessDelay::
|
||||||
|
|
||||||
.checkIfDownButtonIsPressed
|
.checkIfDownButtonIsPressed
|
||||||
ldh a, [hJoyHeld] ; current joypad state
|
ldh a, [hJoyHeld] ; current joypad state
|
||||||
bit 7, a ; down button
|
bit BIT_D_DOWN, a
|
||||||
jr z, .checkIfUpButtonIsPressed
|
jr z, .checkIfUpButtonIsPressed
|
||||||
ld a, 1
|
ld a, 1
|
||||||
ld [wSpritePlayerStateData1YStepVector], a
|
ld [wSpritePlayerStateData1YStepVector], a
|
||||||
|
@ -154,7 +154,7 @@ OverworldLoopLessDelay::
|
||||||
jr .handleDirectionButtonPress
|
jr .handleDirectionButtonPress
|
||||||
|
|
||||||
.checkIfUpButtonIsPressed
|
.checkIfUpButtonIsPressed
|
||||||
bit 6, a ; up button
|
bit BIT_D_UP, a
|
||||||
jr z, .checkIfLeftButtonIsPressed
|
jr z, .checkIfLeftButtonIsPressed
|
||||||
ld a, -1
|
ld a, -1
|
||||||
ld [wSpritePlayerStateData1YStepVector], a
|
ld [wSpritePlayerStateData1YStepVector], a
|
||||||
|
@ -162,7 +162,7 @@ OverworldLoopLessDelay::
|
||||||
jr .handleDirectionButtonPress
|
jr .handleDirectionButtonPress
|
||||||
|
|
||||||
.checkIfLeftButtonIsPressed
|
.checkIfLeftButtonIsPressed
|
||||||
bit 5, a ; left button
|
bit BIT_D_LEFT, a
|
||||||
jr z, .checkIfRightButtonIsPressed
|
jr z, .checkIfRightButtonIsPressed
|
||||||
ld a, -1
|
ld a, -1
|
||||||
ld [wSpritePlayerStateData1XStepVector], a
|
ld [wSpritePlayerStateData1XStepVector], a
|
||||||
|
@ -170,7 +170,7 @@ OverworldLoopLessDelay::
|
||||||
jr .handleDirectionButtonPress
|
jr .handleDirectionButtonPress
|
||||||
|
|
||||||
.checkIfRightButtonIsPressed
|
.checkIfRightButtonIsPressed
|
||||||
bit 4, a ; right button
|
bit BIT_D_RIGHT, a
|
||||||
jr z, .noDirectionButtonsPressed
|
jr z, .noDirectionButtonsPressed
|
||||||
ld a, 1
|
ld a, 1
|
||||||
ld [wSpritePlayerStateData1XStepVector], a
|
ld [wSpritePlayerStateData1XStepVector], a
|
||||||
|
|
|
@ -274,7 +274,7 @@ HandlePartyMenuInput::
|
||||||
scf
|
scf
|
||||||
ret
|
ret
|
||||||
.swappingPokemon
|
.swappingPokemon
|
||||||
bit 1, b ; was the B button pressed?
|
bit BIT_B_BUTTON, b
|
||||||
jr z, .handleSwap ; if not, handle swapping the pokemon
|
jr z, .handleSwap ; if not, handle swapping the pokemon
|
||||||
.cancelSwap ; if the B button was pressed
|
.cancelSwap ; if the B button was pressed
|
||||||
farcall ErasePartyMenuCursors
|
farcall ErasePartyMenuCursors
|
||||||
|
|
|
@ -25,11 +25,11 @@ PrintLetterDelay::
|
||||||
call Joypad
|
call Joypad
|
||||||
ldh a, [hJoyHeld]
|
ldh a, [hJoyHeld]
|
||||||
.checkAButton
|
.checkAButton
|
||||||
bit 0, a ; is the A button pressed?
|
bit BIT_A_BUTTON, a
|
||||||
jr z, .checkBButton
|
jr z, .checkBButton
|
||||||
jr .endWait
|
jr .endWait
|
||||||
.checkBButton
|
.checkBButton
|
||||||
bit 1, a ; is the B button pressed?
|
bit BIT_B_BUTTON, a
|
||||||
jr z, .buttonsNotPressed
|
jr z, .buttonsNotPressed
|
||||||
.endWait
|
.endWait
|
||||||
call DelayFrame
|
call DelayFrame
|
||||||
|
|
|
@ -15,7 +15,7 @@ RedisplayStartMenu::
|
||||||
call HandleMenuInput
|
call HandleMenuInput
|
||||||
ld b, a
|
ld b, a
|
||||||
.checkIfUpPressed
|
.checkIfUpPressed
|
||||||
bit 6, a ; was Up pressed?
|
bit BIT_D_UP, a
|
||||||
jr z, .checkIfDownPressed
|
jr z, .checkIfDownPressed
|
||||||
ld a, [wCurrentMenuItem] ; menu selection
|
ld a, [wCurrentMenuItem] ; menu selection
|
||||||
and a
|
and a
|
||||||
|
@ -54,7 +54,7 @@ RedisplayStartMenu::
|
||||||
ld a, [wCurrentMenuItem]
|
ld a, [wCurrentMenuItem]
|
||||||
ld [wBattleAndStartSavedMenuItem], a ; save current menu selection
|
ld [wBattleAndStartSavedMenuItem], a ; save current menu selection
|
||||||
ld a, b
|
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
|
jp nz, CloseStartMenu
|
||||||
call SaveScreenTilesToBuffer2 ; copy background from wTileMap to wTileMapBackup2
|
call SaveScreenTilesToBuffer2 ; copy background from wTileMap to wTileMapBackup2
|
||||||
CheckEvent EVENT_GOT_POKEDEX
|
CheckEvent EVENT_GOT_POKEDEX
|
||||||
|
@ -79,7 +79,7 @@ RedisplayStartMenu::
|
||||||
CloseStartMenu::
|
CloseStartMenu::
|
||||||
call Joypad
|
call Joypad
|
||||||
ldh a, [hJoyPressed]
|
ldh a, [hJoyPressed]
|
||||||
bit 0, a ; was A button newly pressed?
|
bit BIT_A_BUTTON, a
|
||||||
jr nz, CloseStartMenu
|
jr nz, CloseStartMenu
|
||||||
call LoadTextBoxTilePatterns
|
call LoadTextBoxTilePatterns
|
||||||
jp CloseTextDisplay
|
jp CloseTextDisplay
|
||||||
|
|
|
@ -98,7 +98,7 @@ AfterDisplayingTextID::
|
||||||
HoldTextDisplayOpen::
|
HoldTextDisplayOpen::
|
||||||
call Joypad
|
call Joypad
|
||||||
ldh a, [hJoyHeld]
|
ldh a, [hJoyHeld]
|
||||||
bit 0, a ; is the A button being pressed?
|
bit BIT_A_BUTTON, a
|
||||||
jr nz, HoldTextDisplayOpen
|
jr nz, HoldTextDisplayOpen
|
||||||
|
|
||||||
CloseTextDisplay::
|
CloseTextDisplay::
|
||||||
|
|
|
@ -50,7 +50,7 @@ HandleMenuInput_::
|
||||||
ld [wCheckFor180DegreeTurn], a
|
ld [wCheckFor180DegreeTurn], a
|
||||||
ldh a, [hJoy5]
|
ldh a, [hJoy5]
|
||||||
ld b, a
|
ld b, a
|
||||||
bit 6, a ; pressed Up key?
|
bit BIT_D_UP, a
|
||||||
jr z, .checkIfDownPressed
|
jr z, .checkIfDownPressed
|
||||||
.upPressed
|
.upPressed
|
||||||
ld a, [wCurrentMenuItem] ; selected menu item
|
ld a, [wCurrentMenuItem] ; selected menu item
|
||||||
|
|
Loading…
Reference in a new issue