Implement Waterfall technique (#34)

This commit is contained in:
xCrystal
2023-12-31 13:39:00 +01:00
parent aa91909388
commit a40f7cdde7
11 changed files with 71 additions and 27 deletions

View File

@@ -667,7 +667,7 @@ WaterfallFunction:
ld a, $80
ret
CheckMapCanWaterfall:
CheckMapCanWaterfall::
ld a, [wPlayerDirection]
and $c
cp FACE_UP
@@ -682,6 +682,19 @@ CheckMapCanWaterfall:
scf
ret
Script_WaterfallAuto::
.loop
playsound SFX_SURF
applymovement PLAYER, .SlowStepUp
callasm CheckContinueWaterfall
iffalse .loop
callasm SFXChannelsOff ; end SFX_SURF if still playing
end
.SlowStepUp:
slow_step UP
step_end
Script_WaterfallFromMenu:
reloadmappart
special UpdateTimePals
@@ -693,12 +706,16 @@ Script_UsedWaterfall:
closetext
playsound SFX_BUBBLEBEAM
.loop
applymovement PLAYER, .WaterfallStep
callasm .CheckContinueWaterfall
applymovement PLAYER, WaterfallStep
callasm CheckContinueWaterfall
iffalse .loop
end
.CheckContinueWaterfall:
.UseWaterfallText:
text_far _UseWaterfallText
text_end
CheckContinueWaterfall:
xor a
ldh [hScriptVar], a
ld a, [wPlayerTile]
@@ -708,14 +725,10 @@ Script_UsedWaterfall:
ldh [hScriptVar], a
ret
.WaterfallStep:
WaterfallStep:
turn_waterfall UP
step_end
.UseWaterfallText:
text_far _UseWaterfallText
text_end
TryWaterfallOW::
ld d, WATERFALL
call CheckPartyMove

View File

@@ -769,6 +769,22 @@ CheckFacingTileEvent:
ret ; c
.next_event_1
;; Waterfall
ld a, [wFacingTileID]
call CheckWaterfallTile
jr nz, .next_event_2
; Must be facing up and facing a waterfall tile to trigger the waterfall up sequence.
; Otherwise HI_NYBBLE_CURRENT collision (forced walking in walking direction) applies.
farcall CheckMapCanWaterfall
jr c, .next_event_2
ld a, BANK(Script_WaterfallAuto)
ld hl, Script_WaterfallAuto
call CallScript
ret ; c
.next_event_2
.no_event
xor a
ret ; nc

View File

@@ -340,7 +340,7 @@ DoPlayerMovement::
add hl, bc
ld a, [hl]
ld [wWalkingDirection], a
jr .continue_walk
jr .continue_fast_slide
.water_table
db RIGHT ; COLL_WATERFALL_RIGHT
@@ -414,8 +414,15 @@ DoPlayerMovement::
xor a
ret
.continue_fast_slide
ld a, STEP_ICE
jr .continue_step
.continue_walk
ld a, STEP_WALK
; fallthrough
.continue_step
call .DoStep
ld a, PLAYERMOVEMENT_CONTINUE
scf