From f1118738d56d70989a9a131d6b370b73e8e3bc25 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 21 Feb 2021 18:31:43 -0500 Subject: Added frozen animation for cutscenes The player's party will be set to "frozen" at the start of a cutscene and "still" at the end. "frozen" doesn't include idle animations, which are weird to show up during tense exchanges. A CutsceneOptions enum was introduced to be able to modify the growing number of things that StartCutscene() and HideCutsceneBars() do. Currently the lightning mailbox event uses it so that Lucas's animation is not reset to still (instead of the collapsed animation) after he's electrocuted. --- res/scripts/common.lua | 35 +++++++++++++++++++++++++++++++---- res/scripts/map2.lua | 4 ++-- res/sprites/boney_anim.txt | 8 ++++++++ res/sprites/claus_anim.txt | 8 ++++++++ res/sprites/duster_anim.txt | 8 ++++++++ res/sprites/kuma_anim.txt | 8 ++++++++ res/sprites/lucas_anim.txt | 8 ++++++++ 7 files changed, 73 insertions(+), 6 deletions(-) (limited to 'res') diff --git a/res/scripts/common.lua b/res/scripts/common.lua index 494ace9..45b596d 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua @@ -30,6 +30,10 @@ SpriteLayer = { ABOVE = 1 } +CutsceneOptions = { + DO_NOT_CHANGE_ANIMATION = 1 -- Prevents player party animation being set to "frozen" at the start of a cutscene or "still" at the end +} + gamestate = {} --- Yields until the specified amount of time has passed. @@ -42,12 +46,19 @@ end --- Starts a cutscene. -- This takes care of showing the cutscene bars, as well as halting character --- movement. It does not block. -function StartCutscene() +-- movement. It does not block. See CutsceneOptions for modifiers. +function StartCutscene(options) + options = options or 0 + local playerId = getPlayerSprite() local playerSprite = getSprite(playerId) playerSprite.controllable = false character():halt(playerId) + + if (options & CutsceneOptions.DO_NOT_CHANGE_ANIMATION == 0) then + SetPartyAnimation(playerId, "frozen") + end + message():displayCutsceneBars() local allSprites = getAllSprites() @@ -91,8 +102,10 @@ function WaitForEndOfMessage() end --- Hides the cutscene bars. --- This also re-enables player movement. -function HideCutsceneBars() +-- This also re-enables player movement. See CutsceneOptions for modifiers. +function HideCutsceneBars(options) + options = options or 0 + WaitForEndOfMessage() message():hideCutsceneBars() @@ -100,6 +113,10 @@ function HideCutsceneBars() local playerSprite = getSprite(playerId) playerSprite.controllable = true + if (options & CutsceneOptions.DO_NOT_CHANGE_ANIMATION == 0) then + SetPartyAnimation(playerId, "still") + end + local allSprites = getAllSprites() for k,v in pairs(allSprites) do getSprite(v).paused = false @@ -212,6 +229,16 @@ function SetPartyDirection(spriteId, direction) end end +function SetPartyAnimation(spriteId, animName) + animation():setSpriteAnimation(spriteId, animName) + + local sprite = getSprite(spriteId) + + for i=1,#sprite.followers do + animation():setSpriteAnimation(sprite.followers[i], animName) + end +end + function ChangeMap(map, warp) local playerId = getPlayerSprite() local playerSprite = getSprite(playerId) diff --git a/res/scripts/map2.lua b/res/scripts/map2.lua index cb373b4..31b9e00 100644 --- a/res/scripts/map2.lua +++ b/res/scripts/map2.lua @@ -89,7 +89,7 @@ function map2.mailbox_lightning() DisplayMessage("* It was lightning.\n\fAh.", "", SpeakerType.NONE) WaitForEndOfMessage() - HideCutsceneBars() + HideCutsceneBars(CutsceneOptions.DO_NOT_CHANGE_ANIMATION) end function map2.approach_doria() @@ -142,7 +142,7 @@ function map2.approach_doria() SetAnimation("boney", "crouch") StopSound(barkingNoise) PlaySound("boney_growl.wav") - SetAnimation("kuma", "still") + SetAnimation("kuma", "frozen") Delay(1000) SetAnimation("doria", "talk") diff --git a/res/sprites/boney_anim.txt b/res/sprites/boney_anim.txt index ffbb4fa..a8b036c 100644 --- a/res/sprites/boney_anim.txt +++ b/res/sprites/boney_anim.txt @@ -8,6 +8,14 @@ still[up]: 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 still[up_right]: 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,101,109,101,109 still[right]: 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,102,110,102,110 still[down_right]: 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,103,111,103,111 +frozen[down]: 0 +frozen[down_left]: 1 +frozen[left]: 2 +frozen[up_left]: 3 +frozen[up]: 4 +frozen[up_right]: 5 +frozen[right]: 6 +frozen[down_right]: 7 walk[down]: 8,16,24 walk[down_left]: 9,17,25 walk[left]: 10,18,26 diff --git a/res/sprites/claus_anim.txt b/res/sprites/claus_anim.txt index 79cb64b..14154e6 100644 --- a/res/sprites/claus_anim.txt +++ b/res/sprites/claus_anim.txt @@ -8,6 +8,14 @@ still[up]: 4 still[up_right]: 5 still[right]: 6 still[down_right]: 7 +frozen[down]: 0 +frozen[down_left]: 1 +frozen[left]: 2 +frozen[up_left]: 3 +frozen[up]: 4 +frozen[up_right]: 5 +frozen[right]: 6 +frozen[down_right]: 7 walk[down]: 8,0,16,0 walk[down_left]: 9,1,17,1 walk[left]: 10,2,18,2 diff --git a/res/sprites/duster_anim.txt b/res/sprites/duster_anim.txt index 06e70d0..57c470c 100644 --- a/res/sprites/duster_anim.txt +++ b/res/sprites/duster_anim.txt @@ -8,6 +8,14 @@ still[up]: 4 still[up_right]: 5 still[right]: 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,215,6,215 still[down_right]: 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,216,7,216 +frozen[down]: 0 +frozen[down_left]: 1 +frozen[left]: 2 +frozen[up_left]: 3 +frozen[up]: 4 +frozen[up_right]: 5 +frozen[right]: 6 +frozen[down_right]: 7 walk[down]: 8,16,24,32,40 walk[down_left]: 9,17,25,33,41 walk[left]: 10,18,26,34,42 diff --git a/res/sprites/kuma_anim.txt b/res/sprites/kuma_anim.txt index a6a5b72..01ca970 100644 --- a/res/sprites/kuma_anim.txt +++ b/res/sprites/kuma_anim.txt @@ -8,6 +8,14 @@ still[up]: 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 still[up_right]: 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,133,141,149,157,149,157,149,157,149,141 still[right]: 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,134,142,150,158,150,158,150,158,150,142 still[down_right]: 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,135,143,151,159,151,159,151,159,151,143 +frozen[down]: 0 +frozen[down_left]: 1 +frozen[left]: 2 +frozen[up_left]: 3 +frozen[up]: 4 +frozen[up_right]: 5 +frozen[right]: 6 +frozen[down_right]: 7 walk[down]: 16,0,24,0 walk[down_left]: 17,1,25,1 walk[left]: 18,2,26,2 diff --git a/res/sprites/lucas_anim.txt b/res/sprites/lucas_anim.txt index 98a9f5b..1a8b62b 100644 --- a/res/sprites/lucas_anim.txt +++ b/res/sprites/lucas_anim.txt @@ -8,6 +8,14 @@ still[up]: 4 still[up_right]: 5 still[right]: 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,193,6,193 still[down_right]: 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,192,7,192 +frozen[down]: 0 +frozen[down_left]: 1 +frozen[left]: 2 +frozen[up_left]: 3 +frozen[up]: 4 +frozen[up_right]: 5 +frozen[right]: 6 +frozen[down_right]: 7 walk[down]: 40,0,48,0 walk[down_left]: 41,1,49,1 walk[left]: 42,2,50,2 -- cgit 1.4.1