2015-02-13 11:56:51 +00:00
|
|
|
func snd_se_reset
|
2015-02-23 10:47:22 +00:00
|
|
|
mov _snd_se_frame, 0
|
|
|
|
mov _snd_se_playing, -1
|
2015-02-13 11:56:51 +00:00
|
|
|
ret
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
2019-10-13 19:52:02 +00:00
|
|
|
func SND_SE_PLAY
|
2015-02-13 11:56:51 +00:00
|
|
|
mov bx, sp
|
|
|
|
mov dx, ss:[bx+4]
|
2015-02-23 10:47:22 +00:00
|
|
|
cmp _snd_se_mode, SND_SE_OFF
|
2015-02-13 11:56:51 +00:00
|
|
|
jz short @@ret
|
2015-02-23 10:47:22 +00:00
|
|
|
cmp _snd_se_playing, -1
|
2015-02-13 11:56:51 +00:00
|
|
|
jnz short @@priority?
|
2015-02-23 10:47:22 +00:00
|
|
|
mov _snd_se_playing, dl
|
2015-02-13 11:56:51 +00:00
|
|
|
ret 2
|
|
|
|
|
|
|
|
@@priority?:
|
2015-02-23 10:47:22 +00:00
|
|
|
mov bl, _snd_se_playing
|
2015-02-13 11:56:51 +00:00
|
|
|
xor bh, bh
|
2015-02-23 10:47:22 +00:00
|
|
|
mov al, _snd_se_priorities[bx]
|
2015-02-13 11:56:51 +00:00
|
|
|
mov bx, dx
|
2015-02-23 10:47:22 +00:00
|
|
|
cmp al, _snd_se_priorities[bx]
|
2015-02-13 11:56:51 +00:00
|
|
|
ja short @@ret
|
2015-02-23 10:47:22 +00:00
|
|
|
mov _snd_se_playing, dl
|
|
|
|
mov _snd_se_frame, 0
|
2015-02-13 11:56:51 +00:00
|
|
|
|
|
|
|
@@ret:
|
|
|
|
ret 2
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
|
|
func snd_se_update
|
2015-02-23 10:47:22 +00:00
|
|
|
cmp _snd_se_mode, SND_SE_OFF
|
2015-02-13 11:56:51 +00:00
|
|
|
jz short @@ret
|
2015-02-23 10:47:22 +00:00
|
|
|
cmp _snd_se_playing, -1
|
2015-02-13 11:56:51 +00:00
|
|
|
jz short @@ret
|
2015-02-23 10:47:22 +00:00
|
|
|
cmp _snd_se_frame, 0
|
2015-02-13 11:56:51 +00:00
|
|
|
jnz short @@unlock?
|
2015-02-23 10:47:22 +00:00
|
|
|
mov al, _snd_se_playing
|
|
|
|
cmp _snd_se_mode, SND_SE_BEEP
|
2015-02-13 11:56:51 +00:00
|
|
|
jz short @@beep
|
|
|
|
mov ah, PMD_SE_PLAY
|
|
|
|
int 60h
|
|
|
|
jmp short @@unlock?
|
|
|
|
|
|
|
|
@@beep:
|
|
|
|
xor ah, ah
|
|
|
|
push ax
|
|
|
|
call bgm_sound
|
|
|
|
|
|
|
|
@@unlock?:
|
2015-02-23 10:47:22 +00:00
|
|
|
inc _snd_se_frame
|
|
|
|
mov bl, _snd_se_playing
|
2015-02-13 11:56:51 +00:00
|
|
|
xor bh, bh
|
2015-02-23 10:47:22 +00:00
|
|
|
mov al, _snd_se_priority_frames[bx]
|
|
|
|
cmp al, _snd_se_frame
|
2015-02-13 11:56:51 +00:00
|
|
|
jnb short @@ret
|
2015-02-23 10:47:22 +00:00
|
|
|
mov _snd_se_frame, 0
|
|
|
|
mov _snd_se_playing, -1
|
2015-02-13 11:56:51 +00:00
|
|
|
|
|
|
|
@@ret:
|
|
|
|
ret
|
|
|
|
endfunc
|