diff --git a/audio.asm b/audio.asm index 1b8ef00d..01ec22ec 100644 --- a/audio.asm +++ b/audio.asm @@ -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" diff --git a/audio/engine_2.asm b/audio/engine_2.asm index 3de43a70..51a5d7c4 100644 --- a/audio/engine_2.asm +++ b/audio/engine_2.asm @@ -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 diff --git a/audio/headers/sfxheaders2.asm b/audio/headers/sfxheaders2.asm index 0836a8e5..1acdd2fe 100644 --- a/audio/headers/sfxheaders2.asm +++ b/audio/headers/sfxheaders2.asm @@ -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 diff --git a/audio/low_health_alarm.asm b/audio/low_health_alarm.asm index 6584a889..a550cf70 100644 --- a/audio/low_health_alarm.asm +++ b/audio/low_health_alarm.asm @@ -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 diff --git a/audio/play_battle_music.asm b/audio/play_battle_music.asm index 6fbdb315..3f5ef611 100644 --- a/audio/play_battle_music.asm +++ b/audio/play_battle_music.asm @@ -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 diff --git a/audio/pokedex_rating_sfx.asm b/audio/pokedex_rating_sfx.asm index 4fa8cc04..2e0266f9 100644 --- a/audio/pokedex_rating_sfx.asm +++ b/audio/pokedex_rating_sfx.asm @@ -21,7 +21,6 @@ PlayPokedexRatingSfx:: ld a, [hli] ld c, [hl] call PlaySound - call WaitForSoundToFinish jp PlayDefaultMusic PokedexRatingSfxPointers: diff --git a/audio/sfx/pokeflute_ch5_ch6.asm b/audio/sfx/pokeflute_ch5_ch6.asm index 4f0e96a8..e28b9274 100644 --- a/audio/sfx/pokeflute_ch5_ch6.asm +++ b/audio/sfx/pokeflute_ch5_ch6.asm @@ -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 diff --git a/audio/sfx/pokeflute_ch7.asm b/audio/sfx/pokeflute_ch7.asm index 4435c0fb..c8048899 100644 --- a/audio/sfx/pokeflute_ch7.asm +++ b/audio/sfx/pokeflute_ch7.asm @@ -1,4 +1,4 @@ -SFX_Pokeflute_Ch7: +SFX_PokefluteInBattle_Ch7: execute_music vibrato 16, 1, 4 note_type 8, 1, 0 diff --git a/constants/music_constants.asm b/constants/music_constants.asm index c99e60bc..730c0b3e 100644 --- a/constants/music_constants.asm +++ b/constants/music_constants.asm @@ -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 diff --git a/crysaudio/engine.asm b/crysaudio/engine.asm index ee1e4a59..76dda12b 100644 --- a/crysaudio/engine.asm +++ b/crysaudio/engine.asm @@ -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 diff --git a/crysaudio/music/RBY/pkmnhealed.asm b/crysaudio/music/RBY/pkmnhealed.asm index ae025ac7..d9b2d4b0 100644 --- a/crysaudio/music/RBY/pkmnhealed.asm +++ b/crysaudio/music/RBY/pkmnhealed.asm @@ -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_ diff --git a/crysaudio/red_pointers.asm b/crysaudio/music_pointers_red.asm similarity index 100% rename from crysaudio/red_pointers.asm rename to crysaudio/music_pointers_red.asm diff --git a/crysaudio/rbsfx.asm b/crysaudio/sfx_pointers_red.asm similarity index 98% rename from crysaudio/rbsfx.asm rename to crysaudio/sfx_pointers_red.asm index 1213e3e1..f00e2a4d 100644 --- a/crysaudio/rbsfx.asm +++ b/crysaudio/sfx_pointers_red.asm @@ -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 diff --git a/crysaudio/trainer_encounters.asm b/crysaudio/trainer_encounters.asm deleted file mode 100644 index 2634e99d..00000000 --- a/crysaudio/trainer_encounters.asm +++ /dev/null @@ -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 diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 7456970f..ea7e7b02 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -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 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 4c55450e..08a05d3e 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -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 diff --git a/engine/events/hidden_objects/safari_game.asm b/engine/events/hidden_objects/safari_game.asm index f49cab97..bbb81a2c 100644 --- a/engine/events/hidden_objects/safari_game.asm +++ b/engine/events/hidden_objects/safari_game.asm @@ -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 diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index c49cc54b..204049a9 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -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 diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm index 651534a2..8dda4d1c 100644 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -147,6 +147,8 @@ HandlePokedexSideMenu: call PlayCry pop af ld [wd11e], a +; call GetCryData +; call PlaySound jr .handleMenuInput .choseArea diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index 94b5755d..8dfc8058 100644 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -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 diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index c458a013..2723bf9c 100644 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -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 diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 0b8fca3a..da10c686 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -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 diff --git a/home/audio.asm b/home/audio.asm index 50e88208..3dadf1fd 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -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:: diff --git a/home/overworld.asm b/home/overworld.asm index b3d964df..67c6067d 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -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 diff --git a/scripts/PewterPokecenter.asm b/scripts/PewterPokecenter.asm index 0687b845..4cb7b8b8 100644 --- a/scripts/PewterPokecenter.asm +++ b/scripts/PewterPokecenter.asm @@ -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 diff --git a/scripts/RedsHouse1F.asm b/scripts/RedsHouse1F.asm index 57d50cab..e353e7f1 100644 --- a/scripts/RedsHouse1F.asm +++ b/scripts/RedsHouse1F.asm @@ -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 diff --git a/scripts/SSAnneCaptainsRoom.asm b/scripts/SSAnneCaptainsRoom.asm index 8b458cc4..967b812b 100644 --- a/scripts/SSAnneCaptainsRoom.asm +++ b/scripts/SSAnneCaptainsRoom.asm @@ -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 diff --git a/wram.asm b/wram.asm index cdc76e35..0cf09860 100644 --- a/wram.asm +++ b/wram.asm @@ -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