Misc clean up and small improvements

This commit is contained in:
dannye 2021-03-28 02:23:54 -05:00
parent e8dd755e18
commit 459b5bd615
25 changed files with 326 additions and 160 deletions

141
audio.asm
View file

@ -13,18 +13,24 @@ INCLUDE "audio/headers/sfxheaders2.asm"
SECTION "Sound Effect Headers 3", ROMX
INCLUDE "audio/headers/sfxheaders3.asm"
SECTION "Sound Effects 1", ROMX
INCLUDE "audio/sfx/get_item1_1.asm"
INCLUDE "audio/sfx/get_item2_1.asm"
INCLUDE "audio/sfx/tink_1.asm"
INCLUDE "audio/sfx/heal_hp_1.asm"
INCLUDE "audio/sfx/heal_ailment_1.asm"
INCLUDE "audio/sfx/start_menu_1.asm"
INCLUDE "audio/sfx/pokeflute.asm"
INCLUDE "audio/sfx/cut_1.asm"
INCLUDE "audio/sfx/go_inside_1.asm"
INCLUDE "audio/sfx/swap_1.asm"
INCLUDE "audio/sfx/tink_1.asm"
INCLUDE "audio/sfx/59_1.asm"
INCLUDE "audio/sfx/purchase_1.asm"
INCLUDE "audio/sfx/collision_1.asm"
INCLUDE "audio/sfx/go_outside_1.asm"
INCLUDE "audio/sfx/press_ab_1.asm"
INCLUDE "audio/sfx/pokedex_rating_1.asm"
INCLUDE "audio/sfx/get_key_item_1.asm"
INCLUDE "audio/sfx/save_1.asm"
INCLUDE "audio/sfx/heal_hp_1.asm"
INCLUDE "audio/sfx/poisoned_1.asm"
INCLUDE "audio/sfx/heal_ailment_1.asm"
INCLUDE "audio/sfx/trade_machine_1.asm"
INCLUDE "audio/sfx/turn_on_pc_1.asm"
INCLUDE "audio/sfx/turn_off_pc_1.asm"
@ -43,26 +49,22 @@ INCLUDE "audio/sfx/arrow_tiles_1.asm"
INCLUDE "audio/sfx/push_boulder_1.asm"
INCLUDE "audio/sfx/ss_anne_horn_1.asm"
INCLUDE "audio/sfx/withdraw_deposit_1.asm"
INCLUDE "audio/sfx/cut_1.asm"
INCLUDE "audio/sfx/go_inside_1.asm"
INCLUDE "audio/sfx/swap_1.asm"
INCLUDE "audio/sfx/59_1.asm"
INCLUDE "audio/sfx/purchase_1.asm"
INCLUDE "audio/sfx/collision_1.asm"
INCLUDE "audio/sfx/go_outside_1.asm"
INCLUDE "audio/sfx/save_1.asm"
INCLUDE "audio/sfx/pokeflute.asm"
INCLUDE "audio/sfx/safari_zone_pa.asm"
INCLUDE "audio/sfx/get_item1_1.asm"
INCLUDE "audio/sfx/pokedex_rating_1.asm"
INCLUDE "audio/sfx/get_item2_1.asm"
INCLUDE "audio/sfx/get_key_item_1.asm"
SECTION "Sound Effects 2", ROMX
INCLUDE "audio/sfx/level_up.asm"
INCLUDE "audio/sfx/silph_scope.asm"
INCLUDE "audio/sfx/ball_toss.asm"
INCLUDE "audio/sfx/ball_poof.asm"
INCLUDE "audio/sfx/faint_thud.asm"
INCLUDE "audio/sfx/run.asm"
INCLUDE "audio/sfx/dex_page_added.asm"
INCLUDE "audio/sfx/caught_mon.asm"
INCLUDE "audio/sfx/peck.asm"
INCLUDE "audio/sfx/faint_fall.asm"
INCLUDE "audio/sfx/battle_09.asm"
@ -111,7 +113,10 @@ INCLUDE "audio/sfx/battle_33.asm"
INCLUDE "audio/sfx/battle_34.asm"
INCLUDE "audio/sfx/battle_35.asm"
INCLUDE "audio/sfx/battle_36.asm"
INCLUDE "audio/sfx/silph_scope.asm"
INCLUDE "audio/sfx/level_up.asm"
INCLUDE "audio/sfx/caught_mon.asm"
SECTION "Sound Effects 3", ROMX
@ -184,6 +189,7 @@ SECTION "Songs 2", ROMX
inc_section "crysaudio/music/route3.asm"
inc_section "crysaudio/music/route12.asm"
inc_section "crysaudio/music/kantogymbattle.asm"
inc_section "crysaudio/music/kantotrainerbattle.asm"
inc_section "crysaudio/music/kantowildbattle.asm"
inc_section "crysaudio/music/pokemoncenter.asm"
inc_section "crysaudio/music/looklass.asm"
@ -278,7 +284,6 @@ SECTION "Songs 5", ROMX
inc_section "crysaudio/music/suicunebattle.asm"
inc_section "crysaudio/music/battletowerlobby.asm"
inc_section "crysaudio/music/mobilecenter.asm"
inc_section "crysaudio/music/kantotrainerbattle.asm"
SECTION "Extra Songs 1", ROMX
@ -287,6 +292,7 @@ SECTION "Extra Songs 1", ROMX
inc_section "crysaudio/music/clair.asm"
inc_section "crysaudio/music/mobileadapter.asm"
SECTION "Extra Songs 2", ROMX
inc_section "crysaudio/music/postcredits.asm"
@ -294,35 +300,6 @@ SECTION "Extra Songs 2", ROMX
SECTION "RBY Songs 1", ROMX
inc_section "crysaudio/music/RBY/bikeriding.asm"
inc_section "crysaudio/music/RBY/dungeon1.asm"
inc_section "crysaudio/music/RBY/gamecorner.asm"
inc_section "crysaudio/music/RBY/titlescreen.asm"
inc_section "crysaudio/music/RBY/dungeon2.asm"
inc_section "crysaudio/music/RBY/dungeon3.asm"
inc_section "crysaudio/music/RBY/cinnabarmansion.asm"
inc_section "crysaudio/music/RBY/oakslab.asm"
inc_section "crysaudio/music/RBY/pokemontower.asm"
inc_section "crysaudio/music/RBY/silphco.asm"
inc_section "crysaudio/music/RBY/meeteviltrainer.asm"
inc_section "crysaudio/music/RBY/meetfemaletrainer.asm"
inc_section "crysaudio/music/RBY/meetmaletrainer.asm"
inc_section "crysaudio/music/RBY/introbattle.asm"
inc_section "crysaudio/music/RBY/surfing.asm"
inc_section "crysaudio/music/RBY/jigglypuffsong.asm"
inc_section "crysaudio/music/RBY/halloffame.asm"
inc_section "crysaudio/music/RBY/credits.asm"
inc_section "crysaudio/music/RBY/gymleaderbattle.asm"
inc_section "crysaudio/music/RBY/trainerbattle.asm"
inc_section "crysaudio/music/RBY/wildbattle.asm"
inc_section "crysaudio/music/RBY/finalbattle.asm"
SECTION "RBY Songs 2", ROMX
inc_section "crysaudio/music/RBY/defeatedtrainer.asm"
inc_section "crysaudio/music/RBY/defeatedwildmon.asm"
inc_section "crysaudio/music/RBY/defeatedgymleader.asm"
inc_section "crysaudio/music/RBY/pkmnhealed.asm"
inc_section "crysaudio/music/RBY/routes1.asm"
inc_section "crysaudio/music/RBY/routes2.asm"
@ -344,13 +321,51 @@ SECTION "RBY Songs 2", ROMX
inc_section "crysaudio/music/RBY/safarizone.asm"
inc_section "crysaudio/music/RBY/gym.asm"
inc_section "crysaudio/music/RBY/pokecenter.asm"
SECTION "RBY Songs 2", ROMX
inc_section "crysaudio/music/RBY/gymleaderbattle.asm"
inc_section "crysaudio/music/RBY/trainerbattle.asm"
inc_section "crysaudio/music/RBY/wildbattle.asm"
inc_section "crysaudio/music/RBY/finalbattle.asm"
inc_section "crysaudio/music/RBY/defeatedtrainer.asm"
inc_section "crysaudio/music/RBY/defeatedwildmon.asm"
inc_section "crysaudio/music/RBY/defeatedgymleader.asm"
SECTION "RBY Songs 3", ROMX
inc_section "crysaudio/music/RBY/bikeriding.asm"
inc_section "crysaudio/music/RBY/dungeon1.asm"
inc_section "crysaudio/music/RBY/gamecorner.asm"
inc_section "crysaudio/music/RBY/titlescreen.asm"
inc_section "crysaudio/music/RBY/dungeon2.asm"
inc_section "crysaudio/music/RBY/dungeon3.asm"
inc_section "crysaudio/music/RBY/cinnabarmansion.asm"
inc_section "crysaudio/music/RBY/oakslab.asm"
inc_section "crysaudio/music/RBY/pokemontower.asm"
inc_section "crysaudio/music/RBY/silphco.asm"
inc_section "crysaudio/music/RBY/meeteviltrainer.asm"
inc_section "crysaudio/music/RBY/meetfemaletrainer.asm"
inc_section "crysaudio/music/RBY/meetmaletrainer.asm"
inc_section "crysaudio/music/RBY/introbattle.asm"
inc_section "crysaudio/music/RBY/surfing.asm"
inc_section "crysaudio/music/RBY/jigglypuffsong.asm"
inc_section "crysaudio/music/RBY/halloffame.asm"
inc_section "crysaudio/music/RBY/credits.asm"
SECTION "RBY Songs 4", ROMX
inc_section "crysaudio/music/RBY/yellowintro.asm"
inc_section "crysaudio/music/RBY/surfingpikachu.asm"
inc_section "crysaudio/music/RBY/meetjessiejames.asm"
inc_section "crysaudio/music/RBY/yellowunusedsong.asm"
inc_section "crysaudio/music/RBY/meetjessiejames.asm"
SECTION "TCG Songs 1", ROMX
inc_section "crysaudio/music/TCG/titlescreen.asm"
inc_section "crysaudio/music/TCG/dueltheme1.asm"
inc_section "crysaudio/music/TCG/dueltheme2.asm"
@ -368,6 +383,7 @@ SECTION "TCG Songs 1", ROMX
SECTION "TCG Songs 2", ROMX
inc_section "crysaudio/music/TCG/ronald.asm"
inc_section "crysaudio/music/TCG/imakuni.asm"
inc_section "crysaudio/music/TCG/hallofhonor.asm"
@ -383,6 +399,7 @@ SECTION "TCG Songs 2", ROMX
SECTION "TCG2 Songs 1", ROMX
inc_section "crysaudio/music/TCG2/titlescreen.asm"
inc_section "crysaudio/music/TCG2/herecomesgr.asm"
inc_section "crysaudio/music/TCG2/groverworld.asm"
@ -395,6 +412,7 @@ SECTION "TCG2 Songs 1", ROMX
SECTION "TCG2 Songs 2", ROMX
inc_section "crysaudio/music/TCG2/gamecorner.asm"
inc_section "crysaudio/music/TCG2/grblimp.asm"
inc_section "crysaudio/music/TCG2/grdueltheme1.asm"
@ -404,6 +422,7 @@ SECTION "TCG2 Songs 2", ROMX
SECTION "TCG2 Songs 3", ROMX
inc_section "crysaudio/music/TCG2/imakuni2.asm"
inc_section "crysaudio/music/TCG2/credits.asm"
inc_section "crysaudio/music/TCG2/diddly1.asm"
@ -414,7 +433,8 @@ SECTION "TCG2 Songs 3", ROMX
inc_section "crysaudio/music/TCG2/diddly6.asm"
SECTION "Pinball Songs", ROMX
SECTION "Pinball Songs 1", ROMX
inc_section "crysaudio/music/pinball/redfield.asm"
inc_section "crysaudio/music/pinball/catchemred.asm"
inc_section "crysaudio/music/pinball/hurryupred.asm"
@ -423,22 +443,35 @@ SECTION "Gastly and Haunter Graveyard", ROMX
INCLUDE "crysaudio/music/pinball/gastlyinthegraveyard.asm"
INCLUDE "crysaudio/music/pinball/haunterinthegraveyard.asm"
inc_section "crysaudio/music/pinball/gengarinthegraveyard.asm"
SECTION "Pinball Songs 2", ROMX
inc_section "crysaudio/music/pinball/bluefield.asm"
inc_section "crysaudio/music/pinball/catchemblue.asm"
inc_section "crysaudio/music/pinball/hurryupblue.asm"
inc_section "crysaudio/music/pinball/hiscore.asm"
inc_section "crysaudio/music/pinball/gameover.asm"
SECTION "Pinball Songs 3", ROMX
inc_section "crysaudio/music/pinball/whackthediglett.asm"
inc_section "crysaudio/music/pinball/whackthedugtrio.asm"
SECTION "Pinball Songs 2", ROMX
inc_section "crysaudio/music/pinball/seelstage.asm"
inc_section "crysaudio/music/pinball/title.asm"
SECTION "Pinball Songs 4", ROMX
inc_section "crysaudio/music/pinball/mewtwostage.asm"
inc_section "crysaudio/music/pinball/options.asm"
inc_section "crysaudio/music/pinball/fieldselect.asm"
inc_section "crysaudio/music/pinball/meowthstage.asm"
SECTION "Pinball Songs 5", ROMX
inc_section "crysaudio/music/pinball/endcredits.asm"
inc_section "crysaudio/music/pinball/nameentry.asm"

View file

@ -1,29 +1,40 @@
; an alternate start for MeetRival which has a different first measure
Music_RivalAlternateStart::
ld c, 0 ; BANK(Music_MeetRival)
ld a, MUSIC_MEET_RIVAL
jp PlayMusic
;ld hl, wChannelCommandPointers
;ld de, Music_MeetRival_branch_b1a2
;call Audio1_OverwriteChannelPointer
;ld de, Music_MeetRival_branch_b21d
;call Audio1_OverwriteChannelPointer
;ld de, Music_MeetRival_branch_b2b5
; call PlayMusic
; ld hl, wChannelCommandPointers
; ld de, Music_MeetRival_branch_b1a2
; call Audio1_OverwriteChannelPointer
; ld de, Music_MeetRival_branch_b21d
; call Audio1_OverwriteChannelPointer
; ld de, Music_MeetRival_branch_b2b5
;Audio1_OverwriteChannelPointer:
; ld a, e
; ld [hli], a
; ld a, d
; ld [hli], a
; ret
; an alternate tempo for MeetRival which is slightly slower
Music_RivalAlternateTempo::
ld c, BANK(Music_MeetRival)
ld c, 0 ; BANK(Music_MeetRival)
ld a, MUSIC_MEET_RIVAL
jp PlayMusic
;ld hl, wChannelCommandPointers
;ld de, Music_MeetRival_branch_b119
;jp Audio1_OverwriteChannelPointer
; call PlayMusic
; ld hl, wChannelCommandPointers
; ld de, Music_MeetRival_branch_b119
; jp Audio1_OverwriteChannelPointer
; applies both the alternate start and alternate tempo
Music_RivalAlternateStartAndTempo::
jp Music_RivalAlternateStart
;ld hl, wChannelCommandPointers
;ld de, Music_MeetRival_branch_b19b
;jp Audio1_OverwriteChannelPointer
; call Music_RivalAlternateStart
; ld hl, wChannelCommandPointers
; ld de, Music_MeetRival_branch_b19b
; jp Audio1_OverwriteChannelPointer
; an alternate tempo for Cities1 which is used for the Hall of Fame room
Music_Cities1AlternateTempo::
@ -34,9 +45,10 @@ Music_Cities1AlternateTempo::
ld [wAudioFadeOutControl], a
ld c, 100
call DelayFrames ; wait for the fade-out to finish
ld c, BANK(Music_Cities1)
ld c, 0 ; BANK(Music_Cities1)
ld a, MUSIC_CITIES1
jp PlayMusic
;ld hl, wChannelCommandPointers
;ld de, Music_Cities1_branch_aa6f
;jp Audio1_OverwriteChannelPointer
; call PlayMusic
; ld hl, wChannelCommandPointers
; ld de, Music_Cities1_branch_aa6f
; jp Audio1_OverwriteChannelPointer

View file

@ -163,7 +163,7 @@ Audio2_PlayNextNote:
ld a, c
cp Ch5
jr nz, .beginChecks
ld a, [wLowHealthAlarm] ; low health alarm enabled?
ld a, [wLowHealthAlarmOrig] ; 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, [wLowHealthAlarm]
ld a, [wLowHealthAlarmOrig]
bit 7, a
jr z, .skip
xor a

View file

@ -1,5 +1,5 @@
Music_DoLowHealthAlarm::
ld a, [wLowHealthAlarm]
ld a, [wLowHealthAlarmOrig]
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, [wLowHealthAlarm]
ld a, [wLowHealthAlarmOrig]
and $7f ;decrement alarm timer.
dec a
.asm_21395
; reset the timer and enable flag.
set 7, a
ld [wLowHealthAlarm], a
ld [wLowHealthAlarmOrig], a
ret
.disableAlarm
xor a
ld [wLowHealthAlarm], a ;disable alarm
ld [wLowHealthAlarmOrig], a ;disable alarm
ld [wChannelSoundIDs + Ch5], a ;re-enable sound channel?
ld de, .toneDataSilence
jr .playTone

View file

@ -1,13 +1,13 @@
PlayBattleMusic::
xor a
ld [wAudioFadeOutControl], a
ld [wLowHealthAlarm], a
ld [wLowHealthAlarmOrig], a
ld [wMusicFade], a
dec a ; SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a
call PlayMusic
call DelayFrame
;ld c, BANK(Music_GymLeaderBattle)
ld c, 0 ; BANK(Music_GymLeaderBattle)
ld a, [wGymLeaderNo]
and a
jr z, .notGymLeaderBattle

View file

@ -25,13 +25,13 @@ PlayPokedexRatingSfx::
jp PlayDefaultMusic
PokedexRatingSfxPointers:
db SFX_DENIED, BANK(SFX_Denied_1)
db SFX_POKEDEX_RATING, BANK(SFX_Pokedex_Rating_1)
db SFX_GET_ITEM_1, BANK(SFX_Get_Item1_1)
db SFX_CAUGHT_MON, BANK(SFX_Caught_Mon)
db SFX_LEVEL_UP, BANK(SFX_Level_Up)
db SFX_GET_KEY_ITEM, BANK(SFX_Get_Key_Item_1)
db SFX_GET_ITEM_2, BANK(SFX_Get_Item2_1)
db SFX_DENIED, 0 ; BANK(SFX_Denied_1)
db SFX_POKEDEX_RATING, 0 ; BANK(SFX_Pokedex_Rating_1)
db SFX_GET_ITEM_1, 0 ; BANK(SFX_Get_Item1_1)
db SFX_CAUGHT_MON, 0 ; BANK(SFX_Caught_Mon)
db SFX_LEVEL_UP, 0 ; BANK(SFX_Level_Up)
db SFX_GET_KEY_ITEM, 0 ; BANK(SFX_Get_Key_Item_1)
db SFX_GET_ITEM_2, 0 ; BANK(SFX_Get_Item2_1)
OwnedMonValues:
db 10, 40, 60, 90, 120, 150, $ff

View file

@ -236,7 +236,7 @@ UpdateChannels:
dw .Channel8
.Channel1:
ld a, [wDanger] ; XXX
ld a, [wLowHealthAlarm]
bit DANGER_ON_F, a
ret nz
.Channel5:
@ -527,7 +527,7 @@ _CheckSFX:
ret
PlayDanger:
ld a, [wDanger] ; XXX
ld a, [wLowHealthAlarm]
bit DANGER_ON_F, a
ret z
@ -575,7 +575,7 @@ PlayDanger:
.noreset
; Make sure the danger sound is kept on
or 1 << DANGER_ON_F
ld [wDanger], a ; XXX
ld [wLowHealthAlarm], a
; Enable channel 1 if it's off
ld a, [wSoundOutput]

View file

@ -106,7 +106,7 @@ FIRST_MUSIC_CMD EQU const_value
const octave_cmd ; $d0
octave: MACRO
assert 0 < (\1) && (\1) <= 8, "octave must be 1-8"
assert 1 <= (\1) && (\1) <= 8, "octave must be 1-8"
db octave_cmd | 8 - (\1) ; octave
ENDM

View file

@ -633,17 +633,17 @@ Music_MewtwoStage_branch_49043:
sound_ret
; unreferenced
; note_type 2, 12, 8
; octave 3
; note B_, 1
; volume_envelope 10, 8
; note G_, 1
; volume_envelope 7, 8
; note D#, 1
; volume_envelope 4, 8
; octave 2
; note B_, 1
; sound_ret
note_type 2, 12, 8
octave 3
note B_, 1
volume_envelope 10, 8
note G_, 1
volume_envelope 7, 8
note D#, 1
volume_envelope 4, 8
octave 2
note B_, 1
sound_ret
Music_MewtwoStage_branch_49062:
note_type 3, 12, 8

View file

@ -1063,6 +1063,8 @@ Sfx_RegisterPhoneNumber_Ch5:
rest 8
sound_ret
toggle_sfx ; unused
Sfx_RegisterPhoneNumber_Ch6:
toggle_sfx
duty_cycle 3
@ -1085,6 +1087,8 @@ Sfx_RegisterPhoneNumber_Ch6:
rest 8
sound_ret
toggle_sfx ; unused
Sfx_RegisterPhoneNumber_Ch7:
toggle_sfx
note_type 12, 2, 5
@ -1104,6 +1108,8 @@ Sfx_RegisterPhoneNumber_Ch7:
rest 8
sound_ret
toggle_sfx ; unused
Sfx_RegisterPhoneNumber_Ch8:
toggle_sfx
sfx_toggle_noise 4
@ -1113,6 +1119,8 @@ Sfx_RegisterPhoneNumber_Ch8:
rest 16
sound_ret
toggle_sfx ; unused
Sfx_3rdPlace:
channel_count 3
channel 5, Sfx_3rdPlace_Ch5
@ -1136,6 +1144,8 @@ Sfx_3rdPlace_Ch5:
note D_, 6
sound_ret
toggle_sfx ; unused
Sfx_3rdPlace_Ch6:
toggle_sfx
duty_cycle 2
@ -1151,6 +1161,8 @@ Sfx_3rdPlace_Ch6:
note G_, 6
sound_ret
toggle_sfx ; unused
Sfx_3rdPlace_Ch7:
toggle_sfx
note_type 12, 2, 5
@ -1166,6 +1178,8 @@ Sfx_3rdPlace_Ch7:
note B_, 6
sound_ret
toggle_sfx ; unused
Sfx_GetEgg:
channel_count 4
channel 5, Sfx_GetEgg_Ch5
@ -1203,6 +1217,8 @@ Sfx_GetEgg_Ch5:
rest 9
sound_ret
toggle_sfx ; unused
Sfx_GetEgg_Ch6:
toggle_sfx
vibrato 18, 3, 4
@ -1230,6 +1246,8 @@ Sfx_GetEgg_Ch6:
rest 9
sound_ret
toggle_sfx ; unused
Sfx_GetEgg_Ch7:
toggle_sfx
note_type 8, 2, 5
@ -1247,6 +1265,8 @@ Sfx_GetEgg_Ch7:
rest 9
sound_ret
toggle_sfx ; unused
Sfx_GetEgg_Ch8:
toggle_sfx
sfx_toggle_noise 4
@ -1257,6 +1277,8 @@ Sfx_GetEgg_Ch8:
rest 12
sound_ret
toggle_sfx ; unused
Sfx_MoveDeleted:
channel_count 4
channel 5, Sfx_MoveDeleted_Ch5
@ -1292,6 +1314,8 @@ Sfx_MoveDeleted_Ch5:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_MoveDeleted_Ch6:
toggle_sfx
duty_cycle 3
@ -1326,6 +1350,8 @@ Sfx_MoveDeleted_Ch6:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_MoveDeleted_Ch7:
toggle_sfx
note_type 6, 2, 5
@ -1351,6 +1377,8 @@ Sfx_MoveDeleted_Ch7:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_MoveDeleted_Ch8:
toggle_sfx
sfx_toggle_noise 3
@ -1361,6 +1389,8 @@ Sfx_MoveDeleted_Ch8:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_2ndPlace:
channel_count 4
channel 5, Sfx_2ndPlace_Ch5
@ -1400,6 +1430,8 @@ Sfx_2ndPlace_Ch5:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_2ndPlace_Ch6:
toggle_sfx
duty_cycle 2
@ -1422,6 +1454,8 @@ Sfx_2ndPlace_Ch6:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_2ndPlace_Ch7:
toggle_sfx
note_type 8, 2, 5
@ -1458,6 +1492,8 @@ Sfx_2ndPlace_Ch7:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_2ndPlace_Ch8:
toggle_sfx
sfx_toggle_noise 3
@ -1471,6 +1507,8 @@ Sfx_2ndPlace_Ch8:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_1stPlace:
channel_count 4
channel 5, Sfx_1stPlace_Ch5
@ -1517,6 +1555,8 @@ Sfx_1stPlace_Ch5:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_1stPlace_Ch6:
toggle_sfx
duty_cycle 3
@ -1539,6 +1579,8 @@ Sfx_1stPlace_Ch6:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_1stPlace_Ch7:
toggle_sfx
note_type 12, 2, 5
@ -1561,6 +1603,8 @@ Sfx_1stPlace_Ch7:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_1stPlace_Ch8:
toggle_sfx
sfx_toggle_noise 4
@ -1580,6 +1624,8 @@ Sfx_1stPlace_Ch8:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_ChooseACard:
channel_count 4
channel 5, Sfx_ChooseACard_Ch5
@ -1631,6 +1677,8 @@ Sfx_ChooseACard_Ch5:
rest 12
sound_ret
toggle_sfx ; unused
Sfx_ChooseACard_Ch6:
toggle_sfx
duty_cycle 3
@ -1661,6 +1709,8 @@ Sfx_ChooseACard_Ch6:
rest 12
sound_ret
toggle_sfx ; unused
Sfx_ChooseACard_Ch7:
toggle_sfx
note_type 6, 2, 5
@ -1695,6 +1745,8 @@ Sfx_ChooseACard_Ch7:
rest 12
sound_ret
toggle_sfx ; unused
Sfx_ChooseACard_Ch8:
toggle_sfx
sfx_toggle_noise 4
@ -1718,6 +1770,8 @@ Sfx_ChooseACard_Ch8:
note B_, 16
sound_ret
toggle_sfx ; unused
Sfx_GetTm:
channel_count 4
channel 5, Sfx_GetTm_Ch5
@ -1749,6 +1803,8 @@ Sfx_GetTm_Ch5:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_GetTm_Ch6:
toggle_sfx
duty_cycle 3
@ -1770,6 +1826,8 @@ Sfx_GetTm_Ch6:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_GetTm_Ch7:
toggle_sfx
note_type 6, 2, 5
@ -1799,6 +1857,8 @@ Sfx_GetTm_Ch7:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_GetTm_Ch8:
toggle_sfx
sfx_toggle_noise 4
@ -1817,6 +1877,8 @@ Sfx_GetTm_Ch8:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_GetBadge:
channel_count 4
channel 5, Sfx_GetBadge_Ch5
@ -1843,6 +1905,8 @@ Sfx_GetBadge_Ch5:
rest 6
sound_ret
toggle_sfx ; unused
.sub1:
rest 5
octave 3
@ -1912,6 +1976,8 @@ Sfx_GetBadge_Ch6:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_GetBadge_Ch7:
toggle_sfx
note_type 6, 2, 5
@ -1949,6 +2015,8 @@ Sfx_GetBadge_Ch7:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_GetBadge_Ch8:
toggle_sfx
sfx_toggle_noise 4
@ -1973,6 +2041,8 @@ Sfx_GetBadge_Ch8:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_QuitSlots:
channel_count 4
channel 5, Sfx_QuitSlots_Ch5
@ -2010,6 +2080,8 @@ Sfx_QuitSlots_Ch5:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_QuitSlots_Ch6:
toggle_sfx
duty_cycle 2
@ -2035,6 +2107,8 @@ Sfx_QuitSlots_Ch6:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_QuitSlots_Ch7:
toggle_sfx
note_type 8, 2, 5
@ -2064,6 +2138,8 @@ Sfx_QuitSlots_Ch7:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_QuitSlots_Ch8:
toggle_sfx
sfx_toggle_noise 3
@ -2082,6 +2158,8 @@ Sfx_QuitSlots_Ch8:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_Protect:
channel_count 2
channel 5, Sfx_Protect_Ch5
@ -2970,6 +3048,8 @@ Sfx_DexFanfareLessThan20_Ch5:
note D_, 6
sound_ret
toggle_sfx ; unused
Sfx_DexFanfareLessThan20_Ch6:
toggle_sfx
note_type 8, 12, 1
@ -2987,6 +3067,8 @@ Sfx_DexFanfareLessThan20_Ch6:
note F#, 6
sound_ret
toggle_sfx ; unused
Sfx_DexFanfareLessThan20_Ch7:
toggle_sfx
note_type 8, 2, 5
@ -3013,6 +3095,8 @@ Sfx_DexFanfareLessThan20_Ch7:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_DexFanfareLessThan20_Ch8:
toggle_sfx
sfx_toggle_noise 4
@ -3022,6 +3106,8 @@ Sfx_DexFanfareLessThan20_Ch8:
rest 12
sound_ret
toggle_sfx ; unused
Sfx_DexFanfare140169:
channel_count 4
channel 5, Sfx_DexFanfare140169_Ch5
@ -3056,6 +3142,8 @@ Sfx_DexFanfare140169_Ch5:
rest 8
sound_ret
toggle_sfx ; unused
Sfx_DexFanfare140169_Ch6:
toggle_sfx
duty_cycle 2
@ -3080,6 +3168,8 @@ Sfx_DexFanfare140169_Ch6:
rest 8
sound_ret
toggle_sfx ; unused
Sfx_DexFanfare140169_Ch7:
toggle_sfx
note_type 12, 2, 5
@ -3112,6 +3202,8 @@ Sfx_DexFanfare140169_Ch7:
rest 4
sound_ret
toggle_sfx ; unused
Sfx_DexFanfare140169_Ch8:
toggle_sfx
sfx_toggle_noise 4
@ -3127,6 +3219,8 @@ Sfx_DexFanfare140169_Ch8:
note D_, 8
sound_ret
toggle_sfx ; unused
Sfx_DexFanfare170199:
channel_count 4
channel 5, Sfx_DexFanfare170199_Ch5
@ -3161,6 +3255,8 @@ Sfx_DexFanfare170199_Ch5:
rest 4
sound_ret
toggle_sfx ; unused
Sfx_DexFanfare170199_Ch6:
toggle_sfx
vibrato 18, 3, 4
@ -3187,6 +3283,8 @@ Sfx_DexFanfare170199_Ch6:
rest 4
sound_ret
toggle_sfx ; unused
Sfx_DexFanfare170199_Ch7:
toggle_sfx
note_type 8, 2, 5
@ -3213,6 +3311,8 @@ Sfx_DexFanfare170199_Ch7:
rest 4
sound_ret
toggle_sfx ; unused
Sfx_DexFanfare170199_Ch8:
toggle_sfx
sfx_toggle_noise 4
@ -3233,6 +3333,8 @@ Sfx_DexFanfare170199_Ch8:
note B_, 16
sound_ret
db sound_loop_cmd ; unused
Sfx_DexFanfare200229:
channel_count 4
channel 5, Sfx_DexFanfare200229_Ch5
@ -3265,6 +3367,8 @@ Sfx_DexFanfare200229_Ch5:
rest 4
sound_ret
toggle_sfx ; unused
Sfx_DexFanfare200229_Ch6:
toggle_sfx
vibrato 18, 3, 4
@ -3286,6 +3390,8 @@ Sfx_DexFanfare200229_Ch6:
rest 4
sound_ret
toggle_sfx ; unused
Sfx_DexFanfare200229_Ch7:
toggle_sfx
note_type 8, 2, 5
@ -3328,6 +3434,8 @@ Sfx_DexFanfare200229_Ch7:
rest 6
sound_ret
toggle_sfx ; unused
Sfx_DexFanfare200229_Ch8:
toggle_sfx
sfx_toggle_noise 4
@ -3355,6 +3463,8 @@ Sfx_DexFanfare200229_Ch8:
note B_, 12
sound_ret
toggle_sfx ; unused
Sfx_DexFanfare230Plus:
channel_count 4
channel 5, Sfx_DexFanfare230Plus_Ch5
@ -3408,6 +3518,8 @@ Sfx_DexFanfare230Plus_Ch5:
rest 2
sound_ret
toggle_sfx ; unused
Sfx_DexFanfare230Plus_Ch6:
toggle_sfx
vibrato 18, 3, 4
@ -3441,6 +3553,8 @@ Sfx_DexFanfare230Plus_Ch6:
rest 2
sound_ret
toggle_sfx ; unused
Sfx_DexFanfare230Plus_Ch7:
toggle_sfx
note_type 8, 2, 5
@ -3488,6 +3602,8 @@ Sfx_DexFanfare230Plus_Ch7:
rest 2
sound_ret
toggle_sfx ; unused
Sfx_DexFanfare230Plus_Ch8:
toggle_sfx
sfx_toggle_noise 4
@ -3522,6 +3638,8 @@ Sfx_DexFanfare230Plus_Ch8:
note D_, 6
sound_ret
toggle_sfx ; unused
Sfx_NotVeryEffective:
channel_count 1
channel 8, Sfx_NotVeryEffective_Ch8

View file

@ -16,7 +16,7 @@ PredefPointers::
add_predef ScaleSpriteByTwo
add_predef LoadMonBackPic
add_predef CopyDownscaledMonTiles
add_predef LoadMissableObjects ; add_predef JumpMoveEffect, $03 ; wrong bank
add_predef JumpMoveEffect, $03 ; wrong bank
add_predef HealParty
add_predef MoveAnimation
add_predef DivideBCDPredef

View file

@ -2618,7 +2618,7 @@ PlayApplyingAttackSound:
; play a different sound depending if move is not very effective, neutral, or super-effective
; don't play any sound at all if move is ineffective
call WaitForSoundToFinish
ld a, [wDamageMultipliers] ; effectiveness
ld a, [wDamageMultipliers]
and $7f
ret z
cp 10

View file

@ -865,7 +865,7 @@ EndLowHealthAlarm:
; This function is called when the player has the won the battle. It turns off
; the low health alarm and prevents it from reactivating until the next battle.
xor a
ld [wDanger], a ; turn off low health alarm
ld [wLowHealthAlarm], a ; turn off low health alarm
ld [wChannelSoundIDs + Ch5], a
inc a
ld [wLowHealthAlarmDisabled], a ; prevent it from reactivating
@ -1008,11 +1008,11 @@ RemoveFaintedPlayerMon:
predef FlagActionPredef ; clear gain exp flag for fainted mon
ld hl, wEnemyBattleStatus1
res 2, [hl] ; reset "attacking multiple times" flag
ld a, [wDanger]
ld a, [wLowHealthAlarm]
bit 7, a ; skip sound flag (red bar (?))
jr z, .skipWaitForSound
ld a, $ff
ld [wDanger], a ;disable low health alarm
ld [wLowHealthAlarm], a ;disable low health alarm
call WaitForSoundToFinish
.skipWaitForSound
; a is 0, so this zeroes the enemy's accumulated damage.
@ -1859,7 +1859,7 @@ DrawPlayerHUDAndHPBar:
cp HP_BAR_RED
jr z, .setLowHealthAlarm
.fainted
ld hl, wDanger
ld hl, wLowHealthAlarm
bit 7, [hl] ;low health alarm enabled?
ld [hl], $0
ret z
@ -1867,7 +1867,7 @@ DrawPlayerHUDAndHPBar:
ld [wChannelSoundIDs + Ch5], a
ret
.setLowHealthAlarm
ld hl, wDanger
ld hl, wLowHealthAlarm
set 7, [hl] ;enable low health alarm
ret

View file

@ -45,7 +45,7 @@ EndOfBattle:
predef EvolutionAfterBattle
.resetVariables
xor a
ld [wDanger], a ;disable low health alarm
ld [wLowHealthAlarm], a ;disable low health alarm
ld [wChannelSoundIDs + Ch5], a
ld [wIsInBattle], a
ld [wBattleType], a

View file

@ -990,7 +990,7 @@ ItemUseMedicine:
jp .cureStatusAilment
.notFullHP ; if the pokemon's current HP doesn't equal its max HP
xor a
ld [wDanger], a ;disable low health alarm
ld [wLowHealthAlarm], a ;disable low health alarm
ld [wChannelSoundIDs + Ch5], a
push hl
push de
@ -1731,7 +1731,7 @@ ItemUsePokeflute:
; if some pokemon were asleep
ld hl, PlayedFluteHadEffectText
call PrintText
ld a, [wDanger]
ld a, [wLowHealthAlarm]
and $80
jr nz, .skipMusic
call WaitForSoundToFinish ; wait for sound to end

View file

@ -7,7 +7,7 @@ EvolveMon:
ld a, [wd0b5]
push af
xor a
ld [wDanger], a
ld [wLowHealthAlarm], a
ld [wChannelSoundIDs + Ch5], a
dec a ; SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a

View file

@ -131,11 +131,15 @@ OakSpeech:
ld a, 0 ; BANK(Music_PalletTown)
ld [wAudioROMBank], a
ld [wAudioSavedROMBank], a
ld a, 10
ld [wAudioFadeOutControl], a
ld a, SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a
call PlaySound
call StopMusic
; ld a, 10
; ld [wAudioFadeOutControl], a
; ld a, SFX_STOP_ALL_MUSIC
; ld [wNewSoundID], a
; call PlaySound
pop af
ldh [hLoadedROMBank], a
ld [MBC1RomBank], a

View file

@ -182,9 +182,6 @@ ENDC
ret
.finishedBouncingPokemonLogo
xor a
ldh [hSCY], a
call LoadScreenTilesFromBuffer1
ld c, 36
call DelayFrames

View file

@ -1,7 +1,4 @@
AnimateHealingMachine:
xor a
call PlayMusic
ld de, PokeCenterFlashingMonitorAndHealBall
ld hl, vChars0 tile $7c
lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), 3 ; should be 2
@ -19,6 +16,9 @@ AnimateHealingMachine:
ld de, PokeCenterOAMData
call CopyHealingMachineOAM
ld a, 4
call StopMusic
call WaitForSongToFinish
; ld a, 4
; ld [wAudioFadeOutControl], a
; ld a, SFX_STOP_ALL_MUSIC

View file

@ -44,7 +44,7 @@ INCLUDE "data/items/marts.asm"
INCLUDE "home/overworld_text.asm"
INCLUDE "home/uncompress.asm"
INCLUDE "home/reset_player_sprite.asm"
INCLUDE "home/fade_audio.asm"
;INCLUDE "home/fade_audio.asm"
INCLUDE "home/text_script.asm"
INCLUDE "home/start_menu.asm"
INCLUDE "home/count_set_bits.asm"

View file

@ -51,7 +51,7 @@ PlayDefaultMusicCommon::
ld a, [wMapMusicSoundID]
ld b, a
; call CompareMapMusicBankWithCurrentBank
jr c, .next4
; jr c, .next4
.next3
ld a, [wLastMusicSoundID]
@ -100,7 +100,7 @@ OpenSRAMForSound::
ld [MBC1SRamBank], a
ret
;MapSetup_Sound_Off::
;InitSound::
; push hl
; push de
; push bc
@ -110,11 +110,11 @@ OpenSRAMForSound::
;
; ldh a, [hLoadedROMBank]
; push af
; ld a, BANK(_MapSetup_Sound_Off)
; ld a, BANK(_InitSound)
; ldh [hLoadedROMBank], a
; ld [MBC1RomBank], a
;
; call _MapSetup_Sound_Off
; call _InitSound
;
; pop af
; ldh [hLoadedROMBank], a
@ -155,7 +155,7 @@ UpdateSound::
ret
_LoadMusicByte::
; wCurMusicByte = [a:de]
; [wCurMusicByte] = [a:de]
ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
@ -300,7 +300,7 @@ endr
PlaySFX::
; Play sound effect de.
; Sound effects are ordered by priority (lowest to highest)
; Sound effects are ordered by priority (highest to lowest)
push hl
push de
@ -348,7 +348,7 @@ WaitPlaySFX::
; Wait for sound to finish playing
WaitForSoundToFinish::
WaitSFX::
ld a, [wDanger]
ld a, [wLowHealthAlarm]
and a
ret nz
ld a, [wSFXDontWait]

View file

@ -771,10 +771,9 @@ HandleBlackOut::
jp SpecialEnterMap
StopMusic::
ld [wMusicFade], a
xor a
ld [wMusicFadeID], a
ld a, 1
ld [wMusicFade], a
.wait0
ld a, [wMusicFadeCount]
and a

View file

@ -138,37 +138,41 @@ LoadFrontSpriteByMonIndex::
ret
; PlayCry
;PlayCry::
; Play monster a's cry.
; 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, $14 ; 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]

View file

@ -50,9 +50,9 @@ VBlank::
ldh [hFrameCounter], a
.skipDec
call UpdateSound
; call FadeOutAudio
call UpdateSound
; ld a, [wAudioROMBank] ; music ROM bank
; ldh [hLoadedROMBank], a
; ld [MBC1RomBank], a

View file

@ -1756,7 +1756,7 @@ wBaseCoordY::
; low health alarm counter/enable
; high bit = enable, others = timer to cycle frequencies
wLowHealthAlarm:: ds 1
wLowHealthAlarmOrig:: ds 1
wFBTileCounter::
; counts how many tiles of the current frame block have been drawn
@ -3254,8 +3254,7 @@ wNoiseSampleDelay:: db
wMusicNoiseSampleSet:: db
wSFXNoiseSampleSet:: db
;wLowHealthAlarm::
wDanger::
wLowHealthAlarm::
; bit 7: on/off
; bit 4: pitch
; bit 0-3: counter