Fix pokeflute in battle sfx

and other small improvements
This commit is contained in:
dannye 2021-03-28 23:23:45 -05:00
parent 5f87413b23
commit c1278c478e
28 changed files with 108 additions and 131 deletions

View file

@ -117,6 +117,9 @@ INCLUDE "audio/sfx/battle_36.asm"
INCLUDE "audio/sfx/level_up.asm"
INCLUDE "audio/sfx/caught_mon.asm"
INCLUDE "audio/sfx/pokeflute_ch5_ch6.asm"
INCLUDE "audio/sfx/pokeflute_ch7.asm"
SECTION "Sound Effects 3", ROMX
@ -151,16 +154,15 @@ INCLUDE "audio/pokedex_rating_sfx.asm"
SECTION "Audio Engine 1", ROMX
INCLUDE "crysaudio/engine.asm"
;INCLUDE "crysaudio/trainer_encounters.asm"
INCLUDE "crysaudio/red_pointers.asm"
INCLUDE "crysaudio/music_pointers_red.asm"
;INCLUDE "crysaudio/music_pointers.asm"
INCLUDE "crysaudio/music/nothing.asm"
INCLUDE "crysaudio/cry_pointers.asm"
INCLUDE "crysaudio/rbsfx.asm"
INCLUDE "crysaudio/sfx_pointers_red.asm"
;INCLUDE "crysaudio/sfx_pointers.asm"

View file

@ -163,7 +163,7 @@ Audio2_PlayNextNote:
ld a, c
cp Ch5
jr nz, .beginChecks
ld a, [wLowHealthAlarmOrig] ; low health alarm enabled?
ld a, [wLowHealthAlarm] ; low health alarm enabled?
bit 7, a
ret nz
.beginChecks
@ -976,7 +976,7 @@ Audio2_ResetCryModifiers:
ld a, c
cp Ch5
jr nz, .skip
ld a, [wLowHealthAlarmOrig]
ld a, [wLowHealthAlarm]
bit 7, a
jr z, .skip
xor a

View file

@ -165,3 +165,6 @@ SFX_Battle_36::
SFX_Silph_Scope::
audio_header SFX_Silph_Scope, Ch5
SFX_PokefluteInBattle::
audio_header SFX_PokefluteInBattle, Ch5, Ch6, Ch7

View file

@ -1,5 +1,5 @@
Music_DoLowHealthAlarm::
ld a, [wLowHealthAlarmOrig]
ld a, [wLowHealthAlarm]
cp $ff
jr z, .disableAlarm
@ -21,19 +21,19 @@ Music_DoLowHealthAlarm::
.asm_2138a
ld a, $86
ld [wChannelSoundIDs + Ch5], a ;disable sound channel?
ld a, [wLowHealthAlarmOrig]
ld a, [wLowHealthAlarm]
and $7f ;decrement alarm timer.
dec a
.asm_21395
; reset the timer and enable flag.
set 7, a
ld [wLowHealthAlarmOrig], a
ld [wLowHealthAlarm], a
ret
.disableAlarm
xor a
ld [wLowHealthAlarmOrig], a ;disable alarm
ld [wLowHealthAlarm], a ;disable alarm
ld [wChannelSoundIDs + Ch5], a ;re-enable sound channel?
ld de, .toneDataSilence
jr .playTone

View file

@ -1,7 +1,7 @@
PlayBattleMusic::
xor a
ld [wAudioFadeOutControl], a
ld [wLowHealthAlarmOrig], a
ld [wLowHealthAlarm], a
ld [wMusicFade], a
dec a ; SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a

View file

@ -21,7 +21,6 @@ PlayPokedexRatingSfx::
ld a, [hli]
ld c, [hl]
call PlaySound
call WaitForSoundToFinish
jp PlayDefaultMusic
PokedexRatingSfxPointers:

View file

@ -1,8 +1,8 @@
SFX_Pokeflute_Ch5:
SFX_PokefluteInBattle_Ch5:
tempo 256
SFX_Pokeflute_Ch6:
SFX_PokefluteInBattle_Ch6:
execute_music
note_type 8, 0, 0
rest 5

View file

@ -1,4 +1,4 @@
SFX_Pokeflute_Ch7:
SFX_PokefluteInBattle_Ch7:
execute_music
vibrato 16, 1, 4
note_type 8, 1, 0

View file

@ -214,6 +214,8 @@ const_value = 1
const SFX_SLOTS_NEW_SPIN
const SFX_SHOOTING_STAR
const SFX_POKEFLUTE_IN_BATTLE
const GSSFX_NOT_VERY_EFFECTIVE
const GSSFX_DAMAGE
const GSSFX_SUPER_EFFECTIVE

View file

@ -692,9 +692,9 @@ FadeMusic:
xor a
ld [wVolume], a
; did we just get on a bike?
ld a, [wWalkBikeSurfState] ; XXX
cp 1 ; PLAYER_BIKE
jr z, .bicycle
; ld a, [wPlayerState]
; cp PLAYER_BIKE
; jr z, .bicycle
push bc
; restart sound
call MusicFadeRestart

View file

@ -11,7 +11,6 @@ Music_PkmnHealed_Ch1::
;toggle_perfect_pitch
note_type 12, 8, 1
rest 2
octave 3
pitch_slide 1, 4, B_
note B_, 2
pitch_slide 1, 3, E_

View file

@ -112,6 +112,8 @@ SFX:
dba SFX_Slots_New_Spin
dba SFX_Shooting_Star
dba SFX_PokefluteInBattle
dba Sfx_NotVeryEffective
dba Sfx_Damage
dba Sfx_SuperEffective

View file

@ -1,75 +0,0 @@
; What music plays when a trainer notices you
TrainerEncounterMusic::
; entries correspond to trainer classes (see constants/trainer_constants.asm)
db MUSIC_HIKER_ENCOUNTER ; none
db MUSIC_YOUNGSTER_ENCOUNTER ; falkner
db MUSIC_LASS_ENCOUNTER ; whitney
db MUSIC_YOUNGSTER_ENCOUNTER ; bugsy
db MUSIC_OFFICER_ENCOUNTER ; morty
db MUSIC_OFFICER_ENCOUNTER ; pryce
db MUSIC_LASS_ENCOUNTER ; jasmine
db MUSIC_OFFICER_ENCOUNTER ; chuck
db MUSIC_BEAUTY_ENCOUNTER ; clair
db MUSIC_RIVAL_ENCOUNTER ; rival1
db MUSIC_HIKER_ENCOUNTER ; pokemon_prof
db MUSIC_HIKER_ENCOUNTER ; will
db MUSIC_HIKER_ENCOUNTER ; cal
db MUSIC_OFFICER_ENCOUNTER ; bruno
db MUSIC_HIKER_ENCOUNTER ; karen
db MUSIC_HIKER_ENCOUNTER ; koga
db MUSIC_OFFICER_ENCOUNTER ; champion
db MUSIC_YOUNGSTER_ENCOUNTER ; brock
db MUSIC_LASS_ENCOUNTER ; misty
db MUSIC_OFFICER_ENCOUNTER ; lt_surge
db MUSIC_ROCKET_ENCOUNTER ; scientist
db MUSIC_OFFICER_ENCOUNTER ; erika
db MUSIC_YOUNGSTER_ENCOUNTER ; youngster
db MUSIC_YOUNGSTER_ENCOUNTER ; schoolboy
db MUSIC_YOUNGSTER_ENCOUNTER ; bird_keeper
db MUSIC_LASS_ENCOUNTER ; lass
db MUSIC_LASS_ENCOUNTER ; janine
db MUSIC_HIKER_ENCOUNTER ; cooltrainerm
db MUSIC_BEAUTY_ENCOUNTER ; cooltrainerf
db MUSIC_BEAUTY_ENCOUNTER ; beauty
db MUSIC_POKEMANIAC_ENCOUNTER ; pokemaniac
db MUSIC_ROCKET_ENCOUNTER ; gruntm
db MUSIC_HIKER_ENCOUNTER ; gentleman
db MUSIC_BEAUTY_ENCOUNTER ; skier
db MUSIC_BEAUTY_ENCOUNTER ; teacher
db MUSIC_BEAUTY_ENCOUNTER ; sabrina
db MUSIC_YOUNGSTER_ENCOUNTER ; bug_catcher
db MUSIC_HIKER_ENCOUNTER ; fisher
db MUSIC_HIKER_ENCOUNTER ; swimmerm
db MUSIC_BEAUTY_ENCOUNTER ; swimmerf
db MUSIC_HIKER_ENCOUNTER ; sailor
db MUSIC_POKEMANIAC_ENCOUNTER ; super_nerd
db MUSIC_RIVAL_ENCOUNTER ; rival2
db MUSIC_HIKER_ENCOUNTER ; guitarist
db MUSIC_HIKER_ENCOUNTER ; hiker
db MUSIC_HIKER_ENCOUNTER ; biker
db MUSIC_OFFICER_ENCOUNTER ; blaine
db MUSIC_POKEMANIAC_ENCOUNTER ; burglar
db MUSIC_HIKER_ENCOUNTER ; firebreather
db MUSIC_POKEMANIAC_ENCOUNTER ; juggler
db MUSIC_HIKER_ENCOUNTER ; blackbelt_t
db MUSIC_ROCKET_ENCOUNTER ; executivem
db MUSIC_YOUNGSTER_ENCOUNTER ; psychic_t
db MUSIC_LASS_ENCOUNTER ; picnicker
db MUSIC_YOUNGSTER_ENCOUNTER ; camper
db MUSIC_ROCKET_ENCOUNTER ; executivef
db MUSIC_SAGE_ENCOUNTER ; sage
db MUSIC_SAGE_ENCOUNTER ; medium
db MUSIC_HIKER_ENCOUNTER ; boarder
db MUSIC_HIKER_ENCOUNTER ; pokefanm
db MUSIC_KIMONO_ENCOUNTER ; kimono_girl
db MUSIC_LASS_ENCOUNTER ; twins
db MUSIC_BEAUTY_ENCOUNTER ; pokefanf
db MUSIC_HIKER_ENCOUNTER ; red
db MUSIC_RIVAL_ENCOUNTER ; blue
db MUSIC_HIKER_ENCOUNTER ; officer
db MUSIC_ROCKET_ENCOUNTER ; gruntf
db MUSIC_HIKER_ENCOUNTER ; mysticalman
db MUSIC_HIKER_ENCOUNTER ; unused
db MUSIC_HIKER_ENCOUNTER ; unused
db MUSIC_HIKER_ENCOUNTER ; unused

View file

@ -2183,6 +2183,7 @@ GetMoveSound:
.next
ld a, [wEnemyMonSpecies]
.Continue
push af
ld a, 1
ld [wSFXDontWait], a
@ -2193,18 +2194,19 @@ GetMoveSound:
ld a, b
scf
ret
;push hl
;call GetCryData
;ld b, a
;pop hl
;ld a, [wFrequencyModifier]
;add [hl]
;ld [wFrequencyModifier], a
;inc hl
;ld a, [wTempoModifier]
;add [hl]
;ld [wTempoModifier], a
;jr .done
; push hl
; call GetCryData
; ld b, a
; pop hl
; ld a, [wFrequencyModifier]
; add [hl]
; ld [wFrequencyModifier], a
; inc hl
; ld a, [wTempoModifier]
; add [hl]
; ld [wTempoModifier], a
; jr .done
.NotCryMove
ld a, [hli]
ld [wFrequencyModifier], a

View file

@ -781,10 +781,16 @@ FaintEnemyPokemon:
ld [wTempoModifier], a
ld a, SFX_FAINT_FALL
call PlaySoundWaitForCurrent
; using WaitForSoundToFinish causes a noticeable delay
; so use a smaller hard-coded delay for now
ld c, 10
call DelayFrames
;.sfxwait
; ld a, [wChannelSoundIDs + Ch5]
; cp SFX_FAINT_FALL
; jr z, .sfxwait
ld a, SFX_FAINT_THUD
call PlaySound
call WaitForSoundToFinish

View file

@ -36,7 +36,12 @@ SafariZoneGameOver:
ld c, 0 ; BANK(SFX_Safari_Zone_PA)
ld a, SFX_SAFARI_ZONE_PA
call PlaySound
call WaitForSoundToFinish
;.waitForMusicToPlay
; ld a, [wChannelSoundIDs + Ch5]
; cp SFX_SAFARI_ZONE_PA
; jr nz, .waitForMusicToPlay
ld a, TEXT_SAFARI_GAME_OVER
ldh [hSpriteIndexOrTextID], a

View file

@ -1735,11 +1735,16 @@ ItemUsePokeflute:
and $80
jr nz, .skipMusic
call WaitForSoundToFinish ; wait for sound to end
;farcall Music_PokeFluteInBattle ; play in-battle pokeflute music ; XXX
ld a, SFX_POKEFLUTE_IN_BATTLE
call PlaySound
call WaitForSoundToFinish
; farcall Music_PokeFluteInBattle ; play in-battle pokeflute music
;.musicWaitLoop ; wait for music to finish playing
; ld a, [wChannelSoundIDs + Ch7]
; and a ; music off?
; jr nz, .musicWaitLoop
.skipMusic
ld hl, FluteWokeUpText
jp PrintText

View file

@ -147,6 +147,8 @@ HandlePokedexSideMenu:
call PlayCry
pop af
ld [wd11e], a
; call GetCryData
; call PlaySound
jr .handleMenuInput
.choseArea

View file

@ -58,6 +58,9 @@ AnimateHealingMachine:
ld a, [wChannel1MusicID]
and a
jr nz, .waitLoop2
; ld a, [wChannelSoundIDs]
; cp MUSIC_PKMN_HEALED ; is the healed music still playing?
; jr z, .waitLoop2 ; if so, check gain
ld c, 32
call DelayFrames

View file

@ -122,6 +122,7 @@ _LeaveMapAnim::
.playerNotStandingOnWarpPadOrHole
ld a, $4
call StopMusic
call WaitForSongToFinish
ld a, [wd732]
bit 6, a ; is the last used pokemon center the destination?
jr z, .flyAnimation

View file

@ -224,11 +224,12 @@ BillsPCDeposit:
jp c, BillsPCMenu
call DisplayDepositWithdrawMenu
jp nc, BillsPCMenu
call WaitForSoundToFinish
ld a, [wcf91]
call PlayCry
;call GetCryData
;call PlaySoundWaitForCurrent
; call GetCryData
; call PlaySoundWaitForCurrent
ld a, PARTY_TO_BOX
ld [wMoveMonType], a
call MoveMon
@ -278,11 +279,12 @@ BillsPCWithdraw:
ld a, [wWhichPokemon]
ld hl, wBoxMonNicks
call GetPartyMonName
call WaitForSoundToFinish
ld a, [wcf91]
call PlayCry
;call GetCryData
;call PlaySoundWaitForCurrent
; call GetCryData
; call PlaySoundWaitForCurrent
xor a ; BOX_TO_PARTY
ld [wMoveMonType], a
call MoveMon

View file

@ -61,14 +61,16 @@ PlayDefaultMusicCommon::
.next4
ld a, c
ld [wAudioFadeOutControl], a
and a
jr nz, .next5
inc a
.next5
ld [wMusicFade], a
ld a, b
ld [wLastMusicSoundID], a
ld [wNewSoundID], a
ld [wMusicFadeID], a
ld a, 8
ld [wMusicFade], a
;call FadeMusic ; called in updatemusic
ret
;UpdateMusic6Times::

View file

@ -760,6 +760,7 @@ HandleBlackOut::
call GBFadeOutToBlack
ld a, $08
call StopMusic
call WaitForSongToFinish
ld hl, wd72e
res 5, [hl]
ld a, BANK(ResetStatusAndHalveMoneyOnBlackout) ; also BANK(SpecialWarpIn) and BANK(SpecialEnterMap)
@ -1256,17 +1257,16 @@ CollisionCheckOnLand::
call CheckTilePassable
jr nc, .noCollision
.collision
;ld a, [wChannelSoundIDs + Ch5]
;cp SFX_COLLISION ; check if collision sound is already playing
;jr z, .setCarry
; curSFX is not cleared for some reason.
; ld a, [wChannelSoundIDs + Ch5]
; 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
@ -1945,17 +1945,16 @@ CollisionCheckOnWater::
jr z, .stopSurfing ; stop surfing if the tile is passable
jr .loop
.collision
;ld a, [wChannelSoundIDs + Ch5]
;cp SFX_COLLISION ; check if collision sound is already playing
;jr z, .setCarry
; curSFX is not cleared for some reason.
; ld a, [wChannelSoundIDs + Ch5]
; 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
@ -2307,6 +2306,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

View file

@ -65,6 +65,11 @@ PewterJigglypuffText:
call IsSongPlaying
pop hl
jr c, .spinMovementLoop
; ld a, [wChannelSoundIDs]
; ld b, a
; ld a, [wChannelSoundIDs + Ch2]
; or b
; jr nz, .spinMovementLoop
ld c, 48
call DelayFrames

View file

@ -31,7 +31,13 @@ MomHealPokemon:
ld a, MUSIC_PKMN_HEALED
ld [wNewSoundID], a
call PlayMusic
call WaitForSongToFinish
;.next
; ld a, [wChannelSoundIDs]
; cp MUSIC_PKMN_HEALED
; jr z, .next
ld a, [wMapMusicSoundID]
ld [wNewSoundID], a
call PlayMusic

View file

@ -57,7 +57,13 @@ SSAnne7RubText:
ld a, MUSIC_PKMN_HEALED
ld [wNewSoundID], a
call PlayMusic
call WaitForSongToFinish
;.asm_61910
; ld a, [wChannelSoundIDs]
; cp MUSIC_PKMN_HEALED
; jr z, .asm_61910
call PlayDefaultMusic
SetEvent EVENT_RUBBED_CAPTAINS_BACK
ld hl, wd72d

View file

@ -25,7 +25,7 @@ wTempoModifier::
wSFXDontWait:: ds 1
wMusic::
; crysaudio start
; nonzero if playing
wMusicPlaying:: db
@ -123,10 +123,7 @@ wCurSFX::
wAudioEnd::
wMapMusic:: db
;wDontPlayMapMusicOnReload:: db
wMusicEnd::
; crysaudio end
SECTION "Sprite State Data", WRAM0