summaryrefslogtreecommitdiff
path: root/src/mplayer/mplayer_play_effect_p.z80
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2020-12-30 19:07:31 +0000
committerJuan J. Martinez <jjm@usebox.net>2020-12-30 19:23:41 +0000
commit2682bc5d1d864341aaeb42a449db73c3ecd16d70 (patch)
tree9116764364b4ee0ce7f6037305077807b57776de /src/mplayer/mplayer_play_effect_p.z80
downloadubox-msx-lib-ca9b663c147340e92804979a96eee4113ab0b27f.tar.gz
ubox-msx-lib-ca9b663c147340e92804979a96eee4113ab0b27f.zip
Initial import1.0
Diffstat (limited to 'src/mplayer/mplayer_play_effect_p.z80')
-rw-r--r--src/mplayer/mplayer_play_effect_p.z8045
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mplayer/mplayer_play_effect_p.z80 b/src/mplayer/mplayer_play_effect_p.z80
new file mode 100644
index 0000000..8efd705
--- /dev/null
+++ b/src/mplayer/mplayer_play_effect_p.z80
@@ -0,0 +1,45 @@
+.module mplayer
+
+.globl _mplayer_play_effect_p
+.globl _mplayer_is_sound_effect_on
+.globl mplayer_current_efx
+
+.globl _PLY_AKM_PLAYSOUNDEFFECT
+
+_mplayer_play_effect_p::
+ ld hl, #2
+ add hl, sp
+
+ ld e, (hl)
+ inc hl
+ ld c, (hl)
+ inc hl
+ ld b, (hl)
+
+ ; e effect no
+ ; bc: channel and volume
+ push bc
+ push de
+ ld l, c
+ call _mplayer_is_sound_effect_on
+
+ ld a, l
+ or a
+ pop de
+ pop bc
+ jr z, play_efx
+
+ ld a, (mplayer_current_efx)
+ ; comment out following line if you don't want to
+ ; replace current sound if is the same effect type
+ dec a
+ cp e
+ ret nc
+
+play_efx:
+ ; all good, play the effect
+ ld a, e
+ ld (mplayer_current_efx), a
+
+ jp _PLY_AKM_PLAYSOUNDEFFECT
+