diff options
author | dannye <33dannye@gmail.com> | 2020-11-04 00:06:44 -0600 |
---|---|---|
committer | dannye <33dannye@gmail.com> | 2020-11-04 00:06:44 -0600 |
commit | 5647ca687b92954dcf37a6ea6bfbc9a341c32de4 (patch) | |
tree | dde1937a1bfdb3a835f4155e1c2eb8f1aaf86f63 /audio | |
parent | 53fcd05aa24693093d8af1dc8ec4fedd3957decc (diff) |
Sync with pokered
Diffstat (limited to 'audio')
-rw-r--r-- | audio/alternate_tempo.asm | 53 | ||||
-rw-r--r-- | audio/engine_1.asm | 131 | ||||
-rw-r--r-- | audio/engine_2.asm | 69 | ||||
-rw-r--r-- | audio/engine_3.asm | 6 | ||||
-rw-r--r-- | audio/engine_4.asm | 4 | ||||
-rw-r--r-- | audio/low_health_alarm.asm | 80 | ||||
-rw-r--r-- | audio/notes.asm | 14 | ||||
-rw-r--r-- | audio/play_battle_music.asm | 32 | ||||
-rw-r--r-- | audio/poke_flute.asm | 18 | ||||
-rw-r--r-- | audio/pokedex_rating_sfx.asm | 34 | ||||
-rw-r--r-- | audio/wave_instruments.asm | 4 |
11 files changed, 325 insertions, 120 deletions
diff --git a/audio/alternate_tempo.asm b/audio/alternate_tempo.asm new file mode 100644 index 00000000..87d08e18 --- /dev/null +++ b/audio/alternate_tempo.asm @@ -0,0 +1,53 @@ +; an alternate start for MeetRival which has a different first measure +Music_RivalAlternateStart:: + ld c, BANK(Music_MeetRival) + ld a, MUSIC_MEET_RIVAL + 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 a, MUSIC_MEET_RIVAL + call PlayMusic + ld de, Music_MeetRival_branch_b119 + jr asm_99ed + +; applies both the alternate start and alternate tempo +Music_RivalAlternateStartAndTempo:: + call Music_RivalAlternateStart + ld de, Music_MeetRival_branch_b19b +asm_99ed: + ld hl, wChannelCommandPointers + jp Audio1_OverwriteChannelPointer + +; XXX + ret + +; an alternate tempo for Cities1 which is used for the Hall of Fame room +Music_Cities1AlternateTempo:: + ld a, 10 + ld [wAudioFadeOutCounterReloadValue], a + ld [wAudioFadeOutCounter], a + ld a, $ff ; stop playing music after the fade-out is finished + ld [wAudioFadeOutControl], a + ld c, 100 + call DelayFrames ; wait for the fade-out to finish + ld c, BANK(Music_Cities1) + ld a, MUSIC_CITIES1 + call PlayMusic + ld hl, wChannelCommandPointers + ld de, Music_Cities1_branch_aa6f + jp Audio1_OverwriteChannelPointer diff --git a/audio/engine_1.asm b/audio/engine_1.asm index bd021ab3..a585cd43 100644 --- a/audio/engine_1.asm +++ b/audio/engine_1.asm @@ -20,10 +20,10 @@ Audio1_UpdateMusic:: set 7, a ld [wMuteAudioAndPauseMusic], a xor a ; disable all channels' output - ld [rNR51], a - ld [rNR30], a + ldh [rNR51], a + ldh [rNR30], a ld a, $80 - ld [rNR30], a + ldh [rNR30], a jr .nextChannel .applyAffects call Audio1_ApplyMusicAffects @@ -41,7 +41,7 @@ Audio1_ApplyMusicAffects: ld hl, wChannelNoteDelayCounters ; delay until next note add hl, bc ld a, [hl] - cp $1 ; if the delay is 1, play next note + cp 1 ; if the delay is 1, play next note jp z, Audio1_PlayNextNote dec a ; otherwise, decrease the delay timer ld [hl], a @@ -172,8 +172,8 @@ Audio1_PlayNextNote: Audio1_sound_ret: call Audio1_GetNextMusicByte ld d, a - cp $ff ; is this command a sound_ret? - jp nz, Audio1_sound_call ; no + cp sound_ret_cmd + jp nz, Audio1_sound_call ld b, 0 ld hl, wChannelFlags1 add hl, bc @@ -192,9 +192,9 @@ Audio1_sound_ret: jr nz, .skipSfxChannel3 ; restart hardware channel 3 (wave channel) output ld a, $0 - ld [rNR30], a + ldh [rNR30], a ld a, $80 - ld [rNR30], a + ldh [rNR30], a .skipSfxChannel3 jr nz, .dontDisable ld a, [wDisableChannelOutputWhenSfxEnds] @@ -228,9 +228,9 @@ Audio1_sound_ret: .disableChannelOutput ld hl, Audio1_HWChannelDisableMasks add hl, bc - ld a, [rNR51] + ldh a, [rNR51] and [hl] - ld [rNR51], a + ldh [rNR51], a .afterDisable ld a, [wChannelSoundIDs + Ch5] cp CRY_SFX_START @@ -250,7 +250,7 @@ Audio1_sound_ret: ret c .skipRewind ld a, [wSavedVolume] - ld [rNR50], a + ldh [rNR50], a xor a ld [wSavedVolume], a .skipCry @@ -260,8 +260,8 @@ Audio1_sound_ret: ret Audio1_sound_call: - cp $fd ; is this command a sound_call? - jp nz, Audio1_sound_loop ; no + cp sound_call_cmd + jp nz, Audio1_sound_loop call Audio1_GetNextMusicByte push af call Audio1_GetNextMusicByte @@ -297,8 +297,8 @@ Audio1_sound_call: jp Audio1_sound_ret Audio1_sound_loop: - cp $fe ; is this command a sound_loop? - jp nz, Audio1_note_type ; no + cp sound_loop_cmd + jp nz, Audio1_note_type call Audio1_GetNextMusicByte ld e, a and a @@ -336,8 +336,8 @@ Audio1_sound_loop: Audio1_note_type: and $f0 - cp $d0 ; is this command a note_type? - jp nz, Audio1_toggle_perfect_pitch ; no + cp note_type_cmd + jp nz, Audio1_toggle_perfect_pitch ld a, d and $f ld b, $0 @@ -380,8 +380,8 @@ Audio1_note_type: Audio1_toggle_perfect_pitch: ld a, d - cp $e8 ; is this command a toggle_perfect_pitch? - jr nz, Audio1_vibrato ; no + cp toggle_perfect_pitch_cmd + jr nz, Audio1_vibrato ld b, 0 ld hl, wChannelFlags1 add hl, bc @@ -391,8 +391,8 @@ Audio1_toggle_perfect_pitch: jp Audio1_sound_ret Audio1_vibrato: - cp $ea ; is this command a vibrato? - jr nz, Audio1_pitch_slide ; no + cp vibrato_cmd + jr nz, Audio1_pitch_slide call Audio1_GetNextMusicByte ld b, 0 ld hl, wChannelVibratoDelayCounters @@ -439,8 +439,8 @@ Audio1_vibrato: jp Audio1_sound_ret Audio1_pitch_slide: - cp $eb ; is this command a pitch_slide? - jr nz, Audio1_duty_cycle ; no + cp pitch_slide_cmd + jr nz, Audio1_duty_cycle call Audio1_GetNextMusicByte ld b, 0 ld hl, wChannelPitchSlideLengthModifiers @@ -470,8 +470,8 @@ Audio1_pitch_slide: jp Audio1_note_length Audio1_duty_cycle: - cp $ec ; is this command a duty_cycle? - jr nz, Audio1_tempo ; no + cp duty_cycle_cmd + jr nz, Audio1_tempo call Audio1_GetNextMusicByte rrca rrca @@ -483,8 +483,8 @@ Audio1_duty_cycle: jp Audio1_sound_ret Audio1_tempo: - cp $ed ; is this command a tempo? - jr nz, Audio1_stereo_panning ; no + cp tempo_cmd + jr nz, Audio1_stereo_panning ld a, c cp Ch5 jr nc, .sfxChannel @@ -512,16 +512,16 @@ Audio1_tempo: jp Audio1_sound_ret Audio1_stereo_panning: - cp $ee ; is this command a stereo_panning? - jr nz, Audio1_unknownmusic0xef ; no + cp stereo_panning_cmd + jr nz, Audio1_unknownmusic0xef call Audio1_GetNextMusicByte ld [wStereoPanning], a ; store panning jp Audio1_sound_ret ; this appears to never be used Audio1_unknownmusic0xef: - cp $ef ; is this command an unknownmusic0xef? - jr nz, Audio1_duty_cycle_pattern ; no + cp unknownmusic0xef_cmd + jr nz, Audio1_duty_cycle_pattern call Audio1_GetNextMusicByte push bc ld b, a @@ -538,8 +538,8 @@ Audio1_unknownmusic0xef: jp Audio1_sound_ret Audio1_duty_cycle_pattern: - cp $fc ; is this command a duty_cycle_pattern? - jr nz, Audio1_volume ; no + cp duty_cycle_pattern_cmd + jr nz, Audio1_volume call Audio1_GetNextMusicByte ld b, 0 ld hl, wChannelDutyCyclePatterns @@ -555,15 +555,15 @@ Audio1_duty_cycle_pattern: jp Audio1_sound_ret Audio1_volume: - cp $f0 ; is this command a volume? - jr nz, Audio1_execute_music ; no + cp volume_cmd + jr nz, Audio1_execute_music call Audio1_GetNextMusicByte - ld [rNR50], a ; store volume + ldh [rNR50], a ; store volume jp Audio1_sound_ret Audio1_execute_music: - cp $f8 ; is this command an execute_music? - jr nz, Audio1_octave ; no + cp execute_music_cmd + jr nz, Audio1_octave ld b, $0 ld hl, wChannelFlags2 add hl, bc @@ -572,8 +572,8 @@ Audio1_execute_music: Audio1_octave: and $f0 - cp $e0 ; is this command an octave? - jr nz, Audio1_sfx_note ; no + cp octave_cmd + jr nz, Audio1_sfx_note ld hl, wChannelOctaves ld b, 0 add hl, bc @@ -584,7 +584,7 @@ Audio1_octave: ; sfx_note is either square_note or noise_note depending on the channel Audio1_sfx_note: - cp $20 ; is this command a sfx_note? + cp sfx_note_cmd jr nz, Audio1_pitch_sweep ld a, c cp Ch4 ; is this a noise or sfx channel? @@ -640,15 +640,15 @@ Audio1_pitch_sweep: cp Ch5 jr c, Audio1_note ; if not a sfx ld a, d - cp $10 ; is this command a pitch_sweep? - jr nz, Audio1_note ; no + cp pitch_sweep_cmd + jr nz, Audio1_note ld b, $0 ld hl, wChannelFlags2 add hl, bc bit BIT_EXECUTE_MUSIC, [hl] jr nz, Audio1_note ; no call Audio1_GetNextMusicByte - ld [rNR10], a + ldh [rNR10], a jp Audio1_sound_ret Audio1_note: @@ -657,12 +657,12 @@ Audio1_note: jr nz, Audio1_note_length ; if not noise channel ld a, d and $f0 - cp $b0 ; is this command a drum_note? + cp drum_note_cmd jr z, .drum_note - jr nc, Audio1_note_length ; no + jr nc, Audio1_note_length ; this executes when on the noise channel and - ; the command id is less than $b0 + ; the command id is less than drum_note_cmd ($b0) ; in this case, the upper nybble is used as the noise instrument ($1-$a) ; and the lower nybble is the length minus 1 (0-15) ; however, this doesn't work for instrument #2 because the command id @@ -758,7 +758,7 @@ Audio1_note_length: Audio1_note_pitch: pop af and $f0 - cp $c0 ; compare to rest + cp rest_cmd jr nz, .notRest ld a, c cp Ch5 @@ -780,9 +780,9 @@ Audio1_note_pitch: ld b, 0 ld hl, Audio1_HWChannelDisableMasks add hl, bc - ld a, [rNR51] + ldh a, [rNR51] and [hl] - ld [rNR51], a ; disable hardware channel 3's output + ldh [rNR51], a ; disable hardware channel 3's output jr .done .notChannel3 ld b, REG_VOLUME_ENVELOPE @@ -854,7 +854,7 @@ Audio1_EnableChannelOutput: ld b, 0 call Audio1_9972 add hl, bc - ld a, [rNR51] + ldh a, [rNR51] or [hl] ; set this channel's bits ld d, a ld a, c @@ -876,7 +876,7 @@ Audio1_EnableChannelOutput: add hl, bc and [hl] ld d, a - ld a, [rNR51] + ldh a, [rNR51] ld hl, Audio1_HWChannelDisableMasks add hl, bc and [hl] ; reset this channel's output bits @@ -884,7 +884,7 @@ Audio1_EnableChannelOutput: ld d, a .skip ld a, d - ld [rNR51], a + ldh [rNR51], a ret Audio1_ApplyDutyCycleAndSoundLength: @@ -935,10 +935,10 @@ Audio1_ApplyWavePatternAndFrequency: ld e, [hl] inc hl ld d, [hl] - ld hl, $ff30 ; wave pattern RAM + ld hl, rWave_0 ld b, $f ld a, $0 ; stop hardware channel 3 - ld [rNR30], a + ldh [rNR30], a .loop ld a, [de] inc de @@ -948,7 +948,7 @@ Audio1_ApplyWavePatternAndFrequency: and a jr nz, .loop ld a, $80 ; start hardware channel 3 - ld [rNR30], a + ldh [rNR30], a pop de .notChannel3 ld a, d @@ -1367,7 +1367,7 @@ Audio1_CalculateFrequency: Audio1_PlaySound:: ld [wSoundID], a ld a, [wSoundID] - cp $ff + cp SFX_STOP_ALL_MUSIC jp z, .stopAllAudio cp MAX_SFX_ID_1 jp z, .playSfx @@ -1544,10 +1544,10 @@ Audio1_PlaySound:: ld a, [wSavedVolume] and a jr nz, .done - ld a, [rNR50] + ldh a, [rNR50] ld [wSavedVolume], a ld a, $77 - ld [rNR50], a ; full volume + ldh [rNR50], a ; full volume .done ret @@ -1588,15 +1588,4 @@ Audio1_HWChannelEnableMasks: db $01,$02,$40,$80 Audio1_Pitches: - 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_ +INCLUDE "audio/notes.asm" diff --git a/audio/engine_2.asm b/audio/engine_2.asm index 5fe686a8..65c25c20 100644 --- a/audio/engine_2.asm +++ b/audio/engine_2.asm @@ -5,7 +5,7 @@ Audio2_PlaySound:: ld [wSoundID], a ld a, [wSoundID] - cp $ff + cp SFX_STOP_ALL_MUSIC jp z, .stopAllAudio cp MAX_SFX_ID_2 jp z, .playSfx @@ -182,34 +182,17 @@ Audio2_PlaySound:: ld a, [wSavedVolume] and a jr nz, .done - ld a, [rNR50] + ldh a, [rNR50] ld [wSavedVolume], a ld a, $77 - ld [rNR50], a + ldh [rNR50], a .done ret Audio2_CryRet: sound_ret -Music_PokeFluteInBattle:: - ; begin playing the "caught mon" sound effect - ld a, SFX_CAUGHT_MON - call PlaySoundWaitForCurrent - ; then immediately overwrtie the channel pointers - ld hl, wChannelCommandPointers + Ch5 * 2 - ld de, SFX_Pokeflute_Ch5 - call Audio2_OverwriteChannelPointer - ld de, SFX_Pokeflute_Ch6 - call Audio2_OverwriteChannelPointer - ld de, SFX_Pokeflute_Ch7 - -Audio2_OverwriteChannelPointer: - ld a, e - ld [hli], a - ld a, d - ld [hli], a - ret +INCLUDE "audio/poke_flute.asm" INCLUDE "audio/sfx/pokeflute_ch5_ch6.asm" @@ -220,12 +203,12 @@ Audio2_InitMusicVariables:: ld [wMusicTempo + 1], a ld [wMusicWaveInstrument], a ld [wSfxWaveInstrument], a - ld d, $8 + ld d, NUM_CHANNELS ld hl, wChannelReturnAddresses call Audio2_FillMem ld hl, wChannelCommandPointers call Audio2_FillMem - ld d, $4 + ld d, NUM_MUSIC_CHANS ld hl, wChannelSoundIDs call Audio2_FillMem ld hl, wChannelFlags1 @@ -273,17 +256,17 @@ Audio2_InitMusicVariables:: ld a, $ff ld [wStereoPanning], a xor a - ld [rNR50], a + ldh [rNR50], a ld a, $8 - ld [rNR10], a + ldh [rNR10], a ld a, 0 - ld [rNR51], a + ldh [rNR51], a xor a - ld [rNR30], a + ldh [rNR30], a ld a, $80 - ld [rNR30], a + ldh [rNR30], a ld a, $77 - ld [rNR50], a + ldh [rNR50], a ret Audio2_InitSFXVariables:: @@ -371,27 +354,27 @@ Audio2_InitSFXVariables:: cp Ch5 ret nz ld a, $8 - ld [rNR10], a ; sweep off + ldh [rNR10], a ; sweep off ret Audio2_StopAllAudio:: ld a, $80 - ld [rNR52], a ; sound hardware on - ld [rNR30], a ; wave playback on + ldh [rNR52], a ; sound hardware on + ldh [rNR30], a ; wave playback on xor a - ld [rNR51], a ; no sound output - ld [rNR32], a ; mute channel 3 (wave channel) + ldh [rNR51], a ; no sound output + ldh [rNR32], a ; mute channel 3 (wave channel) ld a, $8 - ld [rNR10], a ; sweep off - ld [rNR12], a ; mute channel 1 (pulse channel 1) - ld [rNR22], a ; mute channel 2 (pulse channel 2) - ld [rNR42], a ; mute channel 4 (noise channel) + ldh [rNR10], a ; sweep off + ldh [rNR12], a ; mute channel 1 (pulse channel 1) + ldh [rNR22], a ; mute channel 2 (pulse channel 2) + ldh [rNR42], a ; mute channel 4 (noise channel) ld a, $40 - ld [rNR14], a ; counter mode - ld [rNR24], a - ld [rNR44], a + ldh [rNR14], a ; counter mode + ldh [rNR24], a + ldh [rNR44], a ld a, $77 - ld [rNR50], a ; full volume + ldh [rNR50], a ; full volume xor a ld [wUnusedC000], a ld [wDisableChannelOutputWhenSfxEnds], a @@ -414,7 +397,7 @@ Audio2_StopAllAudio:: ret ; fills d bytes at hl with a -Audio2_FillMem +Audio2_FillMem: ld b, d .loop ld [hli], a diff --git a/audio/engine_3.asm b/audio/engine_3.asm index 2d4a30e3..10893868 100644 --- a/audio/engine_3.asm +++ b/audio/engine_3.asm @@ -3,7 +3,7 @@ Audio3_PlaySound:: ld [wSoundID], a ld a, [wSoundID] - cp $ff + cp SFX_STOP_ALL_MUSIC jp z, .stopAllAudio cp MAX_SFX_ID_3 jp z, .playSfx @@ -180,10 +180,10 @@ Audio3_PlaySound:: ld a, [wSavedVolume] and a jr nz, .done - ld a, [rNR50] + ldh a, [rNR50] ld [wSavedVolume], a ld a, $77 - ld [rNR50], a ; full volume + ldh [rNR50], a ; full volume .done ret diff --git a/audio/engine_4.asm b/audio/engine_4.asm index 2f0d9ade..850bb66a 100644 --- a/audio/engine_4.asm +++ b/audio/engine_4.asm @@ -180,10 +180,10 @@ Audio4_PlaySound:: ld a, [wSavedVolume] and a jr nz, .done - ld a, [rNR50] + ldh a, [rNR50] ld [wSavedVolume], a ld a, $77 - ld [rNR50], a ; full volume + ldh [rNR50], a ; full volume .done ret diff --git a/audio/low_health_alarm.asm b/audio/low_health_alarm.asm new file mode 100644 index 00000000..a550cf70 --- /dev/null +++ b/audio/low_health_alarm.asm @@ -0,0 +1,80 @@ +Music_DoLowHealthAlarm:: + ld a, [wLowHealthAlarm] + cp $ff + jr z, .disableAlarm + + bit 7, a ;alarm enabled? + ret z ;nope + + and $7f ;low 7 bits are the timer. + jr nz, .asm_21383 ;if timer > 0, play low tone. + + call .playToneHi + ld a, 30 ;keep this tone for 30 frames. + jr .asm_21395 ;reset the timer. + +.asm_21383 + cp 20 + jr nz, .asm_2138a ;if timer == 20, + call .playToneLo ;actually set the sound registers. + +.asm_2138a + ld a, $86 + ld [wChannelSoundIDs + Ch5], a ;disable sound channel? + ld a, [wLowHealthAlarm] + and $7f ;decrement alarm timer. + dec a + +.asm_21395 + ; reset the timer and enable flag. + set 7, a + ld [wLowHealthAlarm], a + ret + +.disableAlarm + xor a + ld [wLowHealthAlarm], a ;disable alarm + ld [wChannelSoundIDs + Ch5], a ;re-enable sound channel? + ld de, .toneDataSilence + jr .playTone + +;update the sound registers to change the frequency. +;the tone set here stays until we change it. +.playToneHi + ld de, .toneDataHi + jr .playTone + +.playToneLo + ld de, .toneDataLo + +;update sound channel 1 to play the alarm, overriding all other sounds. +.playTone + ld hl, rNR10 ;channel 1 sound register + ld c, $5 + xor a + +.copyLoop + ld [hli], a + ld a, [de] + inc de + dec c + jr nz, .copyLoop + ret + +alarm_tone: MACRO + db \1 ; length + db \2 ; envelope + dw \3 ; frequency +ENDM + +;bytes to write to sound channel 1 registers for health alarm. +;starting at FF11 (FF10 is always zeroed). +.toneDataHi + alarm_tone $A0, $E2, $8750 + +.toneDataLo + alarm_tone $B0, $E2, $86EE + +;written to stop the alarm +.toneDataSilence + alarm_tone $00, $00, $8000 diff --git a/audio/notes.asm b/audio/notes.asm new file mode 100644 index 00000000..75e1a0b7 --- /dev/null +++ b/audio/notes.asm @@ -0,0 +1,14 @@ +; This file is INCLUDEd three times, once in each audio engine. + + 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_ diff --git a/audio/play_battle_music.asm b/audio/play_battle_music.asm new file mode 100644 index 00000000..bf86c9ae --- /dev/null +++ b/audio/play_battle_music.asm @@ -0,0 +1,32 @@ +PlayBattleMusic:: + xor a + ld [wAudioFadeOutControl], a + ld [wLowHealthAlarm], a + call StopAllMusic + call DelayFrame + ld c, BANK(Music_GymLeaderBattle) + ld a, [wGymLeaderNo] + and a + jr z, .notGymLeaderBattle + ld a, MUSIC_GYM_LEADER_BATTLE + jr .playSong +.notGymLeaderBattle + ld a, [wCurOpponent] + cp OPP_ID_OFFSET + jr c, .wildBattle + cp OPP_RIVAL3 + jr z, .finalBattle + cp OPP_LANCE + jr nz, .normalTrainerBattle + ld a, MUSIC_GYM_LEADER_BATTLE ; lance also plays gym leader theme + jr .playSong +.normalTrainerBattle + ld a, MUSIC_TRAINER_BATTLE + jr .playSong +.finalBattle + ld a, MUSIC_FINAL_BATTLE + jr .playSong +.wildBattle + ld a, MUSIC_WILD_BATTLE +.playSong + jp PlayMusic diff --git a/audio/poke_flute.asm b/audio/poke_flute.asm new file mode 100644 index 00000000..f55a2a1f --- /dev/null +++ b/audio/poke_flute.asm @@ -0,0 +1,18 @@ +Music_PokeFluteInBattle:: + ; begin playing the "caught mon" sound effect + ld a, SFX_CAUGHT_MON + call PlaySoundWaitForCurrent + ; then immediately overwrite the channel pointers + ld hl, wChannelCommandPointers + Ch5 * 2 + ld de, SFX_Pokeflute_Ch5 + call Audio2_OverwriteChannelPointer + ld de, SFX_Pokeflute_Ch6 + call Audio2_OverwriteChannelPointer + ld de, SFX_Pokeflute_Ch7 + +Audio2_OverwriteChannelPointer: + ld a, e + ld [hli], a + ld a, d + ld [hli], a + ret diff --git a/audio/pokedex_rating_sfx.asm b/audio/pokedex_rating_sfx.asm new file mode 100644 index 00000000..aefbd066 --- /dev/null +++ b/audio/pokedex_rating_sfx.asm @@ -0,0 +1,34 @@ +PlayPokedexRatingSfx:: + ldh a, [hDexRatingNumMonsOwned] + ld c, $0 + ld hl, OwnedMonValues +.getSfxPointer + cp [hl] + jr c, .gotSfxPointer + inc c + inc hl + jr .getSfxPointer +.gotSfxPointer + push bc + call StopAllMusic + pop bc + ld b, $0 + ld hl, PokedexRatingSfxPointers + add hl, bc + add hl, bc + ld a, [hli] + ld c, [hl] + call PlayMusic + jp PlayDefaultMusic + +PokedexRatingSfxPointers: + db SFX_DENIED, BANK(SFX_Denied_3) + 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) + +OwnedMonValues: + db 10, 40, 60, 90, 120, 150, $ff diff --git a/audio/wave_instruments.asm b/audio/wave_instruments.asm index 9f34d3ac..5095cced 100644 --- a/audio/wave_instruments.asm +++ b/audio/wave_instruments.asm @@ -1,3 +1,5 @@ +; This file is INCLUDEd three times, once for each audio engine. + dw .wave0 dw .wave1 dw .wave2 @@ -11,7 +13,7 @@ ; these are the definitions for the channel 3 instruments ; each instrument definition is made up of 32 points (nibbles) that form ; the graph of the wave -; the current instrument is copied to $FF30 +; the current instrument is copied to rWave_0--rWave_f .wave0 db $02,$46,$8A,$CE,$FF,$FE,$ED,$DC,$CB,$A9,$87,$65,$44,$33,$22,$11 |