gary.asm 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. GaryScript:
  2. call EnableAutoTextBoxDrawing
  3. ld hl, GaryScriptPointers
  4. ld a, [wGaryCurScript]
  5. jp CallFunctionInTable
  6. ResetGaryScript:
  7. xor a
  8. ld [wJoyIgnore], a
  9. ld [wGaryCurScript], a
  10. ret
  11. GaryScriptPointers:
  12. dw GaryScript0
  13. dw GaryScript1
  14. dw GaryScript2
  15. dw GaryScript3
  16. dw GaryScript4
  17. dw GaryScript5
  18. dw GaryScript6
  19. dw GaryScript7
  20. dw GaryScript8
  21. dw GaryScript9
  22. dw GaryScript10
  23. GaryScript0:
  24. ret
  25. GaryScript1:
  26. ld a, $ff
  27. ld [wJoyIgnore], a
  28. ld hl, wSimulatedJoypadStatesEnd
  29. ld de, GaryEntrance_RLEMovement
  30. call DecodeRLEList
  31. dec a
  32. ld [wSimulatedJoypadStatesIndex], a
  33. call StartSimulatingJoypadStates
  34. ld a, $2
  35. ld [wGaryCurScript], a
  36. ret
  37. GaryEntrance_RLEMovement:
  38. db D_UP,1
  39. db D_RIGHT,1
  40. db D_UP,3
  41. db $ff
  42. GaryScript2:
  43. ld a, [wSimulatedJoypadStatesIndex]
  44. and a
  45. ret nz
  46. call Delay3
  47. xor a
  48. ld [wJoyIgnore], a
  49. ld hl, wOptions
  50. res 7, [hl] ; Turn on battle animations to make the battle feel more epic.
  51. ld a, $1
  52. ld [hSpriteIndexOrTextID], a
  53. call DisplayTextID
  54. call Delay3
  55. ld hl, wd72d
  56. set 6, [hl]
  57. set 7, [hl]
  58. ld hl, GaryDefeatedText
  59. ld de, GaryVictoryText
  60. call SaveEndBattleTextPointers
  61. ld a, OPP_SONY3
  62. ld [wCurOpponent], a
  63. ; select which team to use during the encounter
  64. ld a, [wRivalStarter]
  65. cp STARTER2
  66. jr nz, .NotStarter2
  67. ld a, $1
  68. jr .saveTrainerId
  69. .NotStarter2
  70. cp STARTER3
  71. jr nz, .NotStarter3
  72. ld a, $2
  73. jr .saveTrainerId
  74. .NotStarter3
  75. ld a, $3
  76. .saveTrainerId
  77. ld [wTrainerNo], a
  78. xor a
  79. ld [hJoyHeld], a
  80. ld a, $3
  81. ld [wGaryCurScript], a
  82. ret
  83. GaryScript3:
  84. ld a, [wIsInBattle]
  85. cp $ff
  86. jp z, ResetGaryScript
  87. call UpdateSprites
  88. SetEvent EVENT_BEAT_CHAMPION_RIVAL
  89. ld a, $f0
  90. ld [wJoyIgnore], a
  91. ld a, $1
  92. ld [hSpriteIndexOrTextID], a
  93. call GaryScript_760c8
  94. ld a, $1
  95. ld [H_SPRITEINDEX], a
  96. call SetSpriteMovementBytesToFF
  97. ld a, $4
  98. ld [wGaryCurScript], a
  99. ret
  100. GaryScript4:
  101. callba Music_Cities1AlternateTempo
  102. ld a, $2
  103. ld [hSpriteIndexOrTextID], a
  104. call GaryScript_760c8
  105. ld a, $2
  106. ld [H_SPRITEINDEX], a
  107. call SetSpriteMovementBytesToFF
  108. ld de, OakEntranceAfterVictoryMovement
  109. ld a, $2
  110. ld [H_SPRITEINDEX], a
  111. call MoveSprite
  112. ld a, HS_CHAMPIONS_ROOM_OAK
  113. ld [wMissableObjectIndex], a
  114. predef ShowObject
  115. ld a, $5
  116. ld [wGaryCurScript], a
  117. ret
  118. OakEntranceAfterVictoryMovement:
  119. db NPC_MOVEMENT_UP
  120. db NPC_MOVEMENT_UP
  121. db NPC_MOVEMENT_UP
  122. db NPC_MOVEMENT_UP
  123. db NPC_MOVEMENT_UP
  124. db $FF
  125. GaryScript5:
  126. ld a, [wd730]
  127. bit 0, a
  128. ret nz
  129. ld a, PLAYER_DIR_LEFT
  130. ld [wPlayerMovingDirection], a
  131. ld a, $1
  132. ld [H_SPRITEINDEX], a
  133. ld a, SPRITE_FACING_LEFT
  134. ld [hSpriteFacingDirection], a
  135. call SetSpriteFacingDirectionAndDelay
  136. ld a, $2
  137. ld [H_SPRITEINDEX], a
  138. xor a ; SPRITE_FACING_DOWN
  139. ld [hSpriteFacingDirection], a
  140. call SetSpriteFacingDirectionAndDelay
  141. ld a, $3
  142. ld [hSpriteIndexOrTextID], a
  143. call GaryScript_760c8
  144. ld a, $6
  145. ld [wGaryCurScript], a
  146. ret
  147. GaryScript6:
  148. ld a, $2
  149. ld [H_SPRITEINDEX], a
  150. ld a, SPRITE_FACING_RIGHT
  151. ld [hSpriteFacingDirection], a
  152. call SetSpriteFacingDirectionAndDelay
  153. ld a, $4
  154. ld [hSpriteIndexOrTextID], a
  155. call GaryScript_760c8
  156. ld a, $7
  157. ld [wGaryCurScript], a
  158. ret
  159. GaryScript7:
  160. ld a, $2
  161. ld [H_SPRITEINDEX], a
  162. xor a ; SPRITE_FACING_DOWN
  163. ld [hSpriteFacingDirection], a
  164. call SetSpriteFacingDirectionAndDelay
  165. ld a, $5
  166. ld [hSpriteIndexOrTextID], a
  167. call GaryScript_760c8
  168. ld de, OakExitGaryRoomMovement
  169. ld a, $2
  170. ld [H_SPRITEINDEX], a
  171. call MoveSprite
  172. ld a, $8
  173. ld [wGaryCurScript], a
  174. ret
  175. OakExitGaryRoomMovement:
  176. db NPC_MOVEMENT_UP
  177. db NPC_MOVEMENT_UP
  178. db $FF
  179. GaryScript8:
  180. ld a, [wd730]
  181. bit 0, a
  182. ret nz
  183. ld a, HS_CHAMPIONS_ROOM_OAK
  184. ld [wMissableObjectIndex], a
  185. predef HideObject
  186. ld a, $9
  187. ld [wGaryCurScript], a
  188. ret
  189. GaryScript9:
  190. ld a, $ff
  191. ld [wJoyIgnore], a
  192. ld hl, wSimulatedJoypadStatesEnd
  193. ld de, WalkToHallOfFame_RLEMovment
  194. call DecodeRLEList
  195. dec a
  196. ld [wSimulatedJoypadStatesIndex], a
  197. call StartSimulatingJoypadStates
  198. ld a, $a
  199. ld [wGaryCurScript], a
  200. ret
  201. WalkToHallOfFame_RLEMovment:
  202. db D_UP,4
  203. db D_LEFT,1
  204. db $ff
  205. GaryScript10:
  206. ld a, [wSimulatedJoypadStatesIndex]
  207. and a
  208. ret nz
  209. xor a
  210. ld [wJoyIgnore], a
  211. ld a, $0
  212. ld [wGaryCurScript], a
  213. ret
  214. GaryScript_760c8:
  215. ld a, $f0
  216. ld [wJoyIgnore], a
  217. call DisplayTextID
  218. ld a, $ff
  219. ld [wJoyIgnore], a
  220. ret
  221. GaryTextPointers:
  222. dw GaryText1
  223. dw GaryText2
  224. dw GaryText3
  225. dw GaryText4
  226. dw GaryText5
  227. GaryText1:
  228. TX_ASM
  229. CheckEvent EVENT_BEAT_CHAMPION_RIVAL
  230. ld hl, GaryChampionIntroText
  231. jr z, .printText
  232. ld hl, GaryText_76103
  233. .printText
  234. call PrintText
  235. jp TextScriptEnd
  236. GaryChampionIntroText:
  237. TX_FAR _GaryChampionIntroText
  238. db "@"
  239. GaryDefeatedText:
  240. TX_FAR _GaryDefeatedText
  241. db "@"
  242. GaryVictoryText:
  243. TX_FAR _GaryVictoryText
  244. db "@"
  245. GaryText_76103:
  246. TX_FAR _GaryText_76103
  247. db "@"
  248. GaryText2:
  249. TX_FAR _GaryText2
  250. db "@"
  251. GaryText3:
  252. TX_ASM
  253. ld a, [wPlayerStarter]
  254. ld [wd11e], a
  255. call GetMonName
  256. ld hl, GaryText_76120
  257. call PrintText
  258. jp TextScriptEnd
  259. GaryText_76120:
  260. TX_FAR _GaryText_76120
  261. db "@"
  262. GaryText4:
  263. TX_FAR _GaryText_76125
  264. db "@"
  265. GaryText5:
  266. TX_FAR _GaryText_7612a
  267. db "@"