ceruleangym.asm 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. CeruleanGymScript:
  2. ld hl, wCurrentMapScriptFlags
  3. bit 6, [hl]
  4. res 6, [hl]
  5. call nz, CeruleanGymScript_5c6d0
  6. call EnableAutoTextBoxDrawing
  7. ld hl, CeruleanGymTrainerHeader0
  8. ld de, CeruleanGymScriptPointers
  9. ld a, [wCeruleanGymCurScript]
  10. call ExecuteCurMapScriptInTable
  11. ld [wCeruleanGymCurScript], a
  12. ret
  13. CeruleanGymScript_5c6d0:
  14. ld hl, Gym2CityName
  15. ld de, Gym2LeaderName
  16. jp LoadGymLeaderAndCityName
  17. Gym2CityName:
  18. db "CERULEAN CITY@"
  19. Gym2LeaderName:
  20. db "MISTY@"
  21. CeruleanGymScript_5c6ed:
  22. xor a
  23. ld [wJoyIgnore], a
  24. ld [wCeruleanGymCurScript], a
  25. ld [wCurMapScript], a
  26. ret
  27. CeruleanGymScriptPointers:
  28. dw CheckFightingMapTrainers
  29. dw DisplayEnemyTrainerTextAndStartBattle
  30. dw EndTrainerBattle
  31. dw CeruleanGymScript3
  32. CeruleanGymScript3:
  33. ld a, [wIsInBattle]
  34. cp $ff
  35. jp z, CeruleanGymScript_5c6ed
  36. ld a, $f0
  37. ld [wJoyIgnore], a
  38. CeruleanGymScript_5c70d:
  39. ld a, $5
  40. ld [hSpriteIndexOrTextID], a
  41. call DisplayTextID
  42. SetEvent EVENT_BEAT_MISTY
  43. lb bc, TM_11, 1
  44. call GiveItem
  45. jr nc, .BagFull
  46. ld a, $6
  47. ld [hSpriteIndexOrTextID], a
  48. call DisplayTextID
  49. SetEvent EVENT_GOT_TM11
  50. jr .asm_5c736
  51. .BagFull
  52. ld a, $7
  53. ld [hSpriteIndexOrTextID], a
  54. call DisplayTextID
  55. .asm_5c736
  56. ld hl, wObtainedBadges
  57. set 1, [hl]
  58. ld hl, wBeatGymFlags
  59. set 1, [hl]
  60. ; deactivate gym trainers
  61. SetEvents EVENT_BEAT_CERULEAN_GYM_TRAINER_0, EVENT_BEAT_CERULEAN_GYM_TRAINER_1
  62. jp CeruleanGymScript_5c6ed
  63. CeruleanGymTextPointers:
  64. dw CeruleanGymText1
  65. dw CeruleanGymText2
  66. dw CeruleanGymText3
  67. dw CeruleanGymText4
  68. dw CeruleanGymText5
  69. dw CeruleanGymText6
  70. dw CeruleanGymText7
  71. CeruleanGymTrainerHeader0:
  72. dbEventFlagBit EVENT_BEAT_CERULEAN_GYM_TRAINER_0
  73. db ($3 << 4) ; trainer's view range
  74. dwEventFlagAddress EVENT_BEAT_CERULEAN_GYM_TRAINER_0
  75. dw CeruleanGymBattleText1 ; TextBeforeBattle
  76. dw CeruleanGymAfterBattleText1 ; TextAfterBattle
  77. dw CeruleanGymEndBattleText1 ; TextEndBattle
  78. dw CeruleanGymEndBattleText1 ; TextEndBattle
  79. CeruleanGymTrainerHeader1:
  80. dbEventFlagBit EVENT_BEAT_CERULEAN_GYM_TRAINER_1
  81. db ($3 << 4) ; trainer's view range
  82. dwEventFlagAddress EVENT_BEAT_CERULEAN_GYM_TRAINER_1
  83. dw CeruleanGymBattleText2 ; TextBeforeBattle
  84. dw CeruleanGymAfterBattleText2 ; TextAfterBattle
  85. dw CeruleanGymEndBattleText2 ; TextEndBattle
  86. dw CeruleanGymEndBattleText2 ; TextEndBattle
  87. db $ff
  88. CeruleanGymText1:
  89. TX_ASM
  90. CheckEvent EVENT_BEAT_MISTY
  91. jr z, .asm_5c78d
  92. CheckEventReuseA EVENT_GOT_TM11
  93. jr nz, .asm_5c785
  94. call z, CeruleanGymScript_5c70d
  95. call DisableWaitingAfterTextDisplay
  96. jr .asm_5c7bb
  97. .asm_5c785
  98. ld hl, CeruleanGymText_5c7c3
  99. call PrintText
  100. jr .asm_5c7bb
  101. .asm_5c78d
  102. ld hl, CeruleanGymText_5c7be
  103. call PrintText
  104. ld hl, wd72d
  105. set 6, [hl]
  106. set 7, [hl]
  107. ld hl, CeruleanGymText_5c7d8
  108. ld de, CeruleanGymText_5c7d8
  109. call SaveEndBattleTextPointers
  110. ld a, [H_SPRITEINDEX]
  111. ld [wSpriteIndex], a
  112. call EngageMapTrainer
  113. call InitBattleEnemyParameters
  114. ld a, $2
  115. ld [wGymLeaderNo], a
  116. xor a
  117. ld [hJoyHeld], a
  118. ld a, $3
  119. ld [wCeruleanGymCurScript], a
  120. .asm_5c7bb
  121. jp TextScriptEnd
  122. CeruleanGymText_5c7be:
  123. TX_FAR _CeruleanGymText_5c7be
  124. db "@"
  125. CeruleanGymText_5c7c3:
  126. TX_FAR _CeruleanGymText_5c7c3
  127. db "@"
  128. CeruleanGymText5:
  129. TX_FAR _CeruleanGymText_5c7c8
  130. db "@"
  131. CeruleanGymText6:
  132. TX_FAR _ReceivedTM11Text
  133. TX_SFX_ITEM_1
  134. db "@"
  135. CeruleanGymText7:
  136. TX_FAR _CeruleanGymText_5c7d3
  137. db "@"
  138. CeruleanGymText_5c7d8:
  139. TX_FAR _CeruleanGymText_5c7d8
  140. TX_SFX_KEY_ITEM ; actually plays the second channel of SFX_BALL_POOF due to the wrong music bank being loaded
  141. TX_BLINK
  142. db "@"
  143. CeruleanGymText2:
  144. TX_ASM
  145. ld hl, CeruleanGymTrainerHeader0
  146. call TalkToTrainer
  147. jp TextScriptEnd
  148. CeruleanGymBattleText1:
  149. TX_FAR _CeruleanGymBattleText1
  150. db "@"
  151. CeruleanGymEndBattleText1:
  152. TX_FAR _CeruleanGymEndBattleText1
  153. db "@"
  154. CeruleanGymAfterBattleText1:
  155. TX_FAR _CeruleanGymAfterBattleText1
  156. db "@"
  157. CeruleanGymText3:
  158. TX_ASM
  159. ld hl, CeruleanGymTrainerHeader1
  160. call TalkToTrainer
  161. jp TextScriptEnd
  162. CeruleanGymBattleText2:
  163. TX_FAR _CeruleanGymBattleText2
  164. db "@"
  165. CeruleanGymEndBattleText2:
  166. TX_FAR _CeruleanGymEndBattleText2
  167. db "@"
  168. CeruleanGymAfterBattleText2:
  169. TX_FAR _CeruleanGymAfterBattleText2
  170. db "@"
  171. CeruleanGymText4:
  172. TX_ASM
  173. CheckEvent EVENT_BEAT_MISTY
  174. jr nz, .asm_5c821
  175. ld hl, CeruleanGymText_5c82a
  176. call PrintText
  177. jr .asm_5c827
  178. .asm_5c821
  179. ld hl, CeruleanGymText_5c82f
  180. call PrintText
  181. .asm_5c827
  182. jp TextScriptEnd
  183. CeruleanGymText_5c82a:
  184. TX_FAR _CeruleanGymText_5c82a
  185. db "@"
  186. CeruleanGymText_5c82f:
  187. TX_FAR _CeruleanGymText_5c82f
  188. db "@"