From ce0628c5ad96e094db12a67d4e98b445fa873ad3 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 14 Feb 2021 16:13:08 -0500 Subject: Added map fadeouts Screen fadeouts and map fadeouts are now handled by the effect system. --- res/scripts/common.lua | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'res/scripts/common.lua') diff --git a/res/scripts/common.lua b/res/scripts/common.lua index 75b86a8..2197417 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua @@ -41,6 +41,7 @@ function StartCutscene() local playerSprite = getSprite(playerId) playerSprite.controllable = false character():halt(playerId) + message():displayCutsceneBars() end function DisplayMessage(msg, name, type) @@ -107,21 +108,27 @@ function StopSound(soundId) end function FadeToBlack(length) - local progress = 0.0 - while progress < length do - progress = progress + coroutine.yield() - setFadeoutProgress(progress / length) - end - setFadeoutProgress(1.0) + effect():fadeScreen(length, 1.0) + repeat + coroutine.yield() + until effect():isScreenFadeComplete() end function RemoveFadeout(length) - local progress = length - while progress > 0 do - progress = progress - coroutine.yield() - setFadeoutProgress(progress / length) + effect():fadeScreen(length, 0.0) + repeat + coroutine.yield() + until effect():isScreenFadeComplete() +end + +function FadeMap(length, amount) + effect():fadeMap(length, amount) +end + +function WaitForMapFade() + while not effect():isMapFadeComplete() do + coroutine.yield() end - setFadeoutProgress(0.0) end function SetPartyDirection(spriteId, direction) -- cgit 1.4.1