mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-06 15:45:24 +13:00
Merge branch 'master' of https://github.com/dannye/pokered-crysaudio
This commit is contained in:
commit
8021cbdf04
530 changed files with 153841 additions and 14088 deletions
487
home/audio.asm
487
home/audio.asm
|
|
@ -32,26 +32,26 @@ PlayDefaultMusicCommon::
|
|||
|
||||
.next
|
||||
ld b, a
|
||||
ld a, d
|
||||
and a ; should current music be faded out first?
|
||||
ld a, BANK(Music_BikeRiding)
|
||||
jr nz, .next2
|
||||
; ld a, d
|
||||
; and a ; should current music be faded out first?
|
||||
; ld a, 0 ; BANK(Music_BikeRiding)
|
||||
; jr nz, .next2
|
||||
|
||||
; Only change the audio ROM bank if the current music isn't going to be faded
|
||||
; out before the default music begins.
|
||||
ld [wAudioROMBank], a
|
||||
; ld [wAudioROMBank], a
|
||||
|
||||
.next2
|
||||
;.next2
|
||||
; [wAudioSavedROMBank] will be copied to [wAudioROMBank] after fading out the
|
||||
; current music (if the current music is faded out).
|
||||
ld [wAudioSavedROMBank], a
|
||||
; ld [wAudioSavedROMBank], a
|
||||
jr .next3
|
||||
|
||||
.walking
|
||||
ld a, [wMapMusicSoundID]
|
||||
ld b, a
|
||||
call CompareMapMusicBankWithCurrentBank
|
||||
jr c, .next4
|
||||
; call CompareMapMusicBankWithCurrentBank
|
||||
; jr c, .next4
|
||||
|
||||
.next3
|
||||
ld a, [wLastMusicSoundID]
|
||||
|
|
@ -60,155 +60,376 @@ PlayDefaultMusicCommon::
|
|||
|
||||
.next4
|
||||
ld a, c
|
||||
ld [wAudioFadeOutControl], a
|
||||
ld [wMusicFade], a
|
||||
ld a, b
|
||||
ld [wLastMusicSoundID], a
|
||||
ld [wNewSoundID], a
|
||||
jp PlaySound
|
||||
ld [wMusicFadeID], a
|
||||
|
||||
UpdateMusic6Times::
|
||||
; This is called when entering a map, before fading out the current music and
|
||||
; playing the default music (i.e. the map's music or biking/surfing music).
|
||||
ld a, [wAudioROMBank]
|
||||
ld b, a
|
||||
cp BANK(Audio1_UpdateMusic)
|
||||
jr nz, .checkForAudio2
|
||||
; audio 1
|
||||
ld hl, Audio1_UpdateMusic
|
||||
jr .next
|
||||
; if no fade, play immediately
|
||||
ld a, [wMusicFade]
|
||||
and a
|
||||
jr nz, .next5
|
||||
ld a, b
|
||||
call PlayMusic
|
||||
.next5
|
||||
|
||||
.checkForAudio2
|
||||
cp BANK(Audio2_UpdateMusic)
|
||||
jr nz, .audio3
|
||||
; audio 2
|
||||
ld hl, Audio2_UpdateMusic
|
||||
jr .next
|
||||
|
||||
.audio3
|
||||
ld hl, Audio3_UpdateMusic
|
||||
|
||||
.next
|
||||
ld c, 6
|
||||
.loop
|
||||
push bc
|
||||
push hl
|
||||
call Bankswitch
|
||||
pop hl
|
||||
pop bc
|
||||
dec c
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
CompareMapMusicBankWithCurrentBank::
|
||||
; Compares the map music's audio ROM bank with the current audio ROM bank
|
||||
; and updates the audio ROM bank variables.
|
||||
; Returns whether the banks are different in carry.
|
||||
ld a, [wMapMusicROMBank]
|
||||
;UpdateMusic6Times::
|
||||
;CompareMapMusicBankWithCurrentBank:
|
||||
; ret
|
||||
|
||||
; plays music or SFX specified by a. If value is $ff, music is stopped
|
||||
PlaySound::
|
||||
push de
|
||||
cp $ff
|
||||
jr nz, .notff
|
||||
xor a
|
||||
call PlayMusic
|
||||
pop de
|
||||
ret
|
||||
.notff
|
||||
ld e, a
|
||||
ld a, [wAudioROMBank]
|
||||
cp e
|
||||
jr nz, .differentBanks
|
||||
ld [wAudioSavedROMBank], a
|
||||
and a
|
||||
xor a
|
||||
ld d, a
|
||||
call PlaySFX
|
||||
pop de
|
||||
ret
|
||||
.differentBanks
|
||||
ld a, c ; this is a fade-out counter value and it's always non-zero
|
||||
and a
|
||||
ld a, e
|
||||
jr nz, .next
|
||||
; If the fade-counter is non-zero, we don't change the audio ROM bank because
|
||||
; it's needed to keep playing the music as it fades out. The FadeOutAudio
|
||||
; routine will take care of copying [wAudioSavedROMBank] to [wAudioROMBank]
|
||||
; when the music has faded out.
|
||||
ld [wAudioROMBank], a
|
||||
.next
|
||||
ld [wAudioSavedROMBank], a
|
||||
scf
|
||||
|
||||
;InitSound::
|
||||
; push hl
|
||||
; push de
|
||||
; push bc
|
||||
; push af
|
||||
;
|
||||
; ldh a, [hLoadedROMBank]
|
||||
; push af
|
||||
; ld a, BANK(_InitSound)
|
||||
; ldh [hLoadedROMBank], a
|
||||
; ld [MBC1RomBank], a
|
||||
;
|
||||
; call _InitSound
|
||||
;
|
||||
; pop af
|
||||
; ldh [hLoadedROMBank], a
|
||||
; ld [MBC1RomBank], a
|
||||
;
|
||||
; pop af
|
||||
; pop bc
|
||||
; pop de
|
||||
; pop hl
|
||||
; ret
|
||||
|
||||
UpdateSound::
|
||||
; push hl
|
||||
; push de
|
||||
; push bc
|
||||
; push af
|
||||
|
||||
ldh a, [hLoadedROMBank]
|
||||
push af
|
||||
ld a, BANK(_UpdateSound)
|
||||
ldh [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
|
||||
call _UpdateSound
|
||||
|
||||
pop af
|
||||
ldh [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
|
||||
; pop af
|
||||
; pop bc
|
||||
; pop de
|
||||
; pop hl
|
||||
ret
|
||||
|
||||
_LoadMusicByte::
|
||||
; [wCurMusicByte] = [a:de]
|
||||
ldh [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
|
||||
ld a, [de]
|
||||
ld [wCurMusicByte], a
|
||||
ld a, BANK(LoadMusicByte)
|
||||
|
||||
ldh [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
ret
|
||||
|
||||
PlayMusic::
|
||||
ld b, a
|
||||
ld [wNewSoundID], a
|
||||
ld e, a
|
||||
xor a
|
||||
ld [wAudioFadeOutControl], a
|
||||
ld a, c
|
||||
ld [wAudioROMBank], a
|
||||
ld [wAudioSavedROMBank], a
|
||||
ld a, b
|
||||
ld d, a
|
||||
; Play music de.
|
||||
|
||||
; plays music specified by a. If value is $ff, music is stopped
|
||||
PlaySound::
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
ld b, a
|
||||
ld a, [wNewSoundID]
|
||||
and a
|
||||
jr z, .next
|
||||
xor a
|
||||
ld [wChannelSoundIDs + CHAN5], a
|
||||
ld [wChannelSoundIDs + CHAN6], a
|
||||
ld [wChannelSoundIDs + CHAN7], a
|
||||
ld [wChannelSoundIDs + CHAN8], a
|
||||
.next
|
||||
ld a, [wAudioFadeOutControl]
|
||||
and a ; has a fade-out length been specified?
|
||||
jr z, .noFadeOut
|
||||
ld a, [wNewSoundID]
|
||||
and a ; is the new sound ID 0?
|
||||
jr z, .done ; if so, do nothing
|
||||
xor a
|
||||
ld [wNewSoundID], a
|
||||
ld a, [wLastMusicSoundID]
|
||||
cp $ff ; has the music been stopped?
|
||||
jr nz, .fadeOut ; if not, fade out the current music
|
||||
; If it has been stopped, start playing the new music immediately.
|
||||
xor a
|
||||
ld [wAudioFadeOutControl], a
|
||||
.noFadeOut
|
||||
xor a
|
||||
ld [wNewSoundID], a
|
||||
push af
|
||||
|
||||
ldh a, [hLoadedROMBank]
|
||||
ldh [hSavedROMBank], a
|
||||
ld a, [wAudioROMBank]
|
||||
push af
|
||||
ld a, BANK(_PlayMusic) ; aka BANK(_InitSound)
|
||||
ldh [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
cp BANK(Audio1_PlaySound)
|
||||
jr nz, .checkForAudio2
|
||||
; audio 1
|
||||
ld a, b
|
||||
call Audio1_PlaySound
|
||||
jr .next2
|
||||
|
||||
.checkForAudio2
|
||||
cp BANK(Audio2_PlaySound)
|
||||
jr nz, .audio3
|
||||
; audio 2
|
||||
ld a, b
|
||||
call Audio2_PlaySound
|
||||
jr .next2
|
||||
ld a, e
|
||||
and a
|
||||
jr z, .nomusic
|
||||
|
||||
.audio3
|
||||
ld a, b
|
||||
call Audio3_PlaySound
|
||||
call _PlayMusic
|
||||
jr .end
|
||||
|
||||
.next2
|
||||
ldh a, [hSavedROMBank]
|
||||
.nomusic
|
||||
call _InitSound
|
||||
|
||||
.end
|
||||
pop af
|
||||
ldh [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
jr .done
|
||||
|
||||
.fadeOut
|
||||
ld a, b
|
||||
ld [wLastMusicSoundID], a
|
||||
ld a, [wAudioFadeOutControl]
|
||||
ld [wAudioFadeOutCounterReloadValue], a
|
||||
ld [wAudioFadeOutCounter], a
|
||||
ld a, b
|
||||
ld [wAudioFadeOutControl], a
|
||||
|
||||
.done
|
||||
pop af
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
|
||||
;PlayMusic2::
|
||||
; ld e, a
|
||||
; xor a
|
||||
; ld d, a
|
||||
; Stop playing music, then play music de.
|
||||
;
|
||||
; push hl
|
||||
; push de
|
||||
; push bc
|
||||
; push af
|
||||
;
|
||||
; ldh a, [hLoadedROMBank]
|
||||
; push af
|
||||
; ld a, BANK(_PlayMusic)
|
||||
; ldh [hLoadedROMBank], a
|
||||
; ld [MBC1RomBank], a
|
||||
;
|
||||
; push de
|
||||
; ld de, MUSIC_NONE
|
||||
; call _PlayMusic
|
||||
; call DelayFrame
|
||||
; pop de
|
||||
; call _PlayMusic
|
||||
;
|
||||
; pop af
|
||||
; ldh [hLoadedROMBank], a
|
||||
; ld [MBC1RomBank], a
|
||||
;
|
||||
; pop af
|
||||
; pop bc
|
||||
; pop de
|
||||
; pop hl
|
||||
; ret
|
||||
|
||||
PlayCry::
|
||||
; Play monster a's cry.
|
||||
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
push af
|
||||
|
||||
ld [wd11e], a
|
||||
predef IndexToPokedex
|
||||
ld a, [wd11e]
|
||||
dec a
|
||||
ld e, a
|
||||
ld d, 0
|
||||
|
||||
ldh a, [hLoadedROMBank]
|
||||
push af
|
||||
|
||||
; Cries are stuck in one bank.
|
||||
ld a, BANK(PokemonCries)
|
||||
ldh [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
|
||||
ld hl, PokemonCries
|
||||
rept 6 ; sizeof(mon_cry)
|
||||
add hl, de
|
||||
endr
|
||||
|
||||
ld e, [hl]
|
||||
inc hl
|
||||
ld d, [hl]
|
||||
inc hl
|
||||
|
||||
ld a, [hli]
|
||||
ld [wCryPitch], a
|
||||
ld a, [hli]
|
||||
ld [wCryPitch + 1], a
|
||||
ld a, [hli]
|
||||
ld [wCryLength], a
|
||||
ld a, [hl]
|
||||
ld [wCryLength + 1], a
|
||||
|
||||
ld a, BANK(_PlayCry)
|
||||
ldh [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
|
||||
call _PlayCry
|
||||
|
||||
pop af
|
||||
ldh [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
|
||||
call WaitForSoundToFinish
|
||||
|
||||
pop af
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
|
||||
PlayBattleSound::
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
push af
|
||||
|
||||
push af
|
||||
ld a, c
|
||||
ld [wCryPitch], a
|
||||
ld a, b
|
||||
ld [wCryPitch + 1], a
|
||||
ld a, e
|
||||
ld [wCryLength], a
|
||||
ld a, d
|
||||
ld [wCryLength + 1], a
|
||||
pop af
|
||||
|
||||
ld e, a
|
||||
xor a
|
||||
ld d, a
|
||||
|
||||
ldh a, [hLoadedROMBank]
|
||||
push af
|
||||
|
||||
ld a, BANK(_PlayBattleSound)
|
||||
ldh [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
|
||||
ld a, e
|
||||
ld [wCurSFX], a
|
||||
call _PlayBattleSound
|
||||
|
||||
pop af
|
||||
ldh [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
|
||||
pop af
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
|
||||
PlaySFX::
|
||||
; Play sound effect de.
|
||||
; Sound effects are ordered by priority (highest to lowest)
|
||||
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
push af
|
||||
|
||||
; Is something already playing?
|
||||
; call CheckSFX
|
||||
; jr nc, .play
|
||||
|
||||
; Does it have priority?
|
||||
; ld a, [wCurSFX]
|
||||
; cp e
|
||||
; jr c, .done
|
||||
|
||||
.play
|
||||
ldh a, [hLoadedROMBank]
|
||||
push af
|
||||
ld a, BANK(_PlaySFX)
|
||||
ldh [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
|
||||
ld a, e
|
||||
ld [wCurSFX], a
|
||||
call _PlaySFX
|
||||
|
||||
pop af
|
||||
ldh [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
|
||||
.done
|
||||
pop af
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
|
||||
PlaySoundWaitForCurrent::
|
||||
WaitPlaySFX::
|
||||
push af
|
||||
call WaitForSoundToFinish
|
||||
pop af
|
||||
jp PlaySound
|
||||
|
||||
; Wait for sound to finish playing
|
||||
WaitForSoundToFinish::
|
||||
WaitSFX::
|
||||
ld a, [wLowHealthAlarm]
|
||||
and a
|
||||
ret nz
|
||||
ld a, [wSFXDontWait]
|
||||
and a
|
||||
ret nz
|
||||
|
||||
; infinite loop until sfx is done playing
|
||||
|
||||
push hl
|
||||
|
||||
.wait
|
||||
ld hl, wChannel5Flags1
|
||||
bit 0, [hl]
|
||||
jr nz, .wait
|
||||
ld hl, wChannel6Flags1
|
||||
bit 0, [hl]
|
||||
jr nz, .wait
|
||||
ld hl, wChannel7Flags1
|
||||
bit 0, [hl]
|
||||
jr nz, .wait
|
||||
ld hl, wChannel8Flags1
|
||||
bit 0, [hl]
|
||||
jr nz, .wait
|
||||
|
||||
pop hl
|
||||
ret
|
||||
|
||||
WaitForSongToFinish::
|
||||
.loop
|
||||
call IsSongPlaying
|
||||
jr c, .loop
|
||||
ret
|
||||
|
||||
IsSongPlaying::
|
||||
; Return carry if any song channels are active.
|
||||
ld a, [wChannel1Flags1]
|
||||
bit 0, a
|
||||
jr nz, .playing
|
||||
ld a, [wChannel2Flags1]
|
||||
bit 0, a
|
||||
jr nz, .playing
|
||||
ld a, [wChannel3Flags1]
|
||||
bit 0, a
|
||||
jr nz, .playing
|
||||
ld a, [wChannel4Flags1]
|
||||
bit 0, a
|
||||
jr nz, .playing
|
||||
and a
|
||||
ret
|
||||
.playing
|
||||
scf
|
||||
ret
|
||||
|
|
|
|||
|
|
@ -4,28 +4,3 @@ DelayFrames::
|
|||
dec c
|
||||
jr nz, DelayFrames
|
||||
ret
|
||||
|
||||
PlaySoundWaitForCurrent::
|
||||
push af
|
||||
call WaitForSoundToFinish
|
||||
pop af
|
||||
jp PlaySound
|
||||
|
||||
; Wait for sound to finish playing
|
||||
WaitForSoundToFinish::
|
||||
ld a, [wLowHealthAlarm]
|
||||
and $80
|
||||
ret nz
|
||||
push hl
|
||||
.waitLoop
|
||||
ld hl, wChannelSoundIDs + CHAN5
|
||||
xor a
|
||||
or [hl]
|
||||
inc hl
|
||||
or [hl]
|
||||
inc hl
|
||||
inc hl
|
||||
or [hl]
|
||||
jr nz, .waitLoop
|
||||
pop hl
|
||||
ret
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
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
|
||||
|
|
@ -97,9 +97,9 @@ DEF rLCDC_DEFAULT EQU %11100011
|
|||
|
||||
predef LoadSGB
|
||||
|
||||
ld a, BANK(SFX_Shooting_Star)
|
||||
ld [wAudioROMBank], a
|
||||
ld [wAudioSavedROMBank], a
|
||||
; ld a, 0 ; BANK(SFX_Shooting_Star)
|
||||
; ld [wAudioROMBank], a
|
||||
; ld [wAudioSavedROMBank], a
|
||||
ld a, $9c
|
||||
ldh [hAutoBGTransferDest + 1], a
|
||||
xor a
|
||||
|
|
@ -126,12 +126,12 @@ ClearVram::
|
|||
|
||||
|
||||
StopAllSounds::
|
||||
ld a, BANK("Audio Engine 1")
|
||||
ld [wAudioROMBank], a
|
||||
ld [wAudioSavedROMBank], a
|
||||
; ld a, 0 ; BANK("Audio Engine 1")
|
||||
; ld [wAudioROMBank], a
|
||||
; ld [wAudioSavedROMBank], a
|
||||
xor a
|
||||
ld [wAudioFadeOutControl], a
|
||||
ld [wNewSoundID], a
|
||||
ld [wMusicFade], a
|
||||
ld [wMusicFadeID], a
|
||||
ld [wLastMusicSoundID], a
|
||||
dec a
|
||||
jp PlaySound
|
||||
|
|
|
|||
|
|
@ -794,12 +794,11 @@ HandleBlackOut::
|
|||
jp SpecialEnterMap
|
||||
|
||||
StopMusic::
|
||||
ld [wAudioFadeOutControl], a
|
||||
ld a, SFX_STOP_ALL_MUSIC
|
||||
ld [wNewSoundID], a
|
||||
call PlaySound
|
||||
ld [wMusicFade], a
|
||||
xor a
|
||||
ld [wMusicFadeID], a
|
||||
.wait
|
||||
ld a, [wAudioFadeOutControl]
|
||||
ld a, [wMusicFade]
|
||||
and a
|
||||
jr nz, .wait
|
||||
jp StopAllSounds
|
||||
|
|
@ -1267,9 +1266,16 @@ CollisionCheckOnLand::
|
|||
call CheckTilePassable
|
||||
jr nc, .noCollision
|
||||
.collision
|
||||
ld a, [wChannelSoundIDs + CHAN5]
|
||||
cp SFX_COLLISION ; check if collision sound is already playing
|
||||
jr z, .setCarry
|
||||
|
||||
; ld a, [wChannelSoundIDs + CHAN5]
|
||||
; cp SFX_COLLISION ; check if collision sound is already playing
|
||||
; jr z, .setCarry
|
||||
|
||||
; ch5 on?
|
||||
ld hl, wChannel5 + wChannel1Flags1 - wChannel1 ; + CHANNEL_FLAGS1
|
||||
bit 0, [hl]
|
||||
jr nz, .setCarry
|
||||
|
||||
ld a, SFX_COLLISION
|
||||
call PlaySound ; play collision sound (if it's not already playing)
|
||||
.setCarry
|
||||
|
|
@ -1948,9 +1954,16 @@ CollisionCheckOnWater::
|
|||
jr z, .stopSurfing ; stop surfing if the tile is passable
|
||||
jr .loop
|
||||
.collision
|
||||
ld a, [wChannelSoundIDs + CHAN5]
|
||||
cp SFX_COLLISION ; check if collision sound is already playing
|
||||
jr z, .setCarry
|
||||
|
||||
; ld a, [wChannelSoundIDs + CHAN5]
|
||||
; cp SFX_COLLISION ; check if collision sound is already playing
|
||||
; jr z, .setCarry
|
||||
|
||||
; ch5 on?
|
||||
ld hl, wChannel5 + wChannel1Flags1 - wChannel1 ; + CHANNEL_FLAGS1
|
||||
bit 0, [hl]
|
||||
jr nz, .setCarry
|
||||
|
||||
ld a, SFX_COLLISION
|
||||
call PlaySound ; play collision sound (if it's not already playing)
|
||||
.setCarry
|
||||
|
|
@ -2302,6 +2315,10 @@ LoadMapHeader::
|
|||
ld a, [hli]
|
||||
ld [wMapMusicSoundID], a ; music 1
|
||||
ld a, [hl]
|
||||
|
||||
; give vanilla red a fair shot at running our savs
|
||||
ld a, BANK("Audio Engine 1")
|
||||
|
||||
ld [wMapMusicROMBank], a ; music 2
|
||||
pop af
|
||||
ldh [hLoadedROMBank], a
|
||||
|
|
@ -2373,7 +2390,7 @@ LoadMapData::
|
|||
ld a, [wFlags_D733]
|
||||
bit 1, a
|
||||
jr nz, .restoreRomBank
|
||||
call UpdateMusic6Times
|
||||
; call UpdateMusic6Times
|
||||
call PlayDefaultMusicFadeOutCurrent
|
||||
.restoreRomBank
|
||||
pop af
|
||||
|
|
|
|||
|
|
@ -128,41 +128,41 @@ LoadFrontSpriteByMonIndex::
|
|||
ret
|
||||
|
||||
|
||||
PlayCry::
|
||||
;PlayCry::
|
||||
; Play monster a's cry.
|
||||
call GetCryData
|
||||
call PlaySound
|
||||
jp WaitForSoundToFinish
|
||||
; call GetCryData
|
||||
; call PlaySound
|
||||
; jp WaitForSoundToFinish
|
||||
|
||||
GetCryData::
|
||||
;GetCryData::
|
||||
; Load cry data for monster a.
|
||||
dec a
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, CryData
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
; dec a
|
||||
; ld c, a
|
||||
; ld b, 0
|
||||
; ld hl, CryData
|
||||
; add hl, bc
|
||||
; add hl, bc
|
||||
; add hl, bc
|
||||
|
||||
ld a, BANK(CryData)
|
||||
call BankswitchHome
|
||||
ld a, [hli]
|
||||
ld b, a ; cry id
|
||||
ld a, [hli]
|
||||
ld [wFrequencyModifier], a
|
||||
ld a, [hl]
|
||||
ld [wTempoModifier], a
|
||||
call BankswitchBack
|
||||
; ld a, BANK(CryData)
|
||||
; call BankswitchHome
|
||||
; ld a, [hli]
|
||||
; ld b, a ; cry id
|
||||
; ld a, [hli]
|
||||
; ld [wFrequencyModifier], a
|
||||
; ld a, [hl]
|
||||
; ld [wTempoModifier], a
|
||||
; call BankswitchBack
|
||||
|
||||
; Cry headers have 3 channels,
|
||||
; and start from index CRY_SFX_START,
|
||||
; so add 3 times the cry id.
|
||||
ld a, b
|
||||
ld c, CRY_SFX_START
|
||||
rlca ; * 2
|
||||
add b
|
||||
add c
|
||||
ret
|
||||
; ld a, b
|
||||
; ld c, CRY_SFX_START
|
||||
; rlca ; * 2
|
||||
; add b
|
||||
; add c
|
||||
; ret
|
||||
|
||||
DisplayPartyMenu::
|
||||
ldh a, [hTileAnimations]
|
||||
|
|
|
|||
|
|
@ -442,12 +442,12 @@ PlayTrainerMusic::
|
|||
and a
|
||||
ret nz
|
||||
xor a
|
||||
ld [wAudioFadeOutControl], a
|
||||
ld [wMusicFade], a
|
||||
ld a, SFX_STOP_ALL_MUSIC
|
||||
call PlaySound
|
||||
ld a, BANK(Music_MeetEvilTrainer)
|
||||
ld [wAudioROMBank], a
|
||||
ld [wAudioSavedROMBank], a
|
||||
; ld a, 0 ; BANK(Music_MeetEvilTrainer)
|
||||
; ld [wAudioROMBank], a
|
||||
; ld [wAudioSavedROMBank], a
|
||||
ld a, [wEngagedTrainerClass]
|
||||
ld b, a
|
||||
ld hl, EvilTrainerList
|
||||
|
|
@ -472,7 +472,7 @@ PlayTrainerMusic::
|
|||
.maleTrainer
|
||||
ld a, MUSIC_MEET_MALE_TRAINER
|
||||
.PlaySound
|
||||
ld [wNewSoundID], a
|
||||
jp PlaySound
|
||||
; ld [wNewSoundID], a
|
||||
jp PlayMusic
|
||||
|
||||
INCLUDE "data/trainers/encounter_types.asm"
|
||||
|
|
|
|||
|
|
@ -54,27 +54,28 @@ VBlank::
|
|||
ldh [hFrameCounter], a
|
||||
|
||||
.skipDec
|
||||
call FadeOutAudio
|
||||
call UpdateSound
|
||||
; call FadeOutAudio
|
||||
|
||||
ld a, [wAudioROMBank] ; music ROM bank
|
||||
ldh [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
; ld a, [wAudioROMBank] ; music ROM bank
|
||||
; ldh [hLoadedROMBank], a
|
||||
; ld [MBC1RomBank], a
|
||||
|
||||
cp BANK(Audio1_UpdateMusic)
|
||||
jr nz, .checkForAudio2
|
||||
.audio1
|
||||
call Audio1_UpdateMusic
|
||||
jr .afterMusic
|
||||
.checkForAudio2
|
||||
cp BANK(Audio2_UpdateMusic)
|
||||
jr nz, .audio3
|
||||
.audio2
|
||||
call Music_DoLowHealthAlarm
|
||||
call Audio2_UpdateMusic
|
||||
jr .afterMusic
|
||||
.audio3
|
||||
call Audio3_UpdateMusic
|
||||
.afterMusic
|
||||
; cp BANK(Audio1_UpdateMusic)
|
||||
; jr nz, .checkForAudio2
|
||||
;.audio1
|
||||
; call Audio1_UpdateMusic
|
||||
; jr .afterMusic
|
||||
;.checkForAudio2
|
||||
; cp BANK(Audio2_UpdateMusic)
|
||||
; jr nz, .audio3
|
||||
;.audio2
|
||||
; call Music_DoLowHealthAlarm
|
||||
; call Audio2_UpdateMusic
|
||||
; jr .afterMusic
|
||||
;.audio3
|
||||
; call Audio3_UpdateMusic
|
||||
;.afterMusic
|
||||
|
||||
farcall TrackPlayTime ; keep track of time played
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue