celadongym.asm 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. CeladonGymScript:
  2. ld hl, wCurrentMapScriptFlags
  3. bit 6, [hl]
  4. res 6, [hl]
  5. call nz, CeladonGymScript_48927
  6. call EnableAutoTextBoxDrawing
  7. ld hl, CeladonGymTrainerHeader0
  8. ld de, CeladonGymScriptPointers
  9. ld a, [wCeladonGymCurScript]
  10. call ExecuteCurMapScriptInTable
  11. ld [wCeladonGymCurScript], a
  12. ret
  13. CeladonGymScript_48927:
  14. ld hl, Gym4CityName
  15. ld de, Gym4LeaderName
  16. jp LoadGymLeaderAndCityName
  17. Gym4CityName:
  18. db "CELADON CITY@"
  19. Gym4LeaderName:
  20. db "ERIKA@"
  21. CeladonGymText_48943:
  22. xor a
  23. ld [wJoyIgnore], a
  24. ld [wCeladonGymCurScript], a
  25. ld [wCurMapScript], a
  26. ret
  27. CeladonGymScriptPointers:
  28. dw CheckFightingMapTrainers
  29. dw DisplayEnemyTrainerTextAndStartBattle
  30. dw EndTrainerBattle
  31. dw CeladonGymScript3
  32. CeladonGymScript3:
  33. ld a, [wIsInBattle]
  34. cp $ff
  35. jp z, CeladonGymText_48943
  36. ld a, $f0
  37. ld [wJoyIgnore], a
  38. CeladonGymText_48963:
  39. ld a, $9
  40. ld [hSpriteIndexOrTextID], a
  41. call DisplayTextID
  42. SetEvent EVENT_BEAT_ERIKA
  43. lb bc, TM_21, 1
  44. call GiveItem
  45. jr nc, .BagFull
  46. ld a, $a
  47. ld [hSpriteIndexOrTextID], a
  48. call DisplayTextID
  49. SetEvent EVENT_GOT_TM21
  50. jr .asm_4898c
  51. .BagFull
  52. ld a, $b
  53. ld [hSpriteIndexOrTextID], a
  54. call DisplayTextID
  55. .asm_4898c
  56. ld hl, wObtainedBadges
  57. set 3, [hl]
  58. ld hl, wBeatGymFlags
  59. set 3, [hl]
  60. ; deactivate gym trainers
  61. SetEventRange EVENT_BEAT_CELADON_GYM_TRAINER_0, EVENT_BEAT_CELADON_GYM_TRAINER_6
  62. jp CeladonGymText_48943
  63. CeladonGymTextPointers:
  64. dw CeladonGymText1
  65. dw CeladonGymText2
  66. dw CeladonGymText3
  67. dw CeladonGymText4
  68. dw CeladonGymText5
  69. dw CeladonGymText6
  70. dw CeladonGymText7
  71. dw CeladonGymText8
  72. dw CeladonGymText9
  73. dw TM21Text
  74. dw TM21NoRoomText
  75. CeladonGymTrainerHeader0:
  76. dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_0
  77. db ($2 << 4) ; trainer's view range
  78. dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_0
  79. dw CeladonGymBattleText2 ; TextBeforeBattle
  80. dw CeladonGymAfterBattleText2 ; TextAfterBattle
  81. dw CeladonGymEndBattleText2 ; TextEndBattle
  82. dw CeladonGymEndBattleText2 ; TextEndBattle
  83. CeladonGymTrainerHeader1:
  84. dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_1
  85. db ($2 << 4) ; trainer's view range
  86. dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_1
  87. dw CeladonGymBattleText3 ; TextBeforeBattle
  88. dw CeladonGymAfterBattleText3 ; TextAfterBattle
  89. dw CeladonGymEndBattleText3 ; TextEndBattle
  90. dw CeladonGymEndBattleText3 ; TextEndBattle
  91. CeladonGymTrainerHeader2:
  92. dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_2
  93. db ($4 << 4) ; trainer's view range
  94. dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_2
  95. dw CeladonGymBattleText4 ; TextBeforeBattle
  96. dw CeladonGymAfterBattleText4 ; TextAfterBattle
  97. dw CeladonGymEndBattleText4 ; TextEndBattle
  98. dw CeladonGymEndBattleText4 ; TextEndBattle
  99. CeladonGymTrainerHeader3:
  100. dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_3
  101. db ($4 << 4) ; trainer's view range
  102. dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_3
  103. dw CeladonGymBattleText5 ; TextBeforeBattle
  104. dw CeladonGymAfterBattleText5 ; TextAfterBattle
  105. dw CeladonGymEndBattleText5 ; TextEndBattle
  106. dw CeladonGymEndBattleText5 ; TextEndBattle
  107. CeladonGymTrainerHeader4:
  108. dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_4
  109. db ($2 << 4) ; trainer's view range
  110. dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_4
  111. dw CeladonGymBattleText6 ; TextBeforeBattle
  112. dw CeladonGymAfterBattleText6 ; TextAfterBattle
  113. dw CeladonGymEndBattleText6 ; TextEndBattle
  114. dw CeladonGymEndBattleText6 ; TextEndBattle
  115. CeladonGymTrainerHeader5:
  116. dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_5
  117. db ($2 << 4) ; trainer's view range
  118. dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_5
  119. dw CeladonGymBattleText7 ; TextBeforeBattle
  120. dw CeladonGymAfterBattleText7 ; TextAfterBattle
  121. dw CeladonGymEndBattleText7 ; TextEndBattle
  122. dw CeladonGymEndBattleText7 ; TextEndBattle
  123. CeladonGymTrainerHeader6:
  124. dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_6, 1
  125. db ($3 << 4) ; trainer's view range
  126. dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_6, 1
  127. dw CeladonGymBattleText8 ; TextBeforeBattle
  128. dw CeladonGymAfterBattleText8 ; TextAfterBattle
  129. dw CeladonGymEndBattleText8 ; TextEndBattle
  130. dw CeladonGymEndBattleText8 ; TextEndBattle
  131. db $ff
  132. CeladonGymText1:
  133. TX_ASM
  134. CheckEvent EVENT_BEAT_ERIKA
  135. jr z, .asm_48a2d
  136. CheckEventReuseA EVENT_GOT_TM21
  137. jr nz, .asm_48a25
  138. call z, CeladonGymText_48963
  139. call DisableWaitingAfterTextDisplay
  140. jr .asm_48a5b
  141. .asm_48a25
  142. ld hl, CeladonGymText_48a68
  143. call PrintText
  144. jr .asm_48a5b
  145. .asm_48a2d
  146. ld hl, CeladonGymText_48a5e
  147. call PrintText
  148. ld hl, wd72d
  149. set 6, [hl]
  150. set 7, [hl]
  151. ld hl, CeladonGymText_48a63
  152. ld de, CeladonGymText_48a63
  153. call SaveEndBattleTextPointers
  154. ld a, [H_SPRITEINDEX]
  155. ld [wSpriteIndex], a
  156. call EngageMapTrainer
  157. call InitBattleEnemyParameters
  158. ld a, $4
  159. ld [wGymLeaderNo], a
  160. ld a, $3
  161. ld [wCeladonGymCurScript], a
  162. ld [wCurMapScript], a
  163. .asm_48a5b
  164. jp TextScriptEnd
  165. CeladonGymText_48a5e:
  166. TX_FAR _CeladonGymText_48a5e
  167. db "@"
  168. CeladonGymText_48a63:
  169. TX_FAR _CeladonGymText_48a63
  170. db "@"
  171. CeladonGymText_48a68:
  172. TX_FAR _CeladonGymText_48a68
  173. db "@"
  174. CeladonGymText9:
  175. TX_FAR _CeladonGymText9
  176. db "@"
  177. TM21Text:
  178. TX_FAR _ReceivedTM21Text
  179. TX_SFX_ITEM_1
  180. TX_FAR _TM21ExplanationText
  181. db "@"
  182. TM21NoRoomText:
  183. TX_FAR _TM21NoRoomText
  184. db "@"
  185. CeladonGymText2:
  186. TX_ASM
  187. ld hl, CeladonGymTrainerHeader0
  188. call TalkToTrainer
  189. jp TextScriptEnd
  190. CeladonGymBattleText2:
  191. TX_FAR _CeladonGymBattleText2
  192. db "@"
  193. CeladonGymEndBattleText2:
  194. TX_FAR _CeladonGymEndBattleText2
  195. db "@"
  196. CeladonGymAfterBattleText2:
  197. TX_FAR _CeladonGymAfterBattleText2
  198. db "@"
  199. CeladonGymText3:
  200. TX_ASM
  201. ld hl, CeladonGymTrainerHeader1
  202. call TalkToTrainer
  203. jp TextScriptEnd
  204. CeladonGymBattleText3:
  205. TX_FAR _CeladonGymBattleText3
  206. db "@"
  207. CeladonGymEndBattleText3:
  208. TX_FAR _CeladonGymEndBattleText3
  209. db "@"
  210. CeladonGymAfterBattleText3:
  211. TX_FAR _CeladonGymAfterBattleText3
  212. db "@"
  213. CeladonGymText4:
  214. TX_ASM
  215. ld hl, CeladonGymTrainerHeader2
  216. call TalkToTrainer
  217. jp TextScriptEnd
  218. CeladonGymBattleText4:
  219. TX_FAR _CeladonGymBattleText4
  220. db "@"
  221. CeladonGymEndBattleText4:
  222. TX_FAR _CeladonGymEndBattleText4
  223. db "@"
  224. CeladonGymAfterBattleText4:
  225. TX_FAR _CeladonGymAfterBattleText4
  226. db "@"
  227. CeladonGymText5:
  228. TX_ASM
  229. ld hl, CeladonGymTrainerHeader3
  230. call TalkToTrainer
  231. jp TextScriptEnd
  232. CeladonGymBattleText5:
  233. TX_FAR _CeladonGymBattleText5
  234. db "@"
  235. CeladonGymEndBattleText5:
  236. TX_FAR _CeladonGymEndBattleText5
  237. db "@"
  238. CeladonGymAfterBattleText5:
  239. TX_FAR _CeladonGymAfterBattleText5
  240. db "@"
  241. CeladonGymText6:
  242. TX_ASM
  243. ld hl, CeladonGymTrainerHeader4
  244. call TalkToTrainer
  245. jp TextScriptEnd
  246. CeladonGymBattleText6:
  247. TX_FAR _CeladonGymBattleText6
  248. db "@"
  249. CeladonGymEndBattleText6:
  250. TX_FAR _CeladonGymEndBattleText6
  251. db "@"
  252. CeladonGymAfterBattleText6:
  253. TX_FAR _CeladonGymAfterBattleText6
  254. db "@"
  255. CeladonGymText7:
  256. TX_ASM
  257. ld hl, CeladonGymTrainerHeader5
  258. call TalkToTrainer
  259. jp TextScriptEnd
  260. CeladonGymBattleText7:
  261. TX_FAR _CeladonGymBattleText7
  262. db "@"
  263. CeladonGymEndBattleText7:
  264. TX_FAR _CeladonGymEndBattleText7
  265. db "@"
  266. CeladonGymAfterBattleText7:
  267. TX_FAR _CeladonGymAfterBattleText7
  268. db "@"
  269. CeladonGymText8:
  270. TX_ASM
  271. ld hl, CeladonGymTrainerHeader6
  272. call TalkToTrainer
  273. jp TextScriptEnd
  274. CeladonGymBattleText8:
  275. TX_FAR _CeladonGymBattleText8
  276. db "@"
  277. CeladonGymEndBattleText8:
  278. TX_FAR _CeladonGymEndBattleText8
  279. db "@"
  280. CeladonGymAfterBattleText8:
  281. TX_FAR _CeladonGymAfterBattleText8
  282. db "@"