From c39a92933d4d66f7436bbaf3b152f906d24ccfd7 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sat, 12 Mar 2005 00:47:17 +0000 Subject: Add key to toggle speech/subtitles svn-id: r17082 --- scumm/dialogs.cpp | 10 +++++++++- scumm/dialogs.h | 1 + scumm/input.cpp | 36 ++++++++++++++++++++++++++++++++++++ scumm/scumm.cpp | 12 ++++++++++++ scumm/scumm.h | 1 + scumm/sound.cpp | 3 +++ 6 files changed, 62 insertions(+), 1 deletion(-) (limited to 'scumm') diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index 75bfaeb6a7..0b30d45cb5 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -422,6 +422,7 @@ ConfigDialog::ConfigDialog(ScummEngine *scumm) // Some misc options // subtitlesCheckbox = new GUI::CheckboxWidget(this, 15, 78, 200, 16, "Show subtitles", 0, 'S'); + speechCheckbox = new GUI::CheckboxWidget(this, 130, 78, 200, 16, "Enable speech", 0, 'E'); // // Create the sub dialog(s) @@ -442,6 +443,7 @@ void ConfigDialog::open() { // update checkboxes, too subtitlesCheckbox->setState(ConfMan.getBool("subtitles")); + speechCheckbox->setState(!ConfMan.getBool("speech_mute")); } void ConfigDialog::close() { @@ -449,9 +451,15 @@ void ConfigDialog::close() { if (getResult()) { // Subtitles ConfMan.set("subtitles", subtitlesCheckbox->getState(), _domain); + ConfMan.set("speech_mute", !subtitlesCheckbox->getState(), _domain); // Sync with current setting + if (ConfMan.getBool("speech_mute")) + _vm->_voiceMode = 2; + else + _vm->_voiceMode = ConfMan.getBool("subtitles"); + if (_vm->_version >= 7) - _vm->VAR(_vm->VAR_VOICE_MODE) = subtitlesCheckbox->getState(); + _vm->VAR(_vm->VAR_VOICE_MODE) = _vm->_voiceMode; } GUI_OptionsDialog::close(); diff --git a/scumm/dialogs.h b/scumm/dialogs.h index faf4ad4bdc..158e599fb7 100644 --- a/scumm/dialogs.h +++ b/scumm/dialogs.h @@ -117,6 +117,7 @@ public: protected: GUI::CheckboxWidget *subtitlesCheckbox; + GUI::CheckboxWidget *speechCheckbox; }; /** diff --git a/scumm/input.cpp b/scumm/input.cpp index 5120c0891d..827eb4c50c 100644 --- a/scumm/input.cpp +++ b/scumm/input.cpp @@ -25,6 +25,9 @@ #include "common/config-manager.h" #include "common/system.h" +#include "gui/message.h" +#include "gui/newgui.h" + #include "scumm/debugger.h" #include "scumm/dialogs.h" #include "scumm/imuse.h" @@ -337,6 +340,39 @@ void ScummEngine::processKbd(bool smushMode) { } #endif + if (_version >= 6 && _lastKeyHit == 20) { + char buf[256]; + + _voiceMode++; + if (_voiceMode == 3) + _voiceMode = 0; + + switch(_voiceMode) { + case 0: + sprintf(buf, "Speech Only"); + ConfMan.set("speech_mute", false); + ConfMan.set("subtitles", false); + break; + case 1: + sprintf(buf, "Speech and Subtitles"); + ConfMan.set("speech_mute", false); + ConfMan.set("subtitles", true); + break; + case 2: + sprintf(buf, "Subtitles Only"); + ConfMan.set("speech_mute", true); + ConfMan.set("subtitles", true); + break; + } + + if (_version >= 7) + VAR(VAR_VOICE_MODE) = _voiceMode; + + GUI::TimedMessageDialog dialog(buf, 1500); + runDialog(dialog); + return; + } + if (VAR_RESTART_KEY != 0xFF && _lastKeyHit == VAR(VAR_RESTART_KEY) || (((_version <= 2) || (_features & GF_FMTOWNS && _version == 3)) && _lastKeyHit == 8)) { confirmrestartDialog(); diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 508ff7878f..ff270a6760 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -829,6 +829,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _copyProtection = false; _demoMode = false; _confirmExit = false; + _voiceMode = 0; _talkDelay = 0; _keepText = false; _existLanguageFile = false; @@ -1024,6 +1025,17 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS if (!ConfMan.hasKey("subtitles")) ConfMan.set("subtitles", !ConfMan.getBool("nosubtitles")); } + + // Make sure that at least subtitles are enabled + if (ConfMan.getBool("speech_mute") && !ConfMan.getBool("subtitles")) + ConfMan.set("subtitles", 1); + + // TODO Detect subtitle only versions of scumm6 games + if (ConfMan.getBool("speech_mute")) + _voiceMode = 2; + else + _voiceMode = ConfMan.getBool("subtitles"); + _confirmExit = ConfMan.getBool("confirm_exit"); if (ConfMan.hasKey("render_mode")) { diff --git a/scumm/scumm.h b/scumm/scumm.h index 44fa8ead0d..41c924f22d 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -1043,6 +1043,7 @@ public: byte *_shadowPalette; bool _skipDrawObject, _skipProcessActors; int _timers[4]; + int _voiceMode; protected: int _shadowPaletteSize; diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 23584b6a76..01fdd86ac4 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -989,6 +989,9 @@ void Sound::soundKludge(int *list, int num) { } void Sound::talkSound(uint32 a, uint32 b, int mode, int channel) { + if (_vm->_version >= 6 && ConfMan.getBool("speech_mute")) + return; + if (mode == 1) { _talk_sound_a1 = a; _talk_sound_b1 = b; -- cgit v1.2.3