End space effect (#22)

This commit is contained in:
xCrystal
2023-10-21 18:00:59 +02:00
parent b0e2e7aef3
commit 961d2f0b6e
7 changed files with 70 additions and 7 deletions

View File

@@ -56,7 +56,7 @@ BoardMenuScript::
.exit:
wait 300
exitoverworld $00
exitoverworld ABANDONED_LEVEL
.ConfirmExitText:
text "Abandon level and"

View File

@@ -43,8 +43,25 @@ MinigameSpaceScript::
end
EndSpaceScript::
; fading out will kick before reaching HandleMapBackground, so update sprites after any change
scall ArriveToRegularSpaceScript
wait 400
playmusic MUSIC_TRAINER_VICTORY
wait 600
callasm .FadeOutSlow ; 800 ms
wait 400
exitoverworld CLEARED_LEVEL
end
.FadeOutSlow:
; clear spaces left sprites
ld hl, wDisplaySecondarySprites
res SECONDARYSPRITES_SPACES_LEFT_F, [hl]
farcall _UpdateSprites
; fade out slow to white
ld b, RGBFADE_TO_WHITE_8BGP_8OBP
jp DoRGBFadeEffect
GreySpaceScript::
scall ArriveToRegularSpaceScript
iftrue .not_landed
@@ -69,9 +86,15 @@ ArriveToRegularSpace:
ld [hScriptVar], a
; if landed, clear spaces left sprites
and a
ret nz
jr nz, .not_landed
ld hl, wDisplaySecondarySprites
res SECONDARYSPRITES_SPACES_LEFT_F, [hl]
.not_landed
; if End Space, update sprites
ld a, [wPlayerTile]
cp COLL_END_SPACE
ret nz
farcall _UpdateSprites
ret
LandedInRegularSpaceScript: