2007-05-30 21:56:52 +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.
|
2004-04-09 12:36:06 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2004-10-15 06:06:47 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2004-04-09 12:36:06 +00:00
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-04-09 12:36:06 +00:00
|
|
|
*
|
2006-02-09 12:19:53 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2004-04-09 12:36:06 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common/config-manager.h"
|
2005-08-19 22:12:09 +00:00
|
|
|
|
2004-11-11 13:37:35 +00:00
|
|
|
#include "sound/mididrv.h"
|
2007-07-29 16:31:29 +00:00
|
|
|
#include "sound/mixer.h"
|
2006-01-04 07:39:16 +00:00
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
#include "kyra/kyra_v1.h"
|
2007-07-29 16:31:29 +00:00
|
|
|
#include "kyra/sound.h"
|
2005-06-24 16:01:42 +00:00
|
|
|
#include "kyra/resource.h"
|
2005-08-19 22:12:09 +00:00
|
|
|
#include "kyra/screen.h"
|
2006-01-02 22:58:59 +00:00
|
|
|
#include "kyra/text.h"
|
2007-07-29 16:33:11 +00:00
|
|
|
#include "kyra/timer.h"
|
|
|
|
#include "kyra/script.h"
|
2008-05-06 20:50:27 +00:00
|
|
|
#include "kyra/debugger.h"
|
2005-08-19 22:12:09 +00:00
|
|
|
|
2006-04-08 11:21:04 +00:00
|
|
|
namespace Kyra {
|
2004-10-15 06:06:47 +00:00
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags)
|
2008-04-29 14:22:04 +00:00
|
|
|
: Engine(system), _flags(flags) {
|
2006-04-27 00:39:10 +00:00
|
|
|
_res = 0;
|
|
|
|
_sound = 0;
|
|
|
|
_text = 0;
|
2007-07-29 16:31:29 +00:00
|
|
|
_staticres = 0;
|
2007-07-29 16:33:11 +00:00
|
|
|
_timer = 0;
|
2008-04-29 15:12:09 +00:00
|
|
|
_emc = 0;
|
2008-05-06 20:50:27 +00:00
|
|
|
_debugger = 0;
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
_gameSpeed = 60;
|
|
|
|
_tickLength = (uint8)(1000.0 / _gameSpeed);
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-07-25 15:11:42 +00:00
|
|
|
_quitFlag = false;
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2008-03-21 16:18:27 +00:00
|
|
|
_speechFile = "";
|
2007-10-10 09:06:15 +00:00
|
|
|
_trackMap = 0;
|
|
|
|
_trackMapSize = 0;
|
|
|
|
_lastMusicCommand = -1;
|
|
|
|
_curSfxFile = _curMusicTheme = -1;
|
|
|
|
|
2008-03-28 00:53:54 +00:00
|
|
|
_gameToLoad = -1;
|
|
|
|
|
2008-05-12 12:42:10 +00:00
|
|
|
_mouseState = -1;
|
2008-05-12 12:57:42 +00:00
|
|
|
_deathHandler = -1;
|
2008-05-12 12:42:10 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
memset(_flagsTable, 0, sizeof(_flagsTable));
|
2007-06-08 23:04:13 +00:00
|
|
|
|
2006-11-13 12:00:36 +00:00
|
|
|
// sets up all engine specific debug levels
|
|
|
|
Common::addSpecialDebugLevel(kDebugLevelScriptFuncs, "ScriptFuncs", "Script function debug level");
|
|
|
|
Common::addSpecialDebugLevel(kDebugLevelScript, "Script", "Script interpreter debug level");
|
|
|
|
Common::addSpecialDebugLevel(kDebugLevelSprites, "Sprites", "Sprite debug level");
|
|
|
|
Common::addSpecialDebugLevel(kDebugLevelScreen, "Screen", "Screen debug level");
|
|
|
|
Common::addSpecialDebugLevel(kDebugLevelSound, "Sound", "Sound debug level");
|
|
|
|
Common::addSpecialDebugLevel(kDebugLevelAnimator, "Animator", "Animator debug level");
|
|
|
|
Common::addSpecialDebugLevel(kDebugLevelMain, "Main", "Generic debug level");
|
|
|
|
Common::addSpecialDebugLevel(kDebugLevelGUI, "GUI", "GUI debug level");
|
|
|
|
Common::addSpecialDebugLevel(kDebugLevelSequence, "Sequence", "Sequence debug level");
|
|
|
|
Common::addSpecialDebugLevel(kDebugLevelMovie, "Movie", "Movie debug level");
|
2007-07-29 16:33:11 +00:00
|
|
|
Common::addSpecialDebugLevel(kDebugLevelTimer, "Timer", "Timer debug level");
|
2007-09-19 13:55:05 +00:00
|
|
|
|
|
|
|
system->getEventManager()->registerRandomSource(_rnd, "kyra");
|
2006-04-27 00:39:10 +00:00
|
|
|
}
|
2004-04-09 12:36:06 +00:00
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
::GUI::Debugger *KyraEngine_v1::getDebugger() {
|
2008-05-06 20:50:27 +00:00
|
|
|
return _debugger;
|
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
int KyraEngine_v1::init() {
|
2008-01-27 15:53:09 +00:00
|
|
|
registerDefaultSettings();
|
|
|
|
|
2006-04-27 00:39:10 +00:00
|
|
|
// Setup mixer
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2008-04-29 14:22:04 +00:00
|
|
|
if (!_flags.useDigSound) {
|
|
|
|
// We prefer AdLib over native MIDI, since our AdLib playback code is much
|
|
|
|
// more mature than our MIDI player. For example we are missing MT-32 support
|
|
|
|
// and it seems our MIDI playback code has threading issues (see bug #1506583
|
|
|
|
// "KYRA1: Crash on exceeded polyphony" for more information).
|
|
|
|
int midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB/* | MDT_PREFER_MIDI*/);
|
|
|
|
|
|
|
|
if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) {
|
|
|
|
// TODO: currently we don't support the PC98 sound data,
|
|
|
|
// but since it has the FM-Towns data files, we just use the
|
|
|
|
// FM-Towns driver
|
|
|
|
if (_flags.gameID == GI_KYRA1)
|
|
|
|
_sound = new SoundTowns(this, _mixer);
|
|
|
|
else
|
|
|
|
_sound = new SoundTowns_v2(this, _mixer);
|
|
|
|
} else if (midiDriver == MD_ADLIB) {
|
|
|
|
_sound = new SoundAdlibPC(this, _mixer);
|
2006-03-28 15:15:36 +00:00
|
|
|
assert(_sound);
|
2008-04-29 14:22:04 +00:00
|
|
|
} else {
|
|
|
|
bool native_mt32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32"));
|
|
|
|
|
|
|
|
MidiDriver *driver = MidiDriver::createMidi(midiDriver);
|
|
|
|
assert(driver);
|
|
|
|
if (native_mt32)
|
|
|
|
driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
|
|
|
|
|
|
|
|
SoundMidiPC *soundMidiPc = new SoundMidiPC(this, _mixer, driver);
|
|
|
|
_sound = soundMidiPc;
|
|
|
|
assert(_sound);
|
|
|
|
soundMidiPc->hasNativeMT32(native_mt32);
|
|
|
|
|
|
|
|
// Unlike some SCUMM games, it's not that the MIDI sounds are
|
|
|
|
// missing. It's just that at least at the time of writing they
|
|
|
|
// are decidedly inferior to the Adlib ones.
|
|
|
|
if (ConfMan.getBool("multi_midi")) {
|
|
|
|
SoundAdlibPC *adlib = new SoundAdlibPC(this, _mixer);
|
|
|
|
assert(adlib);
|
|
|
|
|
|
|
|
_sound = new MixedSoundDriver(this, _mixer, soundMidiPc, adlib);
|
|
|
|
assert(_sound);
|
|
|
|
}
|
2006-03-28 15:15:36 +00:00
|
|
|
}
|
2006-02-27 22:39:55 +00:00
|
|
|
}
|
2007-01-29 18:15:14 +00:00
|
|
|
|
2008-04-04 18:09:19 +00:00
|
|
|
if (_sound)
|
|
|
|
_sound->updateVolumeSettings();
|
2008-04-29 14:22:04 +00:00
|
|
|
|
2006-07-08 12:23:44 +00:00
|
|
|
_res = new Resource(this);
|
|
|
|
assert(_res);
|
2007-10-09 05:40:20 +00:00
|
|
|
_res->reset();
|
2006-03-18 14:43:18 +00:00
|
|
|
_staticres = new StaticResource(this);
|
|
|
|
assert(_staticres);
|
2006-05-19 07:34:24 +00:00
|
|
|
if (!_staticres->init())
|
|
|
|
error("_staticres->init() failed");
|
2008-04-06 14:41:25 +00:00
|
|
|
if (!screen()->init())
|
|
|
|
error("screen()->init() failed");
|
2007-07-29 16:33:11 +00:00
|
|
|
_timer = new TimerManager(this, _system);
|
|
|
|
assert(_timer);
|
2008-01-27 15:56:56 +00:00
|
|
|
setupTimers();
|
2008-04-29 15:12:09 +00:00
|
|
|
_emc = new EMCInterpreter(this);
|
|
|
|
assert(_emc);
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
setupOpcodeTable();
|
2008-01-27 15:56:56 +00:00
|
|
|
readSettings();
|
2006-02-09 12:19:53 +00:00
|
|
|
|
2008-03-28 00:53:54 +00:00
|
|
|
if (ConfMan.hasKey("save_slot")) {
|
|
|
|
_gameToLoad = ConfMan.getInt("save_slot");
|
|
|
|
if (!saveFileLoadable(_gameToLoad))
|
|
|
|
_gameToLoad = -1;
|
|
|
|
}
|
|
|
|
|
2006-08-26 22:17:30 +00:00
|
|
|
_lang = 0;
|
|
|
|
Common::Language lang = Common::parseLanguage(ConfMan.get("language"));
|
|
|
|
|
2007-02-12 18:01:51 +00:00
|
|
|
if (_flags.gameID == GI_KYRA2 || _flags.gameID == GI_KYRA3) {
|
|
|
|
switch (lang) {
|
|
|
|
case Common::EN_ANY:
|
|
|
|
case Common::EN_USA:
|
|
|
|
case Common::EN_GRB:
|
|
|
|
_lang = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Common::FR_FRA:
|
|
|
|
_lang = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Common::DE_DEU:
|
|
|
|
_lang = 2;
|
|
|
|
break;
|
|
|
|
|
2008-01-27 02:05:37 +00:00
|
|
|
case Common::JA_JPN:
|
|
|
|
_lang = 3;
|
|
|
|
break;
|
|
|
|
|
2007-02-12 18:01:51 +00:00
|
|
|
default:
|
|
|
|
warning("unsupported language, switching back to English");
|
|
|
|
_lang = 0;
|
|
|
|
break;
|
|
|
|
}
|
2006-08-26 22:17:30 +00:00
|
|
|
}
|
|
|
|
|
2004-11-23 00:03:25 +00:00
|
|
|
return 0;
|
2004-04-09 12:36:06 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
KyraEngine_v1::~KyraEngine_v1() {
|
2008-04-20 15:16:58 +00:00
|
|
|
for (Common::Array<const Opcode*>::iterator i = _opcodes.begin(); i != _opcodes.end(); ++i)
|
|
|
|
delete *i;
|
|
|
|
_opcodes.clear();
|
|
|
|
|
2005-08-19 22:12:09 +00:00
|
|
|
delete _res;
|
2008-04-06 15:35:30 +00:00
|
|
|
delete _staticres;
|
2006-01-13 23:06:04 +00:00
|
|
|
delete _sound;
|
2006-01-02 22:58:59 +00:00
|
|
|
delete _text;
|
2007-07-29 16:33:11 +00:00
|
|
|
delete _timer;
|
2008-04-29 15:12:09 +00:00
|
|
|
delete _emc;
|
2008-05-06 20:50:27 +00:00
|
|
|
delete _debugger;
|
2006-02-09 12:19:53 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
void KyraEngine_v1::quitGame() {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_v1::quitGame()");
|
2006-05-21 15:41:32 +00:00
|
|
|
_quitFlag = true;
|
|
|
|
// Nothing to do here
|
2006-02-09 12:19:53 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
Common::Point KyraEngine_v1::getMousePos() const {
|
2007-04-01 17:36:13 +00:00
|
|
|
Common::Point mouse = _eventMan->getMousePos();
|
2007-07-29 16:31:29 +00:00
|
|
|
|
2007-03-18 18:27:52 +00:00
|
|
|
if (_flags.useHiResOverlay) {
|
|
|
|
mouse.x >>= 1;
|
|
|
|
mouse.y >>= 1;
|
|
|
|
}
|
2007-04-15 16:41:20 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
return mouse;
|
2005-12-08 17:19:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
void KyraEngine_v1::setMousePos(int x, int y) {
|
2008-03-16 02:00:14 +00:00
|
|
|
if (_flags.useHiResOverlay) {
|
|
|
|
x <<= 1;
|
|
|
|
y <<= 1;
|
|
|
|
}
|
|
|
|
_system->warpMouse(x, y);
|
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
int KyraEngine_v1::setGameFlag(int flag) {
|
2006-02-11 08:31:13 +00:00
|
|
|
_flagsTable[flag >> 3] |= (1 << (flag & 7));
|
|
|
|
return 1;
|
2005-12-10 15:52:38 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
int KyraEngine_v1::queryGameFlag(int flag) const {
|
2006-02-11 08:31:13 +00:00
|
|
|
return ((_flagsTable[flag >> 3] >> (flag & 7)) & 1);
|
2005-12-10 15:52:38 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
int KyraEngine_v1::resetGameFlag(int flag) {
|
2006-02-11 08:31:13 +00:00
|
|
|
_flagsTable[flag >> 3] &= ~(1 << (flag & 7));
|
|
|
|
return 0;
|
2005-12-26 14:53:51 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
void KyraEngine_v1::delayUntil(uint32 timestamp, bool updateTimers, bool update, bool isMainLoop) {
|
2007-07-29 16:31:29 +00:00
|
|
|
while (_system->getMillis() < timestamp && !_quitFlag) {
|
|
|
|
if (timestamp - _system->getMillis() >= 10)
|
|
|
|
delay(10, update, isMainLoop);
|
2005-11-18 23:55:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
void KyraEngine_v1::delay(uint32 amount, bool update, bool isMainLoop) {
|
2007-07-29 16:31:29 +00:00
|
|
|
_system->delayMillis(amount);
|
2005-12-09 23:02:16 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
void KyraEngine_v1::delayWithTicks(int ticks) {
|
2007-07-29 16:31:29 +00:00
|
|
|
delay(ticks * _tickLength);
|
2005-12-09 23:02:16 +00:00
|
|
|
}
|
2006-04-08 11:21:04 +00:00
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
void KyraEngine_v1::registerDefaultSettings() {
|
2008-01-27 15:30:53 +00:00
|
|
|
if (_flags.gameID != GI_KYRA3)
|
|
|
|
ConfMan.registerDefault("cdaudio", (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98));
|
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
void KyraEngine_v1::readSettings() {
|
2008-01-27 15:30:53 +00:00
|
|
|
_configWalkspeed = ConfMan.getInt("walkspeed");
|
2008-02-07 23:31:13 +00:00
|
|
|
_configMusic = 0;
|
|
|
|
|
|
|
|
if (!ConfMan.getBool("music_mute")) {
|
|
|
|
_configMusic = 1;
|
|
|
|
if (_flags.gameID != GI_KYRA3 && ConfMan.getBool("cdaudio") && (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98))
|
|
|
|
_configMusic = 2;
|
|
|
|
}
|
2008-01-27 15:30:53 +00:00
|
|
|
_configSounds = ConfMan.getBool("sfx_mute") ? 0 : 1;
|
|
|
|
|
2008-04-29 15:12:09 +00:00
|
|
|
if (_sound) {
|
|
|
|
_sound->enableMusic(_configMusic);
|
|
|
|
_sound->enableSFX(_configSounds);
|
|
|
|
}
|
2008-01-27 15:30:53 +00:00
|
|
|
|
|
|
|
bool speechMute = ConfMan.getBool("speech_mute");
|
|
|
|
bool subtitles = ConfMan.getBool("subtitles");
|
|
|
|
|
|
|
|
if (!speechMute && subtitles)
|
|
|
|
_configVoice = 2; // Voice & Text
|
|
|
|
else if (!speechMute && !subtitles)
|
|
|
|
_configVoice = 1; // Voice only
|
|
|
|
else
|
|
|
|
_configVoice = 0; // Text only
|
|
|
|
|
|
|
|
setWalkspeed(_configWalkspeed);
|
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
void KyraEngine_v1::writeSettings() {
|
2008-01-27 15:30:53 +00:00
|
|
|
bool speechMute, subtitles;
|
|
|
|
|
|
|
|
ConfMan.setInt("walkspeed", _configWalkspeed);
|
|
|
|
ConfMan.setBool("music_mute", _configMusic == 0);
|
2008-02-07 23:31:13 +00:00
|
|
|
if (_flags.gameID != GI_KYRA3)
|
|
|
|
ConfMan.setBool("cdaudio", _configMusic == 2);
|
2008-01-27 15:30:53 +00:00
|
|
|
ConfMan.setBool("sfx_mute", _configSounds == 0);
|
|
|
|
|
|
|
|
switch (_configVoice) {
|
|
|
|
case 0: // Text only
|
|
|
|
speechMute = true;
|
|
|
|
subtitles = true;
|
|
|
|
break;
|
|
|
|
case 1: // Voice only
|
|
|
|
speechMute = false;
|
|
|
|
subtitles = false;
|
|
|
|
break;
|
|
|
|
default: // Voice & Text
|
|
|
|
speechMute = false;
|
|
|
|
subtitles = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-04-29 15:12:09 +00:00
|
|
|
if (_sound) {
|
|
|
|
if (!_configMusic)
|
|
|
|
_sound->beginFadeOut();
|
|
|
|
_sound->enableMusic(_configMusic);
|
|
|
|
_sound->enableSFX(_configSounds);
|
|
|
|
}
|
2008-01-27 15:30:53 +00:00
|
|
|
|
|
|
|
ConfMan.setBool("speech_mute", speechMute);
|
|
|
|
ConfMan.setBool("subtitles", subtitles);
|
|
|
|
|
|
|
|
ConfMan.flushToDisk();
|
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
bool KyraEngine_v1::speechEnabled() {
|
2008-01-27 15:30:53 +00:00
|
|
|
return _flags.isTalkie && (_configVoice == 1 || _configVoice == 2);
|
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
bool KyraEngine_v1::textEnabled() {
|
2008-01-27 15:30:53 +00:00
|
|
|
return !_flags.isTalkie || (_configVoice == 0 || _configVoice == 2);
|
|
|
|
}
|
|
|
|
|
2008-04-04 18:02:50 +00:00
|
|
|
inline int convertValueToMixer(int value) {
|
|
|
|
value -= 2;
|
|
|
|
return (value * Audio::Mixer::kMaxMixerVolume) / 95;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int convertValueFromMixer(int value) {
|
|
|
|
return (value * 95) / Audio::Mixer::kMaxMixerVolume + 2;
|
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
void KyraEngine_v1::setVolume(kVolumeEntry vol, uint8 value) {
|
2008-04-04 18:02:50 +00:00
|
|
|
switch (vol) {
|
|
|
|
case kVolumeMusic:
|
|
|
|
ConfMan.setInt("music_volume", convertValueToMixer(value));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kVolumeSfx:
|
|
|
|
ConfMan.setInt("sfx_volume", convertValueToMixer(value));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kVolumeSpeech:
|
|
|
|
ConfMan.setInt("speech_volume", convertValueToMixer(value));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Resetup mixer
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
|
2008-04-04 18:09:19 +00:00
|
|
|
if (_sound)
|
|
|
|
_sound->updateVolumeSettings();
|
2008-04-04 18:02:50 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
uint8 KyraEngine_v1::getVolume(kVolumeEntry vol) {
|
2008-04-04 18:02:50 +00:00
|
|
|
switch (vol) {
|
|
|
|
case kVolumeMusic:
|
|
|
|
return convertValueFromMixer(ConfMan.getInt("music_volume"));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kVolumeSfx:
|
|
|
|
return convertValueFromMixer(ConfMan.getInt("sfx_volume"));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kVolumeSpeech:
|
|
|
|
if (speechEnabled())
|
|
|
|
return convertValueFromMixer(ConfMan.getInt("speech_volume"));
|
|
|
|
else
|
|
|
|
return 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2005-08-19 22:12:09 +00:00
|
|
|
} // End of namespace Kyra
|
2007-04-15 16:41:20 +00:00
|
|
|
|