seafoamislands5.asm 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. SeafoamIslands5Script:
  2. call EnableAutoTextBoxDrawing
  3. ld a, [wSeafoamIslands5CurScript]
  4. ld hl, SeafoamIslands5ScriptPointers
  5. jp CallFunctionInTable
  6. SeafoamIslands5Script_467a5:
  7. xor a
  8. ld [wSeafoamIslands5CurScript], a
  9. ld [wJoyIgnore], a
  10. ret
  11. SeafoamIslands5ScriptPointers:
  12. dw SeafoamIslands5Script0
  13. dw SeafoamIslands5Script1
  14. dw SeafoamIslands5Script2
  15. dw SeafoamIslands5Script3
  16. dw SeafoamIslands5Script4
  17. SeafoamIslands5Script4:
  18. ld a, [wIsInBattle]
  19. cp $ff
  20. jr z, SeafoamIslands5Script_467a5
  21. call EndTrainerBattle
  22. ld a, $0
  23. ld [wSeafoamIslands5CurScript], a
  24. ret
  25. SeafoamIslands5Script0:
  26. CheckBothEventsSet EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE
  27. ret z
  28. ld hl, .Coords
  29. call ArePlayerCoordsInArray
  30. ret nc
  31. ld a, [wCoordIndex]
  32. cp $3
  33. jr nc, .asm_467e6
  34. ld a, NPC_MOVEMENT_UP
  35. ld [wSimulatedJoypadStatesEnd + 1], a
  36. ld a, 2
  37. jr .asm_467e8
  38. .asm_467e6
  39. ld a, 1
  40. .asm_467e8
  41. ld [wSimulatedJoypadStatesIndex], a
  42. ld a, D_UP
  43. ld [wSimulatedJoypadStatesEnd], a
  44. call StartSimulatingJoypadStates
  45. ld hl, wFlags_D733
  46. res 2, [hl]
  47. ld a, $1
  48. ld [wSeafoamIslands5CurScript], a
  49. ret
  50. .Coords
  51. db $11,$14
  52. db $11,$15
  53. db $10,$14
  54. db $10,$15
  55. db $FF
  56. SeafoamIslands5Script1:
  57. ld a, [wSimulatedJoypadStatesIndex]
  58. and a
  59. ret nz
  60. xor a
  61. ld [wJoyIgnore], a
  62. ld a, $0
  63. ld [wSeafoamIslands5CurScript], a
  64. ret
  65. SeafoamIslands5Script2:
  66. CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE
  67. ld a, $0
  68. jr z, .asm_46849
  69. ld hl, .Coords
  70. call ArePlayerCoordsInArray
  71. ld a, $0
  72. jr nc, .asm_46849
  73. ld a, [wCoordIndex]
  74. cp $1
  75. jr nz, .asm_46837
  76. ld de, RLEMovementData_46859
  77. jr .asm_4683a
  78. .asm_46837
  79. ld de, RLEMovementData_46852
  80. .asm_4683a
  81. ld hl, wSimulatedJoypadStatesEnd
  82. call DecodeRLEList
  83. dec a
  84. ld [wSimulatedJoypadStatesIndex], a
  85. call StartSimulatingJoypadStates
  86. ld a, $3
  87. .asm_46849
  88. ld [wSeafoamIslands5CurScript], a
  89. ret
  90. .Coords
  91. db $0E,$04
  92. db $0E,$05
  93. db $FF
  94. RLEMovementData_46852:
  95. db D_UP,$03
  96. db D_RIGHT,$02
  97. db D_UP,$01
  98. db $FF
  99. RLEMovementData_46859:
  100. db D_UP,$03
  101. db D_RIGHT,$03
  102. db D_UP,$01
  103. db $FF
  104. SeafoamIslands5Script3:
  105. ld a, [wSimulatedJoypadStatesIndex]
  106. ld b, a
  107. cp $1
  108. call z, SeaFoamIslands5Script_46872
  109. ld a, b
  110. and a
  111. ret nz
  112. ld a, $0
  113. ld [wSeafoamIslands5CurScript], a
  114. ret
  115. SeaFoamIslands5Script_46872:
  116. xor a
  117. ld [wWalkBikeSurfState], a
  118. ld [wWalkBikeSurfStateCopy], a
  119. jp ForceBikeOrSurf
  120. SeafoamIslands5TextPointers:
  121. dw BoulderText
  122. dw BoulderText
  123. dw ArticunoText
  124. dw SeafoamIslands5Text4
  125. dw SeafoamIslands5Text5
  126. ArticunoTrainerHeader:
  127. dbEventFlagBit EVENT_BEAT_ARTICUNO
  128. db ($0 << 4) ; trainer's view range
  129. dwEventFlagAddress EVENT_BEAT_ARTICUNO
  130. dw ArticunoBattleText ; TextBeforeBattle
  131. dw ArticunoBattleText ; TextAfterBattle
  132. dw ArticunoBattleText ; TextEndBattle
  133. dw ArticunoBattleText ; TextEndBattle
  134. db $ff
  135. ArticunoText:
  136. TX_ASM
  137. ld hl, ArticunoTrainerHeader
  138. call TalkToTrainer
  139. ld a, $4
  140. ld [wSeafoamIslands5CurScript], a
  141. jp TextScriptEnd
  142. ArticunoBattleText:
  143. TX_FAR _ArticunoBattleText
  144. TX_ASM
  145. ld a, ARTICUNO
  146. call PlayCry
  147. call WaitForSoundToFinish
  148. jp TextScriptEnd
  149. SeafoamIslands5Text4:
  150. TX_FAR _SeafoamIslands5Text4
  151. db "@"
  152. SeafoamIslands5Text5:
  153. TX_FAR _SeafoamIslands5Text5
  154. db "@"