pitchoffset macro to replace forceoctave

This commit is contained in:
PikalaxALT 2016-07-29 10:40:54 -04:00
parent a32b6ccbb5
commit d84ebd2124
22 changed files with 97 additions and 103 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -15,6 +15,7 @@
const A_
const A#
const B_
const CC ; used for pitchoffset
; channel
const_def

View File

@ -65,7 +65,7 @@ ReturnFromMapSetupScript:: ; b8000
ld a, [wPreviousLandmark]
cp c
ret z
cp $0
cp SPECIAL_MAP
ret
; b8070

View File

@ -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

View File

@ -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

View File

@ -168,7 +168,6 @@ Script_WaitButton: ; 0x9e4bb
closetext
end
UnreferencedScript_0x9e4be:
writetext Text_SaveBeforeEnteringBattleRoom
yesorno

View File

@ -64,4 +64,4 @@
db "LEADER@"
db "OFFICER@"
db "ROCKET@"
db "MYSTICALMAN@"
db "MYSTICALMAN@"