mirror of
https://github.com/pret/pokered.git
synced 2024-10-22 22:55:31 +00:00
bbf2f51a02
This results in 64 home/*.asm files, comparable to pokecrystal's 57.
48 lines
801 B
NASM
48 lines
801 B
NASM
FadeOutAudio::
|
|
ld a, [wAudioFadeOutControl]
|
|
and a ; currently fading out audio?
|
|
jr nz, .fadingOut
|
|
ld a, [wd72c]
|
|
bit 1, a
|
|
ret nz
|
|
ld a, $77
|
|
ldh [rNR50], a
|
|
ret
|
|
.fadingOut
|
|
ld a, [wAudioFadeOutCounter]
|
|
and a
|
|
jr z, .counterReachedZero
|
|
dec a
|
|
ld [wAudioFadeOutCounter], a
|
|
ret
|
|
.counterReachedZero
|
|
ld a, [wAudioFadeOutCounterReloadValue]
|
|
ld [wAudioFadeOutCounter], a
|
|
ldh a, [rNR50]
|
|
and a ; has the volume reached 0?
|
|
jr z, .fadeOutComplete
|
|
ld b, a
|
|
and $f
|
|
dec a
|
|
ld c, a
|
|
ld a, b
|
|
and $f0
|
|
swap a
|
|
dec a
|
|
swap a
|
|
or c
|
|
ldh [rNR50], a
|
|
ret
|
|
.fadeOutComplete
|
|
ld a, [wAudioFadeOutControl]
|
|
ld b, a
|
|
xor a
|
|
ld [wAudioFadeOutControl], a
|
|
ld a, SFX_STOP_ALL_MUSIC
|
|
ld [wNewSoundID], a
|
|
call PlaySound
|
|
ld a, [wAudioSavedROMBank]
|
|
ld [wAudioROMBank], a
|
|
ld a, b
|
|
ld [wNewSoundID], a
|
|
jp PlaySound
|