vermiliongym.asm 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. VermilionGymScript:
  2. ld hl, wCurrentMapScriptFlags
  3. bit 5, [hl]
  4. res 5, [hl]
  5. push hl
  6. call nz, VermilionGymScript_5ca4c
  7. pop hl
  8. bit 6, [hl]
  9. res 6, [hl]
  10. call nz, VermilionGymScript_5ca6d
  11. call EnableAutoTextBoxDrawing
  12. ld hl, VermilionGymTrainerHeader0
  13. ld de, VermilionGymScriptPointers
  14. ld a, [wVermilionGymCurScript]
  15. call ExecuteCurMapScriptInTable
  16. ld [wVermilionGymCurScript], a
  17. ret
  18. VermilionGymScript_5ca4c:
  19. ld hl, Gym3CityName
  20. ld de, Gym3LeaderName
  21. jp LoadGymLeaderAndCityName
  22. Gym3CityName:
  23. db "VERMILION CITY@"
  24. Gym3LeaderName:
  25. db "LT.SURGE@"
  26. VermilionGymScript_5ca6d:
  27. CheckEvent EVENT_2ND_LOCK_OPENED
  28. jr nz, .asm_5ca78
  29. ld a, $24
  30. jr .asm_5ca7f
  31. .asm_5ca78
  32. ld a, SFX_GO_INSIDE
  33. call PlaySound
  34. ld a, $5
  35. .asm_5ca7f
  36. ld [wNewTileBlockID], a
  37. lb bc, 2, 2
  38. predef_jump ReplaceTileBlock
  39. VermilionGymScript_5ca8a:
  40. xor a
  41. ld [wJoyIgnore], a
  42. ld [wVermilionGymCurScript], a
  43. ld [wCurMapScript], a
  44. ret
  45. VermilionGymScriptPointers:
  46. dw CheckFightingMapTrainers
  47. dw DisplayEnemyTrainerTextAndStartBattle
  48. dw EndTrainerBattle
  49. dw VermilionGymScript3
  50. VermilionGymScript3:
  51. ld a, [wIsInBattle]
  52. cp $ff
  53. jp z, VermilionGymScript_5ca8a
  54. ld a, $f0
  55. ld [wJoyIgnore], a
  56. VermilionGymScript_5caaa:
  57. ld a, $6
  58. ld [hSpriteIndexOrTextID], a
  59. call DisplayTextID
  60. SetEvent EVENT_BEAT_LT_SURGE
  61. lb bc, TM_24, 1
  62. call GiveItem
  63. jr nc, .BagFull
  64. ld a, $7
  65. ld [hSpriteIndexOrTextID], a
  66. call DisplayTextID
  67. SetEvent EVENT_GOT_TM24
  68. jr .asm_5cad3
  69. .BagFull
  70. ld a, $8
  71. ld [hSpriteIndexOrTextID], a
  72. call DisplayTextID
  73. .asm_5cad3
  74. ld hl, wObtainedBadges
  75. set 2, [hl]
  76. ld hl, wBeatGymFlags
  77. set 2, [hl]
  78. ; deactivate gym trainers
  79. SetEventRange EVENT_BEAT_VERMILION_GYM_TRAINER_0, EVENT_BEAT_VERMILION_GYM_TRAINER_2
  80. jp VermilionGymScript_5ca8a
  81. VermilionGymTextPointers:
  82. dw VermilionGymText1
  83. dw VermilionGymText2
  84. dw VermilionGymText3
  85. dw VermilionGymText4
  86. dw VermilionGymText5
  87. dw VermilionGymText6
  88. dw VermilionGymText7
  89. dw VermilionGymText8
  90. VermilionGymTrainerHeader0:
  91. dbEventFlagBit EVENT_BEAT_VERMILION_GYM_TRAINER_0
  92. db ($3 << 4) ; trainer's view range
  93. dwEventFlagAddress EVENT_BEAT_VERMILION_GYM_TRAINER_0
  94. dw VermilionGymBattleText1 ; TextBeforeBattle
  95. dw VermilionGymAfterBattleText1 ; TextAfterBattle
  96. dw VermilionGymEndBattleText1 ; TextEndBattle
  97. dw VermilionGymEndBattleText1 ; TextEndBattle
  98. VermilionGymTrainerHeader1:
  99. dbEventFlagBit EVENT_BEAT_VERMILION_GYM_TRAINER_1
  100. db ($2 << 4) ; trainer's view range
  101. dwEventFlagAddress EVENT_BEAT_VERMILION_GYM_TRAINER_1
  102. dw VermilionGymBattleText2 ; TextBeforeBattle
  103. dw VermilionGymAfterBattleText2 ; TextAfterBattle
  104. dw VermilionGymEndBattleText2 ; TextEndBattle
  105. dw VermilionGymEndBattleText2 ; TextEndBattle
  106. VermilionGymTrainerHeader2:
  107. dbEventFlagBit EVENT_BEAT_VERMILION_GYM_TRAINER_2
  108. db ($3 << 4) ; trainer's view range
  109. dwEventFlagAddress EVENT_BEAT_VERMILION_GYM_TRAINER_2
  110. dw VermilionGymBattleText3 ; TextBeforeBattle
  111. dw VermilionGymAfterBattleText3 ; TextAfterBattle
  112. dw VermilionGymEndBattleText3 ; TextEndBattle
  113. dw VermilionGymEndBattleText3 ; TextEndBattle
  114. db $ff
  115. VermilionGymText1:
  116. TX_ASM
  117. CheckEvent EVENT_BEAT_LT_SURGE
  118. jr z, .asm_5cb39
  119. CheckEventReuseA EVENT_GOT_TM24
  120. jr nz, .asm_5cb31
  121. call z, VermilionGymScript_5caaa
  122. call DisableWaitingAfterTextDisplay
  123. jr .asm_5cb6a
  124. .asm_5cb31
  125. ld hl, VermilionGymText_5cb72
  126. call PrintText
  127. jr .asm_5cb6a
  128. .asm_5cb39
  129. ld hl, VermilionGymText_5cb6d
  130. call PrintText
  131. ld hl, wd72d
  132. set 6, [hl]
  133. set 7, [hl]
  134. ld hl, ReceivedThunderbadgeText
  135. ld de, ReceivedThunderbadgeText
  136. call SaveEndBattleTextPointers
  137. ld a, [H_SPRITEINDEX]
  138. ld [wSpriteIndex], a
  139. call EngageMapTrainer
  140. call InitBattleEnemyParameters
  141. ld a, $3
  142. ld [wGymLeaderNo], a
  143. xor a
  144. ld [hJoyHeld], a
  145. ld a, $3
  146. ld [wVermilionGymCurScript], a
  147. ld [wCurMapScript], a
  148. .asm_5cb6a
  149. jp TextScriptEnd
  150. VermilionGymText_5cb6d:
  151. TX_FAR _VermilionGymText_5cb6d
  152. db "@"
  153. VermilionGymText_5cb72:
  154. TX_FAR _VermilionGymText_5cb72
  155. db "@"
  156. VermilionGymText6:
  157. TX_FAR _VermilionGymText_5cb77
  158. db "@"
  159. VermilionGymText7:
  160. TX_FAR _ReceivedTM24Text
  161. TX_SFX_KEY_ITEM
  162. TX_FAR _TM24ExplanationText
  163. db "@"
  164. VermilionGymText8:
  165. TX_FAR _TM24NoRoomText
  166. db "@"
  167. ReceivedThunderbadgeText:
  168. TX_FAR _ReceivedThunderbadgeText
  169. db "@"
  170. VermilionGymText2:
  171. TX_ASM
  172. ld hl, VermilionGymTrainerHeader0
  173. call TalkToTrainer
  174. jp TextScriptEnd
  175. VermilionGymBattleText1:
  176. TX_FAR _VermilionGymBattleText1
  177. db "@"
  178. VermilionGymEndBattleText1:
  179. TX_FAR _VermilionGymEndBattleText1
  180. db "@"
  181. VermilionGymAfterBattleText1:
  182. TX_FAR _VermilionGymAfterBattleText1
  183. db "@"
  184. VermilionGymText3:
  185. TX_ASM
  186. ld hl, VermilionGymTrainerHeader1
  187. call TalkToTrainer
  188. jp TextScriptEnd
  189. VermilionGymBattleText2:
  190. TX_FAR _VermilionGymBattleText2
  191. db "@"
  192. VermilionGymEndBattleText2:
  193. TX_FAR _VermilionGymEndBattleText2
  194. db "@"
  195. VermilionGymAfterBattleText2:
  196. TX_FAR _VermilionGymAfterBattleText2
  197. db "@"
  198. VermilionGymText4:
  199. TX_ASM
  200. ld hl, VermilionGymTrainerHeader2
  201. call TalkToTrainer
  202. jp TextScriptEnd
  203. VermilionGymBattleText3:
  204. TX_FAR _VermilionGymBattleText3
  205. db "@"
  206. VermilionGymEndBattleText3:
  207. TX_FAR _VermilionGymEndBattleText3
  208. db "@"
  209. VermilionGymAfterBattleText3:
  210. TX_FAR _VermilionGymAfterBattleText3
  211. db "@"
  212. VermilionGymText5:
  213. TX_ASM
  214. ld a, [wBeatGymFlags]
  215. bit 2, a
  216. jr nz, .asm_5cbeb
  217. ld hl, VermilionGymText_5cbf4
  218. call PrintText
  219. jr .asm_5cbf1
  220. .asm_5cbeb
  221. ld hl, VermilionGymText_5cbf9
  222. call PrintText
  223. .asm_5cbf1
  224. jp TextScriptEnd
  225. VermilionGymText_5cbf4:
  226. TX_FAR _VermilionGymText_5cbf4
  227. db "@"
  228. VermilionGymText_5cbf9:
  229. TX_FAR _VermilionGymText_5cbf9
  230. db "@"