vermiliondock.asm 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. VermilionDockScript:
  2. call EnableAutoTextBoxDrawing
  3. CheckEventHL EVENT_STARTED_WALKING_OUT_OF_DOCK
  4. jr nz, .asm_1db8d
  5. CheckEventReuseHL EVENT_GOT_HM01
  6. ret z
  7. ld a, [wDestinationWarpID]
  8. cp $1
  9. ret nz
  10. CheckEventReuseHL EVENT_SS_ANNE_LEFT
  11. jp z, VermilionDock_1db9b
  12. SetEventReuseHL EVENT_STARTED_WALKING_OUT_OF_DOCK
  13. call Delay3
  14. ld hl, wd730
  15. set 7, [hl]
  16. ld hl, wSimulatedJoypadStatesEnd
  17. ld a, D_UP
  18. ld [hli], a
  19. ld [hli], a
  20. ld [hl], a
  21. ld a, $3
  22. ld [wSimulatedJoypadStatesIndex], a
  23. xor a
  24. ld [wSpriteStateData2 + $06], a
  25. ld [wOverrideSimulatedJoypadStatesMask], a
  26. dec a
  27. ld [wJoyIgnore], a
  28. ret
  29. .asm_1db8d
  30. CheckEventAfterBranchReuseHL EVENT_WALKED_OUT_OF_DOCK, EVENT_STARTED_WALKING_OUT_OF_DOCK
  31. ret nz
  32. ld a, [wSimulatedJoypadStatesIndex]
  33. and a
  34. ret nz
  35. ld [wJoyIgnore], a
  36. SetEventReuseHL EVENT_WALKED_OUT_OF_DOCK
  37. ret
  38. VermilionDock_1db9b:
  39. SetEventForceReuseHL EVENT_SS_ANNE_LEFT
  40. ld a, $ff
  41. ld [wJoyIgnore], a
  42. ld [wNewSoundID], a
  43. call PlaySound
  44. ld c, BANK(Music_Surfing)
  45. ld a, MUSIC_SURFING
  46. call PlayMusic
  47. callba LoadSmokeTileFourTimes
  48. xor a
  49. ld [wSpriteStateData1 + 2], a
  50. ld c, 120
  51. call DelayFrames
  52. ld b, $9c
  53. call CopyScreenTileBufferToVRAM
  54. coord hl, 0, 10
  55. ld bc, SCREEN_WIDTH * 6
  56. ld a, $14 ; water tile
  57. call FillMemory
  58. ld a, 1
  59. ld [H_AUTOBGTRANSFERENABLED], a
  60. call Delay3
  61. xor a
  62. ld [H_AUTOBGTRANSFERENABLED], a
  63. ld [wSSAnneSmokeDriftAmount], a
  64. ld [rOBP1], a
  65. ld a, 88
  66. ld [wSSAnneSmokeX], a
  67. ld hl, wMapViewVRAMPointer
  68. ld c, [hl]
  69. inc hl
  70. ld b, [hl]
  71. push bc
  72. push hl
  73. ld a, SFX_SS_ANNE_HORN
  74. call PlaySoundWaitForCurrent
  75. ld a, $ff
  76. ld [wUpdateSpritesEnabled], a
  77. ld d, $0
  78. ld e, $8
  79. .asm_1dbfa
  80. ld hl, $0002
  81. add hl, bc
  82. ld a, l
  83. ld [wMapViewVRAMPointer], a
  84. ld a, h
  85. ld [wMapViewVRAMPointer + 1], a
  86. push hl
  87. push de
  88. call ScheduleEastColumnRedraw
  89. call VermilionDock_EmitSmokePuff
  90. pop de
  91. ld b, $10
  92. .asm_1dc11
  93. call VermilionDock_AnimSmokePuffDriftRight
  94. ld c, $8
  95. .asm_1dc16
  96. call VermilionDock_1dc7c
  97. dec c
  98. jr nz, .asm_1dc16
  99. inc d
  100. dec b
  101. jr nz, .asm_1dc11
  102. pop bc
  103. dec e
  104. jr nz, .asm_1dbfa
  105. xor a
  106. ld [rWY], a
  107. ld [hWY], a
  108. call VermilionDock_EraseSSAnne
  109. ld a, $90
  110. ld [hWY], a
  111. ld a, $1
  112. ld [wUpdateSpritesEnabled], a
  113. pop hl
  114. pop bc
  115. ld [hl], b
  116. dec hl
  117. ld [hl], c
  118. call LoadPlayerSpriteGraphics
  119. ld hl, wNumberOfWarps
  120. dec [hl]
  121. ret
  122. VermilionDock_AnimSmokePuffDriftRight:
  123. push bc
  124. push de
  125. ld hl, wOAMBuffer + $11
  126. ld a, [wSSAnneSmokeDriftAmount]
  127. swap a
  128. ld c, a
  129. ld de, 4
  130. .loop
  131. inc [hl]
  132. inc [hl]
  133. add hl, de
  134. dec c
  135. jr nz, .loop
  136. pop de
  137. pop bc
  138. ret
  139. VermilionDock_EmitSmokePuff:
  140. ; new smoke puff above the S.S. Anne's front smokestack
  141. ld a, [wSSAnneSmokeX]
  142. sub 16
  143. ld [wSSAnneSmokeX], a
  144. ld c, a
  145. ld b, 100 ; Y
  146. ld a, [wSSAnneSmokeDriftAmount]
  147. inc a
  148. ld [wSSAnneSmokeDriftAmount], a
  149. ld a, $1
  150. ld de, VermilionDockOAMBlock
  151. call WriteOAMBlock
  152. ret
  153. VermilionDockOAMBlock:
  154. db $fc, $10
  155. db $fd, $10
  156. db $fe, $10
  157. db $ff, $10
  158. VermilionDock_1dc7c:
  159. ld h, d
  160. ld l, $50
  161. call .asm_1dc86
  162. ld h, $0
  163. ld l, $80
  164. .asm_1dc86
  165. ld a, [rLY]
  166. cp l
  167. jr nz, .asm_1dc86
  168. ld a, h
  169. ld [rSCX], a
  170. .asm_1dc8e
  171. ld a, [rLY]
  172. cp h
  173. jr z, .asm_1dc8e
  174. ret
  175. VermilionDock_EraseSSAnne:
  176. ; Fill the area the S.S. Anne occupies in BG map 0 with water tiles.
  177. ld hl, wVermilionDockTileMapBuffer
  178. ld bc, (5 * BG_MAP_WIDTH) + SCREEN_WIDTH
  179. ld a, $14 ; water tile
  180. call FillMemory
  181. ld hl, vBGMap0 + 10 * BG_MAP_WIDTH
  182. ld de, wVermilionDockTileMapBuffer
  183. ld bc, (6 * BG_MAP_WIDTH) / 16
  184. call CopyVideoData
  185. ; Replace the blocks of the lower half of the ship with water blocks. This
  186. ; leaves the upper half alone, but that doesn't matter because replacing any of
  187. ; the blocks is unnecessary because the blocks the ship occupies are south of
  188. ; the player and won't be redrawn when the player automatically walks north and
  189. ; exits the map. This code could be removed without affecting anything.
  190. overworldMapCoord hl, 5, 2, VERMILION_DOCK_WIDTH
  191. ld a, $d ; water block
  192. ld [hli], a
  193. ld [hli], a
  194. ld [hli], a
  195. ld [hl], a
  196. ld a, SFX_SS_ANNE_HORN
  197. call PlaySound
  198. ld c, 120
  199. call DelayFrames
  200. ret
  201. VermilionDockTextPointers:
  202. dw VermilionDockText1
  203. VermilionDockText1:
  204. TX_FAR _VermilionDockText1
  205. db "@"