summary refs log tree commit diff stats
path: root/res/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'res/scripts')
-rw-r--r--res/scripts/common.lua35
-rw-r--r--res/scripts/map2.lua4
2 files changed, 33 insertions, 6 deletions
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 = {
30 ABOVE = 1 30 ABOVE = 1
31} 31}
32 32
33CutsceneOptions = {
34 DO_NOT_CHANGE_ANIMATION = 1 -- Prevents player party animation being set to "frozen" at the start of a cutscene or "still" at the end
35}
36
33gamestate = {} 37gamestate = {}
34 38
35--- Yields until the specified amount of time has passed. 39--- Yields until the specified amount of time has passed.
@@ -42,12 +46,19 @@ end
42 46
43--- Starts a cutscene. 47--- Starts a cutscene.
44-- This takes care of showing the cutscene bars, as well as halting character 48-- This takes care of showing the cutscene bars, as well as halting character
45-- movement. It does not block. 49-- movement. It does not block. See CutsceneOptions for modifiers.
46function StartCutscene() 50function StartCutscene(options)
51 options = options or 0
52
47 local playerId = getPlayerSprite() 53 local playerId = getPlayerSprite()
48 local playerSprite = getSprite(playerId) 54 local playerSprite = getSprite(playerId)
49 playerSprite.controllable = false 55 playerSprite.controllable = false
50 character():halt(playerId) 56 character():halt(playerId)
57
58 if (options & CutsceneOptions.DO_NOT_CHANGE_ANIMATION == 0) then
59 SetPartyAnimation(playerId, "frozen")
60 end
61
51 message():displayCutsceneBars() 62 message():displayCutsceneBars()
52 63
53 local allSprites = getAllSprites() 64 local allSprites = getAllSprites()
@@ -91,8 +102,10 @@ function WaitForEndOfMessage()
91end 102end
92 103
93--- Hides the cutscene bars. 104--- Hides the cutscene bars.
94-- This also re-enables player movement. 105-- This also re-enables player movement. See CutsceneOptions for modifiers.
95function HideCutsceneBars() 106function HideCutsceneBars(options)
107 options = options or 0
108
96 WaitForEndOfMessage() 109 WaitForEndOfMessage()
97 message():hideCutsceneBars() 110 message():hideCutsceneBars()
98 111
@@ -100,6 +113,10 @@ function HideCutsceneBars()
100 local playerSprite = getSprite(playerId) 113 local playerSprite = getSprite(playerId)
101 playerSprite.controllable = true 114 playerSprite.controllable = true
102 115
116 if (options & CutsceneOptions.DO_NOT_CHANGE_ANIMATION == 0) then
117 SetPartyAnimation(playerId, "still")
118 end
119
103 local allSprites = getAllSprites() 120 local allSprites = getAllSprites()
104 for k,v in pairs(allSprites) do 121 for k,v in pairs(allSprites) do
105 getSprite(v).paused = false 122 getSprite(v).paused = false
@@ -212,6 +229,16 @@ function SetPartyDirection(spriteId, direction)
212 end 229 end
213end 230end
214 231
232function SetPartyAnimation(spriteId, animName)
233 animation():setSpriteAnimation(spriteId, animName)
234
235 local sprite = getSprite(spriteId)
236
237 for i=1,#sprite.followers do
238 animation():setSpriteAnimation(sprite.followers[i], animName)
239 end
240end
241
215function ChangeMap(map, warp) 242function ChangeMap(map, warp)
216 local playerId = getPlayerSprite() 243 local playerId = getPlayerSprite()
217 local playerSprite = getSprite(playerId) 244 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()
89 89
90 DisplayMessage("* It was lightning.\n\fAh.", "", SpeakerType.NONE) 90 DisplayMessage("* It was lightning.\n\fAh.", "", SpeakerType.NONE)
91 WaitForEndOfMessage() 91 WaitForEndOfMessage()
92 HideCutsceneBars() 92 HideCutsceneBars(CutsceneOptions.DO_NOT_CHANGE_ANIMATION)
93end 93end
94 94
95function map2.approach_doria() 95function map2.approach_doria()
@@ -142,7 +142,7 @@ function map2.approach_doria()
142 SetAnimation("boney", "crouch") 142 SetAnimation("boney", "crouch")
143 StopSound(barkingNoise) 143 StopSound(barkingNoise)
144 PlaySound("boney_growl.wav") 144 PlaySound("boney_growl.wav")
145 SetAnimation("kuma", "still") 145 SetAnimation("kuma", "frozen")
146 Delay(1000) 146 Delay(1000)
147 147
148 SetAnimation("doria", "talk") 148 SetAnimation("doria", "talk")