aboutsummaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorRangi <35663410+Rangi42@users.noreply.github.com>2020-07-03 09:38:52 -0400
committerGitHub <noreply@github.com>2020-07-03 09:38:52 -0400
commitc85050497c1bd062e9cd40bf5b32fa3beca366cc (patch)
tree9593ddd3ab820223ab580d5fc0ae133b485b8315 /audio
parentActually run .travis/webhook.sh (diff)
parentAdd engine/movie/oak_speech/ subdirectory (diff)
downloadpokeyellow-c85050497c1bd062e9cd40bf5b32fa3beca366cc.tar.gz
pokeyellow-c85050497c1bd062e9cd40bf5b32fa3beca366cc.tar.xz
pokeyellow-c85050497c1bd062e9cd40bf5b32fa3beca366cc.zip
Merge pull request #256 from Rangi42/master
Add subdirectories to engine/ similar to pokecrystal
Diffstat (limited to '')
-rw-r--r--audio.asm231
-rw-r--r--audio/alternate_tempo.asm50
-rw-r--r--audio/low_health_alarm.asm75
-rw-r--r--audio/notes.asm2
-rw-r--r--audio/play_battle_music.asm34
-rw-r--r--audio/poke_flute.asm18
-rw-r--r--audio/pokedex_rating_sfx.asm36
-rw-r--r--audio/wave_instruments.asm2
8 files changed, 223 insertions, 225 deletions
diff --git a/audio.asm b/audio.asm
index 9675c98a..94d63f25 100644
--- a/audio.asm
+++ b/audio.asm
@@ -352,248 +352,30 @@ INCLUDE "audio/sfx/cry21_3.asm"
INCLUDE "audio/sfx/cry22_3.asm"
-
SECTION "Audio Engine 1", ROMX
-PlayBattleMusic::
- xor a
- ld [wAudioFadeOutControl], a
- ld [wLowHealthAlarm], a
- dec a
- ld [wNewSoundID], a
- call PlaySound ; stop music
- 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_SONY3
- 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
-
-
+INCLUDE "audio/play_battle_music.asm"
INCLUDE "audio/engine_1.asm"
+INCLUDE "audio/alternate_tempo.asm"
-; 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
+SECTION "Low Health Alarm (Audio Engine 2)", ROMX
-; an alternate tempo for MeetRival which is slightly slower
-Music_RivalAlternateTempo::
- ld c, BANK(Music_MeetRival)
- ld a, MUSIC_MEET_RIVAL
- call PlayMusic
- ld hl, wChannelCommandPointers
- ld de, Music_MeetRival_branch_b119
- jp Audio1_OverwriteChannelPointer
-
-; applies both the alternate start and alternate tempo
-Music_RivalAlternateStartAndTempo::
- 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::
- 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
+INCLUDE "audio/low_health_alarm.asm"
SECTION "Audio Engine 2", ROMX
-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
-
-;bytes to write to sound channel 1 registers for health alarm.
-;starting at FF11 (FF10 is always zeroed), so these bytes are:
-;length, envelope, freq lo, freq hi
-.toneDataHi
- db $A0,$E2,$50,$87
-
-.toneDataLo
- db $B0,$E2,$EE,$86
-
-;written to stop the alarm
-.toneDataSilence
- db $00,$00,$00,$80
-
-
-INCLUDE "engine/menu/bills_pc.asm"
-
INCLUDE "audio/engine_2.asm"
-
-
-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
+INCLUDE "audio/poke_flute.asm"
SECTION "Audio Engine 3", ROMX
-PlayPokedexRatingSfx::
- ld a, [$ffdc]
- ld c, $0
- ld hl, OwnedMonValues
-.getSfxPointer
- cp [hl]
- jr c, .gotSfxPointer
- inc c
- inc hl
- jr .getSfxPointer
-.gotSfxPointer
- push bc
- ld a, $ff
- ld [wNewSoundID], a
- call PlaySoundWaitForCurrent
- 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
-
-
+INCLUDE "audio/pokedex_rating_sfx.asm"
INCLUDE "audio/engine_3.asm"
-
SECTION "Music 1", ROMX
INCLUDE "audio/music/pkmnhealed.asm"
@@ -663,4 +445,3 @@ INCLUDE "audio/music/surfing.asm"
INCLUDE "audio/music/jigglypuffsong.asm"
INCLUDE "audio/music/halloffame.asm"
INCLUDE "audio/music/credits.asm"
-
diff --git a/audio/alternate_tempo.asm b/audio/alternate_tempo.asm
new file mode 100644
index 00000000..6c2cdc49
--- /dev/null
+++ b/audio/alternate_tempo.asm
@@ -0,0 +1,50 @@
+; 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 hl, wChannelCommandPointers
+ ld de, Music_MeetRival_branch_b119
+ jp Audio1_OverwriteChannelPointer
+
+; applies both the alternate start and alternate tempo
+Music_RivalAlternateStartAndTempo::
+ 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::
+ 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/low_health_alarm.asm b/audio/low_health_alarm.asm
new file mode 100644
index 00000000..514db55f
--- /dev/null
+++ b/audio/low_health_alarm.asm
@@ -0,0 +1,75 @@
+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
+
+;bytes to write to sound channel 1 registers for health alarm.
+;starting at FF11 (FF10 is always zeroed), so these bytes are:
+;length, envelope, freq lo, freq hi
+.toneDataHi
+ db $A0,$E2,$50,$87
+
+.toneDataLo
+ db $B0,$E2,$EE,$86
+
+;written to stop the alarm
+.toneDataSilence
+ db $00,$00,$00,$80
diff --git a/audio/notes.asm b/audio/notes.asm
index 025eb6a8..75e1a0b7 100644
--- a/audio/notes.asm
+++ b/audio/notes.asm
@@ -1,3 +1,5 @@
+; This file is INCLUDEd three times, once in each audio engine.
+
dw $F82C ; C_
dw $F89D ; C#
dw $F907 ; D_
diff --git a/audio/play_battle_music.asm b/audio/play_battle_music.asm
new file mode 100644
index 00000000..35dd19ad
--- /dev/null
+++ b/audio/play_battle_music.asm
@@ -0,0 +1,34 @@
+PlayBattleMusic::
+ xor a
+ ld [wAudioFadeOutControl], a
+ ld [wLowHealthAlarm], a
+ dec a
+ ld [wNewSoundID], a
+ call PlaySound ; stop music
+ 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_SONY3
+ 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..a218d5e6
--- /dev/null
+++ b/audio/pokedex_rating_sfx.asm
@@ -0,0 +1,36 @@
+PlayPokedexRatingSfx::
+ ld a, [$ffdc]
+ ld c, $0
+ ld hl, OwnedMonValues
+.getSfxPointer
+ cp [hl]
+ jr c, .gotSfxPointer
+ inc c
+ inc hl
+ jr .getSfxPointer
+.gotSfxPointer
+ push bc
+ ld a, $ff
+ ld [wNewSoundID], a
+ call PlaySoundWaitForCurrent
+ 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 fede06af..c915f18a 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