CGE2: Implement checkSaySwitch() and add/fix connected code.

This commit is contained in:
uruk 2014-07-24 18:11:10 +02:00
parent 755fedcceb
commit 24cc8a8762
4 changed files with 37 additions and 10 deletions

View File

@ -74,7 +74,7 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription)
_quitFlag = false;
_bitmapPalette = nullptr;
_music = true;
_oldMusicVolume = ConfMan.getInt("music_volume");;
_oldMusicVolume = ConfMan.getInt("music_volume");
_startupMode = 1;
_now = 1;
_sex = 1;
@ -94,7 +94,7 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription)
_enaVox = true;
_sayCap = true;
_sayVox = true;
_oldSayVox = false;
_oldSpeechVolume = ConfMan.getInt("speech_volume");
_req = 1;
_midiNotify = nullptr;
_spriteNotify = nullptr;
@ -167,6 +167,7 @@ bool CGE2Engine::hasFeature(EngineFeature f) const {
Common::Error CGE2Engine::run() {
syncSoundSettings();
syncSpeechSettings();
initGraphics(kScrWidth, kScrHeight, false);
init();
@ -177,11 +178,10 @@ Common::Error CGE2Engine::run() {
return Common::kNoError;
}
void CGE2Engine::syncSoundSettings() {
Engine::syncSoundSettings();
void CGE2Engine::syncSpeechSettings() {
_enaCap = _sayCap = ConfMan.getBool("subtitles");
_enaVox = _sayVox = !ConfMan.getBool("speech_mute");
}
} // End of namespace CGE2

View File

@ -133,7 +133,7 @@ private:
void syncHeader(Common::Serializer &s);
bool loadGame(int slotNumber);
void resetGame();
void syncSoundSettings();
void syncSpeechSettings();
public:
CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription);
virtual bool hasFeature(EngineFeature f) const;
@ -285,7 +285,7 @@ public:
bool _flag[4];
bool _sayCap;
bool _sayVox;
bool _oldSayVox;
int _oldSpeechVolume;
int _req;
NotifyFunctionType _midiNotify;
NotifyFunctionType _spriteNotify;

View File

@ -368,7 +368,7 @@ bool CGE2Engine::loadGame(int slotNumber) {
syncGame(readStream, nullptr);
delete readStream;
syncSoundSettings();
syncSpeechSettings();
initToolbar();
loadHeroes();

View File

@ -75,8 +75,21 @@ void CGE2Engine::optionTouch(int opt, uint16 mask) {
switchCap();
break;
case 9:
if (mask & kMouseLeftUp)
if ((mask & kMouseLeftUp) && !ConfMan.getBool("mute")) {
switchVox();
switch (_sayVox) {
case false:
_oldSpeechVolume = ConfMan.getInt("speech_volume");
ConfMan.setInt("speech_volume", 0);
break;
case true:
ConfMan.setInt("speech_volume", _oldSpeechVolume);
break;
default:
break;
}
}
break;
default:
break;
@ -162,7 +175,21 @@ void CGE2Engine::switchSay() {
}
void CGE2Engine::checkSaySwitch() {
warning("STUB: checkSaySwitch()");
bool mute = false;
if (ConfMan.hasKey("mute"))
mute = ConfMan.getBool("mute");
bool speechMuted = mute;
if (!speechMuted) {
int speechVolume = ConfMan.getInt("speech_volume");
speechMuted = speechVolume == 0;
}
if (!speechMuted && !_sayVox) {
switchVox();
}
if (speechMuted && _sayVox) {
switchVox();
}
}
void CGE2Engine::initToolbar() {