mirror of
https://github.com/pret/pokered.git
synced 2026-05-07 13:53:15 -05:00
46 lines
934 B
NASM
46 lines
934 B
NASM
; This function is used to wait a short period after printing a letter to the
|
|
; screen unless the player presses the A/B button or the delay is turned off
|
|
; through the [wStatusFlags5] or [wLetterPrintingDelayFlags] flags.
|
|
PrintLetterDelay::
|
|
ld a, [wStatusFlags5]
|
|
bit BIT_NO_TEXT_DELAY, a
|
|
ret nz
|
|
ld a, [wLetterPrintingDelayFlags]
|
|
bit BIT_TEXT_DELAY, a
|
|
ret z
|
|
push hl
|
|
push de
|
|
push bc
|
|
ld a, [wLetterPrintingDelayFlags]
|
|
bit BIT_FAST_TEXT_DELAY, a
|
|
jr z, .waitOneFrame
|
|
ld a, [wOptions]
|
|
and $f
|
|
ldh [hFrameCounter], a
|
|
jr .checkButtons
|
|
.waitOneFrame
|
|
ld a, 1
|
|
ldh [hFrameCounter], a
|
|
.checkButtons
|
|
call Joypad
|
|
ldh a, [hJoyHeld]
|
|
; check A button
|
|
bit B_PAD_A, a
|
|
jr z, .checkBButton
|
|
jr .endWait
|
|
.checkBButton
|
|
bit B_PAD_B, a
|
|
jr z, .buttonsNotPressed
|
|
.endWait
|
|
call DelayFrame
|
|
jr .done
|
|
.buttonsNotPressed ; if neither A nor B is pressed
|
|
ldh a, [hFrameCounter]
|
|
and a
|
|
jr nz, .checkButtons
|
|
.done
|
|
pop bc
|
|
pop de
|
|
pop hl
|
|
ret
|