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
47
48
|
.globl _PLW_PlaySoundEffect
.globl _PLW_IsSoundEffectOn
.globl _PLW_PlaySoundEffectP
.globl plw_current_efx
PLY_LW_PLAY_SOUND_EFFECT = 0x0b06 + 0xc
_PLW_PlaySoundEffect::
ld hl,#2
add hl,sp
ld a, (hl)
inc hl
ld c, (hl)
inc hl
ld b, (hl)
jp PLY_LW_PLAY_SOUND_EFFECT
_PLW_PlaySoundEffectP::
; check if current is over
; de is not used
ld e, l
; fixed channel 2
ld l, #2
call _PLW_IsSoundEffectOn
ld a, l
or a
jr z, play_efx
ld a, (plw_current_efx)
cp e
ret nc
play_efx:
; all good, play the effect
ld a, e
ld (plw_current_efx), a
; fixed channel 2, full volume
ld bc, #0x0002
jp PLY_LW_PLAY_SOUND_EFFECT
.area _DATA
plw_current_efx: .ds 1
|