silphco4.asm 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. SilphCo4Script:
  2. call SilphCo4Script_19d21
  3. call EnableAutoTextBoxDrawing
  4. ld hl, SilphCo4TrainerHeader0
  5. ld de, SilphCo4ScriptPointers
  6. ld a, [wSilphCo4CurScript]
  7. call ExecuteCurMapScriptInTable
  8. ld [wSilphCo4CurScript], a
  9. ret
  10. SilphCo4Script_19d21:
  11. ld hl, wCurrentMapScriptFlags
  12. bit 5, [hl]
  13. res 5, [hl]
  14. ret z
  15. ld hl, SilphCo4GateCoords
  16. call SilphCo4Script_19d5d
  17. call SilphCo4Script_19d89
  18. CheckEvent EVENT_SILPH_CO_4_UNLOCKED_DOOR1
  19. jr nz, .asm_19d48
  20. push af
  21. ld a, $54
  22. ld [wNewTileBlockID], a
  23. lb bc, 6, 2
  24. predef ReplaceTileBlock
  25. pop af
  26. .asm_19d48
  27. CheckEventAfterBranchReuseA EVENT_SILPH_CO_4_UNLOCKED_DOOR2, EVENT_SILPH_CO_4_UNLOCKED_DOOR1
  28. ret nz
  29. ld a, $54
  30. ld [wNewTileBlockID], a
  31. lb bc, 4, 6
  32. predef_jump ReplaceTileBlock
  33. SilphCo4GateCoords:
  34. db $06,$02
  35. db $04,$06
  36. db $FF
  37. SilphCo4Script_19d5d:
  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_19d69
  48. ld a, [hli]
  49. cp $ff
  50. jr z, .asm_19d85
  51. push hl
  52. ld hl, $ffe0
  53. inc [hl]
  54. pop hl
  55. cp b
  56. jr z, .asm_19d7a
  57. inc hl
  58. jr .asm_19d69
  59. .asm_19d7a
  60. ld a, [hli]
  61. cp c
  62. jr nz, .asm_19d69
  63. ld hl, wCardKeyDoorY
  64. xor a
  65. ld [hli], a
  66. ld [hl], a
  67. ret
  68. .asm_19d85
  69. xor a
  70. ld [$ffe0], a
  71. ret
  72. SilphCo4Script_19d89:
  73. EventFlagAddress hl, EVENT_SILPH_CO_4_UNLOCKED_DOOR1
  74. ld a, [$ffe0]
  75. and a
  76. ret z
  77. cp $1
  78. jr nz, .next
  79. SetEventReuseHL EVENT_SILPH_CO_4_UNLOCKED_DOOR1
  80. ret
  81. .next
  82. SetEventAfterBranchReuseHL EVENT_SILPH_CO_4_UNLOCKED_DOOR2, EVENT_SILPH_CO_4_UNLOCKED_DOOR1
  83. ret
  84. SilphCo4ScriptPointers:
  85. dw CheckFightingMapTrainers
  86. dw DisplayEnemyTrainerTextAndStartBattle
  87. dw EndTrainerBattle
  88. SilphCo4TextPointers:
  89. dw SilphCo4Text1
  90. dw SilphCo4Text2
  91. dw SilphCo4Text3
  92. dw SilphCo4Text4
  93. dw PickUpItemText
  94. dw PickUpItemText
  95. dw PickUpItemText
  96. SilphCo4TrainerHeader0:
  97. dbEventFlagBit EVENT_BEAT_SILPH_CO_4F_TRAINER_0
  98. db ($4 << 4) ; trainer's view range
  99. dwEventFlagAddress EVENT_BEAT_SILPH_CO_4F_TRAINER_0
  100. dw SilphCo4BattleText2 ; TextBeforeBattle
  101. dw SilphCo4AfterBattleText2 ; TextAfterBattle
  102. dw SilphCo4EndBattleText2 ; TextEndBattle
  103. dw SilphCo4EndBattleText2 ; TextEndBattle
  104. SilphCo4TrainerHeader1:
  105. dbEventFlagBit EVENT_BEAT_SILPH_CO_4F_TRAINER_1
  106. db ($3 << 4) ; trainer's view range
  107. dwEventFlagAddress EVENT_BEAT_SILPH_CO_4F_TRAINER_1
  108. dw SilphCo4BattleText3 ; TextBeforeBattle
  109. dw SilphCo4AfterBattleText3 ; TextAfterBattle
  110. dw SilphCo4EndBattleText3 ; TextEndBattle
  111. dw SilphCo4EndBattleText3 ; TextEndBattle
  112. SilphCo4TrainerHeader2:
  113. dbEventFlagBit EVENT_BEAT_SILPH_CO_4F_TRAINER_2
  114. db ($4 << 4) ; trainer's view range
  115. dwEventFlagAddress EVENT_BEAT_SILPH_CO_4F_TRAINER_2
  116. dw SilphCo4BattleText4 ; TextBeforeBattle
  117. dw SilphCo4AfterBattleText4 ; TextAfterBattle
  118. dw SilphCo4EndBattleText4 ; TextEndBattle
  119. dw SilphCo4EndBattleText4 ; TextEndBattle
  120. db $ff
  121. SilphCo4Text1:
  122. TX_ASM
  123. ld hl, SilphCo4Text_19de0
  124. ld de, SilphCo4Text_19de5
  125. call SilphCo6Script_1a22f
  126. jp TextScriptEnd
  127. SilphCo4Text_19de0:
  128. TX_FAR _SilphCo4Text_19de0
  129. db "@"
  130. SilphCo4Text_19de5:
  131. TX_FAR _SilphCo4Text_19de5
  132. db "@"
  133. SilphCo4Text2:
  134. TX_ASM
  135. ld hl, SilphCo4TrainerHeader0
  136. call TalkToTrainer
  137. jp TextScriptEnd
  138. SilphCo4BattleText2:
  139. TX_FAR _SilphCo4BattleText2
  140. db "@"
  141. SilphCo4EndBattleText2:
  142. TX_FAR _SilphCo4EndBattleText2
  143. db "@"
  144. SilphCo4AfterBattleText2:
  145. TX_FAR _SilphCo4AfterBattleText2
  146. db "@"
  147. SilphCo4Text3:
  148. TX_ASM
  149. ld hl, SilphCo4TrainerHeader1
  150. call TalkToTrainer
  151. jp TextScriptEnd
  152. SilphCo4BattleText3:
  153. TX_FAR _SilphCo4BattleText3
  154. db "@"
  155. SilphCo4EndBattleText3:
  156. TX_FAR _SilphCo4EndBattleText3
  157. db "@"
  158. SilphCo4AfterBattleText3:
  159. TX_FAR _SilphCo4AfterBattleText3
  160. db "@"
  161. SilphCo4Text4:
  162. TX_ASM
  163. ld hl, SilphCo4TrainerHeader2
  164. call TalkToTrainer
  165. jp TextScriptEnd
  166. SilphCo4BattleText4:
  167. TX_FAR _SilphCo4BattleText4
  168. db "@"
  169. SilphCo4EndBattleText4:
  170. TX_FAR _SilphCo4EndBattleText4
  171. db "@"
  172. SilphCo4AfterBattleText4:
  173. TX_FAR _SilphCo4AfterBattleText4
  174. db "@"