2019-01-01 20:06:23 +00:00
|
|
|
VermilionDock_Script:
|
2014-05-18 18:19:10 +00:00
|
|
|
call EnableAutoTextBoxDrawing
|
2015-07-21 17:36:03 +00:00
|
|
|
CheckEventHL EVENT_STARTED_WALKING_OUT_OF_DOCK
|
2023-07-14 01:27:56 +00:00
|
|
|
jr nz, .walking_out_of_dock
|
2015-07-21 17:36:03 +00:00
|
|
|
CheckEventReuseHL EVENT_GOT_HM01
|
2014-05-18 18:19:10 +00:00
|
|
|
ret z
|
2014-09-13 07:50:56 +00:00
|
|
|
ld a, [wDestinationWarpID]
|
2014-05-18 18:19:10 +00:00
|
|
|
cp $1
|
|
|
|
ret nz
|
2015-07-21 01:32:02 +00:00
|
|
|
CheckEventReuseHL EVENT_SS_ANNE_LEFT
|
2023-07-14 01:27:56 +00:00
|
|
|
jp z, VermilionDockSSAnneLeavesScript
|
2015-07-21 17:36:03 +00:00
|
|
|
SetEventReuseHL EVENT_STARTED_WALKING_OUT_OF_DOCK
|
2014-05-18 18:19:10 +00:00
|
|
|
call Delay3
|
2024-07-16 17:02:54 +00:00
|
|
|
ld hl, wStatusFlags5
|
|
|
|
set BIT_SCRIPTED_MOVEMENT_STATE, [hl]
|
2014-09-10 03:55:19 +00:00
|
|
|
ld hl, wSimulatedJoypadStatesEnd
|
2015-07-21 17:36:03 +00:00
|
|
|
ld a, D_UP
|
2014-05-18 18:19:10 +00:00
|
|
|
ld [hli], a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
ld a, $3
|
2014-09-10 03:55:19 +00:00
|
|
|
ld [wSimulatedJoypadStatesIndex], a
|
2014-05-18 18:19:10 +00:00
|
|
|
xor a
|
2020-07-05 21:29:11 +00:00
|
|
|
ld [wSpritePlayerStateData2MovementByte1], a
|
2014-09-10 03:55:19 +00:00
|
|
|
ld [wOverrideSimulatedJoypadStatesMask], a
|
2014-05-18 18:19:10 +00:00
|
|
|
dec a
|
2014-05-25 17:51:53 +00:00
|
|
|
ld [wJoyIgnore], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
2023-07-14 01:27:56 +00:00
|
|
|
.walking_out_of_dock
|
2015-07-21 17:36:03 +00:00
|
|
|
CheckEventAfterBranchReuseHL EVENT_WALKED_OUT_OF_DOCK, EVENT_STARTED_WALKING_OUT_OF_DOCK
|
2014-05-18 18:19:10 +00:00
|
|
|
ret nz
|
2014-09-10 03:55:19 +00:00
|
|
|
ld a, [wSimulatedJoypadStatesIndex]
|
2014-05-18 18:19:10 +00:00
|
|
|
and a
|
|
|
|
ret nz
|
2014-05-25 17:51:53 +00:00
|
|
|
ld [wJoyIgnore], a
|
2015-07-21 17:36:03 +00:00
|
|
|
SetEventReuseHL EVENT_WALKED_OUT_OF_DOCK
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
VermilionDockSSAnneLeavesScript:
|
2015-07-21 01:32:02 +00:00
|
|
|
SetEventForceReuseHL EVENT_SS_ANNE_LEFT
|
2020-07-03 20:37:47 +00:00
|
|
|
ld a, SFX_STOP_ALL_MUSIC
|
2014-05-25 17:51:53 +00:00
|
|
|
ld [wJoyIgnore], a
|
2015-08-09 05:32:44 +00:00
|
|
|
ld [wNewSoundID], a
|
2014-05-18 18:19:10 +00:00
|
|
|
call PlaySound
|
|
|
|
ld c, BANK(Music_Surfing)
|
|
|
|
ld a, MUSIC_SURFING
|
|
|
|
call PlayMusic
|
2020-07-07 01:18:22 +00:00
|
|
|
farcall LoadSmokeTileFourTimes
|
2014-05-18 18:19:10 +00:00
|
|
|
xor a
|
2020-07-05 21:29:11 +00:00
|
|
|
ld [wSpritePlayerStateData1ImageIndex], a
|
2015-07-03 19:38:12 +00:00
|
|
|
ld c, 120
|
2014-05-18 18:19:10 +00:00
|
|
|
call DelayFrames
|
|
|
|
ld b, $9c
|
|
|
|
call CopyScreenTileBufferToVRAM
|
2020-07-07 15:30:10 +00:00
|
|
|
hlcoord 0, 10
|
2015-08-10 04:56:20 +00:00
|
|
|
ld bc, SCREEN_WIDTH * 6
|
|
|
|
ld a, $14 ; water tile
|
2014-05-18 18:19:10 +00:00
|
|
|
call FillMemory
|
2015-07-19 03:49:52 +00:00
|
|
|
ld a, 1
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [hAutoBGTransferEnabled], a
|
2014-05-18 18:19:10 +00:00
|
|
|
call Delay3
|
|
|
|
xor a
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [hAutoBGTransferEnabled], a
|
2015-07-19 03:49:52 +00:00
|
|
|
ld [wSSAnneSmokeDriftAmount], a
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [rOBP1], a
|
2015-07-19 03:49:52 +00:00
|
|
|
ld a, 88
|
|
|
|
ld [wSSAnneSmokeX], a
|
2014-09-14 18:29:18 +00:00
|
|
|
ld hl, wMapViewVRAMPointer
|
2014-05-18 18:19:10 +00:00
|
|
|
ld c, [hl]
|
|
|
|
inc hl
|
|
|
|
ld b, [hl]
|
|
|
|
push bc
|
|
|
|
push hl
|
2015-07-19 08:46:12 +00:00
|
|
|
ld a, SFX_SS_ANNE_HORN
|
2014-05-18 18:19:10 +00:00
|
|
|
call PlaySoundWaitForCurrent
|
|
|
|
ld a, $ff
|
2014-09-13 07:50:56 +00:00
|
|
|
ld [wUpdateSpritesEnabled], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ld d, $0
|
|
|
|
ld e, $8
|
2023-07-14 01:27:56 +00:00
|
|
|
.shift_columns_up
|
2020-07-04 05:00:45 +00:00
|
|
|
ld hl, $2
|
2014-05-18 18:19:10 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, l
|
2014-09-14 18:29:18 +00:00
|
|
|
ld [wMapViewVRAMPointer], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, h
|
2014-09-14 18:29:18 +00:00
|
|
|
ld [wMapViewVRAMPointer + 1], a
|
2014-05-18 18:19:10 +00:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
call ScheduleEastColumnRedraw
|
2015-07-19 03:49:52 +00:00
|
|
|
call VermilionDock_EmitSmokePuff
|
2014-05-18 18:19:10 +00:00
|
|
|
pop de
|
|
|
|
ld b, $10
|
2023-07-14 01:27:56 +00:00
|
|
|
.smoke_puff_drift_loop
|
2015-07-19 03:49:52 +00:00
|
|
|
call VermilionDock_AnimSmokePuffDriftRight
|
2014-05-18 18:19:10 +00:00
|
|
|
ld c, $8
|
2023-07-14 01:27:56 +00:00
|
|
|
.delay_between_drifts
|
|
|
|
call VermilionDock_SyncScrollWithLY
|
2014-05-18 18:19:10 +00:00
|
|
|
dec c
|
2023-07-14 01:27:56 +00:00
|
|
|
jr nz, .delay_between_drifts
|
2014-05-18 18:19:10 +00:00
|
|
|
inc d
|
|
|
|
dec b
|
2023-07-14 01:27:56 +00:00
|
|
|
jr nz, .smoke_puff_drift_loop
|
2014-05-18 18:19:10 +00:00
|
|
|
pop bc
|
|
|
|
dec e
|
2023-07-14 01:27:56 +00:00
|
|
|
jr nz, .shift_columns_up
|
2014-05-18 18:19:10 +00:00
|
|
|
xor a
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [rWY], a
|
|
|
|
ldh [hWY], a
|
2015-08-13 05:14:31 +00:00
|
|
|
call VermilionDock_EraseSSAnne
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, $90
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [hWY], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, $1
|
2014-09-13 07:50:56 +00:00
|
|
|
ld [wUpdateSpritesEnabled], a
|
2014-05-18 18:19:10 +00:00
|
|
|
pop hl
|
|
|
|
pop bc
|
|
|
|
ld [hl], b
|
|
|
|
dec hl
|
|
|
|
ld [hl], c
|
|
|
|
call LoadPlayerSpriteGraphics
|
2014-09-13 07:50:56 +00:00
|
|
|
ld hl, wNumberOfWarps
|
2014-05-18 18:19:10 +00:00
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
VermilionDock_AnimSmokePuffDriftRight:
|
2014-05-18 18:19:10 +00:00
|
|
|
push bc
|
|
|
|
push de
|
2022-07-09 21:18:18 +00:00
|
|
|
ld hl, wShadowOAMSprite04XCoord
|
2015-07-19 03:49:52 +00:00
|
|
|
ld a, [wSSAnneSmokeDriftAmount]
|
2014-05-18 18:19:10 +00:00
|
|
|
swap a
|
|
|
|
ld c, a
|
2015-07-19 03:49:52 +00:00
|
|
|
ld de, 4
|
2023-07-14 01:27:56 +00:00
|
|
|
.drift_loop
|
2014-05-18 18:19:10 +00:00
|
|
|
inc [hl]
|
|
|
|
inc [hl]
|
|
|
|
add hl, de
|
|
|
|
dec c
|
2023-07-14 01:27:56 +00:00
|
|
|
jr nz, .drift_loop
|
2014-05-18 18:19:10 +00:00
|
|
|
pop de
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
VermilionDock_EmitSmokePuff:
|
2015-07-19 03:49:52 +00:00
|
|
|
; new smoke puff above the S.S. Anne's front smokestack
|
|
|
|
ld a, [wSSAnneSmokeX]
|
|
|
|
sub 16
|
|
|
|
ld [wSSAnneSmokeX], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ld c, a
|
2015-07-19 03:49:52 +00:00
|
|
|
ld b, 100 ; Y
|
|
|
|
ld a, [wSSAnneSmokeDriftAmount]
|
2014-05-18 18:19:10 +00:00
|
|
|
inc a
|
2015-07-19 03:49:52 +00:00
|
|
|
ld [wSSAnneSmokeDriftAmount], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, $1
|
|
|
|
ld de, VermilionDockOAMBlock
|
|
|
|
call WriteOAMBlock
|
|
|
|
ret
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
VermilionDockOAMBlock:
|
2024-09-29 22:54:41 +00:00
|
|
|
; tile ID, attributes
|
2014-05-18 18:19:10 +00:00
|
|
|
db $fc, $10
|
|
|
|
db $fd, $10
|
|
|
|
db $fe, $10
|
|
|
|
db $ff, $10
|
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
VermilionDock_SyncScrollWithLY:
|
2014-05-18 18:19:10 +00:00
|
|
|
ld h, d
|
|
|
|
ld l, $50
|
2023-07-14 01:27:56 +00:00
|
|
|
call .sync_scroll_ly
|
2014-05-18 18:19:10 +00:00
|
|
|
ld h, $0
|
|
|
|
ld l, $80
|
2023-07-14 01:27:56 +00:00
|
|
|
.sync_scroll_ly
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh a, [rLY]
|
2014-05-18 18:19:10 +00:00
|
|
|
cp l
|
2023-07-14 01:27:56 +00:00
|
|
|
jr nz, .sync_scroll_ly
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, h
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [rSCX], a
|
2023-07-14 01:27:56 +00:00
|
|
|
.wait_for_ly_match
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh a, [rLY]
|
2014-05-18 18:19:10 +00:00
|
|
|
cp h
|
2023-07-14 01:27:56 +00:00
|
|
|
jr z, .wait_for_ly_match
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
VermilionDock_EraseSSAnne:
|
2015-08-13 05:14:31 +00:00
|
|
|
; Fill the area the S.S. Anne occupies in BG map 0 with water tiles.
|
|
|
|
ld hl, wVermilionDockTileMapBuffer
|
2021-05-31 20:25:16 +00:00
|
|
|
ld bc, wVermilionDockTileMapBufferEnd - wVermilionDockTileMapBuffer
|
2015-08-13 05:14:31 +00:00
|
|
|
ld a, $14 ; water tile
|
2014-05-18 18:19:10 +00:00
|
|
|
call FillMemory
|
2020-07-07 15:30:10 +00:00
|
|
|
hlbgcoord 0, 10
|
2015-08-13 05:14:31 +00:00
|
|
|
ld de, wVermilionDockTileMapBuffer
|
2021-05-31 20:25:16 +00:00
|
|
|
lb bc, BANK(wVermilionDockTileMapBuffer), 12
|
2014-05-18 18:19:10 +00:00
|
|
|
call CopyVideoData
|
2015-08-13 05:14:31 +00:00
|
|
|
|
|
|
|
; Replace the blocks of the lower half of the ship with water blocks. This
|
|
|
|
; leaves the upper half alone, but that doesn't matter because replacing any of
|
|
|
|
; the blocks is unnecessary because the blocks the ship occupies are south of
|
|
|
|
; the player and won't be redrawn when the player automatically walks north and
|
|
|
|
; exits the map. This code could be removed without affecting anything.
|
2020-07-07 15:30:10 +00:00
|
|
|
hlowcoord 5, 2, VERMILION_DOCK_WIDTH
|
2015-08-13 05:14:31 +00:00
|
|
|
ld a, $d ; water block
|
2014-05-18 18:19:10 +00:00
|
|
|
ld [hli], a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
2015-08-13 05:14:31 +00:00
|
|
|
|
2015-07-19 08:46:12 +00:00
|
|
|
ld a, SFX_SS_ANNE_HORN
|
2014-05-18 18:19:10 +00:00
|
|
|
call PlaySound
|
2015-07-03 19:38:12 +00:00
|
|
|
ld c, 120
|
2014-05-18 18:19:10 +00:00
|
|
|
call DelayFrames
|
|
|
|
ret
|
|
|
|
|
2019-01-01 20:06:23 +00:00
|
|
|
VermilionDock_TextPointers:
|
2023-07-14 01:27:56 +00:00
|
|
|
def_text_pointers
|
|
|
|
dw_const VermilionDockUnusedText, TEXT_VERMILIONDOCK_UNUSED
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
VermilionDockUnusedText:
|
|
|
|
text_far _VermilionDockUnusedText
|
2020-07-04 21:09:35 +00:00
|
|
|
text_end
|