pokemontower7.asm 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. PokemonTower7Script:
  2. call EnableAutoTextBoxDrawing
  3. ld hl, PokemonTower7TrainerHeader0
  4. ld de, PokemonTower7ScriptPointers
  5. ld a, [wPokemonTower7CurScript]
  6. call ExecuteCurMapScriptInTable
  7. ld [wPokemonTower7CurScript], a
  8. ret
  9. PokemonTower7Script_60d18:
  10. xor a
  11. ld [wJoyIgnore], a
  12. ld [wPokemonTower7CurScript], a
  13. ld [wCurMapScript], a
  14. ret
  15. PokemonTower7ScriptPointers:
  16. dw CheckFightingMapTrainers
  17. dw DisplayEnemyTrainerTextAndStartBattle
  18. dw PokemonTower7Script2
  19. dw PokemonTower7Script3
  20. dw PokemonTower7Script4
  21. PokemonTower7Script2:
  22. ld hl, wFlags_0xcd60
  23. res 0, [hl]
  24. ld a, [wIsInBattle]
  25. cp $ff
  26. jp z, PokemonTower7Script_60d18
  27. call EndTrainerBattle
  28. ld a, $f0
  29. ld [wJoyIgnore], a
  30. ld a, [wSpriteIndex]
  31. ld [hSpriteIndexOrTextID], a
  32. call DisplayTextID
  33. call PokemonTower7Script_60db6
  34. ld a, $3
  35. ld [wPokemonTower7CurScript], a
  36. ld [wCurMapScript], a
  37. ret
  38. PokemonTower7Script3:
  39. ld a, [wd730]
  40. bit 0, a
  41. ret nz
  42. ld hl, wMissableObjectList
  43. ld a, [wSpriteIndex]
  44. ld b, a
  45. .missableObjectsListLoop
  46. ld a, [hli]
  47. cp b ; search for sprite ID in missing objects list
  48. ld a, [hli]
  49. jr nz, .missableObjectsListLoop
  50. ld [wMissableObjectIndex], a ; remove missable object
  51. predef HideObject
  52. xor a
  53. ld [wJoyIgnore], a
  54. ld [wSpriteIndex], a
  55. ld [wTrainerHeaderFlagBit], a
  56. ld [wUnusedDA38], a
  57. ld a, $0
  58. ld [wPokemonTower7CurScript], a
  59. ld [wCurMapScript], a
  60. ret
  61. PokemonTower7Script4:
  62. ld a, $ff
  63. ld [wJoyIgnore], a
  64. ld a, HS_POKEMONTOWER_7_MR_FUJI
  65. ld [wMissableObjectIndex], a
  66. predef HideObject
  67. ld a, SPRITE_FACING_UP
  68. ld [wSpriteStateData1 + 9], a
  69. ld a, LAVENDER_HOUSE_1
  70. ld [hWarpDestinationMap], a
  71. ld a, $1
  72. ld [wDestinationWarpID], a
  73. ld a, LAVENDER_TOWN
  74. ld [wLastMap], a
  75. ld hl, wd72d
  76. set 3, [hl]
  77. ld a, $0
  78. ld [wPokemonTower7CurScript], a
  79. ld [wCurMapScript], a
  80. ret
  81. PokemonTower7Script_60db6:
  82. ld hl, CoordsData_60de3
  83. ld a, [wSpriteIndex]
  84. dec a
  85. swap a
  86. ld d, $0
  87. ld e, a
  88. add hl, de
  89. ld a, [wYCoord]
  90. ld b, a
  91. ld a, [wXCoord]
  92. ld c, a
  93. .asm_60dcb
  94. ld a, [hli]
  95. cp b
  96. jr nz, .asm_60dde
  97. ld a, [hli]
  98. cp c
  99. jr nz, .asm_60ddf
  100. ld a, [hli]
  101. ld d, [hl]
  102. ld e, a
  103. ld a, [wSpriteIndex]
  104. ld [H_SPRITEINDEX], a
  105. jp MoveSprite
  106. .asm_60dde
  107. inc hl
  108. .asm_60ddf
  109. inc hl
  110. inc hl
  111. jr .asm_60dcb
  112. CoordsData_60de3:
  113. db $0C,$09
  114. dw MovementData_60e13
  115. db $0B,$0A
  116. dw MovementData_60e1b
  117. db $0B,$0B
  118. dw MovementData_60e22
  119. db $0B,$0C
  120. dw MovementData_60e22
  121. db $0A,$0C
  122. dw MovementData_60e28
  123. db $09,$0B
  124. dw MovementData_60e30
  125. db $09,$0A
  126. dw MovementData_60e22
  127. db $09,$09
  128. dw MovementData_60e22
  129. db $08,$09
  130. dw MovementData_60e37
  131. db $07,$0A
  132. dw MovementData_60e22
  133. db $07,$0B
  134. dw MovementData_60e22
  135. db $07,$0C
  136. dw MovementData_60e22
  137. MovementData_60e13:
  138. db NPC_MOVEMENT_RIGHT
  139. db NPC_MOVEMENT_DOWN
  140. db NPC_MOVEMENT_DOWN
  141. db NPC_MOVEMENT_DOWN
  142. db NPC_MOVEMENT_DOWN
  143. db NPC_MOVEMENT_DOWN
  144. db NPC_MOVEMENT_LEFT
  145. db $FF
  146. MovementData_60e1b:
  147. db NPC_MOVEMENT_DOWN
  148. db NPC_MOVEMENT_RIGHT
  149. db NPC_MOVEMENT_DOWN
  150. db NPC_MOVEMENT_DOWN
  151. db NPC_MOVEMENT_DOWN
  152. db NPC_MOVEMENT_DOWN
  153. db $FF
  154. MovementData_60e22:
  155. db NPC_MOVEMENT_DOWN
  156. db NPC_MOVEMENT_DOWN
  157. db NPC_MOVEMENT_DOWN
  158. db NPC_MOVEMENT_DOWN
  159. db NPC_MOVEMENT_DOWN
  160. db $FF
  161. MovementData_60e28:
  162. db NPC_MOVEMENT_LEFT
  163. db NPC_MOVEMENT_DOWN
  164. db NPC_MOVEMENT_DOWN
  165. db NPC_MOVEMENT_DOWN
  166. db NPC_MOVEMENT_DOWN
  167. db NPC_MOVEMENT_DOWN
  168. db NPC_MOVEMENT_DOWN
  169. db $FF
  170. MovementData_60e30:
  171. db NPC_MOVEMENT_DOWN
  172. db NPC_MOVEMENT_DOWN
  173. db NPC_MOVEMENT_DOWN
  174. db NPC_MOVEMENT_LEFT
  175. db NPC_MOVEMENT_DOWN
  176. db NPC_MOVEMENT_DOWN
  177. db $FF
  178. MovementData_60e37:
  179. db NPC_MOVEMENT_RIGHT
  180. db NPC_MOVEMENT_DOWN
  181. db NPC_MOVEMENT_DOWN
  182. db NPC_MOVEMENT_DOWN
  183. db NPC_MOVEMENT_DOWN
  184. db NPC_MOVEMENT_DOWN
  185. db NPC_MOVEMENT_DOWN
  186. db $FF
  187. PokemonTower7TextPointers:
  188. dw PokemonTower7Text1
  189. dw PokemonTower7Text2
  190. dw PokemonTower7Text3
  191. dw PokemonTower7FujiText
  192. PokemonTower7TrainerHeader0:
  193. dbEventFlagBit EVENT_BEAT_POKEMONTOWER_7_TRAINER_0
  194. db ($3 << 4) ; trainer's view range
  195. dwEventFlagAddress EVENT_BEAT_POKEMONTOWER_7_TRAINER_0
  196. dw PokemonTower7BattleText1 ; TextBeforeBattle
  197. dw PokemonTower7AfterBattleText1 ; TextAfterBattle
  198. dw PokemonTower7EndBattleText1 ; TextEndBattle
  199. dw PokemonTower7EndBattleText1 ; TextEndBattle
  200. PokemonTower7TrainerHeader1:
  201. dbEventFlagBit EVENT_BEAT_POKEMONTOWER_7_TRAINER_1
  202. db ($3 << 4) ; trainer's view range
  203. dwEventFlagAddress EVENT_BEAT_POKEMONTOWER_7_TRAINER_1
  204. dw PokemonTower7BattleText2 ; TextBeforeBattle
  205. dw PokemonTower7AfterBattleText2 ; TextAfterBattle
  206. dw PokemonTower7EndBattleText2 ; TextEndBattle
  207. dw PokemonTower7EndBattleText2 ; TextEndBattle
  208. PokemonTower7TrainerHeader2:
  209. dbEventFlagBit EVENT_BEAT_POKEMONTOWER_7_TRAINER_2
  210. db ($3 << 4) ; trainer's view range
  211. dwEventFlagAddress EVENT_BEAT_POKEMONTOWER_7_TRAINER_2
  212. dw PokemonTower7BattleText3 ; TextBeforeBattle
  213. dw PokemonTower7AfterBattleText3 ; TextAfterBattle
  214. dw PokemonTower7EndBattleText3 ; TextEndBattle
  215. dw PokemonTower7EndBattleText3 ; TextEndBattle
  216. db $ff
  217. PokemonTower7Text1:
  218. TX_ASM
  219. ld hl, PokemonTower7TrainerHeader0
  220. call TalkToTrainer
  221. jp TextScriptEnd
  222. PokemonTower7Text2:
  223. TX_ASM
  224. ld hl, PokemonTower7TrainerHeader1
  225. call TalkToTrainer
  226. jp TextScriptEnd
  227. PokemonTower7Text3:
  228. TX_ASM
  229. ld hl, PokemonTower7TrainerHeader2
  230. call TalkToTrainer
  231. jp TextScriptEnd
  232. PokemonTower7FujiText:
  233. TX_ASM
  234. ld hl, TowerRescueFujiText
  235. call PrintText
  236. SetEvent EVENT_RESCUED_MR_FUJI
  237. SetEvent EVENT_RESCUED_MR_FUJI_2
  238. ld a, HS_LAVENDER_HOUSE_1_MR_FUJI
  239. ld [wMissableObjectIndex], a
  240. predef ShowObject
  241. ld a, HS_SAFFRON_CITY_E
  242. ld [wMissableObjectIndex], a
  243. predef HideObject
  244. ld a, HS_SAFFRON_CITY_F
  245. ld [wMissableObjectIndex], a
  246. predef ShowObject
  247. ld a, $4
  248. ld [wPokemonTower7CurScript], a
  249. ld [wCurMapScript], a
  250. jp TextScriptEnd
  251. TowerRescueFujiText:
  252. TX_FAR _TowerRescueFujiText
  253. db "@"
  254. PokemonTower7BattleText1:
  255. TX_FAR _PokemonTower7BattleText1
  256. db "@"
  257. PokemonTower7EndBattleText1:
  258. TX_FAR _PokemonTower7EndBattleText1
  259. db "@"
  260. PokemonTower7AfterBattleText1:
  261. TX_FAR _PokemonTower7AfterBattleText1
  262. db "@"
  263. PokemonTower7BattleText2:
  264. TX_FAR _PokemonTower7BattleText2
  265. db "@"
  266. PokemonTower7EndBattleText2:
  267. TX_FAR _PokemonTower7EndBattleText2
  268. db "@"
  269. PokemonTower7AfterBattleText2:
  270. TX_FAR _PokemonTower7AfterBattleText2
  271. db "@"
  272. PokemonTower7BattleText3:
  273. TX_FAR _PokemonTower7BattleText3
  274. db "@"
  275. PokemonTower7EndBattleText3:
  276. TX_FAR _PokemonTower7EndBattleText3
  277. db "@"
  278. PokemonTower7AfterBattleText3:
  279. TX_FAR _PokemonTower7AfterBattleText3
  280. db "@"