aboutsummaryrefslogtreecommitdiff
path: root/src/mplayer/mplayer_play_effect_p.z80
blob: 8efd705e220f9ffba98ed488a87b4ec7a678031f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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