summary refs log tree commit diff stats
path: root/res/scripts/common.lua
diff options
context:
space:
mode:
Diffstat (limited to 'res/scripts/common.lua')
-rw-r--r--res/scripts/common.lua21
1 files changed, 18 insertions, 3 deletions
diff --git a/res/scripts/common.lua b/res/scripts/common.lua index af25333..e95f6f1 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua
@@ -34,6 +34,10 @@ CutsceneOptions = {
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 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} 35}
36 36
37ChangeMapOptions = {
38 DO_NOT_FADE = 1 -- Prevents fading to and from black
39}
40
37gamestate = {} 41gamestate = {}
38 42
39--- Yields until the specified amount of time has passed. 43--- Yields until the specified amount of time has passed.
@@ -129,6 +133,11 @@ function GetPosition(spriteName)
129 return sprite.loc 133 return sprite.loc
130end 134end
131 135
136function SetPosition(spriteName, x, y)
137 local spriteId = getSpriteByAlias(spriteName)
138 transform():moveSprite(spriteId, vec2i.new(x, y))
139end
140
132function SetDirection(spriteName, dir) 141function SetDirection(spriteName, dir)
133 local spriteId = getSpriteByAlias(spriteName) 142 local spriteId = getSpriteByAlias(spriteName)
134 animation():setSpriteDirection(spriteId, dir) 143 animation():setSpriteDirection(spriteId, dir)
@@ -239,18 +248,24 @@ function SetPartyAnimation(spriteId, animName)
239 end 248 end
240end 249end
241 250
242function ChangeMap(map, warp) 251function ChangeMap(map, warp, options)
252 options = options or 0
253
243 local playerId = getPlayerSprite() 254 local playerId = getPlayerSprite()
244 local playerSprite = getSprite(playerId) 255 local playerSprite = getSprite(playerId)
245 local direction = playerSprite.dir 256 local direction = playerSprite.dir
246 257
247 playerSprite.controllable = false 258 playerSprite.controllable = false
248 FadeToBlack(150) 259 if (options & ChangeMapOptions.DO_NOT_FADE == 0) then
260 FadeToBlack(150)
261 end
249 loadMap(map) 262 loadMap(map)
250 character():transplantParty(playerId, getWarpPoint(warp), direction) 263 character():transplantParty(playerId, getWarpPoint(warp), direction)
251 264
252 coroutine.yield() 265 coroutine.yield()
253 RemoveFadeout(150) 266 if (options & ChangeMapOptions.DO_NOT_FADE == 0) then
267 RemoveFadeout(150)
268 end
254 playerSprite.controllable = true 269 playerSprite.controllable = true
255end 270end
256 271