diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-28 10:15:19 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-28 10:15:19 -0500 |
commit | b3c8a3ab263e2312a35ef68ffb56217eeb619803 (patch) | |
tree | 454ea071f289ae83b5250b133a57ef074de3cbfd | |
parent | 0206fa078e60c0478de6d10376a02377c8574914 (diff) | |
download | tanetane-b3c8a3ab263e2312a35ef68ffb56217eeb619803.tar.gz tanetane-b3c8a3ab263e2312a35ef68ffb56217eeb619803.tar.bz2 tanetane-b3c8a3ab263e2312a35ef68ffb56217eeb619803.zip |
Added time passage mailbox event
-rw-r--r-- | res/maps/hallucination_interior.tmx | 12 | ||||
-rw-r--r-- | res/scripts/common.lua | 44 | ||||
-rw-r--r-- | res/scripts/hallucination_interior.lua | 32 |
3 files changed, 80 insertions, 8 deletions
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 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="64" height="64" tilewidth="16" tileheight="16" infinite="0" nextlayerid="2" nextobjectid="3"> | 2 | <map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="64" height="64" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="4"> |
3 | <properties> | 3 | <properties> |
4 | <property name="music" value="red_green_yellow_yellow"/> | 4 | <property name="music" value="red_green_yellow_yellow"/> |
5 | </properties> | 5 | </properties> |
@@ -40,8 +40,8 @@ | |||
40 | 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, | 40 | 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, |
41 | 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, | 41 | 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, |
42 | 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, | 42 | 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, |
43 | 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, | 43 | 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, |
44 | 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, | 44 | 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, |
45 | 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, | 45 | 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, |
46 | 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, | 46 | 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, |
47 | 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, | 47 | 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 @@ | |||
151 | <property name="script" value="off_top"/> | 151 | <property name="script" value="off_top"/> |
152 | </properties> | 152 | </properties> |
153 | </object> | 153 | </object> |
154 | <object id="3" name="mailbox_time_passage" type="tileSprite" x="119.75" y="566.5"> | ||
155 | <properties> | ||
156 | <property name="interactionScript" value="mailbox_time_passage"/> | ||
157 | </properties> | ||
158 | <point/> | ||
159 | </object> | ||
154 | </objectgroup> | 160 | </objectgroup> |
155 | <layer id="1" name="Upper" width="64" height="64"> | 161 | <layer id="1" name="Upper" width="64" height="64"> |
156 | <properties> | 162 | <properties> |
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 = { | |||
35 | } | 35 | } |
36 | 36 | ||
37 | ChangeMapOptions = { | 37 | ChangeMapOptions = { |
38 | DO_NOT_FADE = 1 -- Prevents fading to and from black | 38 | DO_NOT_FADE = 1, -- Prevents fading to and from black |
39 | DO_NOT_CHANGE_MUSIC = 2 -- Prevents stopping or starting music as part of the map change | ||
39 | } | 40 | } |
40 | 41 | ||
41 | PathfindingOptions = { | 42 | PathfindingOptions = { |
@@ -289,10 +290,12 @@ function ChangeMap(map, warp, options) | |||
289 | loadMap(map) | 290 | loadMap(map) |
290 | character():transplantParty(playerId, getMap():getWarpPoint(warp), direction) | 291 | character():transplantParty(playerId, getMap():getWarpPoint(warp), direction) |
291 | 292 | ||
292 | if (mixer():isPlayingMusic() and not getMap():hasMusic()) then | 293 | if (options & ChangeMapOptions.DO_NOT_CHANGE_MUSIC == 0) then |
293 | mixer():fadeoutMusic(150) | 294 | if (mixer():isPlayingMusic() and not getMap():hasMusic()) then |
294 | elseif (getMap():hasMusic() and (not mixer():isPlayingMusic() or not (mixer():getPlayingTrack() == getMap():getMusic()))) then | 295 | mixer():fadeoutMusic(150) |
295 | mixer():playMusic(getMap():getMusic(), 150) | 296 | elseif (getMap():hasMusic() and (not mixer():isPlayingMusic() or not (mixer():getPlayingTrack() == getMap():getMusic()))) then |
297 | mixer():playMusic(getMap():getMusic(), 150) | ||
298 | end | ||
296 | end | 299 | end |
297 | 300 | ||
298 | coroutine.yield() | 301 | coroutine.yield() |
@@ -413,3 +416,34 @@ function WaitForSpritePath(spriteName) | |||
413 | coroutine.yield() | 416 | coroutine.yield() |
414 | end | 417 | end |
415 | end | 418 | end |
419 | |||
420 | --- Fades out the currently playing music. | ||
421 | -- This does not block. If you want it to block, call Delay for the same amount | ||
422 | -- of time. | ||
423 | -- @param length the fadeout time in milliseconds | ||
424 | function FadeoutMusic(length) | ||
425 | mixer():fadeoutMusic(length) | ||
426 | end | ||
427 | |||
428 | --- Plays the specified track. | ||
429 | -- @param song the name of the song to play | ||
430 | -- @param length the time in milliseconds to fade in. if left blank, the track starts immediately | ||
431 | function PlayMusic(song, length) | ||
432 | length = length or 0 | ||
433 | |||
434 | mixer():playMusic(song, length) | ||
435 | end | ||
436 | |||
437 | --- Makes the player sprite non-controllable. | ||
438 | function DisablePlayerControl() | ||
439 | local playerId = getPlayerSprite() | ||
440 | local playerSprite = getSprite(playerId) | ||
441 | playerSprite.controllable = false | ||
442 | end | ||
443 | |||
444 | --- Makes the player sprite controllable again. | ||
445 | function EnablePlayerControl() | ||
446 | local playerId = getPlayerSprite() | ||
447 | local playerSprite = getSprite(playerId) | ||
448 | playerSprite.controllable = true | ||
449 | 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() | |||
187 | SetAnimation("ionia", "still") | 187 | SetAnimation("ionia", "still") |
188 | HideCutsceneBars() | 188 | HideCutsceneBars() |
189 | end | 189 | end |
190 | |||
191 | function hallucination_interior.mailbox_time_passage() | ||
192 | StartCutscene() | ||
193 | DisplayMessage("* The mailbox lid is open...\n* Peek inside?", "", SpeakerType.NONE) | ||
194 | ShowChoice("Yes", "No") | ||
195 | WaitForEndOfMessage() | ||
196 | |||
197 | if GetChoiceSelection() == 1 then | ||
198 | HideCutsceneBars() | ||
199 | return | ||
200 | end | ||
201 | |||
202 | FadeoutMusic(2000) | ||
203 | Delay(4000) | ||
204 | |||
205 | DisplayMessage("* Inside the mailbox is a long hallway.", "", SpeakerType.NONE) | ||
206 | WaitForEndOfMessage() | ||
207 | |||
208 | Delay(1000) | ||
209 | |||
210 | FadeToBlack(1000) | ||
211 | |||
212 | HideCutsceneBars() | ||
213 | DisablePlayerControl() | ||
214 | ChangeMap("time_passage", "fromMailbox", ChangeMapOptions.DO_NOT_FADE | ChangeMapOptions.DO_NOT_CHANGE_MUSIC) | ||
215 | Delay(1000) | ||
216 | |||
217 | PlayMusic("time_passage", 2000) | ||
218 | RemoveFadeout(2000) | ||
219 | |||
220 | EnablePlayerControl() | ||
221 | end | ||