silphco8.asm 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. SilphCo8Script:
  2. call SilphCo8Script_5651a
  3. call EnableAutoTextBoxDrawing
  4. ld hl, SilphCo8TrainerHeader0
  5. ld de, SilphCo8ScriptPointers
  6. ld a, [wSilphCo8CurScript]
  7. call ExecuteCurMapScriptInTable
  8. ld [wSilphCo8CurScript], a
  9. ret
  10. SilphCo8Script_5651a:
  11. ld hl, wCurrentMapScriptFlags
  12. bit 5, [hl]
  13. res 5, [hl]
  14. ret z
  15. ld hl, SilphCo8GateCoords
  16. call SilphCo8Script_56541
  17. call SilphCo8Script_5656d
  18. CheckEvent EVENT_SILPH_CO_8_UNLOCKED_DOOR
  19. ret nz
  20. ld a, $5f
  21. ld [wNewTileBlockID], a
  22. lb bc, 4, 3
  23. predef_jump ReplaceTileBlock
  24. SilphCo8GateCoords:
  25. db $04,$03
  26. db $FF
  27. SilphCo8Script_56541:
  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_5654d
  38. ld a, [hli]
  39. cp $ff
  40. jr z, .asm_56569
  41. push hl
  42. ld hl, $ffe0
  43. inc [hl]
  44. pop hl
  45. cp b
  46. jr z, .asm_5655e
  47. inc hl
  48. jr .asm_5654d
  49. .asm_5655e
  50. ld a, [hli]
  51. cp c
  52. jr nz, .asm_5654d
  53. ld hl, wCardKeyDoorY
  54. xor a
  55. ld [hli], a
  56. ld [hl], a
  57. ret
  58. .asm_56569
  59. xor a
  60. ld [$ffe0], a
  61. ret
  62. SilphCo8Script_5656d:
  63. ld a, [$ffe0]
  64. and a
  65. ret z
  66. SetEvent EVENT_SILPH_CO_8_UNLOCKED_DOOR
  67. ret
  68. SilphCo8ScriptPointers:
  69. dw CheckFightingMapTrainers
  70. dw DisplayEnemyTrainerTextAndStartBattle
  71. dw EndTrainerBattle
  72. SilphCo8TextPointers:
  73. dw SilphCo8Text1
  74. dw SilphCo8Text2
  75. dw SilphCo8Text3
  76. dw SilphCo8Text4
  77. SilphCo8TrainerHeader0:
  78. dbEventFlagBit EVENT_BEAT_SILPH_CO_8F_TRAINER_0
  79. db ($4 << 4) ; trainer's view range
  80. dwEventFlagAddress EVENT_BEAT_SILPH_CO_8F_TRAINER_0
  81. dw SilphCo8BattleText1 ; TextBeforeBattle
  82. dw SilphCo8AfterBattleText1 ; TextAfterBattle
  83. dw SilphCo8EndBattleText1 ; TextEndBattle
  84. dw SilphCo8EndBattleText1 ; TextEndBattle
  85. SilphCo8TrainerHeader1:
  86. dbEventFlagBit EVENT_BEAT_SILPH_CO_8F_TRAINER_1
  87. db ($4 << 4) ; trainer's view range
  88. dwEventFlagAddress EVENT_BEAT_SILPH_CO_8F_TRAINER_1
  89. dw SilphCo8BattleText2 ; TextBeforeBattle
  90. dw SilphCo8AfterBattleText2 ; TextAfterBattle
  91. dw SilphCo8EndBattleText2 ; TextEndBattle
  92. dw SilphCo8EndBattleText2 ; TextEndBattle
  93. SilphCo8TrainerHeader2:
  94. dbEventFlagBit EVENT_BEAT_SILPH_CO_8F_TRAINER_2
  95. db ($4 << 4) ; trainer's view range
  96. dwEventFlagAddress EVENT_BEAT_SILPH_CO_8F_TRAINER_2
  97. dw SilphCo8BattleText3 ; TextBeforeBattle
  98. dw SilphCo8AfterBattleText3 ; TextAfterBattle
  99. dw SilphCo8EndBattleText3 ; TextEndBattle
  100. dw SilphCo8EndBattleText3 ; TextEndBattle
  101. db $ff
  102. SilphCo8Text1:
  103. TX_ASM
  104. CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI
  105. ld hl, SilphCo8Text_565c3
  106. jr nz, .asm_565b8
  107. ld hl, SilphCo8Text_565be
  108. .asm_565b8
  109. call PrintText
  110. jp TextScriptEnd
  111. SilphCo8Text_565be:
  112. TX_FAR _SilphCo8Text_565be
  113. db "@"
  114. SilphCo8Text_565c3:
  115. TX_FAR _SilphCo8Text_565c3
  116. db "@"
  117. SilphCo8Text2:
  118. TX_ASM
  119. ld hl, SilphCo8TrainerHeader0
  120. call TalkToTrainer
  121. jp TextScriptEnd
  122. SilphCo8Text3:
  123. TX_ASM
  124. ld hl, SilphCo8TrainerHeader1
  125. call TalkToTrainer
  126. jp TextScriptEnd
  127. SilphCo8Text4:
  128. TX_ASM
  129. ld hl, SilphCo8TrainerHeader2
  130. call TalkToTrainer
  131. jp TextScriptEnd
  132. SilphCo8BattleText1:
  133. TX_FAR _SilphCo8BattleText1
  134. db "@"
  135. SilphCo8EndBattleText1:
  136. TX_FAR _SilphCo8EndBattleText1
  137. db "@"
  138. SilphCo8AfterBattleText1:
  139. TX_FAR _SilphCo8AfterBattleText1
  140. db "@"
  141. SilphCo8BattleText2:
  142. TX_FAR _SilphCo8BattleText2
  143. db "@"
  144. SilphCo8EndBattleText2:
  145. TX_FAR _SilphCo8EndBattleText2
  146. db "@"
  147. SilphCo8AfterBattleText2:
  148. TX_FAR _SilphCo8AfterBattleText2
  149. db "@"
  150. SilphCo8BattleText3:
  151. TX_FAR _SilphCo8BattleText3
  152. db "@"
  153. SilphCo8EndBattleText3:
  154. TX_FAR _SilphCo8EndBattleText3
  155. db "@"
  156. SilphCo8AfterBattleText3:
  157. TX_FAR _SilphCo8AfterBattleText3
  158. db "@"