2007-07-29 16:31:29 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2014-02-18 01:34:21 +00:00
|
|
|
*
|
2007-07-29 16:31:29 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2007-07-29 16:31:29 +00:00
|
|
|
* GNU General Public License for more details.
|
2014-02-18 01:34:21 +00:00
|
|
|
*
|
2007-07-29 16:31:29 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-05-11 22:32:37 +00:00
|
|
|
#include "kyra/kyra_lok.h"
|
2011-04-28 13:39:17 +00:00
|
|
|
#include "kyra/sound.h"
|
2007-07-29 16:31:29 +00:00
|
|
|
|
2011-04-24 08:34:27 +00:00
|
|
|
#include "common/system.h"
|
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
namespace Kyra {
|
|
|
|
|
2008-05-11 22:32:37 +00:00
|
|
|
void KyraEngine_LoK::snd_playSoundEffect(int track, int volume) {
|
2009-09-13 21:41:29 +00:00
|
|
|
if (_flags.platform == Common::kPlatformPC98) {
|
|
|
|
if (track < 16 || track > 119)
|
|
|
|
track = 58;
|
|
|
|
else
|
|
|
|
track -= 16;
|
|
|
|
}
|
|
|
|
|
2009-11-14 22:51:35 +00:00
|
|
|
if (_flags.platform == Common::kPlatformFMTowns && track == 49) {
|
2007-07-29 16:31:29 +00:00
|
|
|
snd_playWanderScoreViaMap(56, 1);
|
|
|
|
return;
|
|
|
|
}
|
2007-10-10 09:06:15 +00:00
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
KyraEngine_v1::snd_playSoundEffect(track);
|
2007-07-29 16:31:29 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 22:32:37 +00:00
|
|
|
void KyraEngine_LoK::snd_playWanderScoreViaMap(int command, int restart) {
|
2007-07-29 16:31:29 +00:00
|
|
|
if (restart)
|
|
|
|
_lastMusicCommand = -1;
|
|
|
|
|
2008-06-26 19:42:59 +00:00
|
|
|
if (_flags.platform == Common::kPlatformFMTowns) {
|
2010-08-03 18:19:25 +00:00
|
|
|
if (command >= 35 && command <= 38) {
|
2009-11-29 13:52:02 +00:00
|
|
|
snd_playSoundEffect(command - 20);
|
2007-07-29 16:31:29 +00:00
|
|
|
} else if (command >= 2) {
|
2008-07-03 21:09:07 +00:00
|
|
|
if (_lastMusicCommand != command)
|
2007-07-29 16:31:29 +00:00
|
|
|
// the original does -2 here we handle this inside _sound->playTrack()
|
|
|
|
_sound->playTrack(command);
|
|
|
|
} else {
|
2010-08-03 18:19:25 +00:00
|
|
|
_sound->beginFadeOut();
|
2007-07-29 16:31:29 +00:00
|
|
|
}
|
2008-07-03 21:09:07 +00:00
|
|
|
_lastMusicCommand = command;
|
2008-06-26 19:42:59 +00:00
|
|
|
} else if (_flags.platform == Common::kPlatformPC98) {
|
2008-07-03 21:09:07 +00:00
|
|
|
if (command == 1) {
|
2008-06-28 13:13:37 +00:00
|
|
|
_sound->beginFadeOut();
|
2009-11-14 23:01:51 +00:00
|
|
|
} else if ((command >= 2 && command < 53) || command == 55) {
|
2008-07-03 21:09:07 +00:00
|
|
|
if (_lastMusicCommand != command)
|
|
|
|
_sound->playTrack(command);
|
|
|
|
} else {
|
2008-06-28 13:13:37 +00:00
|
|
|
_sound->haltTrack();
|
2008-07-03 21:09:07 +00:00
|
|
|
}
|
|
|
|
_lastMusicCommand = command;
|
2007-07-29 16:31:29 +00:00
|
|
|
} else {
|
2008-05-11 23:16:50 +00:00
|
|
|
KyraEngine_v1::snd_playWanderScoreViaMap(command, restart);
|
2007-07-29 16:31:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-11 22:32:37 +00:00
|
|
|
void KyraEngine_LoK::snd_playVoiceFile(int id) {
|
2011-06-09 17:09:54 +00:00
|
|
|
Common::String vocFile = Common::String::format("%03d", id);
|
|
|
|
_speechPlayTime = _sound->voicePlay(vocFile.c_str(), &_speechHandle);
|
2007-07-29 16:31:29 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 22:32:37 +00:00
|
|
|
void KyraEngine_LoK::snd_voiceWaitForFinish(bool ingame) {
|
2008-12-16 17:40:34 +00:00
|
|
|
while (_sound->voiceIsPlaying() && !skipFlag()) {
|
2007-07-29 16:31:29 +00:00
|
|
|
if (ingame)
|
|
|
|
delay(10, true);
|
|
|
|
else
|
|
|
|
_system->delayMillis(10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-24 23:05:01 +00:00
|
|
|
uint32 KyraEngine_LoK::snd_getVoicePlayTime() {
|
|
|
|
if (!snd_voiceIsPlaying())
|
|
|
|
return 0;
|
|
|
|
return (_speechPlayTime != -1 ? _speechPlayTime : 0);
|
|
|
|
}
|
|
|
|
|
2009-10-04 21:26:33 +00:00
|
|
|
} // End of namespace Kyra
|