aboutsummaryrefslogtreecommitdiff
path: root/src/mplayer/mplayer_play_effect_p.z80
blob: 9e428cd6938870b3693b74880e1f1c26b364de89 (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
46
.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 e, a
	ld c, l

	ld hl, #2
	add hl, sp
	ld b, (hl)

	; e effect no
	; bc: channel and volume
	push bc
	push de
	ld a, c
	call _mplayer_is_sound_effect_on

	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
	jp nc, play_exit

play_efx:
	; all good, play the effect
	ld a, e
	ld (mplayer_current_efx), a

	call _PLY_AKM_PLAYSOUNDEFFECT

play_exit:
	pop hl
	inc sp
	jp (hl)