rockethideout2.asm 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. RocketHideout2Script:
  2. call EnableAutoTextBoxDrawing
  3. ld hl, RocketHideout2TrainerHeader0
  4. ld de, RocketHideout2ScriptPointers
  5. ld a, [wRocketHideout2CurScript]
  6. call ExecuteCurMapScriptInTable
  7. ld [wRocketHideout2CurScript], a
  8. ret
  9. RocketHideout2ScriptPointers:
  10. dw RocketHideout2Script0
  11. dw DisplayEnemyTrainerTextAndStartBattle
  12. dw EndTrainerBattle
  13. dw RocketHideout2Script3
  14. RocketHideout2Script0:
  15. ld a, [wYCoord]
  16. ld b, a
  17. ld a, [wXCoord]
  18. ld c, a
  19. ld hl, RocketHideout2ArrowTilePlayerMovement
  20. call DecodeArrowMovementRLE
  21. cp $ff
  22. jp z, CheckFightingMapTrainers
  23. ld hl, wd736
  24. set 7, [hl]
  25. call StartSimulatingJoypadStates
  26. ld a, SFX_ARROW_TILES
  27. call PlaySound
  28. ld a, $ff
  29. ld [wJoyIgnore], a
  30. ld a, $3
  31. ld [wCurMapScript], a
  32. ret
  33. ;format:
  34. ;db y,x
  35. ;dw pointer to movement
  36. RocketHideout2ArrowTilePlayerMovement:
  37. db $9,$4
  38. dw RocketHideout2ArrowMovement1
  39. db $b,$4
  40. dw RocketHideout2ArrowMovement2
  41. db $f,$4
  42. dw RocketHideout2ArrowMovement3
  43. db $10,$4
  44. dw RocketHideout2ArrowMovement4
  45. db $13,$4
  46. dw RocketHideout2ArrowMovement1
  47. db $16,$4
  48. dw RocketHideout2ArrowMovement5
  49. db $e,$5
  50. dw RocketHideout2ArrowMovement6
  51. db $16,$6
  52. dw RocketHideout2ArrowMovement7
  53. db $18,$6
  54. dw RocketHideout2ArrowMovement8
  55. db $9,$8
  56. dw RocketHideout2ArrowMovement9
  57. db $c,$8
  58. dw RocketHideout2ArrowMovement10
  59. db $f,$8
  60. dw RocketHideout2ArrowMovement8
  61. db $13,$8
  62. dw RocketHideout2ArrowMovement9
  63. db $17,$8
  64. dw RocketHideout2ArrowMovement11
  65. db $e,$9
  66. dw RocketHideout2ArrowMovement12
  67. db $16,$9
  68. dw RocketHideout2ArrowMovement12
  69. db $9,$a
  70. dw RocketHideout2ArrowMovement13
  71. db $a,$a
  72. dw RocketHideout2ArrowMovement14
  73. db $f,$a
  74. dw RocketHideout2ArrowMovement15
  75. db $11,$a
  76. dw RocketHideout2ArrowMovement16
  77. db $13,$a
  78. dw RocketHideout2ArrowMovement17
  79. db $19,$a
  80. dw RocketHideout2ArrowMovement2
  81. db $e,$b
  82. dw RocketHideout2ArrowMovement18
  83. db $10,$b
  84. dw RocketHideout2ArrowMovement19
  85. db $12,$b
  86. dw RocketHideout2ArrowMovement12
  87. db $9,$c
  88. dw RocketHideout2ArrowMovement20
  89. db $b,$c
  90. dw RocketHideout2ArrowMovement21
  91. db $d,$c
  92. dw RocketHideout2ArrowMovement22
  93. db $11,$c
  94. dw RocketHideout2ArrowMovement23
  95. db $a,$d
  96. dw RocketHideout2ArrowMovement24
  97. db $c,$d
  98. dw RocketHideout2ArrowMovement25
  99. db $10,$d
  100. dw RocketHideout2ArrowMovement26
  101. db $12,$d
  102. dw RocketHideout2ArrowMovement27
  103. db $13,$d
  104. dw RocketHideout2ArrowMovement28
  105. db $16,$d
  106. dw RocketHideout2ArrowMovement29
  107. db $17,$d
  108. dw RocketHideout2ArrowMovement30
  109. db $11,$e
  110. dw RocketHideout2ArrowMovement31
  111. db $10,$f
  112. dw RocketHideout2ArrowMovement12
  113. db $e,$10
  114. dw RocketHideout2ArrowMovement32
  115. db $10,$10
  116. dw RocketHideout2ArrowMovement33
  117. db $12,$10
  118. dw RocketHideout2ArrowMovement34
  119. db $a,$11
  120. dw RocketHideout2ArrowMovement35
  121. db $b,$11
  122. dw RocketHideout2ArrowMovement36
  123. db $FF
  124. ;format: direction, count
  125. ;each list is read starting from the $FF and working backwards
  126. RocketHideout2ArrowMovement1:
  127. db D_LEFT,$02
  128. db $FF
  129. RocketHideout2ArrowMovement2:
  130. db D_RIGHT,$04
  131. db $FF
  132. RocketHideout2ArrowMovement3:
  133. db D_UP,$04
  134. db D_RIGHT,$04
  135. db $FF
  136. RocketHideout2ArrowMovement4:
  137. db D_UP,$04
  138. db D_RIGHT,$04
  139. db D_UP,$01
  140. db $FF
  141. RocketHideout2ArrowMovement5:
  142. db D_LEFT,$02
  143. db D_UP,$03
  144. db $FF
  145. RocketHideout2ArrowMovement6:
  146. db D_DOWN,$02
  147. db D_RIGHT,$04
  148. db $FF
  149. RocketHideout2ArrowMovement7:
  150. db D_UP,$02
  151. db $FF
  152. RocketHideout2ArrowMovement8:
  153. db D_UP,$04
  154. db $FF
  155. RocketHideout2ArrowMovement9:
  156. db D_LEFT,$06
  157. db $FF
  158. RocketHideout2ArrowMovement10:
  159. db D_UP,$01
  160. db $FF
  161. RocketHideout2ArrowMovement11:
  162. db D_LEFT,$06
  163. db D_UP,$04
  164. db $FF
  165. RocketHideout2ArrowMovement12:
  166. db D_DOWN,$02
  167. db $FF
  168. RocketHideout2ArrowMovement13:
  169. db D_LEFT,$08
  170. db $FF
  171. RocketHideout2ArrowMovement14:
  172. db D_LEFT,$08
  173. db D_UP,$01
  174. db $FF
  175. RocketHideout2ArrowMovement15:
  176. db D_LEFT,$08
  177. db D_UP,$06
  178. db $FF
  179. RocketHideout2ArrowMovement16:
  180. db D_UP,$02
  181. db D_RIGHT,$04
  182. db $FF
  183. RocketHideout2ArrowMovement17:
  184. db D_UP,$02
  185. db D_RIGHT,$04
  186. db D_UP,$02
  187. db $FF
  188. RocketHideout2ArrowMovement18:
  189. db D_DOWN,$02
  190. db D_RIGHT,$04
  191. db D_DOWN,$02
  192. db $FF
  193. RocketHideout2ArrowMovement19:
  194. db D_DOWN,$02
  195. db D_RIGHT,$04
  196. db $FF
  197. RocketHideout2ArrowMovement20:
  198. db D_LEFT,$0A
  199. db $FF
  200. RocketHideout2ArrowMovement21:
  201. db D_LEFT,$0A
  202. db D_UP,$02
  203. db $FF
  204. RocketHideout2ArrowMovement22:
  205. db D_LEFT,$0A
  206. db D_UP,$04
  207. db $FF
  208. RocketHideout2ArrowMovement23:
  209. db D_UP,$02
  210. db D_RIGHT,$02
  211. db $FF
  212. RocketHideout2ArrowMovement24:
  213. db D_RIGHT,$01
  214. db D_DOWN,$02
  215. db $FF
  216. RocketHideout2ArrowMovement25:
  217. db D_RIGHT,$01
  218. db $FF
  219. RocketHideout2ArrowMovement26:
  220. db D_DOWN,$02
  221. db D_RIGHT,$02
  222. db $FF
  223. RocketHideout2ArrowMovement27:
  224. db D_DOWN,$02
  225. db D_LEFT,$02
  226. db $FF
  227. RocketHideout2ArrowMovement28:
  228. db D_UP,$02
  229. db D_RIGHT,$04
  230. db D_UP,$02
  231. db D_LEFT,$03
  232. db $FF
  233. RocketHideout2ArrowMovement29:
  234. db D_DOWN,$02
  235. db D_LEFT,$04
  236. db $FF
  237. RocketHideout2ArrowMovement30:
  238. db D_LEFT,$06
  239. db D_UP,$04
  240. db D_LEFT,$05
  241. db $FF
  242. RocketHideout2ArrowMovement31:
  243. db D_UP,$02
  244. db $FF
  245. RocketHideout2ArrowMovement32:
  246. db D_UP,$01
  247. db $FF
  248. RocketHideout2ArrowMovement33:
  249. db D_UP,$03
  250. db $FF
  251. RocketHideout2ArrowMovement34:
  252. db D_UP,$05
  253. db $FF
  254. RocketHideout2ArrowMovement35:
  255. db D_RIGHT,$01
  256. db D_DOWN,$02
  257. db D_LEFT,$04
  258. db $FF
  259. RocketHideout2ArrowMovement36:
  260. db D_LEFT,$0A
  261. db D_UP,$02
  262. db D_LEFT,$05
  263. db $FF
  264. RocketHideout2Script3:
  265. ld a, [wSimulatedJoypadStatesIndex]
  266. and a
  267. jr nz, LoadSpinnerArrowTiles
  268. xor a
  269. ld [wJoyIgnore], a
  270. ld hl, wd736
  271. res 7, [hl]
  272. ld a, $0
  273. ld [wCurMapScript], a
  274. ret
  275. LoadSpinnerArrowTiles:
  276. ld a, [wSpriteStateData1 + 2]
  277. srl a
  278. srl a
  279. ld hl, SpinnerPlayerFacingDirections
  280. ld c, a
  281. ld b, $0
  282. add hl, bc
  283. ld a, [hl]
  284. ld [wSpriteStateData1 + 2], a
  285. ld a, [wCurMapTileset]
  286. cp FACILITY
  287. ld hl, FacilitySpinnerArrows
  288. jr z, .asm_44ff6
  289. ld hl, GymSpinnerArrows
  290. .asm_44ff6
  291. ld a, [wSimulatedJoypadStatesIndex]
  292. bit 0, a
  293. jr nz, .asm_45001
  294. ld de, $18
  295. add hl, de
  296. .asm_45001
  297. ld a, $4
  298. ld bc, $0
  299. .asm_45006
  300. push af
  301. push hl
  302. push bc
  303. add hl, bc
  304. ld a, [hli]
  305. ld e, a
  306. ld a, [hli]
  307. ld d, a
  308. ld a, [hli]
  309. ld c, a
  310. ld a, [hli]
  311. ld b, a
  312. ld a, [hli]
  313. ld h, [hl]
  314. ld l, a
  315. call CopyVideoData
  316. pop bc
  317. ld a, $6
  318. add c
  319. ld c, a
  320. pop hl
  321. pop af
  322. dec a
  323. jr nz, .asm_45006
  324. ret
  325. spinner: MACRO
  326. ; \1: source
  327. ; \2: offset (BANK() chokes on literals)
  328. ; \3: length
  329. ; \4: dest
  330. dw \1 + \2
  331. db \3, BANK(\1)
  332. dw \4
  333. ENDM
  334. FacilitySpinnerArrows:
  335. FACILITY_SPINNER EQU $20 * $10
  336. vFacilitySpinner EQU vTileset + FACILITY_SPINNER
  337. spinner SpinnerArrowAnimTiles, $00, 1, vFacilitySpinner
  338. spinner SpinnerArrowAnimTiles, $10, 1, vFacilitySpinner + $10
  339. spinner SpinnerArrowAnimTiles, $20, 1, vFacilitySpinner + $100
  340. spinner SpinnerArrowAnimTiles, $30, 1, vFacilitySpinner + $110
  341. spinner Facility_GFX, FACILITY_SPINNER + $000, 1, vFacilitySpinner
  342. spinner Facility_GFX, FACILITY_SPINNER + $010, 1, vFacilitySpinner + $10
  343. spinner Facility_GFX, FACILITY_SPINNER + $100, 1, vFacilitySpinner + $100
  344. spinner Facility_GFX, FACILITY_SPINNER + $110, 1, vFacilitySpinner + $110
  345. GymSpinnerArrows:
  346. GYM_SPINNER EQU $3c * $10
  347. vGymSpinner EQU vTileset + GYM_SPINNER
  348. spinner SpinnerArrowAnimTiles, $10, 1, vGymSpinner
  349. spinner SpinnerArrowAnimTiles, $30, 1, vGymSpinner + $10
  350. spinner SpinnerArrowAnimTiles, $00, 1, vGymSpinner + $100
  351. spinner SpinnerArrowAnimTiles, $20, 1, vGymSpinner + $110
  352. spinner Gym_GFX, GYM_SPINNER + $000, 1, vGymSpinner
  353. spinner Gym_GFX, GYM_SPINNER + $010, 1, vGymSpinner + $10
  354. spinner Gym_GFX, GYM_SPINNER + $100, 1, vGymSpinner + $100
  355. spinner Gym_GFX, GYM_SPINNER + $110, 1, vGymSpinner + $110
  356. SpinnerPlayerFacingDirections:
  357. ; This isn't the order of the facing directions. Rather, it's a list of
  358. ; the facing directions that come next. For example, when the player is
  359. ; facing down (00), the next facing direction is left (08).
  360. db $08 ; down -> left
  361. db $0C ; up -> right
  362. db $04 ; left -> up
  363. db $00 ; right -> down
  364. ; these tiles are the animation for the tiles that push the player in dungeons like Rocket HQ
  365. SpinnerArrowAnimTiles:
  366. INCBIN "gfx/spinner_arrow.2bpp"
  367. RocketHideout2TextPointers:
  368. dw RocketHideout2Text1
  369. dw PickUpItemText
  370. dw PickUpItemText
  371. dw PickUpItemText
  372. dw PickUpItemText
  373. RocketHideout2TrainerHeader0:
  374. dbEventFlagBit EVENT_BEAT_ROCKET_HIDEOUT_2_TRAINER_0
  375. db ($4 << 4) ; trainer's view range
  376. dwEventFlagAddress EVENT_BEAT_ROCKET_HIDEOUT_2_TRAINER_0
  377. dw RocketHideout2BattleText2 ; TextBeforeBattle
  378. dw RocketHideout2AfterBattleTxt2 ; TextAfterBattle
  379. dw RocketHideout2EndBattleText2 ; TextEndBattle
  380. dw RocketHideout2EndBattleText2 ; TextEndBattle
  381. db $ff
  382. RocketHideout2Text1:
  383. TX_ASM
  384. ld hl, RocketHideout2TrainerHeader0
  385. call TalkToTrainer
  386. jp TextScriptEnd
  387. RocketHideout2BattleText2:
  388. TX_FAR _RocketHideout2BattleText2
  389. db "@"
  390. RocketHideout2EndBattleText2:
  391. TX_FAR _RocketHideout2EndBattleText2
  392. db "@"
  393. RocketHideout2AfterBattleTxt2:
  394. TX_FAR _RocketHideout2AfterBattleTxt2
  395. db "@"