route23.asm 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. Route23Script:
  2. call Route23Script_511e9
  3. call EnableAutoTextBoxDrawing
  4. ld hl, Route23ScriptPointers
  5. ld a, [wRoute23CurScript]
  6. jp CallFunctionInTable
  7. Route23Script_511e9:
  8. ld hl, wCurrentMapScriptFlags
  9. bit 6, [hl]
  10. res 6, [hl]
  11. ret z
  12. ResetEvents EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH1, EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH2
  13. ResetEvents EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH1, EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH2
  14. ld a, HS_VICTORY_ROAD_3_BOULDER
  15. ld [wMissableObjectIndex], a
  16. predef ShowObject
  17. ld a, HS_VICTORY_ROAD_2_BOULDER
  18. ld [wMissableObjectIndex], a
  19. predef_jump HideObject
  20. Route23ScriptPointers:
  21. dw Route23Script0
  22. dw Route23Script1
  23. dw Route23Script2
  24. Route23Script0:
  25. ld hl, YCoordsData_51255
  26. ld a, [wYCoord]
  27. ld b, a
  28. ld e, $0
  29. EventFlagBit c, EVENT_PASSED_EARTHBADGE_CHECK + 1, EVENT_PASSED_CASCADEBADGE_CHECK
  30. .asm_51224
  31. ld a, [hli]
  32. cp $ff
  33. ret z
  34. inc e
  35. dec c
  36. cp b
  37. jr nz, .asm_51224
  38. cp $23
  39. jr nz, .asm_51237
  40. ld a, [wXCoord]
  41. cp $e
  42. ret nc
  43. .asm_51237
  44. ld a, e
  45. ld [hSpriteIndexOrTextID], a
  46. ld a, c
  47. ld [wWhichBadge], a
  48. ld b, FLAG_TEST
  49. EventFlagAddress hl, EVENT_PASSED_CASCADEBADGE_CHECK
  50. predef FlagActionPredef
  51. ld a, c
  52. and a
  53. ret nz
  54. call Route23Script_5125d
  55. call DisplayTextID
  56. xor a
  57. ld [hJoyHeld], a
  58. ret
  59. YCoordsData_51255:
  60. db $23,$38,$55,$60,$69,$77,$88,$FF
  61. Route23Script_5125d:
  62. ld hl, BadgeTextPointers
  63. ld a, [wWhichBadge]
  64. ld c, a
  65. ld b, 0
  66. add hl, bc
  67. add hl, bc
  68. ld a, [hli]
  69. ld h, [hl]
  70. ld l, a
  71. ld de, wcd6d
  72. .copyTextLoop
  73. ld a, [hli]
  74. ld [de], a
  75. inc de
  76. cp "@"
  77. jr nz, .copyTextLoop
  78. ret
  79. BadgeTextPointers:
  80. dw CascadeBadgeText
  81. dw ThunderBadgeText
  82. dw RainbowBadgeText
  83. dw SoulBadgeText
  84. dw MarshBadgeText
  85. dw VolcanoBadgeText
  86. dw EarthBadgeText
  87. EarthBadgeText:
  88. db "EARTHBADGE@"
  89. VolcanoBadgeText:
  90. db "VOLCANOBADGE@"
  91. MarshBadgeText:
  92. db "MARSHBADGE@"
  93. SoulBadgeText:
  94. db "SOULBADGE@"
  95. RainbowBadgeText:
  96. db "RAINBOWBADGE@"
  97. ThunderBadgeText:
  98. db "THUNDERBADGE@"
  99. CascadeBadgeText:
  100. db "CASCADEBADGE@"
  101. Route23Script_512d8:
  102. ld a, $1
  103. ld [wSimulatedJoypadStatesIndex], a
  104. ld a, D_DOWN
  105. ld [wSimulatedJoypadStatesEnd], a
  106. xor a
  107. ld [wSpriteStateData1 + 9], a
  108. ld [wJoyIgnore], a
  109. jp StartSimulatingJoypadStates
  110. Route23Script1:
  111. ld a, [wSimulatedJoypadStatesIndex]
  112. and a
  113. ret nz
  114. Route23Script2:
  115. ld a, $0
  116. ld [wRoute23CurScript], a
  117. ret
  118. Route23TextPointers:
  119. dw Route23Text1
  120. dw Route23Text2
  121. dw Route23Text3
  122. dw Route23Text4
  123. dw Route23Text5
  124. dw Route23Text6
  125. dw Route23Text7
  126. dw Route23Text8
  127. Route23Text1:
  128. TX_ASM
  129. EventFlagBit a, EVENT_PASSED_EARTHBADGE_CHECK, EVENT_PASSED_CASCADEBADGE_CHECK
  130. call Route23Script_51346
  131. jp TextScriptEnd
  132. Route23Text2:
  133. TX_ASM
  134. EventFlagBit a, EVENT_PASSED_VOLCANOBADGE_CHECK, EVENT_PASSED_CASCADEBADGE_CHECK
  135. call Route23Script_51346
  136. jp TextScriptEnd
  137. Route23Text3:
  138. TX_ASM
  139. EventFlagBit a, EVENT_PASSED_MARSHBADGE_CHECK, EVENT_PASSED_CASCADEBADGE_CHECK
  140. call Route23Script_51346
  141. jp TextScriptEnd
  142. Route23Text4:
  143. TX_ASM
  144. EventFlagBit a, EVENT_PASSED_SOULBADGE_CHECK, EVENT_PASSED_CASCADEBADGE_CHECK
  145. call Route23Script_51346
  146. jp TextScriptEnd
  147. Route23Text5:
  148. TX_ASM
  149. EventFlagBit a, EVENT_PASSED_RAINBOWBADGE_CHECK, EVENT_PASSED_CASCADEBADGE_CHECK
  150. call Route23Script_51346
  151. jp TextScriptEnd
  152. Route23Text6:
  153. TX_ASM
  154. EventFlagBit a, EVENT_PASSED_THUNDERBADGE_CHECK, EVENT_PASSED_CASCADEBADGE_CHECK
  155. call Route23Script_51346
  156. jp TextScriptEnd
  157. Route23Text7:
  158. TX_ASM
  159. EventFlagBit a, EVENT_PASSED_CASCADEBADGE_CHECK
  160. call Route23Script_51346
  161. jp TextScriptEnd
  162. Route23Script_51346:
  163. ld [wWhichBadge], a
  164. call Route23Script_5125d
  165. ld a, [wWhichBadge]
  166. inc a
  167. ld c, a
  168. ld b, FLAG_TEST
  169. ld hl, wObtainedBadges
  170. predef FlagActionPredef
  171. ld a, c
  172. and a
  173. jr nz, .asm_5136e
  174. ld hl, VictoryRoadGuardText1
  175. call PrintText
  176. call Route23Script_512d8
  177. ld a, $1
  178. ld [wRoute23CurScript], a
  179. ret
  180. .asm_5136e
  181. ld hl, VictoryRoadGuardText2
  182. call PrintText
  183. ld a, [wWhichBadge]
  184. ld c, a
  185. ld b, FLAG_SET
  186. EventFlagAddress hl, EVENT_PASSED_CASCADEBADGE_CHECK
  187. predef FlagActionPredef
  188. ld a, $2
  189. ld [wRoute23CurScript], a
  190. ret
  191. Route23Script_51388:
  192. ld hl, VictoryRoadGuardText2
  193. jp PrintText
  194. VictoryRoadGuardText1:
  195. TX_FAR _VictoryRoadGuardText1
  196. TX_ASM
  197. ld a, SFX_DENIED
  198. call PlaySoundWaitForCurrent
  199. call WaitForSoundToFinish
  200. jp TextScriptEnd
  201. VictoryRoadGuardText2:
  202. TX_FAR _VictoryRoadGuardText2
  203. TX_SFX_ITEM_1
  204. TX_FAR _VictoryRoadGuardText_513a3
  205. db "@"
  206. Route23Text8:
  207. TX_FAR _Route23Text8
  208. db "@"