CGE2: Set speech only/text only/both modes according to Launcher options.

This commit is contained in:
uruk 2014-07-24 16:50:36 +02:00
parent a6eb089033
commit 755fedcceb
5 changed files with 27 additions and 33 deletions

View File

@ -91,6 +91,7 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription)
_endGame = false;
for (int i = 0; i < 4; i++)
_flag[i] = false;
_enaVox = true;
_sayCap = true;
_sayVox = true;
_oldSayVox = false;
@ -98,7 +99,6 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription)
_midiNotify = nullptr;
_spriteNotify = nullptr;
_enaCap = true;
_enaVox = true;
}
void CGE2Engine::init() {
@ -177,4 +177,11 @@ Common::Error CGE2Engine::run() {
return Common::kNoError;
}
void CGE2Engine::syncSoundSettings() {
Engine::syncSoundSettings();
_enaCap = _sayCap = ConfMan.getBool("subtitles");
_enaVox = _sayVox = !ConfMan.getBool("speech_mute");
}
} // End of namespace CGE2

View File

@ -133,6 +133,7 @@ private:
void syncHeader(Common::Serializer &s);
bool loadGame(int slotNumber);
void resetGame();
void syncSoundSettings();
public:
CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription);
virtual bool hasFeature(EngineFeature f) const;
@ -175,6 +176,7 @@ public:
Sprite *locate(int ref);
bool isHero(Sprite *spr);
void loadUser();
void switchSay();
void checkSaySwitch();
void loadPos();
void releasePocket(Sprite *spr);

View File

@ -366,9 +366,9 @@ bool CGE2Engine::loadGame(int slotNumber) {
// Get in the savegame
syncGame(readStream, nullptr);
delete readStream;
syncSoundSettings();
initToolbar();
loadHeroes();

View File

@ -62,7 +62,7 @@ void Sound::close() {
void Sound::open() {
setRepeat(1);
if (_vm->_commandHandlerTurbo != nullptr)
_vm->checkSaySwitch();
_vm->switchSay();
play(_vm->_fx->load(99, 99));
}

View File

@ -137,47 +137,32 @@ void CGE2Engine::setVolume(int idx, int cnt) {
}
void CGE2Engine::switchCap() {
if (_enaCap) {
if (_enaCap && _enaVox) {
_sayCap = !_sayCap;
if (!_sayCap)
if (!_sayCap && _enaVox)
_sayVox = true;
checkSaySwitch();
keyClick();
switchSay();
}
}
void CGE2Engine::switchVox() {
if (_enaVox) {
if (_enaVox && _enaCap) {
_sayVox = !_sayVox;
if (!_sayVox)
if (!_sayVox && _enaCap)
_sayCap = true;
checkSaySwitch();
keyClick();
switchSay();
}
}
void CGE2Engine::switchSay() {
_commandHandlerTurbo->addCommand(kCmdSeq, 129, _sayVox, nullptr);
_commandHandlerTurbo->addCommand(kCmdSeq, 128, _sayCap, nullptr);
}
void CGE2Engine::checkSaySwitch() {
bool mute = false;
if (ConfMan.hasKey("mute"))
mute = ConfMan.getBool("mute");
bool speechMute = mute;
if (!speechMute)
speechMute = ConfMan.getBool("speech_mute");
if (!speechMute) {
int speechVolume = ConfMan.getInt("speech_volume");
speechMute = speechVolume == 0;
}
if (speechMute) {
_sayVox = false;
_sayCap = true;
}
if (_oldSayVox != _sayVox) {
_commandHandlerTurbo->addCommand(kCmdSeq, 129, _sayVox, nullptr);
_commandHandlerTurbo->addCommand(kCmdSeq, 128, _sayCap, nullptr);
keyClick();
}
_oldSayVox = _sayVox;
warning("STUB: checkSaySwitch()");
}
void CGE2Engine::initToolbar() {
@ -187,7 +172,7 @@ void CGE2Engine::initToolbar() {
if (!_music)
_midiPlayer->killMidi();
_commandHandlerTurbo->addCommand(kCmdSeq, 128, _sayCap, nullptr); // Sets the speech caption switch on.
switchSay();
_infoLine->gotoxyz(V3D(kInfoX, kInfoY, 0));
_infoLine->setText(nullptr);