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

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