2014-05-21 20:26:28 +00:00
|
|
|
; Audio interfaces.
|
|
|
|
|
2015-11-12 04:38:57 +00:00
|
|
|
MapSetup_Sound_Off:: ; 3b4e
|
2014-05-21 20:26:28 +00:00
|
|
|
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
push af
|
|
|
|
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, BANK(_MapSetup_Sound_Off)
|
2014-05-21 20:26:28 +00:00
|
|
|
ld [hROMBank], a
|
|
|
|
ld [MBC3RomBank], a
|
|
|
|
|
2015-11-12 04:38:57 +00:00
|
|
|
call _MapSetup_Sound_Off
|
2014-05-21 20:26:28 +00:00
|
|
|
|
|
|
|
pop af
|
|
|
|
ld [hROMBank], a
|
|
|
|
ld [MBC3RomBank], a
|
|
|
|
|
|
|
|
pop af
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 3b6a
|
|
|
|
|
|
|
|
|
|
|
|
UpdateSound:: ; 3b6a
|
|
|
|
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
push af
|
|
|
|
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
ld a, BANK(_UpdateSound)
|
|
|
|
ld [hROMBank], a
|
|
|
|
ld [MBC3RomBank], a
|
|
|
|
|
|
|
|
call _UpdateSound
|
|
|
|
|
|
|
|
pop af
|
|
|
|
ld [hROMBank], a
|
|
|
|
ld [MBC3RomBank], a
|
|
|
|
|
|
|
|
pop af
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 3b86
|
|
|
|
|
|
|
|
|
|
|
|
_LoadMusicByte:: ; 3b86
|
2018-01-23 22:39:09 +00:00
|
|
|
; wCurMusicByte = [a:de]
|
2014-05-21 20:26:28 +00:00
|
|
|
GLOBAL LoadMusicByte
|
|
|
|
|
|
|
|
ld [hROMBank], a
|
|
|
|
ld [MBC3RomBank], a
|
|
|
|
|
|
|
|
ld a, [de]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurMusicByte], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ld a, BANK(LoadMusicByte)
|
|
|
|
|
|
|
|
ld [hROMBank], a
|
|
|
|
ld [MBC3RomBank], a
|
|
|
|
ret
|
|
|
|
; 3b97
|
|
|
|
|
|
|
|
|
|
|
|
PlayMusic:: ; 3b97
|
|
|
|
; Play music de.
|
|
|
|
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
push af
|
|
|
|
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
2015-11-12 04:38:57 +00:00
|
|
|
ld a, BANK(_PlayMusic) ; and BANK(_MapSetup_Sound_Off)
|
2014-05-21 20:26:28 +00:00
|
|
|
ld [hROMBank], a
|
|
|
|
ld [MBC3RomBank], a
|
|
|
|
|
|
|
|
ld a, e
|
|
|
|
and a
|
|
|
|
jr z, .nomusic
|
|
|
|
|
|
|
|
call _PlayMusic
|
|
|
|
jr .end
|
|
|
|
|
|
|
|
.nomusic
|
2015-11-12 04:38:57 +00:00
|
|
|
call _MapSetup_Sound_Off
|
2014-05-21 20:26:28 +00:00
|
|
|
|
|
|
|
.end
|
|
|
|
pop af
|
|
|
|
ld [hROMBank], a
|
|
|
|
ld [MBC3RomBank], a
|
|
|
|
pop af
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 3bbc
|
|
|
|
|
|
|
|
|
|
|
|
PlayMusic2:: ; 3bbc
|
|
|
|
; Stop playing music, then play music de.
|
|
|
|
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
push af
|
|
|
|
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
ld a, BANK(_PlayMusic)
|
|
|
|
ld [hROMBank], a
|
|
|
|
ld [MBC3RomBank], a
|
|
|
|
|
|
|
|
push de
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call _PlayMusic
|
|
|
|
call DelayFrame
|
|
|
|
pop de
|
|
|
|
call _PlayMusic
|
|
|
|
|
|
|
|
pop af
|
|
|
|
ld [hROMBank], a
|
|
|
|
ld [MBC3RomBank], a
|
|
|
|
|
|
|
|
pop af
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
|
|
|
; 3be3
|
|
|
|
|
|
|
|
|
2018-01-17 04:47:45 +00:00
|
|
|
PlayCry:: ; 3be3
|
2018-01-23 16:17:21 +00:00
|
|
|
; Play cry de.
|
2014-05-21 20:26:28 +00:00
|
|
|
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
push af
|
|
|
|
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
|
2017-12-26 17:50:32 +00:00
|
|
|
; Cries are stuck in one bank.
|
|
|
|
ld a, BANK(PokemonCries)
|
2014-05-21 20:26:28 +00:00
|
|
|
ld [hROMBank], a
|
|
|
|
ld [MBC3RomBank], a
|
|
|
|
|
2017-12-26 17:50:32 +00:00
|
|
|
ld hl, PokemonCries
|
|
|
|
rept 6 ; sizeof(mon_cry)
|
2014-05-21 20:26:28 +00:00
|
|
|
add hl, de
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2014-05-21 20:26:28 +00:00
|
|
|
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
inc hl
|
|
|
|
|
|
|
|
ld a, [hli]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCryPitch], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ld a, [hli]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCryPitch + 1], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ld a, [hli]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCryLength], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ld a, [hl]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCryLength + 1], a
|
2014-05-21 20:26:28 +00:00
|
|
|
|
2018-01-17 04:47:45 +00:00
|
|
|
ld a, BANK(_PlayCry)
|
2014-05-21 20:26:28 +00:00
|
|
|
ld [hROMBank], a
|
|
|
|
ld [MBC3RomBank], a
|
|
|
|
|
2018-01-17 04:47:45 +00:00
|
|
|
call _PlayCry
|
2014-05-21 20:26:28 +00:00
|
|
|
|
|
|
|
pop af
|
|
|
|
ld [hROMBank], a
|
|
|
|
ld [MBC3RomBank], a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2014-05-21 20:26:28 +00:00
|
|
|
pop af
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 3c23
|
|
|
|
|
|
|
|
|
|
|
|
PlaySFX:: ; 3c23
|
|
|
|
; Play sound effect de.
|
2016-05-28 19:43:41 +00:00
|
|
|
; Sound effects are ordered by priority (highest to lowest)
|
2014-05-21 20:26:28 +00:00
|
|
|
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
push af
|
|
|
|
|
|
|
|
; Is something already playing?
|
|
|
|
call CheckSFX
|
|
|
|
jr nc, .play
|
|
|
|
|
|
|
|
; Does it have priority?
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurSFX]
|
2014-05-21 20:26:28 +00:00
|
|
|
cp e
|
|
|
|
jr c, .done
|
|
|
|
|
|
|
|
.play
|
|
|
|
ld a, [hROMBank]
|
|
|
|
push af
|
|
|
|
ld a, BANK(_PlaySFX)
|
|
|
|
ld [hROMBank], a
|
|
|
|
ld [MBC3RomBank], a
|
|
|
|
|
|
|
|
ld a, e
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurSFX], a
|
2014-05-21 20:26:28 +00:00
|
|
|
call _PlaySFX
|
|
|
|
|
|
|
|
pop af
|
|
|
|
ld [hROMBank], a
|
|
|
|
ld [MBC3RomBank], a
|
|
|
|
|
|
|
|
.done
|
|
|
|
pop af
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 3c4e
|
|
|
|
|
|
|
|
|
|
|
|
WaitPlaySFX:: ; 3c4e
|
|
|
|
call WaitSFX
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
|
|
|
; 3c55
|
|
|
|
|
|
|
|
|
|
|
|
WaitSFX:: ; 3c55
|
|
|
|
; infinite loop until sfx is done playing
|
|
|
|
|
|
|
|
push hl
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2014-05-21 20:26:28 +00:00
|
|
|
.wait
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wChannel5Flags
|
2014-05-21 20:26:28 +00:00
|
|
|
bit 0, [hl]
|
|
|
|
jr nz, .wait
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wChannel6Flags
|
2014-05-21 20:26:28 +00:00
|
|
|
bit 0, [hl]
|
|
|
|
jr nz, .wait
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wChannel7Flags
|
2014-05-21 20:26:28 +00:00
|
|
|
bit 0, [hl]
|
|
|
|
jr nz, .wait
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wChannel8Flags
|
2014-05-21 20:26:28 +00:00
|
|
|
bit 0, [hl]
|
|
|
|
jr nz, .wait
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2014-05-21 20:26:28 +00:00
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 3c74
|
|
|
|
|
|
|
|
IsSFXPlaying:: ; 3c74
|
|
|
|
; Return carry if no sound effect is playing.
|
|
|
|
; The inverse of CheckSFX.
|
|
|
|
push hl
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wChannel5Flags
|
2014-05-21 20:26:28 +00:00
|
|
|
bit 0, [hl]
|
|
|
|
jr nz, .playing
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wChannel6Flags
|
2014-05-21 20:26:28 +00:00
|
|
|
bit 0, [hl]
|
|
|
|
jr nz, .playing
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wChannel7Flags
|
2014-05-21 20:26:28 +00:00
|
|
|
bit 0, [hl]
|
|
|
|
jr nz, .playing
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wChannel8Flags
|
2014-05-21 20:26:28 +00:00
|
|
|
bit 0, [hl]
|
|
|
|
jr nz, .playing
|
|
|
|
|
|
|
|
pop hl
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.playing
|
|
|
|
pop hl
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; 3c97
|
|
|
|
|
|
|
|
MaxVolume:: ; 3c97
|
2017-12-09 18:28:23 +00:00
|
|
|
ld a, MAX_VOLUME
|
2018-01-23 21:45:34 +00:00
|
|
|
ld [wVolume], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ret
|
|
|
|
; 3c9d
|
|
|
|
|
|
|
|
LowVolume:: ; 3c9d
|
|
|
|
ld a, $33 ; 40%
|
2018-01-23 21:45:34 +00:00
|
|
|
ld [wVolume], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ret
|
|
|
|
; 3ca3
|
|
|
|
|
|
|
|
VolumeOff:: ; 3ca3
|
|
|
|
xor a
|
2018-01-23 21:45:34 +00:00
|
|
|
ld [wVolume], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ret
|
|
|
|
; 3ca8
|
|
|
|
|
2015-12-02 02:54:11 +00:00
|
|
|
Unused_FadeOutMusic:: ; 3ca8
|
2014-05-21 20:26:28 +00:00
|
|
|
ld a, 4
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMusicFade], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ret
|
|
|
|
; 3cae
|
|
|
|
|
2015-12-02 02:54:11 +00:00
|
|
|
FadeInMusic:: ; 3cae
|
2018-01-09 22:20:47 +00:00
|
|
|
ld a, 4 | (1 << MUSIC_FADE_IN_F)
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMusicFade], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ret
|
|
|
|
; 3cb4
|
|
|
|
|
|
|
|
SkipMusic:: ; 3cb4
|
|
|
|
; Skip a frames of music.
|
2015-11-05 19:06:03 +00:00
|
|
|
.loop
|
2014-05-21 20:26:28 +00:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
dec a
|
|
|
|
call UpdateSound
|
2015-11-05 19:06:03 +00:00
|
|
|
jr .loop
|
2014-05-21 20:26:28 +00:00
|
|
|
; 3cbc
|
|
|
|
|
|
|
|
FadeToMapMusic:: ; 3cbc
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
push af
|
|
|
|
|
2018-01-17 03:57:19 +00:00
|
|
|
call GetMapMusic_MaybeSpecial
|
2014-05-21 20:26:28 +00:00
|
|
|
ld a, [wMapMusic]
|
|
|
|
cp e
|
|
|
|
jr z, .done
|
|
|
|
|
|
|
|
ld a, 8
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMusicFade], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ld a, e
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMusicFadeID], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ld a, d
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMusicFadeID + 1], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ld a, e
|
|
|
|
ld [wMapMusic], a
|
|
|
|
|
|
|
|
.done
|
|
|
|
pop af
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 3cdf
|
|
|
|
|
|
|
|
PlayMapMusic:: ; 3cdf
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
push af
|
|
|
|
|
2018-01-17 03:57:19 +00:00
|
|
|
call GetMapMusic_MaybeSpecial
|
2014-05-21 20:26:28 +00:00
|
|
|
ld a, [wMapMusic]
|
|
|
|
cp e
|
|
|
|
jr z, .done
|
|
|
|
|
|
|
|
push de
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
|
|
|
call DelayFrame
|
|
|
|
pop de
|
|
|
|
ld a, e
|
|
|
|
ld [wMapMusic], a
|
|
|
|
call PlayMusic
|
|
|
|
|
|
|
|
.done
|
|
|
|
pop af
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 3d03
|
|
|
|
|
|
|
|
EnterMapMusic:: ; 3d03
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
push af
|
|
|
|
|
|
|
|
xor a
|
2015-12-26 23:11:55 +00:00
|
|
|
ld [wDontPlayMapMusicOnReload], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ld de, MUSIC_BICYCLE
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPlayerState]
|
2014-05-21 20:26:28 +00:00
|
|
|
cp PLAYER_BIKE
|
|
|
|
jr z, .play
|
2018-01-17 03:57:19 +00:00
|
|
|
call GetMapMusic_MaybeSpecial
|
2014-05-21 20:26:28 +00:00
|
|
|
.play
|
|
|
|
push de
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
|
|
|
call DelayFrame
|
|
|
|
pop de
|
|
|
|
|
|
|
|
ld a, e
|
|
|
|
ld [wMapMusic], a
|
|
|
|
call PlayMusic
|
|
|
|
|
|
|
|
pop af
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 3d2f
|
|
|
|
|
2015-07-21 05:52:46 +00:00
|
|
|
TryRestartMapMusic:: ; 3d2f
|
2015-12-26 23:11:55 +00:00
|
|
|
ld a, [wDontPlayMapMusicOnReload]
|
2014-05-21 20:26:28 +00:00
|
|
|
and a
|
|
|
|
jr z, RestartMapMusic
|
|
|
|
xor a
|
|
|
|
ld [wMapMusic], a
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
|
|
|
call DelayFrame
|
|
|
|
xor a
|
2015-12-26 23:11:55 +00:00
|
|
|
ld [wDontPlayMapMusicOnReload], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ret
|
|
|
|
; 3d47
|
|
|
|
|
|
|
|
RestartMapMusic:: ; 3d47
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
push af
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
|
|
|
call DelayFrame
|
|
|
|
ld a, [wMapMusic]
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
call PlayMusic
|
|
|
|
pop af
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 3d62
|
|
|
|
|
|
|
|
SpecialMapMusic:: ; 3d62
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPlayerState]
|
2014-05-21 20:26:28 +00:00
|
|
|
cp PLAYER_SURF
|
|
|
|
jr z, .surf
|
|
|
|
cp PLAYER_SURF_PIKA
|
|
|
|
jr z, .surf
|
|
|
|
|
2017-12-28 12:15:46 +00:00
|
|
|
ld a, [wStatusFlags2]
|
2018-01-22 20:40:43 +00:00
|
|
|
bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, a
|
2014-05-21 20:26:28 +00:00
|
|
|
jr nz, .contest
|
|
|
|
|
|
|
|
.no
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.bike
|
|
|
|
ld de, MUSIC_BICYCLE
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.surf
|
|
|
|
ld de, MUSIC_SURF
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.contest
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMapGroup]
|
2014-05-21 20:26:28 +00:00
|
|
|
cp GROUP_ROUTE_35_NATIONAL_PARK_GATE
|
|
|
|
jr nz, .no
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMapNumber]
|
2014-05-21 20:26:28 +00:00
|
|
|
cp MAP_ROUTE_35_NATIONAL_PARK_GATE
|
|
|
|
jr z, .ranking
|
|
|
|
cp MAP_ROUTE_36_NATIONAL_PARK_GATE
|
|
|
|
jr nz, .no
|
|
|
|
|
|
|
|
.ranking
|
|
|
|
ld de, MUSIC_BUG_CATCHING_CONTEST_RANKING
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 3d97
|
|
|
|
|
2018-01-17 03:57:19 +00:00
|
|
|
GetMapMusic_MaybeSpecial:: ; 3d97
|
2014-05-21 20:26:28 +00:00
|
|
|
call SpecialMapMusic
|
|
|
|
ret c
|
2018-01-17 03:57:19 +00:00
|
|
|
call GetMapMusic
|
2014-05-21 20:26:28 +00:00
|
|
|
ret
|
|
|
|
; 3d9f
|
|
|
|
|
2018-01-02 15:04:21 +00:00
|
|
|
Unreferenced_Function3d9f:: ; 3d9f
|
2014-05-21 20:26:28 +00:00
|
|
|
; Places a BCD number at the
|
|
|
|
; upper center of the screen.
|
2018-01-10 18:47:57 +00:00
|
|
|
ld a, 4 * TILE_WIDTH
|
2018-01-30 19:52:46 +00:00
|
|
|
ld [wVirtualOAMSprite38YCoord], a
|
|
|
|
ld [wVirtualOAMSprite39YCoord], a
|
2018-01-10 18:47:57 +00:00
|
|
|
ld a, 10 * TILE_WIDTH
|
2018-01-30 19:52:46 +00:00
|
|
|
ld [wVirtualOAMSprite38XCoord], a
|
2018-01-10 18:47:57 +00:00
|
|
|
ld a, 11 * TILE_WIDTH
|
2018-01-30 19:52:46 +00:00
|
|
|
ld [wVirtualOAMSprite39XCoord], a
|
2014-05-21 20:26:28 +00:00
|
|
|
xor a
|
2018-01-30 19:52:46 +00:00
|
|
|
ld [wVirtualOAMSprite38Attributes], a
|
|
|
|
ld [wVirtualOAMSprite39Attributes], a
|
2015-02-10 23:14:41 +00:00
|
|
|
ld a, [wc296]
|
2016-01-18 05:39:01 +00:00
|
|
|
cp 100
|
2014-05-21 20:26:28 +00:00
|
|
|
jr nc, .max
|
|
|
|
add 1
|
|
|
|
daa
|
|
|
|
ld b, a
|
|
|
|
swap a
|
|
|
|
and $f
|
|
|
|
add "0"
|
2018-01-30 19:52:46 +00:00
|
|
|
ld [wVirtualOAMSprite38TileID], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ld a, b
|
|
|
|
and $f
|
|
|
|
add "0"
|
2018-01-30 19:52:46 +00:00
|
|
|
ld [wVirtualOAMSprite39TileID], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
.max
|
|
|
|
ld a, "9"
|
2018-01-30 19:52:46 +00:00
|
|
|
ld [wVirtualOAMSprite38TileID], a
|
|
|
|
ld [wVirtualOAMSprite39TileID], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ret
|
|
|
|
; 3dde
|
|
|
|
|
|
|
|
CheckSFX:: ; 3dde
|
|
|
|
; Return carry if any SFX channels are active.
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wChannel5Flags]
|
2014-05-21 20:26:28 +00:00
|
|
|
bit 0, a
|
|
|
|
jr nz, .playing
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wChannel6Flags]
|
2014-05-21 20:26:28 +00:00
|
|
|
bit 0, a
|
|
|
|
jr nz, .playing
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wChannel7Flags]
|
2014-05-21 20:26:28 +00:00
|
|
|
bit 0, a
|
|
|
|
jr nz, .playing
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wChannel8Flags]
|
2014-05-21 20:26:28 +00:00
|
|
|
bit 0, a
|
|
|
|
jr nz, .playing
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
.playing
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 3dfe
|
|
|
|
|
2016-01-12 17:46:18 +00:00
|
|
|
TerminateExpBarSound:: ; 3dfe
|
2014-05-21 20:26:28 +00:00
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wChannel5Flags], a
|
|
|
|
ld [wSoundInput], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ld [rNR10], a
|
|
|
|
ld [rNR11], a
|
|
|
|
ld [rNR12], a
|
|
|
|
ld [rNR13], a
|
|
|
|
ld [rNR14], a
|
|
|
|
ret
|
|
|
|
; 3e10
|
|
|
|
|
|
|
|
|
|
|
|
ChannelsOff:: ; 3e10
|
|
|
|
; Quickly turn off music channels
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wChannel1Flags], a
|
|
|
|
ld [wChannel2Flags], a
|
|
|
|
ld [wChannel3Flags], a
|
|
|
|
ld [wChannel4Flags], a
|
|
|
|
ld [wSoundInput], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ret
|
|
|
|
; 3e21
|
|
|
|
|
|
|
|
SFXChannelsOff:: ; 3e21
|
|
|
|
; Quickly turn off sound effect channels
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wChannel5Flags], a
|
|
|
|
ld [wChannel6Flags], a
|
|
|
|
ld [wChannel7Flags], a
|
|
|
|
ld [wChannel8Flags], a
|
|
|
|
ld [wSoundInput], a
|
2014-05-21 20:26:28 +00:00
|
|
|
ret
|
|
|
|
; 3e32
|