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

@ -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, " "