ceruleancity.asm 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. CeruleanCityScript:
  2. call EnableAutoTextBoxDrawing
  3. ld hl, CeruleanCityScriptPointers
  4. ld a, [wCeruleanCityCurScript]
  5. jp CallFunctionInTable
  6. CeruleanCityScript_1948c:
  7. xor a
  8. ld [wJoyIgnore], a
  9. ld [wCeruleanCityCurScript], a
  10. ld a, HS_CERULEAN_RIVAL
  11. ld [wMissableObjectIndex], a
  12. predef_jump HideObject
  13. CeruleanCityScriptPointers:
  14. dw CeruleanCityScript0
  15. dw CeruleanCityScript1
  16. dw CeruleanCityScript2
  17. dw CeruleanCityScript3
  18. dw CeruleanCityScript4
  19. CeruleanCityScript4:
  20. ld a, [wIsInBattle]
  21. cp $ff
  22. jp z, CeruleanCityScript_1948c
  23. ld a, $f0
  24. ld [wJoyIgnore], a
  25. SetEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF
  26. ld a, $2
  27. ld [hSpriteIndexOrTextID], a
  28. call DisplayTextID
  29. xor a
  30. ld [wJoyIgnore], a
  31. ld [wCeruleanCityCurScript], a
  32. ret
  33. CeruleanCityScript0:
  34. CheckEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF
  35. jr nz, .asm_194f7
  36. ld hl, CeruleanCityCoords1
  37. call ArePlayerCoordsInArray
  38. jr nc, .asm_194f7
  39. ld a, [wCoordIndex]
  40. cp $1
  41. ld a, PLAYER_DIR_UP
  42. ld b, SPRITE_FACING_DOWN
  43. jr nz, .asm_194e6
  44. ld a, PLAYER_DIR_DOWN
  45. ld b, SPRITE_FACING_UP
  46. .asm_194e6
  47. ld [wPlayerMovingDirection], a
  48. ld a, b
  49. ld [wSpriteStateData1 + 2 * $10 + $9], a
  50. call Delay3
  51. ld a, $2
  52. ld [hSpriteIndexOrTextID], a
  53. jp DisplayTextID
  54. .asm_194f7
  55. CheckEvent EVENT_BEAT_CERULEAN_RIVAL
  56. ret nz
  57. ld hl, CeruleanCityCoords2
  58. call ArePlayerCoordsInArray
  59. ret nc
  60. ld a, [wWalkBikeSurfState]
  61. and a
  62. jr z, .asm_19512
  63. ld a, $ff
  64. ld [wNewSoundID], a
  65. call PlaySound
  66. .asm_19512
  67. ld c, BANK(Music_MeetRival)
  68. ld a, MUSIC_MEET_RIVAL
  69. call PlayMusic
  70. xor a
  71. ld [hJoyHeld], a
  72. ld a, $f0
  73. ld [wJoyIgnore], a
  74. ld a, [wXCoord]
  75. cp $14
  76. jr z, .asm_19535
  77. ld a, $1
  78. ld [H_SPRITEINDEX], a
  79. ld a, $5
  80. ld [H_SPRITEDATAOFFSET], a
  81. call GetPointerWithinSpriteStateData2
  82. ld [hl], $19
  83. .asm_19535
  84. ld a, HS_CERULEAN_RIVAL
  85. ld [wMissableObjectIndex], a
  86. predef ShowObject
  87. ld de, CeruleanCityMovement1
  88. ld a, $1
  89. ld [H_SPRITEINDEX], a
  90. call MoveSprite
  91. ld a, $1
  92. ld [wCeruleanCityCurScript], a
  93. ret
  94. CeruleanCityCoords1:
  95. db $07,$1e
  96. db $09,$1e
  97. db $ff
  98. CeruleanCityCoords2:
  99. db $06,$14
  100. db $06,$15
  101. db $ff
  102. CeruleanCityMovement1:
  103. db NPC_MOVEMENT_DOWN
  104. db NPC_MOVEMENT_DOWN
  105. db NPC_MOVEMENT_DOWN
  106. db $FF
  107. CeruleanCityScript_1955d:
  108. ld a, 1
  109. ld [H_SPRITEINDEX], a
  110. xor a ; SPRITE_FACING_DOWN
  111. ld [hSpriteFacingDirection], a
  112. jp SetSpriteFacingDirectionAndDelay ; face object
  113. CeruleanCityScript1:
  114. ld a, [wd730]
  115. bit 0, a
  116. ret nz
  117. xor a
  118. ld [wJoyIgnore], a
  119. ld a, $1
  120. ld [hSpriteIndexOrTextID], a
  121. call DisplayTextID
  122. ld hl, wd72d
  123. set 6, [hl]
  124. set 7, [hl]
  125. ld hl, CeruleanCityText_1966d
  126. ld de, CeruleanCityText_19672
  127. call SaveEndBattleTextPointers
  128. ld a, OPP_SONY1
  129. ld [wCurOpponent], a
  130. ; select which team to use during the encounter
  131. ld a, [wRivalStarter]
  132. cp STARTER2
  133. jr nz, .NotSquirtle
  134. ld a, $7
  135. jr .done
  136. .NotSquirtle
  137. cp STARTER3
  138. jr nz, .Charmander
  139. ld a, $8
  140. jr .done
  141. .Charmander
  142. ld a, $9
  143. .done
  144. ld [wTrainerNo], a
  145. xor a
  146. ld [hJoyHeld], a
  147. call CeruleanCityScript_1955d
  148. ld a, $2
  149. ld [wCeruleanCityCurScript], a
  150. ret
  151. CeruleanCityScript2:
  152. ld a, [wIsInBattle]
  153. cp $ff
  154. jp z, CeruleanCityScript_1948c
  155. call CeruleanCityScript_1955d
  156. ld a, $f0
  157. ld [wJoyIgnore], a
  158. SetEvent EVENT_BEAT_CERULEAN_RIVAL
  159. ld a, $1
  160. ld [hSpriteIndexOrTextID], a
  161. call DisplayTextID
  162. ld a, $ff
  163. ld [wNewSoundID], a
  164. call PlaySound
  165. callba Music_RivalAlternateStart
  166. ld a, $1
  167. ld [H_SPRITEINDEX], a
  168. call SetSpriteMovementBytesToFF
  169. ld a, [wXCoord]
  170. cp $14
  171. jr nz, .asm_195f0
  172. ld de, CeruleanCityMovement4
  173. jr .asm_195f3
  174. .asm_195f0
  175. ld de, CeruleanCityMovement3
  176. .asm_195f3
  177. ld a, $1
  178. ld [H_SPRITEINDEX], a
  179. call MoveSprite
  180. ld a, $3
  181. ld [wCeruleanCityCurScript], a
  182. ret
  183. CeruleanCityMovement3:
  184. db NPC_MOVEMENT_LEFT
  185. db NPC_MOVEMENT_DOWN
  186. db NPC_MOVEMENT_DOWN
  187. db NPC_MOVEMENT_DOWN
  188. db NPC_MOVEMENT_DOWN
  189. db NPC_MOVEMENT_DOWN
  190. db NPC_MOVEMENT_DOWN
  191. db $FF
  192. CeruleanCityMovement4:
  193. db NPC_MOVEMENT_RIGHT
  194. db NPC_MOVEMENT_DOWN
  195. db NPC_MOVEMENT_DOWN
  196. db NPC_MOVEMENT_DOWN
  197. db NPC_MOVEMENT_DOWN
  198. db NPC_MOVEMENT_DOWN
  199. db NPC_MOVEMENT_DOWN
  200. db $FF
  201. CeruleanCityScript3:
  202. ld a, [wd730]
  203. bit 0, a
  204. ret nz
  205. ld a, HS_CERULEAN_RIVAL
  206. ld [wMissableObjectIndex], a
  207. predef HideObject
  208. xor a
  209. ld [wJoyIgnore], a
  210. call PlayDefaultMusic
  211. ld a, $0
  212. ld [wCeruleanCityCurScript], a
  213. ret
  214. CeruleanCityTextPointers:
  215. dw CeruleanCityText1
  216. dw CeruleanCityText2
  217. dw CeruleanCityText3
  218. dw CeruleanCityText4
  219. dw CeruleanCityText5
  220. dw CeruleanCityText6
  221. dw CeruleanCityText7
  222. dw CeruleanCityText8
  223. dw CeruleanCityText9
  224. dw CeruleanCityText10
  225. dw CeruleanCityText11
  226. dw CeruleanCityText12
  227. dw CeruleanCityText13
  228. dw MartSignText
  229. dw PokeCenterSignText
  230. dw CeruleanCityText16
  231. dw CeruleanCityText17
  232. CeruleanCityText1:
  233. TX_ASM
  234. CheckEvent EVENT_BEAT_CERULEAN_RIVAL
  235. ; do pre-battle text
  236. jr z, .PreBattleText
  237. ; or talk about bill
  238. ld hl, CeruleanCityText_19677
  239. call PrintText
  240. jr .end
  241. .PreBattleText
  242. ld hl, CeruleanCityText_19668
  243. call PrintText
  244. .end
  245. jp TextScriptEnd
  246. CeruleanCityText_19668:
  247. TX_FAR _CeruleanCityText_19668
  248. db "@"
  249. CeruleanCityText_1966d:
  250. TX_FAR _CeruleanCityText_1966d
  251. db "@"
  252. CeruleanCityText_19672:
  253. TX_FAR _CeruleanCityText_19672
  254. db "@"
  255. CeruleanCityText_19677:
  256. TX_FAR _CeruleanCityText_19677
  257. db "@"
  258. CeruleanCityText2:
  259. TX_ASM
  260. CheckEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF
  261. jr nz, .asm_4ca20
  262. ld hl, CeruleanCityText_196d9
  263. call PrintText
  264. ld hl, wd72d
  265. set 6, [hl]
  266. set 7, [hl]
  267. ld hl, CeruleanCityText_196ee
  268. ld de, CeruleanCityText_196ee
  269. call SaveEndBattleTextPointers
  270. ld a, [hSpriteIndexOrTextID]
  271. ld [wSpriteIndex], a
  272. call EngageMapTrainer
  273. call InitBattleEnemyParameters
  274. ld a, $4
  275. ld [wCeruleanCityCurScript], a
  276. jp TextScriptEnd
  277. .asm_4ca20
  278. ld hl, CeruleanCityText_196f3
  279. call PrintText
  280. lb bc, TM_28, 1
  281. call GiveItem
  282. jr c, .Success
  283. ld hl, TM28NoRoomText
  284. call PrintText
  285. jr .Done
  286. .Success
  287. ld a, $1
  288. ld [wDoNotWaitForButtonPressAfterDisplayingText], a
  289. ld hl, ReceivedTM28Text
  290. call PrintText
  291. callba CeruleanHideRocket
  292. .Done
  293. jp TextScriptEnd
  294. CeruleanCityText_196d9:
  295. TX_FAR _CeruleanCityText_196d9
  296. db "@"
  297. ReceivedTM28Text:
  298. TX_FAR _ReceivedTM28Text
  299. TX_SFX_ITEM_1
  300. TX_FAR _ReceivedTM28Text2
  301. TX_WAIT
  302. db "@"
  303. TM28NoRoomText:
  304. TX_FAR _TM28NoRoomText
  305. db "@"
  306. CeruleanCityText_196ee:
  307. TX_FAR _CeruleanCityText_196ee
  308. db "@"
  309. CeruleanCityText_196f3:
  310. TX_FAR _CeruleanCityText_196f3
  311. db "@"
  312. CeruleanCityText3:
  313. TX_FAR _CeruleanCityText3
  314. db "@"
  315. CeruleanCityText4:
  316. TX_FAR _CeruleanCityText4
  317. db "@"
  318. CeruleanCityText5:
  319. TX_FAR _CeruleanCityText5
  320. db "@"
  321. CeruleanCityText11:
  322. CeruleanCityText6:
  323. TX_FAR _CeruleanCityText6
  324. db "@"
  325. CeruleanCityText7:
  326. TX_ASM
  327. ld a, [hRandomAdd]
  328. cp 180
  329. jr c, .asm_e9fc9
  330. ld hl, CeruleanCityText_19730
  331. call PrintText
  332. jr .asm_d486e
  333. .asm_e9fc9
  334. cp 100
  335. jr c, .asm_df99b
  336. ld hl, CeruleanCityText_19735
  337. call PrintText
  338. jr .asm_d486e
  339. .asm_df99b
  340. ld hl, CeruleanCityText_1973a
  341. call PrintText
  342. .asm_d486e
  343. jp TextScriptEnd
  344. CeruleanCityText_19730:
  345. TX_FAR _CeruleanCityText_19730
  346. db "@"
  347. CeruleanCityText_19735:
  348. TX_FAR _CeruleanCityText_19735
  349. db "@"
  350. CeruleanCityText_1973a:
  351. TX_FAR _CeruleanCityText_1973a
  352. db "@"
  353. CeruleanCityText8:
  354. TX_ASM
  355. ld a, [hRandomAdd]
  356. cp 180
  357. jr c, .asm_e28da
  358. ld hl, CeruleanCityText_1976f
  359. call PrintText
  360. jr .asm_f2f38
  361. .asm_e28da
  362. cp 120
  363. jr c, .asm_15d08
  364. ld hl, CeruleanCityText_19774
  365. call PrintText
  366. jr .asm_f2f38
  367. .asm_15d08
  368. cp 60
  369. jr c, .asm_d7fea
  370. ld hl, CeruleanCityText_19779
  371. call PrintText
  372. jr .asm_f2f38
  373. .asm_d7fea
  374. ld hl, CeruleanCityText_1977e
  375. call PrintText
  376. .asm_f2f38
  377. jp TextScriptEnd
  378. CeruleanCityText_1976f:
  379. TX_FAR _CeruleanCityText_1976f
  380. db "@"
  381. CeruleanCityText_19774:
  382. TX_FAR _CeruleanCityText_19774
  383. db "@"
  384. CeruleanCityText_19779:
  385. TX_FAR _CeruleanCityText_19779
  386. db "@"
  387. CeruleanCityText_1977e:
  388. TX_FAR _CeruleanCityText_1977e
  389. db "@"
  390. CeruleanCityText9:
  391. TX_FAR _CeruleanCityText9
  392. db "@"
  393. CeruleanCityText10:
  394. TX_FAR _CeruleanCityText10
  395. db "@"
  396. CeruleanCityText12:
  397. TX_FAR _CeruleanCityText12
  398. db "@"
  399. CeruleanCityText13:
  400. TX_FAR _CeruleanCityText13
  401. db "@"
  402. CeruleanCityText16:
  403. TX_FAR _CeruleanCityText16
  404. db "@"
  405. CeruleanCityText17:
  406. TX_FAR _CeruleanCityText17
  407. db "@"