pokered-rematch/scripts/vermiliondock.asm

216 lines
4.0 KiB
NASM
Raw Normal View History

2016-06-12 00:24:04 +00:00
VermilionDockScript:
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
jr nz, .asm_1db8d
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
2014-05-18 18:19:10 +00:00
jp z, VermilionDock_1db9b
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
ld hl, wd730
2014-05-18 18:19:10 +00:00
set 7, [hl]
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
ld [wSimulatedJoypadStatesIndex], a
2014-05-18 18:19:10 +00:00
xor a
ld [wSpriteStateData2 + $06], a
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
.asm_1db8d
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
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
2016-06-12 00:24:04 +00:00
VermilionDock_1db9b:
2015-07-21 01:32:02 +00:00
SetEventForceReuseHL EVENT_SS_ANNE_LEFT
2014-05-18 18:19:10 +00:00
ld a, $ff
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
callba LoadSmokeTileFourTimes
2014-05-18 18:19:10 +00:00
xor a
ld [wSpriteStateData1 + 2], a
ld c, 120
2014-05-18 18:19:10 +00:00
call DelayFrames
ld b, $9c
call CopyScreenTileBufferToVRAM
2015-07-18 20:52:03 +00:00
coord hl, 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
ld [H_AUTOBGTRANSFERENABLED], a
2014-05-18 18:19:10 +00:00
call Delay3
xor a
2015-07-19 03:49:52 +00:00
ld [H_AUTOBGTRANSFERENABLED], a
ld [wSSAnneSmokeDriftAmount], a
ld [rOBP1], a
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
.asm_1dbfa
ld hl, $0002
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
.asm_1dc11
2015-07-19 03:49:52 +00:00
call VermilionDock_AnimSmokePuffDriftRight
2014-05-18 18:19:10 +00:00
ld c, $8
.asm_1dc16
call VermilionDock_1dc7c
dec c
jr nz, .asm_1dc16
2014-05-18 18:19:10 +00:00
inc d
dec b
jr nz, .asm_1dc11
2014-05-18 18:19:10 +00:00
pop bc
dec e
jr nz, .asm_1dbfa
2014-05-18 18:19:10 +00:00
xor a
2015-07-19 03:49:52 +00:00
ld [rWY], a
2014-09-23 22:02:03 +00:00
ld [hWY], a
2015-08-13 05:14:31 +00:00
call VermilionDock_EraseSSAnne
2014-05-18 18:19:10 +00:00
ld a, $90
2014-09-23 22:02:03 +00:00
ld [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
ld hl, wOAMBuffer + $11
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
.loop
2014-05-18 18:19:10 +00:00
inc [hl]
inc [hl]
add hl, de
dec c
2015-07-19 03:49:52 +00:00
jr nz, .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:
2014-05-18 18:19:10 +00:00
db $fc, $10
db $fd, $10
db $fe, $10
db $ff, $10
2016-06-12 00:24:04 +00:00
VermilionDock_1dc7c:
2014-05-18 18:19:10 +00:00
ld h, d
ld l, $50
call .asm_1dc86
ld h, $0
ld l, $80
.asm_1dc86
2015-07-15 02:46:52 +00:00
ld a, [rLY]
2014-05-18 18:19:10 +00:00
cp l
jr nz, .asm_1dc86
2014-05-18 18:19:10 +00:00
ld a, h
2015-07-19 03:49:52 +00:00
ld [rSCX], a
2014-05-18 18:19:10 +00:00
.asm_1dc8e
2015-07-15 02:46:52 +00:00
ld a, [rLY]
2014-05-18 18:19:10 +00:00
cp h
jr z, .asm_1dc8e
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
ld bc, (5 * BG_MAP_WIDTH) + SCREEN_WIDTH
2015-08-13 05:14:31 +00:00
ld a, $14 ; water tile
2014-05-18 18:19:10 +00:00
call FillMemory
ld hl, vBGMap0 + 10 * BG_MAP_WIDTH
2015-08-13 05:14:31 +00:00
ld de, wVermilionDockTileMapBuffer
ld bc, (6 * BG_MAP_WIDTH) / 16
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.
overworldMapCoord hl, 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
ld c, 120
2014-05-18 18:19:10 +00:00
call DelayFrames
ret
2016-06-12 00:24:04 +00:00
VermilionDockTextPointers:
2014-05-18 18:19:10 +00:00
dw VermilionDockText1
2016-06-12 00:24:04 +00:00
VermilionDockText1:
2014-05-18 18:19:10 +00:00
TX_FAR _VermilionDockText1
db "@"