public void ProcessSfxQueues()
{
if (_talkSoundMode != 0)
{
if ((_talkSoundMode & 1) != 0)
StartTalkSound(_talkSoundA1, _talkSoundB1, 1);
if ((_talkSoundMode & 2) != 0)
_talkChannelHandle = StartTalkSound(_talkSoundA2, _talkSoundB2, 2);
_talkSoundMode = 0;
}
int act = vm.TalkingActor;
if ((SfxMode & 2) != 0 && act != 0)
{
bool finished;
if (vm.MusicEngine is IMuseDigital)
{
finished = !IsSoundRunning(TalkSoundID);
}
// else if (_vm->_game.heversion >= 60)
// {
// finished = !isSoundRunning(1);
// }
else
{
finished = !_mixer.IsSoundHandleActive(_talkChannelHandle);
}
if ((uint)act < 0x80 && ((vm.Game.Version == 8) || (vm.Game.Version <= 7 && !vm.String[0].NoTalkAnim)))
{
var a = vm.Actors[act];
if (a.IsInCurrentRoom)
{
if (IsMouthSyncOff(_curSoundPos) && !_mouthSyncMode)
{
if (!_endOfMouthSync)
a.RunTalkScript(a.TalkStopFrame);
_mouthSyncMode = false;
}
else if (!IsMouthSyncOff(_curSoundPos) && !_mouthSyncMode)
{
a.RunTalkScript(a.TalkStartFrame);
_mouthSyncMode = true;
}
if (vm.Game.Version <= 6 && finished)
a.RunTalkScript(a.TalkStopFrame);
}
}
if (finished && vm.TalkDelay == 0)
{
if (!(vm.Game.Version == 8 && vm.Variables[vm.VariableHaveMessage.Value] == 0))
vm.StopTalk();
}
}
if ((sfxMode & 1) != 0)
{
if (IsSfxFinished())
{
sfxMode &= ~1;
}
}
}