From b3c8a3ab263e2312a35ef68ffb56217eeb619803 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 28 Feb 2021 10:15:19 -0500 Subject: Added time passage mailbox event --- res/maps/hallucination_interior.tmx | 12 +++++++--- res/scripts/common.lua | 44 ++++++++++++++++++++++++++++++---- res/scripts/hallucination_interior.lua | 32 +++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 8 deletions(-) (limited to 'res') diff --git a/res/maps/hallucination_interior.tmx b/res/maps/hallucination_interior.tmx index ee7a5cd..55e5506 100644 --- a/res/maps/hallucination_interior.tmx +++ b/res/maps/hallucination_interior.tmx @@ -1,5 +1,5 @@ - + @@ -40,8 +40,8 @@ 2,2,1,1,1,1,2,2,2,2,2,2,2,4,5,12,3221225481,3221225481,3221225481,51,8,3221225481,2147483698,2147483697,13,14,15,16,1,1,37,38,1,37,38,38,2,2,2,59,2147483697,2,2,2,2,2,2,2,2,2,2,2,1073741884,1073741887,1073741886,1073741833,3,4,5,12,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,3221225481,3221225481,3,4,5,12,56,57,3221225481,9,3221225522,3221225521,66,67,1,37,38,1,1,67,1,66,67,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,4,5,12,2147483705,2147483704,9,9,9,2,2,2,2,2, 72,72,72,72,2,2,2,2,32,30,31,33,1073741835,3221225483,3221225482,3221225481,3221225481,3221225481,3221225481,3221225481,3221225481,3221225481,3221225481,3221225522,3221225521,2147483715,2147483714,66,67,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,9,9,9,9,9,3,4,5,12,2,2,2,2, -72,72,72,72,2,7,32,30,31,33,32,30,31,33,3221225478,3221225482,3221225481,3221225481,1073741833,1073741833,1073741833,1073741833,1073741833,1073741833,3221225522,66,67,2,2,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,14,5,12,9,9,9,9,2,2,2,2,2,2, -72,72,72,72,32,30,31,33,43,44,45,7,7,7,7,3221225478,3221225482,9,1073741833,1073741833,1073741833,1073741833,1073741833,1073741833,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,5,9,9,9,3,4,5,12,2,2,2,2, +72,72,72,72,2,7,32,35,31,33,32,30,31,33,3221225478,3221225482,3221225481,3221225481,1073741833,1073741833,1073741833,1073741833,1073741833,1073741833,3221225522,66,67,2,2,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,14,5,12,9,9,9,9,2,2,2,2,2,2, +72,72,72,72,32,30,31,465,43,44,45,7,7,7,7,3221225478,3221225482,9,1073741833,1073741833,1073741833,1073741833,1073741833,1073741833,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,5,9,9,9,3,4,5,12,2,2,2,2, 72,72,72,72,2,7,7,46,47,7,7,7,2,2,2,2,2,3221225482,1073741833,1073741833,1073741833,1073741833,3,4,5,12,2,2,2,2,13,14,15,16,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,3,4,5,12,9,9,9,9,2,2,2,2,2,2, 72,72,72,72,2,2,2,7,7,3221225508,1073741852,1073741852,2,2,2,2,2,2,2,2147483690,2147483689,2147483657,1073741833,1073741833,1073741834,30,31,33,2,2,1,1,1,1,2,2,13,14,15,16,13,14,15,16,1,14,15,1,3,4,5,12,9,9,9,41,42,2,2,2,2,2,2,2, 72,72,72,72,2,2,2,1073741852,1073741852,3221225501,64,2,2,2,2,2,2,2,2,2147483701,2147483700,2147483703,1073741833,1073741834,1073741830,7,2,2,2,2,2,2,2,2,2,2,1,1,1,14,15,16,13,14,15,23,24,14,15,71,60,62,9,9,55,52,53,2,2,2,2,2,2,2, @@ -151,6 +151,12 @@ + + + + + + diff --git a/res/scripts/common.lua b/res/scripts/common.lua index 123f2a0..8eb491f 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua @@ -35,7 +35,8 @@ CutsceneOptions = { } ChangeMapOptions = { - DO_NOT_FADE = 1 -- Prevents fading to and from black + DO_NOT_FADE = 1, -- Prevents fading to and from black + DO_NOT_CHANGE_MUSIC = 2 -- Prevents stopping or starting music as part of the map change } PathfindingOptions = { @@ -289,10 +290,12 @@ function ChangeMap(map, warp, options) loadMap(map) character():transplantParty(playerId, getMap():getWarpPoint(warp), direction) - if (mixer():isPlayingMusic() and not getMap():hasMusic()) then - mixer():fadeoutMusic(150) - elseif (getMap():hasMusic() and (not mixer():isPlayingMusic() or not (mixer():getPlayingTrack() == getMap():getMusic()))) then - mixer():playMusic(getMap():getMusic(), 150) + if (options & ChangeMapOptions.DO_NOT_CHANGE_MUSIC == 0) then + if (mixer():isPlayingMusic() and not getMap():hasMusic()) then + mixer():fadeoutMusic(150) + elseif (getMap():hasMusic() and (not mixer():isPlayingMusic() or not (mixer():getPlayingTrack() == getMap():getMusic()))) then + mixer():playMusic(getMap():getMusic(), 150) + end end coroutine.yield() @@ -413,3 +416,34 @@ function WaitForSpritePath(spriteName) coroutine.yield() end end + +--- Fades out the currently playing music. +-- This does not block. If you want it to block, call Delay for the same amount +-- of time. +-- @param length the fadeout time in milliseconds +function FadeoutMusic(length) + mixer():fadeoutMusic(length) +end + +--- Plays the specified track. +-- @param song the name of the song to play +-- @param length the time in milliseconds to fade in. if left blank, the track starts immediately +function PlayMusic(song, length) + length = length or 0 + + mixer():playMusic(song, length) +end + +--- Makes the player sprite non-controllable. +function DisablePlayerControl() + local playerId = getPlayerSprite() + local playerSprite = getSprite(playerId) + playerSprite.controllable = false +end + +--- Makes the player sprite controllable again. +function EnablePlayerControl() + local playerId = getPlayerSprite() + local playerSprite = getSprite(playerId) + playerSprite.controllable = true +end diff --git a/res/scripts/hallucination_interior.lua b/res/scripts/hallucination_interior.lua index bd075f1..4fbaa99 100644 --- a/res/scripts/hallucination_interior.lua +++ b/res/scripts/hallucination_interior.lua @@ -187,3 +187,35 @@ function hallucination_interior.talk_to_ionia() SetAnimation("ionia", "still") HideCutsceneBars() end + +function hallucination_interior.mailbox_time_passage() + StartCutscene() + DisplayMessage("* The mailbox lid is open...\n* Peek inside?", "", SpeakerType.NONE) + ShowChoice("Yes", "No") + WaitForEndOfMessage() + + if GetChoiceSelection() == 1 then + HideCutsceneBars() + return + end + + FadeoutMusic(2000) + Delay(4000) + + DisplayMessage("* Inside the mailbox is a long hallway.", "", SpeakerType.NONE) + WaitForEndOfMessage() + + Delay(1000) + + FadeToBlack(1000) + + HideCutsceneBars() + DisablePlayerControl() + ChangeMap("time_passage", "fromMailbox", ChangeMapOptions.DO_NOT_FADE | ChangeMapOptions.DO_NOT_CHANGE_MUSIC) + Delay(1000) + + PlayMusic("time_passage", 2000) + RemoveFadeout(2000) + + EnablePlayerControl() +end -- cgit 1.4.1