silphco7.asm 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. SilphCo7Script:
  2. call SilphCo7Script_51b77
  3. call EnableAutoTextBoxDrawing
  4. ld hl, SilphCo7TrainerHeader0
  5. ld de, SilphCo7ScriptPointers
  6. ld a, [wSilphCo7CurScript]
  7. call ExecuteCurMapScriptInTable
  8. ld [wSilphCo7CurScript], a
  9. ret
  10. SilphCo7Script_51b77:
  11. ld hl, wCurrentMapScriptFlags
  12. bit 5, [hl]
  13. res 5, [hl]
  14. ret z
  15. ld hl, SilphCo7GateCoords
  16. call SilphCo7Text_51bc8
  17. call SilphCo7Text_51bf4
  18. CheckEvent EVENT_SILPH_CO_7_UNLOCKED_DOOR1
  19. jr nz, .asm_51b9e
  20. push af
  21. ld a, $54
  22. ld [wNewTileBlockID], a
  23. lb bc, 3, 5
  24. predef ReplaceTileBlock
  25. pop af
  26. .asm_51b9e
  27. CheckEventAfterBranchReuseA EVENT_SILPH_CO_7_UNLOCKED_DOOR2, EVENT_SILPH_CO_7_UNLOCKED_DOOR1
  28. jr nz, .asm_51bb1
  29. push af
  30. ld a, $54
  31. ld [wNewTileBlockID], a
  32. lb bc, 2, 10
  33. predef ReplaceTileBlock
  34. pop af
  35. .asm_51bb1
  36. CheckEventAfterBranchReuseA EVENT_SILPH_CO_7_UNLOCKED_DOOR3, EVENT_SILPH_CO_7_UNLOCKED_DOOR2
  37. ret nz
  38. ld a, $54
  39. ld [wNewTileBlockID], a
  40. lb bc, 6, 10
  41. predef_jump ReplaceTileBlock
  42. SilphCo7GateCoords:
  43. db $03,$05
  44. db $02,$0A
  45. db $06,$0A
  46. db $FF
  47. SilphCo7Text_51bc8:
  48. push hl
  49. ld hl, wCardKeyDoorY
  50. ld a, [hli]
  51. ld b, a
  52. ld a, [hl]
  53. ld c, a
  54. xor a
  55. ld [$ffe0], a
  56. pop hl
  57. .asm_51bd4
  58. ld a, [hli]
  59. cp $ff
  60. jr z, .asm_51bf0
  61. push hl
  62. ld hl, $ffe0
  63. inc [hl]
  64. pop hl
  65. cp b
  66. jr z, .asm_51be5
  67. inc hl
  68. jr .asm_51bd4
  69. .asm_51be5
  70. ld a, [hli]
  71. cp c
  72. jr nz, .asm_51bd4
  73. ld hl, wCardKeyDoorY
  74. xor a
  75. ld [hli], a
  76. ld [hl], a
  77. ret
  78. .asm_51bf0
  79. xor a
  80. ld [$ffe0], a
  81. ret
  82. SilphCo7Text_51bf4:
  83. EventFlagAddress hl, EVENT_SILPH_CO_7_UNLOCKED_DOOR1
  84. ld a, [$ffe0]
  85. and a
  86. ret z
  87. cp $1
  88. jr nz, .next1
  89. SetEventReuseHL EVENT_SILPH_CO_7_UNLOCKED_DOOR1
  90. ret
  91. .next1
  92. cp $2
  93. jr nz, .next2
  94. SetEventAfterBranchReuseHL EVENT_SILPH_CO_7_UNLOCKED_DOOR2, EVENT_SILPH_CO_7_UNLOCKED_DOOR1
  95. ret
  96. .next2
  97. SetEventAfterBranchReuseHL EVENT_SILPH_CO_7_UNLOCKED_DOOR3, EVENT_SILPH_CO_7_UNLOCKED_DOOR1
  98. ret
  99. SilphCo7Text_51c0c:
  100. xor a
  101. ld [wJoyIgnore], a
  102. SilphCo7Text_51c10:
  103. ld [wSilphCo7CurScript], a
  104. ld [wCurMapScript], a
  105. ret
  106. SilphCo7ScriptPointers:
  107. dw SilphCo7Script0
  108. dw DisplayEnemyTrainerTextAndStartBattle
  109. dw EndTrainerBattle
  110. dw SilphCo7Script3
  111. dw SilphCo7Script4
  112. dw SilphCo7Script5
  113. SilphCo7Script0:
  114. CheckEvent EVENT_BEAT_SILPH_CO_RIVAL
  115. jp nz, CheckFightingMapTrainers
  116. ld hl, CoordsData_51c78
  117. call ArePlayerCoordsInArray
  118. jp nc, CheckFightingMapTrainers
  119. xor a
  120. ld [hJoyHeld], a
  121. ld a, $f0
  122. ld [wJoyIgnore], a
  123. ld a, PLAYER_DIR_DOWN
  124. ld [wPlayerMovingDirection], a
  125. ld a, $ff
  126. ld [wNewSoundID], a
  127. call PlaySound
  128. ld c, BANK(Music_MeetRival)
  129. ld a, MUSIC_MEET_RIVAL
  130. call PlayMusic
  131. ld a, $9
  132. ld [hSpriteIndexOrTextID], a
  133. call DisplayTextID
  134. ld a, $9
  135. ld [H_SPRITEINDEX], a
  136. call SetSpriteMovementBytesToFF
  137. ld de, MovementData_51c7d
  138. ld a, [wCoordIndex]
  139. ld [wcf0d], a
  140. cp $1
  141. jr z, .asm_51c6c
  142. inc de
  143. .asm_51c6c
  144. ld a, $9
  145. ld [H_SPRITEINDEX], a
  146. call MoveSprite
  147. ld a, $3
  148. jp SilphCo7Text_51c10
  149. CoordsData_51c78:
  150. db $02,$03
  151. db $03,$03
  152. db $FF
  153. MovementData_51c7d:
  154. db NPC_MOVEMENT_UP
  155. db NPC_MOVEMENT_UP
  156. db NPC_MOVEMENT_UP
  157. db NPC_MOVEMENT_UP
  158. db $FF
  159. SilphCo7Script3:
  160. ld a, [wd730]
  161. bit 0, a
  162. ret nz
  163. xor a
  164. ld [wJoyIgnore], a
  165. ld a, $d
  166. ld [hSpriteIndexOrTextID], a
  167. call DisplayTextID
  168. call Delay3
  169. ld hl, wd72d
  170. set 6, [hl]
  171. set 7, [hl]
  172. ld hl, SilphCo7Text14
  173. ld de, SilphCo7Text_51ecd
  174. call SaveEndBattleTextPointers
  175. ld a, OPP_SONY2
  176. ld [wCurOpponent], a
  177. ld a, [wRivalStarter]
  178. cp STARTER2
  179. jr nz, .asm_51cb6
  180. ld a, $7
  181. jr .asm_51cc0
  182. .asm_51cb6
  183. cp STARTER3
  184. jr nz, .asm_51cbe
  185. ld a, $8
  186. jr .asm_51cc0
  187. .asm_51cbe
  188. ld a, $9
  189. .asm_51cc0
  190. ld [wTrainerNo], a
  191. ld a, $4
  192. jp SilphCo7Text_51c10
  193. SilphCo7Script4:
  194. ld a, [wIsInBattle]
  195. cp $ff
  196. jp z, SilphCo7Text_51c0c
  197. ld a, $f0
  198. ld [wJoyIgnore], a
  199. SetEvent EVENT_BEAT_SILPH_CO_RIVAL
  200. ld a, PLAYER_DIR_DOWN
  201. ld [wPlayerMovingDirection], a
  202. ld a, $9
  203. ld [H_SPRITEINDEX], a
  204. ld a, SPRITE_FACING_UP
  205. ld [hSpriteFacingDirection], a
  206. call SetSpriteFacingDirectionAndDelay
  207. ld a, $f
  208. ld [hSpriteIndexOrTextID], a
  209. call DisplayTextID
  210. ld a, $ff
  211. ld [wNewSoundID], a
  212. call PlaySound
  213. callba Music_RivalAlternateStart
  214. ld de, MovementData_51d1d
  215. ld a, [wcf0d]
  216. cp $1
  217. jr nz, .asm_51d0e
  218. ld de, MovementData_51d1a
  219. .asm_51d0e
  220. ld a, $9
  221. ld [H_SPRITEINDEX], a
  222. call MoveSprite
  223. ld a, $5
  224. jp SilphCo7Text_51c10
  225. MovementData_51d1a:
  226. db NPC_MOVEMENT_RIGHT
  227. db NPC_MOVEMENT_RIGHT
  228. db $FF
  229. MovementData_51d1d:
  230. db NPC_MOVEMENT_LEFT
  231. db NPC_MOVEMENT_UP
  232. db NPC_MOVEMENT_UP
  233. db NPC_MOVEMENT_RIGHT
  234. db NPC_MOVEMENT_RIGHT
  235. db NPC_MOVEMENT_RIGHT
  236. db NPC_MOVEMENT_DOWN
  237. db $FF
  238. SilphCo7Script5:
  239. ld a, [wd730]
  240. bit 0, a
  241. ret nz
  242. ld a, HS_SILPH_CO_7F_RIVAL
  243. ld [wMissableObjectIndex], a
  244. predef HideObject
  245. call PlayDefaultMusic
  246. xor a
  247. ld [wJoyIgnore], a
  248. jp SilphCo7Text_51c10
  249. SilphCo7TextPointers:
  250. dw SilphCo7Text1
  251. dw SilphCo7Text2
  252. dw SilphCo7Text3
  253. dw SilphCo7Text4
  254. dw SilphCo7Text5
  255. dw SilphCo7Text6
  256. dw SilphCo7Text7
  257. dw SilphCo7Text8
  258. dw SilphCo7Text9
  259. dw PickUpItemText
  260. dw PickUpItemText
  261. dw PickUpItemText
  262. dw SilphCo7Text13
  263. dw SilphCo7Text14
  264. dw SilphCo7Text15
  265. SilphCo7TrainerHeader0:
  266. dbEventFlagBit EVENT_BEAT_SILPH_CO_7F_TRAINER_0
  267. db ($2 << 4) ; trainer's view range
  268. dwEventFlagAddress EVENT_BEAT_SILPH_CO_7F_TRAINER_0
  269. dw SilphCo7BattleText1 ; TextBeforeBattle
  270. dw SilphCo7AfterBattleText1 ; TextAfterBattle
  271. dw SilphCo7EndBattleText1 ; TextEndBattle
  272. dw SilphCo7EndBattleText1 ; TextEndBattle
  273. SilphCo7TrainerHeader1:
  274. dbEventFlagBit EVENT_BEAT_SILPH_CO_7F_TRAINER_1
  275. db ($3 << 4) ; trainer's view range
  276. dwEventFlagAddress EVENT_BEAT_SILPH_CO_7F_TRAINER_1
  277. dw SilphCo7BattleText2 ; TextBeforeBattle
  278. dw SilphCo7AfterBattleText2 ; TextAfterBattle
  279. dw SilphCo7EndBattleText2 ; TextEndBattle
  280. dw SilphCo7EndBattleText2 ; TextEndBattle
  281. SilphCo7TrainerHeader2:
  282. dbEventFlagBit EVENT_BEAT_SILPH_CO_7F_TRAINER_2
  283. db ($3 << 4) ; trainer's view range
  284. dwEventFlagAddress EVENT_BEAT_SILPH_CO_7F_TRAINER_2
  285. dw SilphCo7BattleText3 ; TextBeforeBattle
  286. dw SilphCo7AfterBattleText3 ; TextAfterBattle
  287. dw SilphCo7EndBattleText3 ; TextEndBattle
  288. dw SilphCo7EndBattleText3 ; TextEndBattle
  289. SilphCo7TrainerHeader3:
  290. dbEventFlagBit EVENT_BEAT_SILPH_CO_7F_TRAINER_3, 1
  291. db ($4 << 4) ; trainer's view range
  292. dwEventFlagAddress EVENT_BEAT_SILPH_CO_7F_TRAINER_3, 1
  293. dw SilphCo7BattleText4 ; TextBeforeBattle
  294. dw SilphCo7AfterBattleText4 ; TextAfterBattle
  295. dw SilphCo7EndBattleText4 ; TextEndBattle
  296. dw SilphCo7EndBattleText4 ; TextEndBattle
  297. db $ff
  298. SilphCo7Text1:
  299. ; lapras guy
  300. TX_ASM
  301. ld a, [wd72e]
  302. bit 0, a ; got lapras?
  303. jr z, .givelapras
  304. CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI
  305. jr nz, .savedsilph
  306. ld hl, .LaprasGuyText
  307. call PrintText
  308. jr .done
  309. .givelapras
  310. ld hl, .MeetLaprasGuyText
  311. call PrintText
  312. lb bc, LAPRAS, 15
  313. call GivePokemon
  314. jr nc, .done
  315. ld a, [wSimulatedJoypadStatesEnd]
  316. and a
  317. call z, WaitForTextScrollButtonPress
  318. call EnableAutoTextBoxDrawing
  319. ld hl, .HeresYourLaprasText
  320. call PrintText
  321. ld hl, wd72e
  322. set 0, [hl]
  323. jr .done
  324. .savedsilph
  325. ld hl, .LaprasGuySavedText
  326. call PrintText
  327. .done
  328. jp TextScriptEnd
  329. .MeetLaprasGuyText
  330. TX_FAR _MeetLaprasGuyText
  331. db "@"
  332. .HeresYourLaprasText
  333. TX_FAR _HeresYourLaprasText
  334. db "@"
  335. .LaprasGuyText
  336. TX_FAR _LaprasGuyText
  337. db "@"
  338. .LaprasGuySavedText
  339. TX_FAR _LaprasGuySavedText
  340. db "@"
  341. SilphCo7Text2:
  342. TX_ASM
  343. CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI
  344. jr nz, .savedsilph
  345. ld hl, .rockettext
  346. call PrintText
  347. jr .done
  348. .savedsilph
  349. ld hl, .savedtext
  350. call PrintText
  351. .done
  352. jp TextScriptEnd
  353. .rockettext
  354. TX_FAR _SilphCo7Text_51e00
  355. db "@"
  356. .savedtext
  357. TX_FAR _CanceledMasterBallText
  358. db "@"
  359. SilphCo7Text3:
  360. TX_ASM
  361. CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI
  362. jr nz, .savedsilph
  363. ld hl, .rockettext
  364. call PrintText
  365. jr .done
  366. .savedsilph
  367. ld hl, .savedtext
  368. call PrintText
  369. .done
  370. jp TextScriptEnd
  371. .rockettext
  372. TX_FAR _SilphCo7Text_51e23
  373. db "@"
  374. .savedtext
  375. TX_FAR _SilphCo7Text_51e28
  376. db "@"
  377. SilphCo7Text4:
  378. TX_ASM
  379. CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI
  380. jr nz, .savedsilph
  381. ld hl, .rockettext
  382. call PrintText
  383. jr .done
  384. .savedsilph
  385. ld hl, .savedtext
  386. call PrintText
  387. .done
  388. jp TextScriptEnd
  389. .rockettext
  390. TX_FAR _SilphCo7Text_51e46
  391. db "@"
  392. .savedtext
  393. TX_FAR _SilphCo7Text_51e4b
  394. db "@"
  395. SilphCo7Text5:
  396. TX_ASM
  397. ld hl, SilphCo7TrainerHeader0
  398. call TalkToTrainer
  399. jp TextScriptEnd
  400. SilphCo7BattleText1:
  401. TX_FAR _SilphCo7BattleText1
  402. db "@"
  403. SilphCo7EndBattleText1:
  404. TX_FAR _SilphCo7EndBattleText1
  405. db "@"
  406. SilphCo7AfterBattleText1:
  407. TX_FAR _SilphCo7AfterBattleText1
  408. db "@"
  409. SilphCo7Text6:
  410. TX_ASM
  411. ld hl, SilphCo7TrainerHeader1
  412. call TalkToTrainer
  413. jp TextScriptEnd
  414. SilphCo7BattleText2:
  415. TX_FAR _SilphCo7BattleText2
  416. db "@"
  417. SilphCo7EndBattleText2:
  418. TX_FAR _SilphCo7EndBattleText2
  419. db "@"
  420. SilphCo7AfterBattleText2:
  421. TX_FAR _SilphCo7AfterBattleText2
  422. db "@"
  423. SilphCo7Text7:
  424. TX_ASM
  425. ld hl, SilphCo7TrainerHeader2
  426. call TalkToTrainer
  427. jp TextScriptEnd
  428. SilphCo7BattleText3:
  429. TX_FAR _SilphCo7BattleText3
  430. db "@"
  431. SilphCo7EndBattleText3:
  432. TX_FAR _SilphCo7EndBattleText3
  433. db "@"
  434. SilphCo7AfterBattleText3:
  435. TX_FAR _SilphCo7AfterBattleText3
  436. db "@"
  437. SilphCo7Text8:
  438. TX_ASM
  439. ld hl, SilphCo7TrainerHeader3
  440. call TalkToTrainer
  441. jp TextScriptEnd
  442. SilphCo7BattleText4:
  443. TX_FAR _SilphCo7BattleText4
  444. db "@"
  445. SilphCo7EndBattleText4:
  446. TX_FAR _SilphCo7EndBattleText4
  447. db "@"
  448. SilphCo7AfterBattleText4:
  449. TX_FAR _SilphCo7AfterBattleText4
  450. db "@"
  451. SilphCo7Text9:
  452. TX_ASM
  453. ld hl, SilphCo7Text_51ebe
  454. call PrintText
  455. jp TextScriptEnd
  456. SilphCo7Text_51ebe:
  457. TX_FAR _SilphCo7Text_51ebe
  458. db "@"
  459. SilphCo7Text13:
  460. TX_FAR _SilphCo7Text_51ec3
  461. db "@"
  462. SilphCo7Text14:
  463. TX_FAR _SilphCo7Text_51ec8
  464. db "@"
  465. SilphCo7Text_51ecd:
  466. TX_FAR _SilphCo7Text_51ecd
  467. db "@"
  468. SilphCo7Text15:
  469. TX_FAR _SilphCo7Text_51ed2
  470. db "@"