summary refs log tree commit diff stats
path: root/res/scripts/common.lua
blob: e7af1cf918f316f11d680fdbc6ec3b536efa242f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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