From d84ebd212434dd754729543b257cd17fed9e54d4 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 29 Jul 2016 10:40:54 -0400 Subject: [PATCH] pitchoffset macro to replace forceoctave --- audio/engine.asm | 66 ++++++++++++++---------------- audio/music/clair.asm | 6 +-- audio/music/credits.asm | 16 ++++---- audio/music/evolution.asm | 8 ++-- audio/music/healpokemon.asm | 10 ++--- audio/music/kantotrainerbattle.asm | 6 +-- audio/music/kantowildbattle.asm | 16 ++++---- audio/music/lookofficer.asm | 4 +- audio/music/lookrocket.asm | 6 +-- audio/music/postcredits.asm | 4 +- audio/music/profoak.asm | 8 ++-- audio/music/ssaqua.asm | 4 +- audio/music/surf.asm | 4 +- audio/music/wildpokemonvictory.asm | 12 +++--- audio/sfx.asm | 4 +- audio/sfx_crystal.asm | 8 ++-- constants/audio_constants.asm | 1 + engine/events_3.asm | 2 +- macros/sound.asm | 10 ++--- macros/wram.asm | 2 +- maps/BattleTower1F.asm | 1 - text/trainer_class_names.asm | 2 +- 22 files changed, 97 insertions(+), 103 deletions(-) diff --git a/audio/engine.asm b/audio/engine.asm index a4a9ac62f..48571fdf4 100644 --- a/audio/engine.asm +++ b/audio/engine.asm @@ -231,7 +231,6 @@ UpdateChannels: ; e8125 ld l, a jp [hl] - .ChannelFnPtrs: dw .Channel1 dw .Channel2 @@ -643,7 +642,6 @@ FadeMusic: ; e8358 dec a jr .updatevolume - .novolume ; make sure volume is off xor a @@ -1211,8 +1209,6 @@ ParseMusic: ; e85e1 set NOTE_UNKN_4, [hl] jp LoadNote - - .rest ; note = rest ld hl, Channel1NoteFlags - Channel1 @@ -1220,7 +1216,6 @@ ParseMusic: ; e85e1 set NOTE_REST, [hl] ; Rest ret -; .endchannel ; $ff is reached in music data ld hl, Channel1Flags - Channel1 @@ -1808,10 +1803,12 @@ Music_SlidePitchTo: ; e88bd ld [wCurNoteDuration], a call GetMusicByte + ; pitch in e ld d, a and $f ld e, a + ; octave in d ld a, d swap a and $f @@ -2054,7 +2051,7 @@ Music_ForceOctave: ; e89b1 ; this forces all notes up by the starting octave ; params: 1 call GetMusicByte - ld hl, Channel1StartingOctave - Channel1 + ld hl, Channel1PitchOffset - Channel1 add hl, bc ld [hl], a ret @@ -2246,7 +2243,7 @@ GetFrequency: ; e8a5d ; get octave ; get starting octave - ld hl, Channel1StartingOctave - Channel1 + ld hl, Channel1PitchOffset - Channel1 add hl, bc ld a, [hl] swap a ; hi nybble @@ -2255,7 +2252,7 @@ GetFrequency: ; e8a5d add d push af ; we'll use this later ; get starting octave - ld hl, Channel1StartingOctave - Channel1 + ld hl, Channel1PitchOffset - Channel1 add hl, bc ld a, [hl] and $f ; lo nybble @@ -2573,7 +2570,6 @@ _PlayCryHeader:: ; e8b79 dec a jr nz, .loop - ; Cries play at max volume, so we save the current volume for later. ld a, [LastVolume] and a @@ -2693,7 +2689,6 @@ _PlaySFX:: ; e8c04 ; e8ca6 - PlayStereoSFX:: ; e8ca6 ; play sfx de @@ -2797,7 +2792,6 @@ PlayStereoSFX:: ; e8ca6 ; e8d1b - LoadChannel: ; e8d1b ; prep channel for use ; input: @@ -2889,31 +2883,31 @@ LoadMusicByte:: ; e8d76 ; e8d80 FrequencyTable: ; e8d80 - dw 0 ; filler - dw $f82c - dw $f89d - dw $f907 - dw $f96b - dw $f9ca - dw $fa23 - dw $fa77 - dw $fac7 - dw $fb12 - dw $fb58 - dw $fb9b - dw $fbda - dw $fc16 - dw $fc4e - dw $fc83 - dw $fcb5 - dw $fce5 - dw $fd11 - dw $fd3b - dw $fd63 - dw $fd89 - dw $fdac - dw $fdcd - dw $fded + dw 0 ; __ + dw $f82c ; C_ + dw $f89d ; C# + dw $f907 ; D_ + dw $f96b ; D# + dw $f9ca ; E_ + dw $fa23 ; F_ + dw $fa77 ; F# + dw $fac7 ; G_ + dw $fb12 ; G# + dw $fb58 ; A_ + dw $fb9b ; A# + dw $fbda ; B_ + dw $fc16 ; C_ + dw $fc4e ; C# + dw $fc83 ; D_ + dw $fcb5 ; D# + dw $fce5 ; E_ + dw $fd11 ; F_ + dw $fd3b ; F# + dw $fd63 ; G_ + dw $fd89 ; G# + dw $fdac ; A_ + dw $fdcd ; A# + dw $fded ; B_ ; e8db2 WaveSamples: ; e8db2 diff --git a/audio/music/clair.asm b/audio/music/clair.asm index d4ea143b3..bedfc4dee 100644 --- a/audio/music/clair.asm +++ b/audio/music/clair.asm @@ -207,9 +207,9 @@ Music_Clair_branch_1fb77: ; 1fb77 octave 3 note A#, 16 note __, 4 - forceoctave $c + pitchoffset 0, CC callchannel Music_Clair_branch_1fba6 - forceoctave $0 + pitchoffset 0, C_ octave 5 note F#, 2 note __, 4 @@ -254,7 +254,7 @@ Music_Clair_branch_1fba6: ; 1fba6 Music_Clair_Ch3: ; 1fbb9 notetype $c, $14 - forceoctave $c + pitchoffset 0, CC octave 3 note C#, 2 note __, 4 diff --git a/audio/music/credits.asm b/audio/music/credits.asm index 532faef70..708b70ee4 100644 --- a/audio/music/credits.asm +++ b/audio/music/credits.asm @@ -142,12 +142,12 @@ Music_Credits_Ch1: ; 1f328 note E_, 7 octave 3 note __, 1 - forceoctave $2 + pitchoffset 0, D_ callchannel Music_Credits_branch_1f483 callchannel Music_Credits_branch_1f4ed callchannel Music_Credits_branch_1f4f8 callchannel Music_Credits_branch_1f559 - forceoctave $0 + pitchoffset 0, C_ octave 3 note A_, 12 notetype $8, $a7 @@ -664,11 +664,11 @@ Music_Credits_Ch2: ; 1f58d note A_, 4 note G_, 4 notetype $6, $c7 - forceoctave $2 + pitchoffset 0, D_ callchannel Music_Credits_branch_1f6cb callchannel Music_Credits_branch_1f73f callchannel Music_Credits_branch_1f748 - forceoctave $0 + pitchoffset 0, C_ octave 5 note C#, 1 note D_, 11 @@ -1139,15 +1139,15 @@ Music_Credits_Ch3: ; 1f772 note F_, 1 note F#, 7 note G_, 8 - forceoctave $2 + pitchoffset 0, D_ callchannel Music_Credits_branch_1f8aa callchannel Music_Credits_branch_1f8db - forceoctave $12 + pitchoffset 1, D_ callchannel Music_Credits_branch_1f8e7 - forceoctave $2 + pitchoffset 0, D_ callchannel Music_Credits_branch_1f934 callchannel Music_Credits_branch_1f94b - forceoctave $0 + pitchoffset 0, C_ octave 6 note C#, 2 octave 5 diff --git a/audio/music/evolution.asm b/audio/music/evolution.asm index 6d30ca176..61f7af716 100644 --- a/audio/music/evolution.asm +++ b/audio/music/evolution.asm @@ -13,13 +13,13 @@ Music_Evolution_Ch1: ; f06ed dutycycle $2 notetype $c, $92 octave 3 - slidepitchto 0, 4, A_ + slidepitchto 1, 4, A_ note C_, 1 - slidepitchto 0, 4, A_ + slidepitchto 1, 4, A_ note G_, 1 - slidepitchto 0, 4, A_ + slidepitchto 1, 4, A_ note C_, 1 - slidepitchto 0, 4, A_ + slidepitchto 1, 4, A_ note G_, 1 note __, 4 dutycycle $3 diff --git a/audio/music/healpokemon.asm b/audio/music/healpokemon.asm index 50963304c..264d3db78 100644 --- a/audio/music/healpokemon.asm +++ b/audio/music/healpokemon.asm @@ -11,16 +11,16 @@ Music_HealPokemon_Ch1: ; f06a0 tone $0001 notetype $c, $81 note __, 2 - slidepitchto 0, 4, __ + slidepitchto 1, 4, __ note B_, 2 - slidepitchto 0, 5, E_ + slidepitchto 1, 5, E_ note B_, 2 - slidepitchto 0, 4, E_ + slidepitchto 1, 4, E_ note E_, 2 note __, 4 - slidepitchto 0, 3, __ + slidepitchto 1, 3, __ note E_, 4 - slidepitchto 0, 4, __ + slidepitchto 1, 4, __ note B_, 4 endchannel ; f06c4 diff --git a/audio/music/kantotrainerbattle.asm b/audio/music/kantotrainerbattle.asm index fa21746db..10c1e7c0e 100644 --- a/audio/music/kantotrainerbattle.asm +++ b/audio/music/kantotrainerbattle.asm @@ -9,7 +9,7 @@ Music_KantoTrainerBattle: ; ec9fa Music_KantoTrainerBattle_Ch1: ; eca04 tempo 114 volume $77 - forceoctave $1b + pitchoffset 1, B_ notetype $c, $b3 vibrato $12, $24 dutycycle $1 @@ -467,7 +467,7 @@ Music_KantoTrainerBattle_branch_eca88: ; eca88 ; ecbea Music_KantoTrainerBattle_Ch2: ; ecbea - forceoctave $1b + pitchoffset 1, B_ vibrato $6, $36 dutycycle $1 notetype $c, $d1 @@ -920,7 +920,7 @@ Music_KantoTrainerBattle_branch_ecc41: ; ecc41 ; ecdd2 Music_KantoTrainerBattle_Ch3: ; ecdd2 - forceoctave $1b + pitchoffset 1, B_ vibrato $12, $23 notetype $c, $15 octave 2 diff --git a/audio/music/kantowildbattle.asm b/audio/music/kantowildbattle.asm index 5737f643b..7f4f6e174 100644 --- a/audio/music/kantowildbattle.asm +++ b/audio/music/kantowildbattle.asm @@ -327,17 +327,17 @@ Music_KantoWildBattle_branch_ed1c8: ; ed1c8 notetype $6, $b7 callchannel Music_KantoWildBattle_branch_ed307 callchannel Music_KantoWildBattle_branch_ed307 - forceoctave $1 + pitchoffset 0, C# callchannel Music_KantoWildBattle_branch_ed307 callchannel Music_KantoWildBattle_branch_ed307 - forceoctave $0 + pitchoffset 0, C_ rept 4 callchannel Music_KantoWildBattle_branch_ed307 endr - forceoctave $1 + pitchoffset 0, C# callchannel Music_KantoWildBattle_branch_ed307 callchannel Music_KantoWildBattle_branch_ed307 - forceoctave $0 + pitchoffset 0, C_ callchannel Music_KantoWildBattle_branch_ed307 callchannel Music_KantoWildBattle_branch_ed307 note __, 16 @@ -384,9 +384,9 @@ endr note G#, 1 notetype $6, $b7 callchannel Music_KantoWildBattle_branch_ed31b - forceoctave $1 + pitchoffset 0, C# callchannel Music_KantoWildBattle_branch_ed31b - forceoctave $0 + pitchoffset 0, C_ callchannel Music_KantoWildBattle_branch_ed340 octave 2 note C_, 2 @@ -450,9 +450,9 @@ endr callchannel Music_KantoWildBattle_branch_ed354 callchannel Music_KantoWildBattle_branch_ed340 callchannel Music_KantoWildBattle_branch_ed354 - forceoctave $1 + pitchoffset 0, C# callchannel Music_KantoWildBattle_branch_ed340 - forceoctave $0 + pitchoffset 0, C_ note C#, 2 note __, 2 octave 3 diff --git a/audio/music/lookofficer.asm b/audio/music/lookofficer.asm index f0eb3af1e..a8667afdb 100644 --- a/audio/music/lookofficer.asm +++ b/audio/music/lookofficer.asm @@ -73,9 +73,9 @@ Music_LookOfficer_branch_ed882: ; ed882 note E_, 2 note G#, 2 loopchannel 2, Music_LookOfficer_branch_ed882 - forceoctave $1 + pitchoffset 0, C# callchannel Music_LookOfficer_branch_ed89e - forceoctave $0 + pitchoffset 0, C_ callchannel Music_LookOfficer_branch_ed89e loopchannel 0, Music_LookOfficer_branch_ed882 ; ed89e diff --git a/audio/music/lookrocket.asm b/audio/music/lookrocket.asm index 3ee5f3a5c..518a9b7e0 100644 --- a/audio/music/lookrocket.asm +++ b/audio/music/lookrocket.asm @@ -8,7 +8,7 @@ Music_LookRocket: ; f74a2 Music_LookRocket_Ch1: ; f74ae tempo 123 volume $77 - forceoctave $2 + pitchoffset 0, D_ stereopanning $f dutycycle $3 vibrato $5, $64 @@ -94,7 +94,7 @@ Music_RocketTheme_branch_f750c: ; f750c ; f7514 Music_LookRocket_Ch2: ; f7514 - forceoctave $2 + pitchoffset 0, D_ vibrato $4, $64 dutycycle $3 notetype $c, $b7 @@ -216,7 +216,7 @@ Music_RocketTheme_branch_f758a: ; f758a ; f7597 Music_LookRocket_Ch3: ; f7597 - forceoctave $2 + pitchoffset 0, D_ vibrato $4, $22 notetype $c, $14 stereopanning $f0 diff --git a/audio/music/postcredits.asm b/audio/music/postcredits.asm index fe4893da9..d998d6212 100644 --- a/audio/music/postcredits.asm +++ b/audio/music/postcredits.asm @@ -8,7 +8,7 @@ Music_PostCredits: ; cfd9e Music_PostCredits_Ch1: ; cfda5 tempo 271 volume $77 - forceoctave $3 + pitchoffset 0, D# dutycycle $2 notetype $c, $93 note __, 8 @@ -133,7 +133,7 @@ Music_PostCredits_branch_cfdb2: ; cfdb2 ; cfe48 Music_PostCredits_Ch2: ; cfe48 - forceoctave $3 + pitchoffset 0, D# dutycycle $2 notetype $c, $a3 octave 5 diff --git a/audio/music/profoak.asm b/audio/music/profoak.asm index f0cd32a26..c24592350 100644 --- a/audio/music/profoak.asm +++ b/audio/music/profoak.asm @@ -34,10 +34,10 @@ Music_ProfOak_branch_f4e22: ; f4e22 callchannel Music_ProfOak_branch_f4e58 callchannel Music_ProfOak_branch_f4e6c callchannel Music_ProfOak_branch_f4e6c - forceoctave $2 + pitchoffset 0, D_ callchannel Music_ProfOak_branch_f4e58 callchannel Music_ProfOak_branch_f4e58 - forceoctave $0 + pitchoffset 0, C_ callchannel Music_ProfOak_branch_f4e6c callchannel Music_ProfOak_branch_f4e6c loopchannel 0, Music_ProfOak_branch_f4e22 @@ -241,10 +241,10 @@ Music_ProfOak_branch_f4f1d: ; f4f1d callchannel Music_ProfOak_branch_f4f5a callchannel Music_ProfOak_branch_f4f69 callchannel Music_ProfOak_branch_f4f69 - forceoctave $2 + pitchoffset 0, D_ callchannel Music_ProfOak_branch_f4f5a callchannel Music_ProfOak_branch_f4f5a - forceoctave $0 + pitchoffset 0, C_ callchannel Music_ProfOak_branch_f4f69 callchannel Music_ProfOak_branch_f4f69 loopchannel 0, Music_ProfOak_branch_f4f1d diff --git a/audio/music/ssaqua.asm b/audio/music/ssaqua.asm index e8782efb7..94570eccf 100644 --- a/audio/music/ssaqua.asm +++ b/audio/music/ssaqua.asm @@ -276,9 +276,9 @@ Music_SSAqua_branch_eaed5: ; eaed5 octave 4 note C#, 1 note E_, 1 - forceoctave $c + pitchoffset 0, CC callchannel Music_SSAqua_branch_eafe0 - forceoctave $0 + pitchoffset 0, C_ octave 3 note B_, 1 note __, 1 diff --git a/audio/music/surf.asm b/audio/music/surf.asm index 18f0cab9f..8a04945d9 100644 --- a/audio/music/surf.asm +++ b/audio/music/surf.asm @@ -425,7 +425,7 @@ Music_Surf_branch_f5333: ; f5333 note B_, 16 octave 4 note C#, 8 - forceoctave $c + pitchoffset 0, CC dutycycle $3 callchannel Music_Surf_branch_f53d6 intensity $b8 @@ -436,7 +436,7 @@ Music_Surf_branch_f5333: ; f5333 intensity $b8 dutycycle $1 callchannel Music_Surf_branch_f5404 - forceoctave $0 + pitchoffset 0, C_ notetype $c, $b8 octave 4 note B_, 12 diff --git a/audio/music/wildpokemonvictory.asm b/audio/music/wildpokemonvictory.asm index fba1ed40d..fc95e111e 100644 --- a/audio/music/wildpokemonvictory.asm +++ b/audio/music/wildpokemonvictory.asm @@ -29,14 +29,14 @@ Music_WildPokemonVictory_branch_f4538: ; f4538 intensity $78 octave 3 note G_, 4 - forceoctave $1 + pitchoffset 0, C# callchannel Music_WildPokemonVictory_branch_f455c note F#, 2 note F#, 2 note F#, 4 callchannel Music_WildPokemonVictory_branch_f455c note G#, 4 - forceoctave $0 + pitchoffset 0, C_ intensity $78 octave 3 note F#, 4 @@ -97,7 +97,7 @@ Music_WildPokemonVictory_branch_f4587: ; f4587 note E_, 1 note G_, 1 note A#, 1 - forceoctave $1 + pitchoffset 0, C# callchannel Music_WildPokemonVictory_branch_f45b5 octave 4 note B_, 2 @@ -106,7 +106,7 @@ Music_WildPokemonVictory_branch_f4587: ; f4587 callchannel Music_WildPokemonVictory_branch_f45b5 octave 4 note B_, 4 - forceoctave $0 + pitchoffset 0, C_ intensity $81 octave 3 note B_, 1 @@ -156,7 +156,7 @@ Music_WildPokemonVictory_branch_f45cf: ; f45cf note E_, 2 note __, 2 note C_, 4 - forceoctave $1 + pitchoffset 0, C# callchannel Music_WildPokemonVictory_branch_f45f4 note D#, 2 note C#, 2 @@ -166,7 +166,7 @@ Music_WildPokemonVictory_branch_f45cf: ; f45cf callchannel Music_WildPokemonVictory_branch_f45f4 note E_, 2 note __, 2 - forceoctave $0 + pitchoffset 0, C_ octave 2 note B_, 4 loopchannel 0, Music_WildPokemonVictory_branch_f45cf diff --git a/audio/sfx.asm b/audio/sfx.asm index a25861881..0a13717e2 100644 --- a/audio/sfx.asm +++ b/audio/sfx.asm @@ -1957,9 +1957,9 @@ Sfx_GetBadge_Ch5: ; f1189 note F_, 3 callchannel Sfx_GetBadge_branch_f11aa note A#, 3 - forceoctave $2 + pitchoffset 0, D_ callchannel Sfx_GetBadge_branch_f11aa - forceoctave $0 + pitchoffset 0, C_ intensity $a7 note A_, 16 note __, 6 diff --git a/audio/sfx_crystal.asm b/audio/sfx_crystal.asm index 2bcf91edd..178d4b560 100644 --- a/audio/sfx_crystal.asm +++ b/audio/sfx_crystal.asm @@ -169,7 +169,7 @@ Sfx_GameFreakPresents_Ch5: ; 179945 dutycycle $2 notetype $2, $b1 soundinput $ff - forceoctave $1a + pitchoffset 1, A# octave 5 note C_, 2 note E_, 2 @@ -194,7 +194,7 @@ Sfx_Tingle: ; 179961 Sfx_Tingle_Ch5: ; 179964 togglesfx dutycycle $1 - forceoctave $b + pitchoffset 0, B_ notetype $1, $b1 Sfx_Tingle_branch_17996c: ; 17996c octave 5 @@ -234,7 +234,7 @@ Sfx_4NoteDitty_Ch5: ; 17999b togglesfx dutycycle $2 notetype $2, $e8 - forceoctave $2 + pitchoffset 0, D_ octave 4 note C_, 2 intensity $48 @@ -279,7 +279,7 @@ Sfx_Twinkle: ; 1799cb Sfx_Twinkle_Ch5: ; 1799ce togglesfx dutycycle $0 - forceoctave $2 + pitchoffset 0, D_ notetype $2, $e1 octave 3 note G_, 2 diff --git a/constants/audio_constants.asm b/constants/audio_constants.asm index c341e901b..b34ffe67d 100755 --- a/constants/audio_constants.asm +++ b/constants/audio_constants.asm @@ -15,6 +15,7 @@ const A_ const A# const B_ + const CC ; used for pitchoffset ; channel const_def diff --git a/engine/events_3.asm b/engine/events_3.asm index d37d6c33a..01b8d7046 100755 --- a/engine/events_3.asm +++ b/engine/events_3.asm @@ -65,7 +65,7 @@ ReturnFromMapSetupScript:: ; b8000 ld a, [wPreviousLandmark] cp c ret z - cp $0 + cp SPECIAL_MAP ret ; b8070 diff --git a/macros/sound.asm b/macros/sound.asm index a0eacc1e0..ad6a50749 100644 --- a/macros/sound.asm +++ b/macros/sound.asm @@ -37,10 +37,10 @@ notetype: macro endc endm - enum forceoctave_cmd -forceoctave: macro - db forceoctave_cmd - db \1 ; octave + enum pitchoffset_cmd +pitchoffset: macro + db pitchoffset_cmd + dn \1, \2 - 1 ; octave, key endm enum tempo_cmd @@ -81,7 +81,7 @@ togglesfx: macro enum slidepitchto_cmd slidepitchto: macro db slidepitchto_cmd - db \1 ; unknown + db \1 - 1 ; duration dn \2, \3 ; octave, pitch endm diff --git a/macros/wram.asm b/macros/wram.asm index 1a44f0f17..ce53dc5c7 100755 --- a/macros/wram.asm +++ b/macros/wram.asm @@ -134,7 +134,7 @@ channel_struct: MACRO \1FrequencyHi:: db \1Pitch:: db ; 0:rest 1-c:note \1Octave:: db ; 7-0 (0 is highest) -\1StartingOctave:: db ; raises existing octaves (to repeat phrases) +\1PitchOffset:: db ; raises existing octaves (to repeat phrases) \1NoteDuration:: db ; frames remaining for the current note \1Field0x16:: ds 1 ; c117 ds 1 ; c118 diff --git a/maps/BattleTower1F.asm b/maps/BattleTower1F.asm index ac954b426..5d8809b10 100644 --- a/maps/BattleTower1F.asm +++ b/maps/BattleTower1F.asm @@ -168,7 +168,6 @@ Script_WaitButton: ; 0x9e4bb closetext end - UnreferencedScript_0x9e4be: writetext Text_SaveBeforeEnteringBattleRoom yesorno diff --git a/text/trainer_class_names.asm b/text/trainer_class_names.asm index daa7e08a9..555e6c652 100755 --- a/text/trainer_class_names.asm +++ b/text/trainer_class_names.asm @@ -64,4 +64,4 @@ db "LEADER@" db "OFFICER@" db "ROCKET@" - db "MYSTICALMAN@" \ No newline at end of file + db "MYSTICALMAN@"