silphco2.asm 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. SilphCo2Script:
  2. call SilphCo2Script_59d07
  3. call EnableAutoTextBoxDrawing
  4. ld hl, SilphCo2TrainerHeader0
  5. ld de, SilphCo2ScriptPointers
  6. ld a, [wSilphCo2CurScript]
  7. call ExecuteCurMapScriptInTable
  8. ld [wSilphCo2CurScript], a
  9. ret
  10. SilphCo2Script_59d07:
  11. ld hl, wCurrentMapScriptFlags
  12. bit 5, [hl]
  13. res 5, [hl]
  14. ret z
  15. ld hl, SilphCo2GateCoords
  16. call SilphCo2Script_59d43
  17. call SilphCo2Script_59d6f
  18. CheckEvent EVENT_SILPH_CO_2_UNLOCKED_DOOR1
  19. jr nz, .asm_59d2e
  20. push af
  21. ld a, $54
  22. ld [wNewTileBlockID], a
  23. lb bc, 2, 2
  24. predef ReplaceTileBlock
  25. pop af
  26. .asm_59d2e
  27. CheckEventAfterBranchReuseA EVENT_SILPH_CO_2_UNLOCKED_DOOR2, EVENT_SILPH_CO_2_UNLOCKED_DOOR1
  28. ret nz
  29. ld a, $54
  30. ld [wNewTileBlockID], a
  31. lb bc, 5, 2
  32. predef_jump ReplaceTileBlock
  33. SilphCo2GateCoords:
  34. db $02,$02
  35. db $05,$02
  36. db $FF
  37. SilphCo2Script_59d43:
  38. push hl
  39. ld hl, wCardKeyDoorY
  40. ld a, [hli]
  41. ld b, a
  42. ld a, [hl]
  43. ld c, a
  44. xor a
  45. ld [$ffe0], a
  46. pop hl
  47. .asm_59d4f
  48. ld a, [hli]
  49. cp $ff
  50. jr z, .asm_59d6b
  51. push hl
  52. ld hl, $ffe0
  53. inc [hl]
  54. pop hl
  55. cp b
  56. jr z, .asm_59d60
  57. inc hl
  58. jr .asm_59d4f
  59. .asm_59d60
  60. ld a, [hli]
  61. cp c
  62. jr nz, .asm_59d4f
  63. ld hl, wCardKeyDoorY
  64. xor a
  65. ld [hli], a
  66. ld [hl], a
  67. ret
  68. .asm_59d6b
  69. xor a
  70. ld [$ffe0], a
  71. ret
  72. SilphCo2Script_59d6f:
  73. EventFlagAddress hl, EVENT_SILPH_CO_2_UNLOCKED_DOOR1
  74. ld a, [$ffe0]
  75. and a
  76. ret z
  77. cp $1
  78. jr nz, .next
  79. SetEventReuseHL EVENT_SILPH_CO_2_UNLOCKED_DOOR1
  80. ret
  81. .next
  82. SetEventAfterBranchReuseHL EVENT_SILPH_CO_2_UNLOCKED_DOOR2, EVENT_SILPH_CO_2_UNLOCKED_DOOR1
  83. ret
  84. SilphCo2ScriptPointers:
  85. dw CheckFightingMapTrainers
  86. dw DisplayEnemyTrainerTextAndStartBattle
  87. dw EndTrainerBattle
  88. SilphCo2TextPointers:
  89. dw SilphCo2Text1
  90. dw SilphCo2Text2
  91. dw SilphCo2Text3
  92. dw SilphCo2Text4
  93. dw SilphCo2Text5
  94. SilphCo2TrainerHeader0:
  95. dbEventFlagBit EVENT_BEAT_SILPH_CO_2F_TRAINER_0
  96. db ($3 << 4) ; trainer's view range
  97. dwEventFlagAddress EVENT_BEAT_SILPH_CO_2F_TRAINER_0
  98. dw SilphCo2BattleText1 ; TextBeforeBattle
  99. dw SilphCo2AfterBattleText1 ; TextAfterBattle
  100. dw SilphCo2EndBattleText1 ; TextEndBattle
  101. dw SilphCo2EndBattleText1 ; TextEndBattle
  102. SilphCo2TrainerHeader1:
  103. dbEventFlagBit EVENT_BEAT_SILPH_CO_2F_TRAINER_1
  104. db ($4 << 4) ; trainer's view range
  105. dwEventFlagAddress EVENT_BEAT_SILPH_CO_2F_TRAINER_1
  106. dw SilphCo2BattleText2 ; TextBeforeBattle
  107. dw SilphCo2AfterBattleText2 ; TextAfterBattle
  108. dw SilphCo2EndBattleText2 ; TextEndBattle
  109. dw SilphCo2EndBattleText2 ; TextEndBattle
  110. SilphCo2TrainerHeader2:
  111. dbEventFlagBit EVENT_BEAT_SILPH_CO_2F_TRAINER_2
  112. db ($3 << 4) ; trainer's view range
  113. dwEventFlagAddress EVENT_BEAT_SILPH_CO_2F_TRAINER_2
  114. dw SilphCo2BattleText3 ; TextBeforeBattle
  115. dw SilphCo2AfterBattleText3 ; TextAfterBattle
  116. dw SilphCo2EndBattleText3 ; TextEndBattle
  117. dw SilphCo2EndBattleText3 ; TextEndBattle
  118. SilphCo2TrainerHeader3:
  119. dbEventFlagBit EVENT_BEAT_SILPH_CO_2F_TRAINER_3
  120. db ($3 << 4) ; trainer's view range
  121. dwEventFlagAddress EVENT_BEAT_SILPH_CO_2F_TRAINER_3
  122. dw SilphCo2BattleText4 ; TextBeforeBattle
  123. dw SilphCo2AfterBattleText4 ; TextAfterBattle
  124. dw SilphCo2EndBattleText4 ; TextEndBattle
  125. dw SilphCo2EndBattleText4 ; TextEndBattle
  126. db $ff
  127. SilphCo2Text1:
  128. TX_ASM
  129. CheckEvent EVENT_GOT_TM36
  130. jr nz, .asm_59de4
  131. ld hl, SilphCo2Text_59ded
  132. call PrintText
  133. lb bc, TM_36, 1
  134. call GiveItem
  135. ld hl, TM36NoRoomText
  136. jr nc, .asm_59de7
  137. SetEvent EVENT_GOT_TM36
  138. ld hl, ReceivedTM36Text
  139. jr .asm_59de7
  140. .asm_59de4
  141. ld hl, TM36ExplanationText
  142. .asm_59de7
  143. call PrintText
  144. jp TextScriptEnd
  145. SilphCo2Text_59ded:
  146. TX_FAR _SilphCo2Text_59ded
  147. db "@"
  148. ReceivedTM36Text:
  149. TX_FAR _ReceivedTM36Text
  150. TX_SFX_ITEM_1
  151. db "@"
  152. TM36ExplanationText:
  153. TX_FAR _TM36ExplanationText
  154. db "@"
  155. TM36NoRoomText:
  156. TX_FAR _TM36NoRoomText
  157. db "@"
  158. SilphCo2Text2:
  159. TX_ASM
  160. ld hl, SilphCo2TrainerHeader0
  161. call TalkToTrainer
  162. jp TextScriptEnd
  163. SilphCo2Text3:
  164. TX_ASM
  165. ld hl, SilphCo2TrainerHeader1
  166. call TalkToTrainer
  167. jp TextScriptEnd
  168. SilphCo2Text4:
  169. TX_ASM
  170. ld hl, SilphCo2TrainerHeader2
  171. call TalkToTrainer
  172. jp TextScriptEnd
  173. SilphCo2Text5:
  174. TX_ASM
  175. ld hl, SilphCo2TrainerHeader3
  176. call TalkToTrainer
  177. jp TextScriptEnd
  178. SilphCo2BattleText1:
  179. TX_FAR _SilphCo2BattleText1
  180. db "@"
  181. SilphCo2EndBattleText1:
  182. TX_FAR _SilphCo2EndBattleText1
  183. db "@"
  184. SilphCo2AfterBattleText1:
  185. TX_FAR _SilphCo2AfterBattleText1
  186. db "@"
  187. SilphCo2BattleText2:
  188. TX_FAR _SilphCo2BattleText2
  189. db "@"
  190. SilphCo2EndBattleText2:
  191. TX_FAR _SilphCo2EndBattleText2
  192. db "@"
  193. SilphCo2AfterBattleText2:
  194. TX_FAR _SilphCo2AfterBattleText2
  195. db "@"
  196. SilphCo2BattleText3:
  197. TX_FAR _SilphCo2BattleText3
  198. db "@"
  199. SilphCo2EndBattleText3:
  200. TX_FAR _SilphCo2EndBattleText3
  201. db "@"
  202. SilphCo2AfterBattleText3:
  203. TX_FAR _SilphCo2AfterBattleText3
  204. db "@"
  205. SilphCo2BattleText4:
  206. TX_FAR _SilphCo2BattleText4
  207. db "@"
  208. SilphCo2EndBattleText4:
  209. TX_FAR _SilphCo2EndBattleText4
  210. db "@"
  211. SilphCo2AfterBattleText4:
  212. TX_FAR _SilphCo2AfterBattleText4
  213. db "@"