silphco9.asm 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. SilphCo9Script:
  2. call SilphCo9Script_5d7d1
  3. call EnableAutoTextBoxDrawing
  4. ld hl, SilphCo9TrainerHeader0
  5. ld de, SilphCo9ScriptPointers
  6. ld a, [wSilphCo9CurScript]
  7. call ExecuteCurMapScriptInTable
  8. ld [wSilphCo9CurScript], a
  9. ret
  10. SilphCo9Script_5d7d1:
  11. ld hl, wCurrentMapScriptFlags
  12. bit 5, [hl]
  13. res 5, [hl]
  14. ret z
  15. ld hl, SilphCo9GateCoords
  16. call SilphCo9Script_5d837
  17. call SilphCo9Script_5d863
  18. CheckEvent EVENT_SILPH_CO_9_UNLOCKED_DOOR1
  19. jr nz, .asm_5d7f8
  20. push af
  21. ld a, $5f
  22. ld [wNewTileBlockID], a
  23. lb bc, 4, 1
  24. predef ReplaceTileBlock
  25. pop af
  26. .asm_5d7f8
  27. CheckEventAfterBranchReuseA EVENT_SILPH_CO_9_UNLOCKED_DOOR2, EVENT_SILPH_CO_9_UNLOCKED_DOOR1
  28. jr nz, .asm_5d80b
  29. push af
  30. ld a, $54
  31. ld [wNewTileBlockID], a
  32. lb bc, 2, 9
  33. predef ReplaceTileBlock
  34. pop af
  35. .asm_5d80b
  36. CheckEventAfterBranchReuseA EVENT_SILPH_CO_9_UNLOCKED_DOOR3, EVENT_SILPH_CO_9_UNLOCKED_DOOR2
  37. jr nz, .asm_5d81e
  38. push af
  39. ld a, $54
  40. ld [wNewTileBlockID], a
  41. lb bc, 5, 9
  42. predef ReplaceTileBlock
  43. pop af
  44. .asm_5d81e
  45. CheckEventAfterBranchReuseA EVENT_SILPH_CO_9_UNLOCKED_DOOR4, EVENT_SILPH_CO_9_UNLOCKED_DOOR3
  46. ret nz
  47. ld a, $5f
  48. ld [wNewTileBlockID], a
  49. lb bc, 6, 5
  50. predef_jump ReplaceTileBlock
  51. SilphCo9GateCoords:
  52. db $04,$01
  53. db $02,$09
  54. db $05,$09
  55. db $06,$05
  56. db $FF
  57. SilphCo9Script_5d837:
  58. push hl
  59. ld hl, wCardKeyDoorY
  60. ld a, [hli]
  61. ld b, a
  62. ld a, [hl]
  63. ld c, a
  64. xor a
  65. ld [$ffe0], a
  66. pop hl
  67. .asm_5d843
  68. ld a, [hli]
  69. cp $ff
  70. jr z, .asm_5d85f
  71. push hl
  72. ld hl, $ffe0
  73. inc [hl]
  74. pop hl
  75. cp b
  76. jr z, .asm_5d854
  77. inc hl
  78. jr .asm_5d843
  79. .asm_5d854
  80. ld a, [hli]
  81. cp c
  82. jr nz, .asm_5d843
  83. ld hl, wCardKeyDoorY
  84. xor a
  85. ld [hli], a
  86. ld [hl], a
  87. ret
  88. .asm_5d85f
  89. xor a
  90. ld [$ffe0], a
  91. ret
  92. SilphCo9Script_5d863:
  93. EventFlagAddress hl, EVENT_SILPH_CO_9_UNLOCKED_DOOR1
  94. ld a, [$ffe0]
  95. and a
  96. ret z
  97. cp $1
  98. jr nz, .next1
  99. SetEventReuseHL EVENT_SILPH_CO_9_UNLOCKED_DOOR1
  100. ret
  101. .next1
  102. cp $2
  103. jr nz, .next2
  104. SetEventAfterBranchReuseHL EVENT_SILPH_CO_9_UNLOCKED_DOOR2, EVENT_SILPH_CO_9_UNLOCKED_DOOR1
  105. ret
  106. .next2
  107. cp $3
  108. jr nz, .next3
  109. SetEventAfterBranchReuseHL EVENT_SILPH_CO_9_UNLOCKED_DOOR3, EVENT_SILPH_CO_9_UNLOCKED_DOOR1
  110. ret
  111. .next3
  112. cp $4
  113. ret nz
  114. SetEventAfterBranchReuseHL EVENT_SILPH_CO_9_UNLOCKED_DOOR4, EVENT_SILPH_CO_9_UNLOCKED_DOOR1
  115. ret
  116. SilphCo9ScriptPointers:
  117. dw CheckFightingMapTrainers
  118. dw DisplayEnemyTrainerTextAndStartBattle
  119. dw EndTrainerBattle
  120. SilphCo9TextPointers:
  121. dw SilphCo9Text1
  122. dw SilphCo9Text2
  123. dw SilphCo9Text3
  124. dw SilphCo9Text4
  125. SilphCo9TrainerHeader0:
  126. dbEventFlagBit EVENT_BEAT_SILPH_CO_9F_TRAINER_0
  127. db ($4 << 4) ; trainer's view range
  128. dwEventFlagAddress EVENT_BEAT_SILPH_CO_9F_TRAINER_0
  129. dw SilphCo9BattleText1 ; TextBeforeBattle
  130. dw SilphCo9AfterBattleText1 ; TextAfterBattle
  131. dw SilphCo9EndBattleText1 ; TextEndBattle
  132. dw SilphCo9EndBattleText1 ; TextEndBattle
  133. SilphCo9TrainerHeader1:
  134. dbEventFlagBit EVENT_BEAT_SILPH_CO_9F_TRAINER_1
  135. db ($2 << 4) ; trainer's view range
  136. dwEventFlagAddress EVENT_BEAT_SILPH_CO_9F_TRAINER_1
  137. dw SilphCo9BattleText2 ; TextBeforeBattle
  138. dw SilphCo9AfterBattleText2 ; TextAfterBattle
  139. dw SilphCo9EndBattleText2 ; TextEndBattle
  140. dw SilphCo9EndBattleText2 ; TextEndBattle
  141. SilphCo9TrainerHeader2:
  142. dbEventFlagBit EVENT_BEAT_SILPH_CO_9F_TRAINER_2
  143. db ($4 << 4) ; trainer's view range
  144. dwEventFlagAddress EVENT_BEAT_SILPH_CO_9F_TRAINER_2
  145. dw SilphCo9BattleText3 ; TextBeforeBattle
  146. dw SilphCo9AfterBattleText3 ; TextAfterBattle
  147. dw SilphCo9EndBattleText3 ; TextEndBattle
  148. dw SilphCo9EndBattleText3 ; TextEndBattle
  149. db $ff
  150. SilphCo9Text1:
  151. TX_ASM
  152. CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI
  153. jr nz, .asm_5d8dc
  154. ld hl, SilphCo9Text_5d8e5
  155. call PrintText
  156. predef HealParty
  157. call GBFadeOutToWhite
  158. call Delay3
  159. call GBFadeInFromWhite
  160. ld hl, SilphCo9Text_5d8ea
  161. call PrintText
  162. jr .asm_5d8e2
  163. .asm_5d8dc
  164. ld hl, SilphCo9Text_5d8ef
  165. call PrintText
  166. .asm_5d8e2
  167. jp TextScriptEnd
  168. SilphCo9Text_5d8e5:
  169. TX_FAR _SilphCo9Text_5d8e5
  170. db "@"
  171. SilphCo9Text_5d8ea:
  172. TX_FAR _SilphCo9Text_5d8ea
  173. db "@"
  174. SilphCo9Text_5d8ef:
  175. TX_FAR _SilphCo9Text_5d8ef
  176. db "@"
  177. SilphCo9Text2:
  178. TX_ASM
  179. ld hl, SilphCo9TrainerHeader0
  180. call TalkToTrainer
  181. jp TextScriptEnd
  182. SilphCo9Text3:
  183. TX_ASM
  184. ld hl, SilphCo9TrainerHeader1
  185. call TalkToTrainer
  186. jp TextScriptEnd
  187. SilphCo9Text4:
  188. TX_ASM
  189. ld hl, SilphCo9TrainerHeader2
  190. call TalkToTrainer
  191. jp TextScriptEnd
  192. SilphCo9BattleText1:
  193. TX_FAR _SilphCo9BattleText1
  194. db "@"
  195. SilphCo9EndBattleText1:
  196. TX_FAR _SilphCo9EndBattleText1
  197. db "@"
  198. SilphCo9AfterBattleText1:
  199. TX_FAR _SilphCo9AfterBattleText1
  200. db "@"
  201. SilphCo9BattleText2:
  202. TX_FAR _SilphCo9BattleText2
  203. db "@"
  204. SilphCo9EndBattleText2:
  205. TX_FAR _SilphCo9EndBattleText2
  206. db "@"
  207. SilphCo9AfterBattleText2:
  208. TX_FAR _SilphCo9AfterBattleText2
  209. db "@"
  210. SilphCo9BattleText3:
  211. TX_FAR _SilphCo9BattleText3
  212. db "@"
  213. SilphCo9EndBattleText3:
  214. TX_FAR _SilphCo9EndBattleText3
  215. db "@"
  216. SilphCo9AfterBattleText3:
  217. TX_FAR _SilphCo9AfterBattleText3
  218. db "@"