audio.asm 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. AUDIO_1 EQU $2
  2. AUDIO_2 EQU $8
  3. AUDIO_3 EQU $1f
  4. INCLUDE "constants.asm"
  5. SECTION "Sound Effect Headers 1", ROMX, BANK[AUDIO_1]
  6. INCLUDE "audio/headers/sfxheaders1.asm"
  7. SECTION "Sound Effect Headers 2", ROMX, BANK[AUDIO_2]
  8. INCLUDE "audio/headers/sfxheaders2.asm"
  9. SECTION "Sound Effect Headers 3", ROMX, BANK[AUDIO_3]
  10. INCLUDE "audio/headers/sfxheaders3.asm"
  11. SECTION "Music Headers 1", ROMX, BANK[AUDIO_1]
  12. INCLUDE "audio/headers/musicheaders1.asm"
  13. SECTION "Music Headers 2", ROMX, BANK[AUDIO_2]
  14. INCLUDE "audio/headers/musicheaders2.asm"
  15. SECTION "Music Headers 3", ROMX, BANK[AUDIO_3]
  16. INCLUDE "audio/headers/musicheaders3.asm"
  17. SECTION "Sound Effects 1", ROMX, BANK[AUDIO_1]
  18. INCLUDE "audio/sfx/snare1_1.asm"
  19. INCLUDE "audio/sfx/snare2_1.asm"
  20. INCLUDE "audio/sfx/snare3_1.asm"
  21. INCLUDE "audio/sfx/snare4_1.asm"
  22. INCLUDE "audio/sfx/snare5_1.asm"
  23. INCLUDE "audio/sfx/triangle1_1.asm"
  24. INCLUDE "audio/sfx/triangle2_1.asm"
  25. INCLUDE "audio/sfx/snare6_1.asm"
  26. INCLUDE "audio/sfx/snare7_1.asm"
  27. INCLUDE "audio/sfx/snare8_1.asm"
  28. INCLUDE "audio/sfx/snare9_1.asm"
  29. INCLUDE "audio/sfx/cymbal1_1.asm"
  30. INCLUDE "audio/sfx/cymbal2_1.asm"
  31. INCLUDE "audio/sfx/cymbal3_1.asm"
  32. INCLUDE "audio/sfx/muted_snare1_1.asm"
  33. INCLUDE "audio/sfx/triangle3_1.asm"
  34. INCLUDE "audio/sfx/muted_snare2_1.asm"
  35. INCLUDE "audio/sfx/muted_snare3_1.asm"
  36. INCLUDE "audio/sfx/muted_snare4_1.asm"
  37. Audio1_WavePointers: INCLUDE "audio/wave_instruments.asm"
  38. INCLUDE "audio/sfx/start_menu_1.asm"
  39. INCLUDE "audio/sfx/pokeflute.asm"
  40. INCLUDE "audio/sfx/cut_1.asm"
  41. INCLUDE "audio/sfx/go_inside_1.asm"
  42. INCLUDE "audio/sfx/swap_1.asm"
  43. INCLUDE "audio/sfx/tink_1.asm"
  44. INCLUDE "audio/sfx/59_1.asm"
  45. INCLUDE "audio/sfx/purchase_1.asm"
  46. INCLUDE "audio/sfx/collision_1.asm"
  47. INCLUDE "audio/sfx/go_outside_1.asm"
  48. INCLUDE "audio/sfx/press_ab_1.asm"
  49. INCLUDE "audio/sfx/save_1.asm"
  50. INCLUDE "audio/sfx/heal_hp_1.asm"
  51. INCLUDE "audio/sfx/poisoned_1.asm"
  52. INCLUDE "audio/sfx/heal_ailment_1.asm"
  53. INCLUDE "audio/sfx/trade_machine_1.asm"
  54. INCLUDE "audio/sfx/turn_on_pc_1.asm"
  55. INCLUDE "audio/sfx/turn_off_pc_1.asm"
  56. INCLUDE "audio/sfx/enter_pc_1.asm"
  57. INCLUDE "audio/sfx/shrink_1.asm"
  58. INCLUDE "audio/sfx/switch_1.asm"
  59. INCLUDE "audio/sfx/healing_machine_1.asm"
  60. INCLUDE "audio/sfx/teleport_exit1_1.asm"
  61. INCLUDE "audio/sfx/teleport_enter1_1.asm"
  62. INCLUDE "audio/sfx/teleport_exit2_1.asm"
  63. INCLUDE "audio/sfx/ledge_1.asm"
  64. INCLUDE "audio/sfx/teleport_enter2_1.asm"
  65. INCLUDE "audio/sfx/fly_1.asm"
  66. INCLUDE "audio/sfx/denied_1.asm"
  67. INCLUDE "audio/sfx/arrow_tiles_1.asm"
  68. INCLUDE "audio/sfx/push_boulder_1.asm"
  69. INCLUDE "audio/sfx/ss_anne_horn_1.asm"
  70. INCLUDE "audio/sfx/withdraw_deposit_1.asm"
  71. INCLUDE "audio/sfx/safari_zone_pa.asm"
  72. INCLUDE "audio/sfx/unused_1.asm"
  73. INCLUDE "audio/sfx/cry09_1.asm"
  74. INCLUDE "audio/sfx/cry23_1.asm"
  75. INCLUDE "audio/sfx/cry24_1.asm"
  76. INCLUDE "audio/sfx/cry11_1.asm"
  77. INCLUDE "audio/sfx/cry25_1.asm"
  78. INCLUDE "audio/sfx/cry03_1.asm"
  79. INCLUDE "audio/sfx/cry0f_1.asm"
  80. INCLUDE "audio/sfx/cry10_1.asm"
  81. INCLUDE "audio/sfx/cry00_1.asm"
  82. INCLUDE "audio/sfx/cry0e_1.asm"
  83. INCLUDE "audio/sfx/cry06_1.asm"
  84. INCLUDE "audio/sfx/cry07_1.asm"
  85. INCLUDE "audio/sfx/cry05_1.asm"
  86. INCLUDE "audio/sfx/cry0b_1.asm"
  87. INCLUDE "audio/sfx/cry0c_1.asm"
  88. INCLUDE "audio/sfx/cry02_1.asm"
  89. INCLUDE "audio/sfx/cry0d_1.asm"
  90. INCLUDE "audio/sfx/cry01_1.asm"
  91. INCLUDE "audio/sfx/cry0a_1.asm"
  92. INCLUDE "audio/sfx/cry08_1.asm"
  93. INCLUDE "audio/sfx/cry04_1.asm"
  94. INCLUDE "audio/sfx/cry19_1.asm"
  95. INCLUDE "audio/sfx/cry16_1.asm"
  96. INCLUDE "audio/sfx/cry1b_1.asm"
  97. INCLUDE "audio/sfx/cry12_1.asm"
  98. INCLUDE "audio/sfx/cry13_1.asm"
  99. INCLUDE "audio/sfx/cry14_1.asm"
  100. INCLUDE "audio/sfx/cry1e_1.asm"
  101. INCLUDE "audio/sfx/cry15_1.asm"
  102. INCLUDE "audio/sfx/cry17_1.asm"
  103. INCLUDE "audio/sfx/cry1c_1.asm"
  104. INCLUDE "audio/sfx/cry1a_1.asm"
  105. INCLUDE "audio/sfx/cry1d_1.asm"
  106. INCLUDE "audio/sfx/cry18_1.asm"
  107. INCLUDE "audio/sfx/cry1f_1.asm"
  108. INCLUDE "audio/sfx/cry20_1.asm"
  109. INCLUDE "audio/sfx/cry21_1.asm"
  110. INCLUDE "audio/sfx/cry22_1.asm"
  111. SECTION "Sound Effects 2", ROMX, BANK[AUDIO_2]
  112. INCLUDE "audio/sfx/snare1_2.asm"
  113. INCLUDE "audio/sfx/snare2_2.asm"
  114. INCLUDE "audio/sfx/snare3_2.asm"
  115. INCLUDE "audio/sfx/snare4_2.asm"
  116. INCLUDE "audio/sfx/snare5_2.asm"
  117. INCLUDE "audio/sfx/triangle1_2.asm"
  118. INCLUDE "audio/sfx/triangle2_2.asm"
  119. INCLUDE "audio/sfx/snare6_2.asm"
  120. INCLUDE "audio/sfx/snare7_2.asm"
  121. INCLUDE "audio/sfx/snare8_2.asm"
  122. INCLUDE "audio/sfx/snare9_2.asm"
  123. INCLUDE "audio/sfx/cymbal1_2.asm"
  124. INCLUDE "audio/sfx/cymbal2_2.asm"
  125. INCLUDE "audio/sfx/cymbal3_2.asm"
  126. INCLUDE "audio/sfx/muted_snare1_2.asm"
  127. INCLUDE "audio/sfx/triangle3_2.asm"
  128. INCLUDE "audio/sfx/muted_snare2_2.asm"
  129. INCLUDE "audio/sfx/muted_snare3_2.asm"
  130. INCLUDE "audio/sfx/muted_snare4_2.asm"
  131. Audio2_WavePointers: INCLUDE "audio/wave_instruments.asm"
  132. INCLUDE "audio/sfx/press_ab_2.asm"
  133. INCLUDE "audio/sfx/start_menu_2.asm"
  134. INCLUDE "audio/sfx/tink_2.asm"
  135. INCLUDE "audio/sfx/heal_hp_2.asm"
  136. INCLUDE "audio/sfx/heal_ailment_2.asm"
  137. INCLUDE "audio/sfx/silph_scope.asm"
  138. INCLUDE "audio/sfx/ball_toss.asm"
  139. INCLUDE "audio/sfx/ball_poof.asm"
  140. INCLUDE "audio/sfx/faint_thud.asm"
  141. INCLUDE "audio/sfx/run.asm"
  142. INCLUDE "audio/sfx/dex_page_added.asm"
  143. INCLUDE "audio/sfx/pokeflute_ch6.asm"
  144. INCLUDE "audio/sfx/peck.asm"
  145. INCLUDE "audio/sfx/faint_fall.asm"
  146. INCLUDE "audio/sfx/battle_09.asm"
  147. INCLUDE "audio/sfx/pound.asm"
  148. INCLUDE "audio/sfx/battle_0b.asm"
  149. INCLUDE "audio/sfx/battle_0c.asm"
  150. INCLUDE "audio/sfx/battle_0d.asm"
  151. INCLUDE "audio/sfx/battle_0e.asm"
  152. INCLUDE "audio/sfx/battle_0f.asm"
  153. INCLUDE "audio/sfx/damage.asm"
  154. INCLUDE "audio/sfx/not_very_effective.asm"
  155. INCLUDE "audio/sfx/battle_12.asm"
  156. INCLUDE "audio/sfx/battle_13.asm"
  157. INCLUDE "audio/sfx/battle_14.asm"
  158. INCLUDE "audio/sfx/vine_whip.asm"
  159. INCLUDE "audio/sfx/battle_16.asm"
  160. INCLUDE "audio/sfx/battle_17.asm"
  161. INCLUDE "audio/sfx/battle_18.asm"
  162. INCLUDE "audio/sfx/battle_19.asm"
  163. INCLUDE "audio/sfx/super_effective.asm"
  164. INCLUDE "audio/sfx/battle_1b.asm"
  165. INCLUDE "audio/sfx/battle_1c.asm"
  166. INCLUDE "audio/sfx/doubleslap.asm"
  167. INCLUDE "audio/sfx/battle_1e.asm"
  168. INCLUDE "audio/sfx/horn_drill.asm"
  169. INCLUDE "audio/sfx/battle_20.asm"
  170. INCLUDE "audio/sfx/battle_21.asm"
  171. INCLUDE "audio/sfx/battle_22.asm"
  172. INCLUDE "audio/sfx/battle_23.asm"
  173. INCLUDE "audio/sfx/battle_24.asm"
  174. INCLUDE "audio/sfx/battle_25.asm"
  175. INCLUDE "audio/sfx/battle_26.asm"
  176. INCLUDE "audio/sfx/battle_27.asm"
  177. INCLUDE "audio/sfx/battle_28.asm"
  178. INCLUDE "audio/sfx/battle_29.asm"
  179. INCLUDE "audio/sfx/battle_2a.asm"
  180. INCLUDE "audio/sfx/battle_2b.asm"
  181. INCLUDE "audio/sfx/battle_2c.asm"
  182. INCLUDE "audio/sfx/psybeam.asm"
  183. INCLUDE "audio/sfx/battle_2e.asm"
  184. INCLUDE "audio/sfx/battle_2f.asm"
  185. INCLUDE "audio/sfx/psychic_m.asm"
  186. INCLUDE "audio/sfx/battle_31.asm"
  187. INCLUDE "audio/sfx/battle_32.asm"
  188. INCLUDE "audio/sfx/battle_33.asm"
  189. INCLUDE "audio/sfx/battle_34.asm"
  190. INCLUDE "audio/sfx/battle_35.asm"
  191. INCLUDE "audio/sfx/battle_36.asm"
  192. INCLUDE "audio/sfx/unused_2.asm"
  193. INCLUDE "audio/sfx/cry09_2.asm"
  194. INCLUDE "audio/sfx/cry23_2.asm"
  195. INCLUDE "audio/sfx/cry24_2.asm"
  196. INCLUDE "audio/sfx/cry11_2.asm"
  197. INCLUDE "audio/sfx/cry25_2.asm"
  198. INCLUDE "audio/sfx/cry03_2.asm"
  199. INCLUDE "audio/sfx/cry0f_2.asm"
  200. INCLUDE "audio/sfx/cry10_2.asm"
  201. INCLUDE "audio/sfx/cry00_2.asm"
  202. INCLUDE "audio/sfx/cry0e_2.asm"
  203. INCLUDE "audio/sfx/cry06_2.asm"
  204. INCLUDE "audio/sfx/cry07_2.asm"
  205. INCLUDE "audio/sfx/cry05_2.asm"
  206. INCLUDE "audio/sfx/cry0b_2.asm"
  207. INCLUDE "audio/sfx/cry0c_2.asm"
  208. INCLUDE "audio/sfx/cry02_2.asm"
  209. INCLUDE "audio/sfx/cry0d_2.asm"
  210. INCLUDE "audio/sfx/cry01_2.asm"
  211. INCLUDE "audio/sfx/cry0a_2.asm"
  212. INCLUDE "audio/sfx/cry08_2.asm"
  213. INCLUDE "audio/sfx/cry04_2.asm"
  214. INCLUDE "audio/sfx/cry19_2.asm"
  215. INCLUDE "audio/sfx/cry16_2.asm"
  216. INCLUDE "audio/sfx/cry1b_2.asm"
  217. INCLUDE "audio/sfx/cry12_2.asm"
  218. INCLUDE "audio/sfx/cry13_2.asm"
  219. INCLUDE "audio/sfx/cry14_2.asm"
  220. INCLUDE "audio/sfx/cry1e_2.asm"
  221. INCLUDE "audio/sfx/cry15_2.asm"
  222. INCLUDE "audio/sfx/cry17_2.asm"
  223. INCLUDE "audio/sfx/cry1c_2.asm"
  224. INCLUDE "audio/sfx/cry1a_2.asm"
  225. INCLUDE "audio/sfx/cry1d_2.asm"
  226. INCLUDE "audio/sfx/cry18_2.asm"
  227. INCLUDE "audio/sfx/cry1f_2.asm"
  228. INCLUDE "audio/sfx/cry20_2.asm"
  229. INCLUDE "audio/sfx/cry21_2.asm"
  230. INCLUDE "audio/sfx/cry22_2.asm"
  231. SECTION "Sound Effects 3", ROMX, BANK[AUDIO_3]
  232. INCLUDE "audio/sfx/snare1_3.asm"
  233. INCLUDE "audio/sfx/snare2_3.asm"
  234. INCLUDE "audio/sfx/snare3_3.asm"
  235. INCLUDE "audio/sfx/snare4_3.asm"
  236. INCLUDE "audio/sfx/snare5_3.asm"
  237. INCLUDE "audio/sfx/triangle1_3.asm"
  238. INCLUDE "audio/sfx/triangle2_3.asm"
  239. INCLUDE "audio/sfx/snare6_3.asm"
  240. INCLUDE "audio/sfx/snare7_3.asm"
  241. INCLUDE "audio/sfx/snare8_3.asm"
  242. INCLUDE "audio/sfx/snare9_3.asm"
  243. INCLUDE "audio/sfx/cymbal1_3.asm"
  244. INCLUDE "audio/sfx/cymbal2_3.asm"
  245. INCLUDE "audio/sfx/cymbal3_3.asm"
  246. INCLUDE "audio/sfx/muted_snare1_3.asm"
  247. INCLUDE "audio/sfx/triangle3_3.asm"
  248. INCLUDE "audio/sfx/muted_snare2_3.asm"
  249. INCLUDE "audio/sfx/muted_snare3_3.asm"
  250. INCLUDE "audio/sfx/muted_snare4_3.asm"
  251. Audio3_WavePointers: INCLUDE "audio/wave_instruments.asm"
  252. INCLUDE "audio/sfx/start_menu_3.asm"
  253. INCLUDE "audio/sfx/cut_3.asm"
  254. INCLUDE "audio/sfx/go_inside_3.asm"
  255. INCLUDE "audio/sfx/swap_3.asm"
  256. INCLUDE "audio/sfx/tink_3.asm"
  257. INCLUDE "audio/sfx/59_3.asm"
  258. INCLUDE "audio/sfx/purchase_3.asm"
  259. INCLUDE "audio/sfx/collision_3.asm"
  260. INCLUDE "audio/sfx/go_outside_3.asm"
  261. INCLUDE "audio/sfx/press_ab_3.asm"
  262. INCLUDE "audio/sfx/save_3.asm"
  263. INCLUDE "audio/sfx/heal_hp_3.asm"
  264. INCLUDE "audio/sfx/poisoned_3.asm"
  265. INCLUDE "audio/sfx/heal_ailment_3.asm"
  266. INCLUDE "audio/sfx/trade_machine_3.asm"
  267. INCLUDE "audio/sfx/turn_on_pc_3.asm"
  268. INCLUDE "audio/sfx/turn_off_pc_3.asm"
  269. INCLUDE "audio/sfx/enter_pc_3.asm"
  270. INCLUDE "audio/sfx/shrink_3.asm"
  271. INCLUDE "audio/sfx/switch_3.asm"
  272. INCLUDE "audio/sfx/healing_machine_3.asm"
  273. INCLUDE "audio/sfx/teleport_exit1_3.asm"
  274. INCLUDE "audio/sfx/teleport_enter1_3.asm"
  275. INCLUDE "audio/sfx/teleport_exit2_3.asm"
  276. INCLUDE "audio/sfx/ledge_3.asm"
  277. INCLUDE "audio/sfx/teleport_enter2_3.asm"
  278. INCLUDE "audio/sfx/fly_3.asm"
  279. INCLUDE "audio/sfx/denied_3.asm"
  280. INCLUDE "audio/sfx/arrow_tiles_3.asm"
  281. INCLUDE "audio/sfx/push_boulder_3.asm"
  282. INCLUDE "audio/sfx/ss_anne_horn_3.asm"
  283. INCLUDE "audio/sfx/withdraw_deposit_3.asm"
  284. INCLUDE "audio/sfx/intro_lunge.asm"
  285. INCLUDE "audio/sfx/intro_hip.asm"
  286. INCLUDE "audio/sfx/intro_hop.asm"
  287. INCLUDE "audio/sfx/intro_raise.asm"
  288. INCLUDE "audio/sfx/intro_crash.asm"
  289. INCLUDE "audio/sfx/intro_whoosh.asm"
  290. INCLUDE "audio/sfx/slots_stop_wheel.asm"
  291. INCLUDE "audio/sfx/slots_reward.asm"
  292. INCLUDE "audio/sfx/slots_new_spin.asm"
  293. INCLUDE "audio/sfx/shooting_star.asm"
  294. INCLUDE "audio/sfx/unused_3.asm"
  295. INCLUDE "audio/sfx/cry09_3.asm"
  296. INCLUDE "audio/sfx/cry23_3.asm"
  297. INCLUDE "audio/sfx/cry24_3.asm"
  298. INCLUDE "audio/sfx/cry11_3.asm"
  299. INCLUDE "audio/sfx/cry25_3.asm"
  300. INCLUDE "audio/sfx/cry03_3.asm"
  301. INCLUDE "audio/sfx/cry0f_3.asm"
  302. INCLUDE "audio/sfx/cry10_3.asm"
  303. INCLUDE "audio/sfx/cry00_3.asm"
  304. INCLUDE "audio/sfx/cry0e_3.asm"
  305. INCLUDE "audio/sfx/cry06_3.asm"
  306. INCLUDE "audio/sfx/cry07_3.asm"
  307. INCLUDE "audio/sfx/cry05_3.asm"
  308. INCLUDE "audio/sfx/cry0b_3.asm"
  309. INCLUDE "audio/sfx/cry0c_3.asm"
  310. INCLUDE "audio/sfx/cry02_3.asm"
  311. INCLUDE "audio/sfx/cry0d_3.asm"
  312. INCLUDE "audio/sfx/cry01_3.asm"
  313. INCLUDE "audio/sfx/cry0a_3.asm"
  314. INCLUDE "audio/sfx/cry08_3.asm"
  315. INCLUDE "audio/sfx/cry04_3.asm"
  316. INCLUDE "audio/sfx/cry19_3.asm"
  317. INCLUDE "audio/sfx/cry16_3.asm"
  318. INCLUDE "audio/sfx/cry1b_3.asm"
  319. INCLUDE "audio/sfx/cry12_3.asm"
  320. INCLUDE "audio/sfx/cry13_3.asm"
  321. INCLUDE "audio/sfx/cry14_3.asm"
  322. INCLUDE "audio/sfx/cry1e_3.asm"
  323. INCLUDE "audio/sfx/cry15_3.asm"
  324. INCLUDE "audio/sfx/cry17_3.asm"
  325. INCLUDE "audio/sfx/cry1c_3.asm"
  326. INCLUDE "audio/sfx/cry1a_3.asm"
  327. INCLUDE "audio/sfx/cry1d_3.asm"
  328. INCLUDE "audio/sfx/cry18_3.asm"
  329. INCLUDE "audio/sfx/cry1f_3.asm"
  330. INCLUDE "audio/sfx/cry20_3.asm"
  331. INCLUDE "audio/sfx/cry21_3.asm"
  332. INCLUDE "audio/sfx/cry22_3.asm"
  333. SECTION "Audio Engine 1", ROMX, BANK[AUDIO_1]
  334. PlayBattleMusic::
  335. xor a
  336. ld [wAudioFadeOutControl], a
  337. ld [wLowHealthAlarm], a
  338. dec a
  339. ld [wNewSoundID], a
  340. call PlaySound ; stop music
  341. call DelayFrame
  342. ld c, BANK(Music_GymLeaderBattle)
  343. ld a, [wGymLeaderNo]
  344. and a
  345. jr z, .notGymLeaderBattle
  346. ld a, MUSIC_GYM_LEADER_BATTLE
  347. jr .playSong
  348. .notGymLeaderBattle
  349. ld a, [wCurOpponent]
  350. cp 200
  351. jr c, .wildBattle
  352. cp OPP_SONY3
  353. jr z, .finalBattle
  354. cp OPP_LANCE
  355. jr nz, .normalTrainerBattle
  356. ld a, MUSIC_GYM_LEADER_BATTLE ; lance also plays gym leader theme
  357. jr .playSong
  358. .normalTrainerBattle
  359. ld a, MUSIC_TRAINER_BATTLE
  360. jr .playSong
  361. .finalBattle
  362. ld a, MUSIC_FINAL_BATTLE
  363. jr .playSong
  364. .wildBattle
  365. ld a, MUSIC_WILD_BATTLE
  366. .playSong
  367. jp PlayMusic
  368. INCLUDE "audio/engine_1.asm"
  369. ; an alternate start for MeetRival which has a different first measure
  370. Music_RivalAlternateStart::
  371. ld c, BANK(Music_MeetRival)
  372. ld a, MUSIC_MEET_RIVAL
  373. call PlayMusic
  374. ld hl, wChannelCommandPointers
  375. ld de, Music_MeetRival_branch_b1a2
  376. call Audio1_OverwriteChannelPointer
  377. ld de, Music_MeetRival_branch_b21d
  378. call Audio1_OverwriteChannelPointer
  379. ld de, Music_MeetRival_branch_b2b5
  380. Audio1_OverwriteChannelPointer:
  381. ld a, e
  382. ld [hli], a
  383. ld a, d
  384. ld [hli], a
  385. ret
  386. ; an alternate tempo for MeetRival which is slightly slower
  387. Music_RivalAlternateTempo::
  388. ld c, BANK(Music_MeetRival)
  389. ld a, MUSIC_MEET_RIVAL
  390. call PlayMusic
  391. ld hl, wChannelCommandPointers
  392. ld de, Music_MeetRival_branch_b119
  393. jp Audio1_OverwriteChannelPointer
  394. ; applies both the alternate start and alternate tempo
  395. Music_RivalAlternateStartAndTempo::
  396. call Music_RivalAlternateStart
  397. ld hl, wChannelCommandPointers
  398. ld de, Music_MeetRival_branch_b19b
  399. jp Audio1_OverwriteChannelPointer
  400. ; an alternate tempo for Cities1 which is used for the Hall of Fame room
  401. Music_Cities1AlternateTempo::
  402. ld a, 10
  403. ld [wAudioFadeOutCounterReloadValue], a
  404. ld [wAudioFadeOutCounter], a
  405. ld a, $ff ; stop playing music after the fade-out is finished
  406. ld [wAudioFadeOutControl], a
  407. ld c, 100
  408. call DelayFrames ; wait for the fade-out to finish
  409. ld c, BANK(Music_Cities1)
  410. ld a, MUSIC_CITIES1
  411. call PlayMusic
  412. ld hl, wChannelCommandPointers
  413. ld de, Music_Cities1_branch_aa6f
  414. jp Audio1_OverwriteChannelPointer
  415. SECTION "Audio Engine 2", ROMX, BANK[AUDIO_2]
  416. Music_DoLowHealthAlarm::
  417. ld a, [wLowHealthAlarm]
  418. cp $ff
  419. jr z, .disableAlarm
  420. bit 7, a ;alarm enabled?
  421. ret z ;nope
  422. and $7f ;low 7 bits are the timer.
  423. jr nz, .asm_21383 ;if timer > 0, play low tone.
  424. call .playToneHi
  425. ld a, 30 ;keep this tone for 30 frames.
  426. jr .asm_21395 ;reset the timer.
  427. .asm_21383
  428. cp 20
  429. jr nz, .asm_2138a ;if timer == 20,
  430. call .playToneLo ;actually set the sound registers.
  431. .asm_2138a
  432. ld a, $86
  433. ld [wChannelSoundIDs + Ch4], a ;disable sound channel?
  434. ld a, [wLowHealthAlarm]
  435. and $7f ;decrement alarm timer.
  436. dec a
  437. .asm_21395
  438. ; reset the timer and enable flag.
  439. set 7, a
  440. ld [wLowHealthAlarm], a
  441. ret
  442. .disableAlarm
  443. xor a
  444. ld [wLowHealthAlarm], a ;disable alarm
  445. ld [wChannelSoundIDs + Ch4], a ;re-enable sound channel?
  446. ld de, .toneDataSilence
  447. jr .playTone
  448. ;update the sound registers to change the frequency.
  449. ;the tone set here stays until we change it.
  450. .playToneHi
  451. ld de, .toneDataHi
  452. jr .playTone
  453. .playToneLo
  454. ld de, .toneDataLo
  455. ;update sound channel 1 to play the alarm, overriding all other sounds.
  456. .playTone
  457. ld hl, rNR10 ;channel 1 sound register
  458. ld c, $5
  459. xor a
  460. .copyLoop
  461. ld [hli], a
  462. ld a, [de]
  463. inc de
  464. dec c
  465. jr nz, .copyLoop
  466. ret
  467. ;bytes to write to sound channel 1 registers for health alarm.
  468. ;starting at FF11 (FF10 is always zeroed), so these bytes are:
  469. ;length, envelope, freq lo, freq hi
  470. .toneDataHi
  471. db $A0,$E2,$50,$87
  472. .toneDataLo
  473. db $B0,$E2,$EE,$86
  474. ;written to stop the alarm
  475. .toneDataSilence
  476. db $00,$00,$00,$80
  477. INCLUDE "engine/menu/bills_pc.asm"
  478. INCLUDE "audio/engine_2.asm"
  479. Music_PokeFluteInBattle::
  480. ; begin playing the "caught mon" sound effect
  481. ld a, SFX_CAUGHT_MON
  482. call PlaySoundWaitForCurrent
  483. ; then immediately overwrite the channel pointers
  484. ld hl, wChannelCommandPointers + Ch4 * 2
  485. ld de, SFX_08_PokeFlute_Ch4
  486. call Audio2_OverwriteChannelPointer
  487. ld de, SFX_08_PokeFlute_Ch5
  488. call Audio2_OverwriteChannelPointer
  489. ld de, SFX_08_PokeFlute_Ch6
  490. Audio2_OverwriteChannelPointer:
  491. ld a, e
  492. ld [hli], a
  493. ld a, d
  494. ld [hli], a
  495. ret
  496. SECTION "Audio Engine 3", ROMX, BANK[AUDIO_3]
  497. PlayPokedexRatingSfx::
  498. ld a, [$ffdc]
  499. ld c, $0
  500. ld hl, OwnedMonValues
  501. .getSfxPointer
  502. cp [hl]
  503. jr c, .gotSfxPointer
  504. inc c
  505. inc hl
  506. jr .getSfxPointer
  507. .gotSfxPointer
  508. push bc
  509. ld a, $ff
  510. ld [wNewSoundID], a
  511. call PlaySoundWaitForCurrent
  512. pop bc
  513. ld b, $0
  514. ld hl, PokedexRatingSfxPointers
  515. add hl, bc
  516. add hl, bc
  517. ld a, [hli]
  518. ld c, [hl]
  519. call PlayMusic
  520. jp PlayDefaultMusic
  521. PokedexRatingSfxPointers:
  522. db SFX_DENIED, BANK(SFX_Denied_3)
  523. db SFX_POKEDEX_RATING, BANK(SFX_Pokedex_Rating_1)
  524. db SFX_GET_ITEM_1, BANK(SFX_Get_Item1_1)
  525. db SFX_CAUGHT_MON, BANK(SFX_Caught_Mon)
  526. db SFX_LEVEL_UP, BANK(SFX_Level_Up)
  527. db SFX_GET_KEY_ITEM, BANK(SFX_Get_Key_Item_1)
  528. db SFX_GET_ITEM_2, BANK(SFX_Get_Item2_1)
  529. OwnedMonValues:
  530. db 10, 40, 60, 90, 120, 150, $ff
  531. INCLUDE "audio/engine_3.asm"
  532. SECTION "Music 1", ROMX, BANK[AUDIO_1]
  533. INCLUDE "audio/music/pkmnhealed.asm"
  534. INCLUDE "audio/music/routes1.asm"
  535. INCLUDE "audio/music/routes2.asm"
  536. INCLUDE "audio/music/routes3.asm"
  537. INCLUDE "audio/music/routes4.asm"
  538. INCLUDE "audio/music/indigoplateau.asm"
  539. INCLUDE "audio/music/pallettown.asm"
  540. INCLUDE "audio/music/unusedsong.asm"
  541. INCLUDE "audio/music/cities1.asm"
  542. INCLUDE "audio/sfx/get_item1_1.asm"
  543. INCLUDE "audio/music/museumguy.asm"
  544. INCLUDE "audio/music/meetprofoak.asm"
  545. INCLUDE "audio/music/meetrival.asm"
  546. INCLUDE "audio/sfx/pokedex_rating_1.asm"
  547. INCLUDE "audio/sfx/get_item2_1.asm"
  548. INCLUDE "audio/sfx/get_key_item_1.asm"
  549. INCLUDE "audio/music/ssanne.asm"
  550. INCLUDE "audio/music/cities2.asm"
  551. INCLUDE "audio/music/celadon.asm"
  552. INCLUDE "audio/music/cinnabar.asm"
  553. INCLUDE "audio/music/vermilion.asm"
  554. INCLUDE "audio/music/lavender.asm"
  555. INCLUDE "audio/music/safarizone.asm"
  556. INCLUDE "audio/music/gym.asm"
  557. INCLUDE "audio/music/pokecenter.asm"
  558. SECTION "Music 2", ROMX, BANK[AUDIO_2]
  559. INCLUDE "audio/sfx/pokeflute_ch4_ch5.asm"
  560. INCLUDE "audio/sfx/unused2_2.asm"
  561. INCLUDE "audio/music/gymleaderbattle.asm"
  562. INCLUDE "audio/music/trainerbattle.asm"
  563. INCLUDE "audio/music/wildbattle.asm"
  564. INCLUDE "audio/music/finalbattle.asm"
  565. INCLUDE "audio/sfx/level_up.asm"
  566. INCLUDE "audio/sfx/get_item2_2.asm"
  567. INCLUDE "audio/sfx/caught_mon.asm"
  568. INCLUDE "audio/music/defeatedtrainer.asm"
  569. INCLUDE "audio/music/defeatedwildmon.asm"
  570. INCLUDE "audio/music/defeatedgymleader.asm"
  571. SECTION "Music 3", ROMX, BANK[AUDIO_3]
  572. INCLUDE "audio/music/bikeriding.asm"
  573. INCLUDE "audio/music/dungeon1.asm"
  574. INCLUDE "audio/music/gamecorner.asm"
  575. INCLUDE "audio/music/titlescreen.asm"
  576. INCLUDE "audio/sfx/get_item1_3.asm"
  577. INCLUDE "audio/music/dungeon2.asm"
  578. INCLUDE "audio/music/dungeon3.asm"
  579. INCLUDE "audio/music/cinnabarmansion.asm"
  580. INCLUDE "audio/sfx/pokedex_rating_3.asm"
  581. INCLUDE "audio/sfx/get_item2_3.asm"
  582. INCLUDE "audio/sfx/get_key_item_3.asm"
  583. INCLUDE "audio/music/oakslab.asm"
  584. INCLUDE "audio/music/pokemontower.asm"
  585. INCLUDE "audio/music/silphco.asm"
  586. INCLUDE "audio/music/meeteviltrainer.asm"
  587. INCLUDE "audio/music/meetfemaletrainer.asm"
  588. INCLUDE "audio/music/meetmaletrainer.asm"
  589. INCLUDE "audio/music/introbattle.asm"
  590. INCLUDE "audio/music/surfing.asm"
  591. INCLUDE "audio/music/jigglypuffsong.asm"
  592. INCLUDE "audio/music/halloffame.asm"
  593. INCLUDE "audio/music/credits.asm"