summaryrefslogtreecommitdiff
path: root/home/delay.asm
diff options
context:
space:
mode:
Diffstat (limited to 'home/delay.asm')
-rw-r--r--home/delay.asm32
1 files changed, 32 insertions, 0 deletions
diff --git a/home/delay.asm b/home/delay.asm
new file mode 100644
index 00000000..eba865c2
--- /dev/null
+++ b/home/delay.asm
@@ -0,0 +1,32 @@
+DelayFrames::
+; wait c frames
+ call DelayFrame
+ dec c
+ jr nz, DelayFrames
+ ret
+
+PlaySoundWaitForCurrent::
+ push af
+ call WaitForSoundToFinish
+ pop af
+ jp PlaySound
+
+; Wait for sound to finish playing
+WaitForSoundToFinish::
+ ld a, [wLowHealthAlarm]
+ and $80
+ ret nz
+ push hl
+.waitLoop
+ ld hl, wChannelSoundIDs + Ch5
+ xor a
+ or [hl]
+ inc hl
+ or [hl]
+ inc hl
+ inc hl
+ or [hl]
+ and a
+ jr nz, .waitLoop
+ pop hl
+ ret