SpeakerType = { NONE = 0, MAN = 1, WOMAN = 2, BOY = 3, GIRL = 4, NONHUMAN = 5 } function DisplayMessage(msg, name, type) message():displayMessage(msg, name, type) end function WaitForEndOfMessage() while (message().isMessageActive) do coroutine.yield() end end function HideCutsceneBars() WaitForEndOfMessage() message():hideCutsceneBars() end function SetAnimation(spriteName, animName) local spriteId = getSpriteByAlias(spriteName) animation():setSpriteAnimation(spriteId, animName) end function PlaySound(filename) mixer():playSound("../res/sfx/" .. filename) end function LoopSound(filename) return mixer():loopSound("../res/sfx/" .. filename) end function StopSound(soundId) mixer():stopChannel(soundId) end function FadeToBlack(length) local progress = 0.0 while progress < length do progress = progress + coroutine.yield() setFadeoutProgress(progress / length) end setFadeoutProgress(1.0) end function RemoveFadeout(length) local progress = length while progress > 0 do progress = progress - coroutine.yield() setFadeoutProgress(progress / length) end setFadeoutProgress(0.0) end function ChangeMap(map, warp) FadeToBlack(150) loadMap("../res/maps/" .. map .. ".tmx", warp) coroutine.yield() RemoveFadeout(150) end