seafoamislands4.asm 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. SeafoamIslands4Script:
  2. call EnableAutoTextBoxDrawing
  3. ld hl, wFlags_0xcd60
  4. bit 7, [hl]
  5. res 7, [hl]
  6. jr z, .asm_465dc
  7. ld hl, Seafoam4HolesCoords
  8. call CheckBoulderCoords
  9. ret nc
  10. EventFlagAddress hl, EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE
  11. ld a, [wCoordIndex]
  12. cp $1
  13. jr nz, .asm_465b8
  14. SetEventReuseHL EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE
  15. ld a, HS_SEAFOAM_ISLANDS_4_BOULDER_1
  16. ld [wObjectToHide], a
  17. ld a, HS_SEAFOAM_ISLANDS_5_BOULDER_1
  18. ld [wObjectToShow], a
  19. jr .asm_465c4
  20. .asm_465b8
  21. SetEventAfterBranchReuseHL EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE
  22. ld a, HS_SEAFOAM_ISLANDS_4_BOULDER_2
  23. ld [wObjectToHide], a
  24. ld a, HS_SEAFOAM_ISLANDS_5_BOULDER_2
  25. ld [wObjectToShow], a
  26. .asm_465c4
  27. ld a, [wObjectToHide]
  28. ld [wMissableObjectIndex], a
  29. predef HideObject
  30. ld a, [wObjectToShow]
  31. ld [wMissableObjectIndex], a
  32. predef ShowObject
  33. jr .asm_465ed
  34. .asm_465dc
  35. ld a, $a2
  36. ld [wDungeonWarpDestinationMap], a
  37. ld hl, Seafoam4HolesCoords
  38. call IsPlayerOnDungeonWarp
  39. ld a, [wd732]
  40. bit 4, a
  41. ret nz
  42. .asm_465ed
  43. ld hl, SeafoamIslands4ScriptPointers
  44. ld a, [wSeafoamIslands4CurScript]
  45. jp CallFunctionInTable
  46. Seafoam4HolesCoords:
  47. db $10,$03
  48. db $10,$06
  49. db $ff
  50. SeafoamIslands4ScriptPointers:
  51. dw SeafoamIslands4Script0
  52. dw SeafoamIslands4Script1
  53. dw SeafoamIslands4Script2
  54. dw SeafoamIslands4Script3
  55. SeafoamIslands4Script0:
  56. CheckBothEventsSet EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE
  57. ret z
  58. ld a, [wYCoord]
  59. cp $8
  60. ret nz
  61. ld a, [wXCoord]
  62. cp $f
  63. ret nz
  64. ld hl, wSimulatedJoypadStatesEnd
  65. ld de, RLEMovement46632
  66. call DecodeRLEList
  67. dec a
  68. ld [wSimulatedJoypadStatesIndex], a
  69. call StartSimulatingJoypadStates
  70. ld hl, wFlags_D733
  71. set 2, [hl]
  72. ld a, $1
  73. ld [wSeafoamIslands4CurScript], a
  74. ret
  75. RLEMovement46632:
  76. db D_DOWN,6
  77. db D_RIGHT,5
  78. db D_DOWN,3
  79. db $ff
  80. SeafoamIslands4Script1:
  81. ld a, [wSimulatedJoypadStatesIndex]
  82. and a
  83. ret nz
  84. ld a, $0
  85. ld [wSeafoamIslands4CurScript], a
  86. ret
  87. SeafoamIslands4Script2:
  88. CheckBothEventsSet EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE
  89. ret z
  90. ld a, [wXCoord]
  91. cp $12
  92. jr z, .asm_4665e
  93. cp $13
  94. ld a, $0
  95. jr nz, .asm_4667b
  96. ld de, RLEData_4667f
  97. jr .asm_46661
  98. .asm_4665e
  99. ld de, RLEData_46688
  100. .asm_46661
  101. ld hl, wSimulatedJoypadStatesEnd
  102. call DecodeRLEList
  103. dec a
  104. ld [wSimulatedJoypadStatesIndex], a
  105. xor a
  106. ld [wSpriteStateData2 + $06], a
  107. ld hl, wd730
  108. set 7, [hl]
  109. ld hl, wFlags_D733
  110. set 2, [hl]
  111. ld a, $3
  112. .asm_4667b
  113. ld [wSeafoamIslands4CurScript], a
  114. ret
  115. RLEData_4667f:
  116. db D_DOWN,$06
  117. db D_RIGHT,$02
  118. db D_DOWN,$04
  119. db D_LEFT,$01
  120. db $FF
  121. RLEData_46688:
  122. db D_DOWN,$06
  123. db D_RIGHT,$02
  124. db D_DOWN,$04
  125. db $FF
  126. SeafoamIslands4Script3:
  127. ld a, [wSimulatedJoypadStatesIndex]
  128. and a
  129. ret nz
  130. ld a, $0
  131. ld [wSeafoamIslands4CurScript], a
  132. ret
  133. SeafoamIslands4TextPointers:
  134. dw BoulderText
  135. dw BoulderText
  136. dw BoulderText
  137. dw BoulderText
  138. dw BoulderText
  139. dw BoulderText