silphco11.asm 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. SilphCo11Script:
  2. call SilphCo11Script_62110
  3. call EnableAutoTextBoxDrawing
  4. ld hl, SilphCo11TrainerHeader0
  5. ld de, SilphCo11ScriptPointers
  6. ld a, [wSilphCo11CurScript]
  7. call ExecuteCurMapScriptInTable
  8. ld [wSilphCo11CurScript], a
  9. ret
  10. SilphCo11Script_62110:
  11. ld hl, wCurrentMapScriptFlags
  12. bit 5, [hl]
  13. res 5, [hl]
  14. ret z
  15. ld hl, SilphCo11GateCoords
  16. call SilphCo11Script_62137
  17. call SilphCo11Script_62163
  18. CheckEvent EVENT_SILPH_CO_11_UNLOCKED_DOOR
  19. ret nz
  20. ld a, $20
  21. ld [wNewTileBlockID], a
  22. lb bc, 6, 3
  23. predef_jump ReplaceTileBlock
  24. SilphCo11GateCoords:
  25. db $06,$03
  26. db $FF
  27. SilphCo11Script_62137:
  28. push hl
  29. ld hl, wCardKeyDoorY
  30. ld a, [hli]
  31. ld b, a
  32. ld a, [hl]
  33. ld c, a
  34. xor a
  35. ld [$ffe0], a
  36. pop hl
  37. .asm_62143
  38. ld a, [hli]
  39. cp $ff
  40. jr z, .asm_6215f
  41. push hl
  42. ld hl, $ffe0
  43. inc [hl]
  44. pop hl
  45. cp b
  46. jr z, .asm_62154
  47. inc hl
  48. jr .asm_62143
  49. .asm_62154
  50. ld a, [hli]
  51. cp c
  52. jr nz, .asm_62143
  53. ld hl, wCardKeyDoorY
  54. xor a
  55. ld [hli], a
  56. ld [hl], a
  57. ret
  58. .asm_6215f
  59. xor a
  60. ld [$ffe0], a
  61. ret
  62. SilphCo11Script_62163:
  63. ld a, [$ffe0]
  64. and a
  65. ret z
  66. SetEvent EVENT_SILPH_CO_11_UNLOCKED_DOOR
  67. ret
  68. SilphCo11Script_6216d:
  69. ld hl, MissableObjectIDs_6219b
  70. .asm_62170
  71. ld a, [hli]
  72. cp $ff
  73. jr z, .asm_62181
  74. push hl
  75. ld [wMissableObjectIndex], a
  76. predef HideObject
  77. pop hl
  78. jr .asm_62170
  79. .asm_62181
  80. ld hl, MissableObjectIDs_62194
  81. .asm_62184
  82. ld a, [hli]
  83. cp $ff
  84. ret z
  85. push hl
  86. ld [wMissableObjectIndex], a
  87. predef ShowObject
  88. pop hl
  89. jr .asm_62184
  90. MissableObjectIDs_62194:
  91. db HS_SAFFRON_CITY_8
  92. db HS_SAFFRON_CITY_9
  93. db HS_SAFFRON_CITY_A
  94. db HS_SAFFRON_CITY_B
  95. db HS_SAFFRON_CITY_C
  96. db HS_SAFFRON_CITY_D
  97. db $FF
  98. MissableObjectIDs_6219b:
  99. db HS_SAFFRON_CITY_1
  100. db HS_SAFFRON_CITY_2
  101. db HS_SAFFRON_CITY_3
  102. db HS_SAFFRON_CITY_4
  103. db HS_SAFFRON_CITY_5
  104. db HS_SAFFRON_CITY_6
  105. db HS_SAFFRON_CITY_7
  106. db HS_SAFFRON_CITY_E
  107. db HS_SAFFRON_CITY_F
  108. db HS_SILPH_CO_2F_2
  109. db HS_SILPH_CO_2F_3
  110. db HS_SILPH_CO_2F_4
  111. db HS_SILPH_CO_2F_5
  112. db HS_SILPH_CO_3F_1
  113. db HS_SILPH_CO_3F_2
  114. db HS_SILPH_CO_4F_1
  115. db HS_SILPH_CO_4F_2
  116. db HS_SILPH_CO_4F_3
  117. db HS_SILPH_CO_5F_1
  118. db HS_SILPH_CO_5F_2
  119. db HS_SILPH_CO_5F_3
  120. db HS_SILPH_CO_5F_4
  121. db HS_SILPH_CO_6F_1
  122. db HS_SILPH_CO_6F_2
  123. db HS_SILPH_CO_6F_3
  124. db HS_SILPH_CO_7F_1
  125. db HS_SILPH_CO_7F_2
  126. db HS_SILPH_CO_7F_3
  127. db HS_SILPH_CO_7F_4
  128. db HS_SILPH_CO_8F_1
  129. db HS_SILPH_CO_8F_2
  130. db HS_SILPH_CO_8F_3
  131. db HS_SILPH_CO_9F_1
  132. db HS_SILPH_CO_9F_2
  133. db HS_SILPH_CO_9F_3
  134. db HS_SILPH_CO_10F_1
  135. db HS_SILPH_CO_10F_2
  136. db HS_SILPH_CO_11F_1
  137. db HS_SILPH_CO_11F_2
  138. db HS_SILPH_CO_11F_3
  139. db $FF
  140. SilphCo11Script_621c4:
  141. xor a
  142. ld [wJoyIgnore], a
  143. SilphCo11Script_621c8:
  144. ld [wSilphCo11CurScript], a
  145. ld [wCurMapScript], a
  146. ret
  147. SilphCo11ScriptPointers:
  148. dw SilphCo11Script0
  149. dw DisplayEnemyTrainerTextAndStartBattle
  150. dw EndTrainerBattle
  151. dw SilphCo11Script3
  152. dw SilphCo11Script4
  153. dw SilphCo11Script5
  154. SilphCo11Script0:
  155. CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI
  156. ret nz
  157. ld hl, CoordsData_62211
  158. call ArePlayerCoordsInArray
  159. jp nc, CheckFightingMapTrainers
  160. ld a, [wCoordIndex]
  161. ld [wcf0d], a
  162. xor a
  163. ld [hJoyHeld], a
  164. ld a, $f0
  165. ld [wJoyIgnore], a
  166. ld a, $3
  167. ld [hSpriteIndexOrTextID], a
  168. call DisplayTextID
  169. ld a, $3
  170. ld [H_SPRITEINDEX], a
  171. call SetSpriteMovementBytesToFF
  172. ld de, MovementData_62216
  173. call MoveSprite
  174. ld a, $3
  175. jp SilphCo11Script_621c8
  176. CoordsData_62211:
  177. db $0D,$06
  178. db $0C,$07
  179. db $FF
  180. MovementData_62216:
  181. db NPC_MOVEMENT_DOWN
  182. db NPC_MOVEMENT_DOWN
  183. db NPC_MOVEMENT_DOWN
  184. db $FF
  185. SilphCo11Script_6221a:
  186. ld [wPlayerMovingDirection], a
  187. ld a, $3
  188. ld [H_SPRITEINDEX], a
  189. ld a, b
  190. ld [hSpriteFacingDirection], a
  191. jp SetSpriteFacingDirectionAndDelay
  192. SilphCo11Script5:
  193. ld a, [wIsInBattle]
  194. cp $ff
  195. jp z, SilphCo11Script_621c4
  196. ld a, [wcf0d]
  197. cp $1
  198. jr z, .asm_6223c
  199. ld a, PLAYER_DIR_LEFT
  200. ld b, SPRITE_FACING_RIGHT
  201. jr .asm_62240
  202. .asm_6223c
  203. ld a, PLAYER_DIR_UP
  204. ld b, SPRITE_FACING_DOWN
  205. .asm_62240
  206. call SilphCo11Script_6221a
  207. ld a, $f0
  208. ld [wJoyIgnore], a
  209. ld a, $6
  210. ld [hSpriteIndexOrTextID], a
  211. call DisplayTextID
  212. call GBFadeOutToBlack
  213. call SilphCo11Script_6216d
  214. call UpdateSprites
  215. call Delay3
  216. call GBFadeInFromBlack
  217. SetEvent EVENT_BEAT_SILPH_CO_GIOVANNI
  218. xor a
  219. ld [wJoyIgnore], a
  220. jp SilphCo11Script_621c8
  221. SilphCo11Script3:
  222. ld a, [wd730]
  223. bit 0, a
  224. ret nz
  225. ld a, $3
  226. ld [H_SPRITEINDEX], a
  227. call SetSpriteMovementBytesToFF
  228. ld a, [wcf0d]
  229. cp $1
  230. jr z, .asm_62284
  231. ld a, PLAYER_DIR_LEFT
  232. ld b, SPRITE_FACING_RIGHT
  233. jr .asm_62288
  234. .asm_62284
  235. ld a, PLAYER_DIR_UP
  236. ld b, SPRITE_FACING_DOWN
  237. .asm_62288
  238. call SilphCo11Script_6221a
  239. call Delay3
  240. ld a, $4
  241. jp SilphCo11Script_621c8
  242. SilphCo11Script4:
  243. ld hl, wd72d
  244. set 6, [hl]
  245. set 7, [hl]
  246. ld hl, SilphCo10Text_62330
  247. ld de, SilphCo10Text_62330
  248. call SaveEndBattleTextPointers
  249. ld a, [H_SPRITEINDEX]
  250. ld [wSpriteIndex], a
  251. call EngageMapTrainer
  252. call InitBattleEnemyParameters
  253. xor a
  254. ld [wJoyIgnore], a
  255. ld a, $5
  256. jp SilphCo11Script_621c8
  257. SilphCo11TextPointers:
  258. dw SilphCo11Text1
  259. dw SilphCo11Text2
  260. dw SilphCo11Text3
  261. dw SilphCo11Text4
  262. dw SilphCo11Text5
  263. dw SilphCo11Text6
  264. SilphCo11TrainerHeader0:
  265. dbEventFlagBit EVENT_BEAT_SILPH_CO_11F_TRAINER_0
  266. db ($4 << 4) ; trainer's view range
  267. dwEventFlagAddress EVENT_BEAT_SILPH_CO_11F_TRAINER_0
  268. dw SilphCo11BattleText1 ; TextBeforeBattle
  269. dw SilphCo11AfterBattleText1 ; TextAfterBattle
  270. dw SilphCo11EndBattleText1 ; TextEndBattle
  271. dw SilphCo11EndBattleText1 ; TextEndBattle
  272. SilphCo11TrainerHeader1:
  273. dbEventFlagBit EVENT_BEAT_SILPH_CO_11F_TRAINER_1
  274. db ($3 << 4) ; trainer's view range
  275. dwEventFlagAddress EVENT_BEAT_SILPH_CO_11F_TRAINER_1
  276. dw SilphCo11BattleText2 ; TextBeforeBattle
  277. dw SilphCo11AfterBattleText2 ; TextAfterBattle
  278. dw SilphCo11EndBattleText2 ; TextEndBattle
  279. dw SilphCo11EndBattleText2 ; TextEndBattle
  280. db $ff
  281. SilphCo11Text1:
  282. TX_ASM
  283. CheckEvent EVENT_GOT_MASTER_BALL
  284. jp nz, .asm_62308
  285. ld hl, SilphCoPresidentText
  286. call PrintText
  287. lb bc, MASTER_BALL, 1
  288. call GiveItem
  289. jr nc, .BagFull
  290. ld hl, ReceivedSilphCoMasterBallText
  291. call PrintText
  292. SetEvent EVENT_GOT_MASTER_BALL
  293. jr .asm_6230e
  294. .BagFull
  295. ld hl, SilphCoMasterBallNoRoomText
  296. call PrintText
  297. jr .asm_6230e
  298. .asm_62308
  299. ld hl, SilphCo10Text_6231c
  300. call PrintText
  301. .asm_6230e
  302. jp TextScriptEnd
  303. SilphCoPresidentText:
  304. TX_FAR _SilphCoPresidentText
  305. db "@"
  306. ReceivedSilphCoMasterBallText:
  307. TX_FAR _ReceivedSilphCoMasterBallText
  308. TX_SFX_KEY_ITEM
  309. db "@"
  310. SilphCo10Text_6231c:
  311. TX_FAR _SilphCo10Text_6231c
  312. db "@"
  313. SilphCoMasterBallNoRoomText:
  314. TX_FAR _SilphCoMasterBallNoRoomText
  315. db "@"
  316. SilphCo11Text2:
  317. TX_FAR _SilphCo11Text2
  318. db "@"
  319. SilphCo11Text3:
  320. TX_FAR _SilphCo11Text3
  321. db "@"
  322. SilphCo10Text_62330:
  323. TX_FAR _SilphCo10Text_62330
  324. db "@"
  325. SilphCo11Text6:
  326. TX_FAR _SilphCo10Text_62335
  327. db "@"
  328. SilphCo11Text4:
  329. TX_ASM
  330. ld hl, SilphCo11TrainerHeader0
  331. call TalkToTrainer
  332. jp TextScriptEnd
  333. SilphCo11BattleText1:
  334. TX_FAR _SilphCo11BattleText1
  335. db "@"
  336. SilphCo11EndBattleText1:
  337. TX_FAR _SilphCo11EndBattleText1
  338. db "@"
  339. SilphCo11AfterBattleText1:
  340. TX_FAR _SilphCo11AfterBattleText1
  341. db "@"
  342. SilphCo11Text5:
  343. TX_ASM
  344. ld hl, SilphCo11TrainerHeader1
  345. call TalkToTrainer
  346. jp TextScriptEnd
  347. SilphCo11BattleText2:
  348. TX_FAR _SilphCo11BattleText2
  349. db "@"
  350. SilphCo11EndBattleText2:
  351. TX_FAR _SilphCo11EndBattleText2
  352. db "@"
  353. SilphCo11AfterBattleText2:
  354. TX_FAR _SilphCo11AfterBattleText2
  355. db "@"
  356. SilphCo10Text_6236c:
  357. TX_ASM
  358. ld hl, SilphCo10Text_6237b
  359. call PrintText
  360. ld a, PORYGON
  361. call DisplayPokedex
  362. jp TextScriptEnd
  363. SilphCo10Text_6237b:
  364. TX_FAR _SilphCo10Text_6237b
  365. db "@"