diff options
author | Max Horn | 2006-05-13 17:30:04 +0000 |
---|---|---|
committer | Max Horn | 2006-05-13 17:30:04 +0000 |
commit | 0d6362ea485f89a940ffadd1c6fe954f94309c53 (patch) | |
tree | 1b6c0e09ff11ae5cb4d193333981304b6497c4d5 | |
parent | 61c3f9d4aae5d7cbbc706a9fb1ecd0ef0f21bbf2 (diff) | |
download | scummvm-rg350-0d6362ea485f89a940ffadd1c6fe954f94309c53.tar.gz scummvm-rg350-0d6362ea485f89a940ffadd1c6fe954f94309c53.tar.bz2 scummvm-rg350-0d6362ea485f89a940ffadd1c6fe954f94309c53.zip |
Patch #1091170: ALL, SCUMM: Subtitle speed control
svn-id: r22456
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | engines/queen/journal.cpp | 2 | ||||
-rw-r--r-- | engines/queen/queen.cpp | 5 | ||||
-rw-r--r-- | engines/scumm/dialogs.cpp | 19 | ||||
-rw-r--r-- | engines/scumm/dialogs.h | 4 | ||||
-rw-r--r-- | engines/scumm/input.cpp | 3 | ||||
-rw-r--r-- | engines/scumm/script.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/script_v8.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 30 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 2 | ||||
-rw-r--r-- | gui/launcher.cpp | 9 | ||||
-rw-r--r-- | gui/options.cpp | 160 | ||||
-rw-r--r-- | gui/options.h | 21 | ||||
-rw-r--r-- | gui/theme-config.cpp | 40 | ||||
-rw-r--r-- | gui/themes/modern.ini | 40 |
15 files changed, 268 insertions, 73 deletions
@@ -18,10 +18,12 @@ For a more comprehensive changelog for the latest experimental CVS code, see: - Restructured our source tree partially. - Fixed a bug that prevented you from overriding the scaler from the command line for 640x480 games. + - Added subtitle configuration controls to the Launcher options dialogs. SCUMM: - Rewrote the detection code, for improved accuracy and better support of fan translations. It should now work much better on games with unknown MD5. + - Added subtitle configuration controls to the options dialog. Broken Sword 1: - Added support for the --save-slot option. diff --git a/engines/queen/journal.cpp b/engines/queen/journal.cpp index d6298777c2..1a0c511b6d 100644 --- a/engines/queen/journal.cpp +++ b/engines/queen/journal.cpp @@ -310,7 +310,7 @@ void Journal::handleMouseDown(int x, int y) { enterYesNoPanelMode(zoneNum, TXT_GIVE_UP); break; case ZN_TEXT_SPEED: - val = (x - 136) * QueenEngine::MAX_TEXT_SPEED / (266 - 136); + val = (x - 136) * QueenEngine::MAX_TEXT_SPEED / (266 - 136); _vm->talkSpeed(val); drawConfigPanel(); break; diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index 305d5034d2..32ed860b75 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -186,7 +186,7 @@ void QueenEngine::readOptionSettings() { _music->setVolume(ConfMan.getInt("music_volume")); _sound->musicToggle(!ConfMan.getBool("music_mute")); _sound->sfxToggle(!ConfMan.getBool("sfx_mute")); - _talkSpeed = ConfMan.getInt("talkspeed"); + _talkSpeed = (ConfMan.getInt("talkspeed") * (MAX_TEXT_SPEED - MIN_TEXT_SPEED) + 255 / 2) / 255 + MIN_TEXT_SPEED; _sound->speechToggle(!ConfMan.getBool("speech_mute")); _subtitles = ConfMan.getBool("subtitles"); checkOptionSettings(); @@ -196,7 +196,7 @@ void QueenEngine::writeOptionSettings() { ConfMan.setInt("music_volume", _music->volume()); ConfMan.setBool("music_mute", !_sound->musicOn()); ConfMan.setBool("sfx_mute", !_sound->sfxOn()); - ConfMan.setInt("talkspeed", _talkSpeed); + ConfMan.setInt("talkspeed", ((_talkSpeed - MIN_TEXT_SPEED) * 255 + (MAX_TEXT_SPEED - MIN_TEXT_SPEED) / 2) / (MAX_TEXT_SPEED - MIN_TEXT_SPEED)); ConfMan.setBool("speech_mute", !_sound->speechOn()); ConfMan.setBool("subtitles", _subtitles); ConfMan.flushToDisk(); @@ -444,6 +444,7 @@ int QueenEngine::init() { _sound = Sound::giveSound(_mixer, this, _resource->compression()); _walk = new Walk(this); + //_talkspeedScale = (MAX_TEXT_SPEED - MIN_TEXT_SPEED) / 255.0; registerDefaultSettings(); readOptionSettings(); diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index 18e2d3e3e1..17b86067f9 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -608,7 +608,7 @@ void MainMenuDialog::open() { #pragma mark - enum { - kOKCmd = 'ok ' + kOKCmd = 'ok ' }; enum { @@ -653,8 +653,8 @@ ConfigDialog::ConfigDialog() // Some misc options // - _subtitlesCheckbox = new GUI::CheckboxWidget(this, "scummconfig_subtitlesCheckbox", "Show subtitles", 0, 'S'); - _speechCheckbox = new GUI::CheckboxWidget(this, "scummconfig_speechCheckbox", "Enable speech", 0, 'E'); + // SCUMM has a talkspeed range of 0-9 + addSubtitleControls(this, "scummconfig_", 9); // // Add the buttons @@ -683,19 +683,9 @@ ConfigDialog::~ConfigDialog() { void ConfigDialog::open() { GUI_OptionsDialog::open(); - - // update checkboxes, too - _subtitlesCheckbox->setState(ConfMan.getBool("subtitles", _domain)); - _speechCheckbox->setState(!ConfMan.getBool("speech_mute", _domain)); } void ConfigDialog::close() { - if (getResult()) { - // Subtitles - ConfMan.setBool("subtitles", _subtitlesCheckbox->getState(), _domain); - ConfMan.setBool("speech_mute", !_speechCheckbox->getState(), _domain); - } - GUI_OptionsDialog::close(); } @@ -927,8 +917,9 @@ void ValueDisplayDialog::drawDialog() { } void ValueDisplayDialog::handleTickle() { - if (getMillis() > _timer) + if (getMillis() > _timer) { close(); + } } void ValueDisplayDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h index 33ef7ebd23..37b706b96e 100644 --- a/engines/scumm/dialogs.h +++ b/engines/scumm/dialogs.h @@ -140,10 +140,6 @@ public: virtual void open(); virtual void close(); virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); - -protected: - GUI::CheckboxWidget *_subtitlesCheckbox; - GUI::CheckboxWidget *_speechCheckbox; }; /** diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index 10492d04f9..73ba0ac926 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -445,6 +445,9 @@ void ScummEngine::processKbd(bool smushMode) { // Display the talk speed ValueDisplayDialog dlg("Text speed: ", 0, 9, 9 - _defaultTalkDelay, '+', '-'); _defaultTalkDelay = 9 - runDialog(dlg); + + // Save the new talkspeed value to ConfMan + setTalkspeed(9 - _defaultTalkDelay); if (VAR_CHARINC != 0xFF) VAR(VAR_CHARINC) = _defaultTalkDelay; diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index fa014a4465..f3915ea4e1 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -617,7 +617,7 @@ void ScummEngine::writeVar(uint var, int value) { } if (var == VAR_CHARINC && ConfMan.hasKey("talkspeed")) { - uint talkspeed = ConfMan.getInt("talkspeed"); + uint talkspeed = getTalkspeed(); if (talkspeed <= 9) VAR(VAR_CHARINC) = talkspeed; } else { diff --git a/engines/scumm/script_v8.cpp b/engines/scumm/script_v8.cpp index c3be9a4af0..9bf3ba5b1e 100644 --- a/engines/scumm/script_v8.cpp +++ b/engines/scumm/script_v8.cpp @@ -420,7 +420,7 @@ void ScummEngine_v8::writeVar(uint var, int value) { checkRange(_numVariables - 1, 0, var, "Variable %d out of range(w)"); if (var == VAR_CHARINC && ConfMan.hasKey("talkspeed")) { - uint talkspeed = ConfMan.getInt("talkspeed"); + uint talkspeed = getTalkspeed(); if (talkspeed <= 9) VAR(VAR_CHARINC) = talkspeed; } else diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 4ec64eea15..4037482f14 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -499,6 +499,12 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) VAR_SOUNDPARAM3 = 0xFF; VAR_MOUSEPRESENT = 0xFF; VAR_MEMORY_PERFORMANCE = 0xFF; + + if (ConfMan.hasKey("talkspeed")) { + _defaultTalkDelay = 9 - getTalkspeed(); + VAR_CHARINC = _defaultTalkDelay; + } + VAR_VIDEO_PERFORMANCE = 0xFF; VAR_ROOM_FLAG = 0xFF; VAR_GAME_LOADED = 0xFF; @@ -1498,7 +1504,6 @@ void ScummEngine::updateSoundSettings() { _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic); _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech); - if (ConfMan.getBool("speech_mute")) _voiceMode = 2; else @@ -1506,8 +1511,31 @@ void ScummEngine::updateSoundSettings() { if (VAR_VOICE_MODE != 0xFF) VAR(VAR_VOICE_MODE) = _voiceMode; + + _defaultTalkDelay = 9 - getTalkspeed(); + VAR(VAR_CHARINC) = _defaultTalkDelay; } +void ScummEngine::setTalkspeed(int talkspeed) { + /*if (talkspeed != 0) + if (talkspeed == 9) + talkspeed = 255; + else + talkspeed = (int)(talkspeed * 255.0 / 9.0 + 0.5);*/ + ConfMan.setInt("talkspeed", (talkspeed * 255 + 9 / 2) / 9); +} + +int ScummEngine::getTalkspeed() { + /*int talkspeed = ConfMan.getInt("talkspeed"); + + if (talkspeed != 0) + if (talkspeed == 255) + talkspeed = 9; + else + talkspeed = (int)(talkspeed * 9.0 / 255.0 + 0.5); + return talkspeed;*/ + return (ConfMan.getInt("talkspeed") * 9 + 255 / 2) / 255; +} #pragma mark - diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 3b19795dc6..e77418f28e 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -470,6 +470,8 @@ protected: void loadCJKFont(); void setupMusic(int midi); void updateSoundSettings(); + void setTalkspeed(int talkspeed); + int getTalkspeed(); protected: // Scumm main loop & helper functions. diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 92bc6b0fc8..a68a514b05 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -189,7 +189,9 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) _platformPopUp->appendEntry(p->description, p->id); } + // // 2) The 'Path' tab + // tab->addTab("Paths"); // These buttons have to be extra wide, or the text will be truncated @@ -230,6 +232,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) _globalAudioOverride = new CheckboxWidget(tab, "gameoptions_audioCheckbox", "Override global audio settings", kCmdGlobalAudioOverride, 0); addAudioControls(tab, "gameoptions_"); + addSubtitleControls(tab, "gameoptions_"); // // 5) The MIDI tab @@ -249,7 +252,6 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) addVolumeControls(tab, "gameoptions_"); - // Activate the first tab tab->setActiveTab(0); @@ -271,7 +273,8 @@ void EditGameDialog::open() { _globalGraphicsOverride->setState(e); e = ConfMan.hasKey("music_driver", _domain) || - ConfMan.hasKey("subtitles", _domain); + ConfMan.hasKey("subtitles", _domain) || + ConfMan.hasKey("talkspeed", _domain); _globalAudioOverride->setState(e); e = ConfMan.hasKey("multi_midi", _domain) || @@ -346,6 +349,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat break; case kCmdGlobalAudioOverride: setAudioSettingsState(data != 0); + setSubtitleSettingsState(data != 0); draw(); break; case kCmdGlobalMIDIOverride: @@ -356,7 +360,6 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat setVolumeSettingsState(data != 0); draw(); break; - case kCmdChooseSoundFontCmd: { BrowserDialog browser("Select SoundFont", false); diff --git a/gui/options.cpp b/gui/options.cpp index 46128dad6f..1db3100081 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -55,11 +55,13 @@ namespace GUI { // - music & graphics driver (but see also the comments on EditGameDialog // for some techincal difficulties with this) // - default volumes (sfx/speech/music) -// - aspect ratio, language, platform, subtitles, debug mode/level, cd drive, joystick, multi midi, native mt32 +// - aspect ratio, language, platform, debug mode/level, cd drive, joystick, multi midi, native mt32 enum { kMusicVolumeChanged = 'muvc', kSfxVolumeChanged = 'sfvc', + kSubtitleToggle = 'sttg', + kSubtitleSpeedChanged = 'stsc', kSpeechVolumeChanged = 'vcvc', kChooseSoundFontCmd = 'chsf', kChooseSaveDirCmd = 'chos', @@ -83,6 +85,12 @@ OptionsDialog::OptionsDialog(const String &domain, String name) init(); } +const char *OptionsDialog::_subModeDesc[] = { + "Speech Only", + "Speech and Subtitles", + "Subtitles Only" +}; + void OptionsDialog::init() { _enableGraphicSettings = false; _gfxPopUp = 0; @@ -90,19 +98,26 @@ void OptionsDialog::init() { _fullscreenCheckbox = 0; _aspectCheckbox = 0; _enableAudioSettings = false; - _subCheckbox = 0; _midiPopUp = 0; _enableMIDISettings = false; _multiMidiCheckbox = 0; _mt32Checkbox = 0; _enableGSCheckbox = 0; _enableVolumeSettings = false; + _musicVolumeDesc = 0; _musicVolumeSlider = 0; _musicVolumeLabel = 0; + _sfxVolumeDesc = 0; _sfxVolumeSlider = 0; _sfxVolumeLabel = 0; + _speechVolumeDesc = 0; _speechVolumeSlider = 0; _speechVolumeLabel = 0; + _subToggleDesc = 0; + _subToggleButton = 0; + _subSpeedDesc = 0; + _subSpeedSlider = 0; + _subSpeedLabel = 0; } void OptionsDialog::open() { @@ -111,6 +126,7 @@ void OptionsDialog::open() { // Reset result value setResult(0); + // Graphic options if (_fullscreenCheckbox) { _gfxPopUp->setSelected(0); @@ -150,7 +166,8 @@ void OptionsDialog::open() { #endif } - if (_subCheckbox) { + // Audio options + if (_midiPopUp) { // Music driver const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers(); int i = 0; @@ -163,9 +180,6 @@ void OptionsDialog::open() { md++; } _midiPopUp->setSelected(md->name ? i : 0); - - // Subtitles setting - _subCheckbox->setState(ConfMan.getBool("subtitles", _domain)); } if (_multiMidiCheckbox) { @@ -202,10 +216,27 @@ void OptionsDialog::open() { _speechVolumeSlider->setValue(vol); _speechVolumeLabel->setValue(vol); } + + // Subtitle options + if (_subToggleButton) { + int speed; + int sliderMaxValue = _subSpeedSlider->getMaxValue(); + + _subMode = getSubtitleMode(ConfMan.getBool("subtitles", _domain), ConfMan.getBool("speech_mute")); + _subToggleButton->setLabel(_subModeDesc[_subMode]); + + // Engines that reuse the subtitle speed widget set their own max value. + // Scale the config value accordingly (see addSubtitleControls) + speed = (ConfMan.getInt("talkspeed", _domain) * sliderMaxValue + 255 / 2) / 255; + _subSpeedSlider->setValue(speed); + _subSpeedLabel->setValue(speed); + } } void OptionsDialog::close() { if (getResult()) { + + // Graphic options if (_fullscreenCheckbox) { if (_enableGraphicSettings) { ConfMan.setBool("fullscreen", _fullscreenCheckbox->getState(), _domain); @@ -224,6 +255,7 @@ void OptionsDialog::close() { } } + // Volume options if (_musicVolumeSlider) { if (_enableVolumeSettings) { ConfMan.setInt("music_volume", _musicVolumeSlider->getValue(), _domain); @@ -236,9 +268,9 @@ void OptionsDialog::close() { } } - if (_subCheckbox) { + // Audio options + if (_midiPopUp) { if (_enableAudioSettings) { - ConfMan.setBool("subtitles", _subCheckbox->getState(), _domain); const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers(); while (md->name && md->id != (int)_midiPopUp->getSelectedTag()) md++; @@ -248,7 +280,6 @@ void OptionsDialog::close() { ConfMan.removeKey("music_driver", _domain); } else { ConfMan.removeKey("music_driver", _domain); - ConfMan.removeKey("subtitles", _domain); } } @@ -270,6 +301,42 @@ void OptionsDialog::close() { } } + // Subtitle options + if (_subToggleButton) { + if (_enableSubtitleSettings) { + bool subtitles, speech_mute; + int talkspeed; + int sliderMaxValue = _subSpeedSlider->getMaxValue(); + + switch (_subMode) { + case 0: + subtitles = speech_mute = false; + break; + case 1: + subtitles = true; + speech_mute = false; + break; + case 2: + default: + subtitles = speech_mute = true; + break; + } + + ConfMan.setBool("subtitles", subtitles, _domain); + ConfMan.setBool("speech_mute", speech_mute, _domain); + + // Engines that reuse the subtitle speed widget set their own max value. + // Scale the config value accordingly (see addSubtitleControls) + talkspeed = (_subSpeedSlider->getValue() * 255 + sliderMaxValue / 2) / sliderMaxValue; + ConfMan.setInt("talkspeed", talkspeed, _domain); + + } else { + ConfMan.removeKey("subtitles", _domain); + ConfMan.removeKey("talkspeed", _domain); + ConfMan.removeKey("speech_mute", _domain); + } + } + // Save config file ConfMan.flushToDisk(); } @@ -291,6 +358,22 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data _speechVolumeLabel->setValue(_speechVolumeSlider->getValue()); _speechVolumeLabel->draw(); break; + case kSubtitleToggle: + if (_subMode < 2) + _subMode++; + else + _subMode = 0; + + _subToggleButton->setLabel(_subModeDesc[_subMode]); + _subToggleButton->draw(); + _subSpeedDesc->draw(); + _subSpeedSlider->draw(); + _subSpeedLabel->draw(); + break; + case kSubtitleSpeedChanged: + _subSpeedLabel->setValue(_subSpeedSlider->getValue()); + _subSpeedLabel->draw(); + break; case kOKCmd: setResult(1); close(); @@ -315,7 +398,6 @@ void OptionsDialog::setAudioSettingsState(bool enabled) { _enableAudioSettings = enabled; _midiPopUp->setEnabled(enabled); - _subCheckbox->setEnabled(enabled); } void OptionsDialog::setMIDISettingsState(bool enabled) { @@ -331,14 +413,27 @@ void OptionsDialog::setMIDISettingsState(bool enabled) { void OptionsDialog::setVolumeSettingsState(bool enabled) { _enableVolumeSettings = enabled; + _musicVolumeDesc->setEnabled(enabled); _musicVolumeSlider->setEnabled(enabled); _musicVolumeLabel->setEnabled(enabled); + _sfxVolumeDesc->setEnabled(enabled); _sfxVolumeSlider->setEnabled(enabled); _sfxVolumeLabel->setEnabled(enabled); + _speechVolumeDesc->setEnabled(enabled); _speechVolumeSlider->setEnabled(enabled); _speechVolumeLabel->setEnabled(enabled); } +void OptionsDialog::setSubtitleSettingsState(bool enabled) { + _enableSubtitleSettings = enabled; + + _subToggleButton->setEnabled(enabled); + _subToggleDesc->setEnabled(enabled); + _subSpeedDesc->setEnabled(enabled); + _subSpeedSlider->setEnabled(enabled); + _subSpeedLabel->setEnabled(enabled); +} + void OptionsDialog::addGraphicControls(GuiObject *boss, String prefix) { const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes(); @@ -391,9 +486,6 @@ void OptionsDialog::addAudioControls(GuiObject *boss, String prefix) { md++; } - // Subtitles on/off - _subCheckbox = new CheckboxWidget(boss, prefix + "auSubtitlesCheckbox", "Display subtitles", 0, 0); - _enableAudioSettings = true; } @@ -414,29 +506,41 @@ void OptionsDialog::addMIDIControls(GuiObject *boss, String prefix) { _enableMIDISettings = true; } +// The function has an extra slider range parameter, since both the launcher and SCUMM engine +// make use of the widgets. The launcher range is 0-255. SCUMM's 0-9 +void OptionsDialog::addSubtitleControls(GuiObject *boss, String prefix, int maxSliderVal) { + + _subToggleDesc = new StaticTextWidget(boss, prefix + "subToggleDesc", "Text and Speech:"); + _subToggleButton = new ButtonWidget(boss, prefix + "subToggleButton", "", kSubtitleToggle, 0); + + // Subtitle speed + _subSpeedDesc = new StaticTextWidget(boss, prefix + "subSubtitleSpeedDesc", "Subtitle speed:"); + _subSpeedSlider = new SliderWidget(boss, prefix + "subSubtitleSpeedSlider", kSubtitleSpeedChanged); + _subSpeedLabel = new StaticTextWidget(boss, prefix + "subSubtitleSpeedLabel", "100%"); + _subSpeedSlider->setMinValue(0); _subSpeedSlider->setMaxValue(maxSliderVal); + _subSpeedLabel->setFlags(WIDGET_CLEARBG); + + _enableSubtitleSettings = true; +} + void OptionsDialog::addVolumeControls(GuiObject *boss, String prefix) { - const char *slider_labels[] = { - "Music volume:", - "SFX volume:", - "Speech volume:" - }; // Volume controllers - new StaticTextWidget(boss, prefix + "vcMusicText", slider_labels[0]); + _musicVolumeDesc = new StaticTextWidget(boss, prefix + "vcMusicText", "Music volume:"); _musicVolumeSlider = new SliderWidget(boss, prefix + "vcMusicSlider", kMusicVolumeChanged); _musicVolumeLabel = new StaticTextWidget(boss, prefix + "vcMusicLabel", "100%"); _musicVolumeSlider->setMinValue(0); _musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); _musicVolumeLabel->setFlags(WIDGET_CLEARBG); - new StaticTextWidget(boss, prefix + "vcSfxText", slider_labels[1]); + _sfxVolumeDesc = new StaticTextWidget(boss, prefix + "vcSfxText", "SFX volume:"); _sfxVolumeSlider = new SliderWidget(boss, prefix + "vcSfxSlider", kSfxVolumeChanged); _sfxVolumeLabel = new StaticTextWidget(boss, prefix + "vcSfxLabel", "100%"); _sfxVolumeSlider->setMinValue(0); _sfxVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); _sfxVolumeLabel->setFlags(WIDGET_CLEARBG); - new StaticTextWidget(boss, prefix + "vcSpeechText" , slider_labels[2]); + _speechVolumeDesc = new StaticTextWidget(boss, prefix + "vcSpeechText" , "Speech volume:"); _speechVolumeSlider = new SliderWidget(boss, prefix + "vcSpeechSlider", kSpeechVolumeChanged); _speechVolumeLabel = new StaticTextWidget(boss, prefix + "vcSpeechLabel", "100%"); _speechVolumeSlider->setMinValue(0); @@ -446,6 +550,18 @@ void OptionsDialog::addVolumeControls(GuiObject *boss, String prefix) { _enableVolumeSettings = true; } +int OptionsDialog::getSubtitleMode(bool subtitles, bool speech_mute) { + if (!subtitles && !speech_mute) // Speech only + return 0; + else if (subtitles && !speech_mute) // Speech and subtitles + return 1; + else if (subtitles && speech_mute) // Subtitles only + return 2; + else + warning("Wrong configuration: Both subtitles and speech are off. Assuming subtitles only"); + return 2; +} + void OptionsDialog::handleScreenChanged() { Dialog::handleScreenChanged(); @@ -481,6 +597,8 @@ GlobalOptionsDialog::GlobalOptionsDialog() tab->addTab("Audio"); addAudioControls(tab, "globaloptions_"); addVolumeControls(tab, "globaloptions_"); + addSubtitleControls(tab, "globaloptions_"); + // TODO: cd drive setting // diff --git a/gui/options.h b/gui/options.h index 343aae33af..aca2f39a47 100644 --- a/gui/options.h +++ b/gui/options.h @@ -66,11 +66,15 @@ protected: void addAudioControls(GuiObject *boss, String prefix); void addMIDIControls(GuiObject *boss, String prefix); void addVolumeControls(GuiObject *boss, String prefix); + // The default value is the launcher's non-scaled talkspeed value. When SCUMM uses the widget, + // it uses its own scale + void addSubtitleControls(GuiObject *boss, String prefix, int maxSliderVal = 255); void setGraphicSettingsState(bool enabled); void setAudioSettingsState(bool enabled); void setMIDISettingsState(bool enabled); void setVolumeSettingsState(bool enabled); + void setSubtitleSettingsState(bool enabled); private: // @@ -87,7 +91,6 @@ private: // bool _enableAudioSettings; PopUpWidget *_midiPopUp; - CheckboxWidget *_subCheckbox; // // MIDI controls @@ -96,18 +99,34 @@ private: CheckboxWidget *_multiMidiCheckbox; CheckboxWidget *_mt32Checkbox; CheckboxWidget *_enableGSCheckbox; + + // + // Subtitle controls + // + int getSubtitleMode(bool subtitles, bool speech_mute); + bool _enableSubtitleSettings; + StaticTextWidget *_subToggleDesc; + ButtonWidget *_subToggleButton; + int _subMode; + static const char *_subModeDesc[]; + StaticTextWidget *_subSpeedDesc; + SliderWidget *_subSpeedSlider; + StaticTextWidget *_subSpeedLabel; // // Volume controls // bool _enableVolumeSettings; + StaticTextWidget *_musicVolumeDesc; SliderWidget *_musicVolumeSlider; StaticTextWidget *_musicVolumeLabel; + StaticTextWidget *_sfxVolumeDesc; SliderWidget *_sfxVolumeSlider; StaticTextWidget *_sfxVolumeLabel; + StaticTextWidget *_speechVolumeDesc; SliderWidget *_speechVolumeSlider; StaticTextWidget *_speechVolumeLabel; }; diff --git a/gui/theme-config.cpp b/gui/theme-config.cpp index 708a84ba09..c9c83c7dbc 100644 --- a/gui/theme-config.cpp +++ b/gui/theme-config.cpp @@ -50,6 +50,7 @@ const char *Theme::_defaultConfigINI = "def_scummhelpX=5\n" "def_scummhelpW=(w - 2 * 5)\n" "def_midiControlsSpacing=1\n" +"def_vcAudioTabIndent=0\n" "use=XxY\n" "# Scumm Saveload dialog\n" "scummsaveload=8 8 (w - 2 * 8) (h - 16)\n" @@ -85,6 +86,7 @@ const char *Theme::_defaultConfigINI = "def_scummhelpW=370\n" "def_scummhelpX=((w - scummhelpW) / 2)\n" "def_midiControlsSpacing=2\n" +"def_vcAudioTabIndent=10\n" "##### Widgets config\n" "ListWidget.leftPadding=4\n" "ListWidget.rightPadding=0\n" @@ -141,12 +143,14 @@ const char *Theme::_defaultConfigINI = "\n" "# graphics tab\n" "opYoffset=vBorder\n" +"opXoffset=0\n" "useWithPrefix=graphicsControls globaloptions_\n" "\n" "# audio tab\n" "opYoffset=vBorder\n" "useWithPrefix=audioControls globaloptions_\n" "useWithPrefix=volumeControls globaloptions_\n" +"useWithPrefix=subtitleControls globaloptions_\n" "\n" "# MIDI tab\n" "opYoffset=vBorder\n" @@ -205,6 +209,7 @@ const char *Theme::_defaultConfigINI = "\n" "# graphics tab\n" "opYoffset=vBorder\n" +"opXoffset=gox\n" "gameoptions_graphicsCheckbox=gox opYoffset (kFontHeight + 10 + 192) buttonHeight\n" "opYoffset=(opYoffset + buttonHeight)\n" "useWithPrefix=graphicsControls gameoptions_\n" @@ -214,6 +219,7 @@ const char *Theme::_defaultConfigINI = "gameoptions_audioCheckbox=gox opYoffset (kFontHeight + 10 + 180) buttonHeight\n" "opYoffset=(opYoffset + buttonHeight)\n" "useWithPrefix=audioControls gameoptions_\n" +"useWithPrefix=subtitleControls gameoptions_\n" "\n" "# midi tab\n" "opYoffset=vBorder\n" @@ -251,9 +257,8 @@ const char *Theme::_defaultConfigINI = "# hence it is on the end of the list\n" "opYoffset=8\n" "useWithPrefix=volumeControls scummconfig_\n" -"scummconfig_subtitlesCheckbox=15 opYoffset (kFontHeight + 10 + 89) buttonHeight\n" +"useWithPrefix=subtitleControls scummconfig_\n" "opYoffset=(opYoffset + buttonHeight)\n" -"scummconfig_speechCheckbox=prev.x opYoffset (kFontHeight + 10 + 85) buttonHeight\n" "opYoffset=(opYoffset + buttonHeight + 4)\n" "soWidth=(8 + 3 * buttonWidth + 4)\n" "scummconfig_keys=(soWidth - 3 * (buttonWidth + 4) + 6) opYoffset (buttonWidth - 10) buttonHeight\n" @@ -299,7 +304,6 @@ const char *Theme::_defaultConfigINI = "chooser_cancel=(chooserW - 2 * (buttonWidth + 10)) (opHeight - buttonHeight - 8) buttonWidth buttonHeight\n" "chooser_ok=(prev.x2 + 10) prev.y prev.w prev.h\n" "\n" -"\n" "[graphicsControls]\n" "gcx=10\n" "gcw=(parent.w - 2 * 10)\n" @@ -316,24 +320,23 @@ const char *Theme::_defaultConfigINI = "aux=10\n" "auw=(parent.w - 2 * 10)\n" "auMidiPopup=(aux - 5) (opYoffset - 1) (auw + 5) (kLineHeight + 2)\n" -"opYoffset=(opYoffset + kLineHeight + 4)\n" -"auSubtitlesCheckbox=aux opYoffset (kFontHeight + 10 + 102) buttonHeight\n" -"opYoffset=(opYoffset + buttonHeight + 18)\n" +"opYoffset=(opYoffset + buttonHeight + 4)\n" "\n" "[volumeControls]\n" -"vctextw=95\n" -"vcxoff=(vctextw + 15)\n" -"vcMusicText=10 (opYoffset + 2) vctextw kLineHeight\n" +"vctextw=(95 + vcAudioTabIndent)\n" +"vcxoff=(opXoffset + vctextw + 15)\n" +"vcx=(opXoffset + 10)\n" +"vcMusicText=vcx (opYoffset + 2) vctextw kLineHeight\n" "vcMusicText.align=kTextAlignRight\n" "vcMusicSlider=vcxoff opYoffset sliderWidth sliderHeight\n" "vcMusicLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight\n" "opYoffset=(opYoffset + sliderHeight + 4)\n" -"vcSfxText=10 (opYoffset + 2) vctextw kLineHeight\n" +"vcSfxText=vcx (opYoffset + 2) vctextw kLineHeight\n" "vcSfxText.align=kTextAlignRight\n" "vcSfxSlider=vcxoff opYoffset sliderWidth sliderHeight\n" "vcSfxLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight\n" "opYoffset=(opYoffset + sliderHeight + 4)\n" -"vcSpeechText=10 (opYoffset + 2) vctextw kLineHeight\n" +"vcSpeechText=vcx (opYoffset + 2) vctextw kLineHeight\n" "vcSpeechText.align=kTextAlignRight\n" "vcSpeechSlider=vcxoff opYoffset sliderWidth sliderHeight\n" "vcSpeechLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight\n" @@ -351,6 +354,21 @@ const char *Theme::_defaultConfigINI = "mcGSCheckbox=mcx opYoffset (kFontHeight + 10 + 142) buttonHeight\n" "opYoffset=(opYoffset + buttonHeight + midiControlsSpacing)\n" "\n" +"[subtitleControls]\n" +"sbx=(opXoffset + 10)\n" +"sbYoff=(buttonHeight / 8)\n" +"sbOff=((sliderHeight - kLineHeight) / 2 + 2)\n" +"sbtextw=(100 + vcAudioTabIndent)\n" +"opYoffset=(opYoffset + sbYoff)\n" +"subToggleDesc=sbx (opYoffset + sbYoff) sbtextw buttonHeight\n" +"subToggleButton=prev.x2 (opYoffset - sbYoff) (buttonWidth + 54) buttonHeight\n" +"opYoffset=(opYoffset + buttonHeight + 6)\n" +"subSubtitleSpeedDesc=sbx (opYoffset + sbOff) sbtextw kLineHeight\n" +"subSubtitleSpeedDesc.align=kTextAlignRight\n" +"subSubtitleSpeedSlider=prev.x2 opYoffset sliderWidth sliderHeight\n" +"subSubtitleSpeedLabel=(prev.x2 + 10) (opYoffset + sbOff) 24 kLineHeight\n" +"opYoffset=(opYoffset + sliderHeight + 8)\n" +"\n" "[scummmain]\n" "## Main dialog\n" "# note that scummmain size depends on overall height\n" diff --git a/gui/themes/modern.ini b/gui/themes/modern.ini index 0bc67b7edb..6c6e5d51b4 100644 --- a/gui/themes/modern.ini +++ b/gui/themes/modern.ini @@ -234,6 +234,7 @@ useWithPrefix=graphicsControls globaloptions_ opYoffset=vBorder useWithPrefix=audioControls globaloptions_ useWithPrefix=volumeControls globaloptions_ +useWithPrefix=subtitleControls globaloptions_ # MIDI tab opYoffset=vBorder @@ -302,6 +303,7 @@ opYoffset=vBorder gameoptions_audioCheckbox=gox opYoffset (kFontHeight + 10 + 180) buttonHeight opYoffset=(opYoffset + buttonHeight + 6) useWithPrefix=audioControls gameoptions_ +useWithPrefix=subtitleControls gameoptions_ # midi tab opYoffset=vBorder @@ -341,9 +343,8 @@ use=scummmain # hence it is on the end of the list opYoffset=8 useWithPrefix=volumeControls scummconfig_ -scummconfig_subtitlesCheckbox=15 opYoffset (kFontHeight + 10 + 89) buttonHeight +useWithPrefix=subtitleControls scummconfig_ opYoffset=(opYoffset + buttonHeight) -scummconfig_speechCheckbox=prev.x opYoffset (kFontHeight + 10 + 85) buttonHeight opYoffset=(opYoffset + buttonHeight + 4) soWidth=(8 + 3 * buttonWidth + 4) scummconfig_keys=(soWidth - 3 * (buttonWidth + 4) + 6) opYoffset (buttonWidth - 10) buttonHeight @@ -389,7 +390,6 @@ chooser_list=10 (6 + kLineHeight + 2) prev.w (opHeight - self.y - buttonHeight - chooser_cancel=(chooserW - 2 * (buttonWidth + 10)) (opHeight - buttonHeight - 8) buttonWidth buttonHeight chooser_ok=(prev.x2 + 10) prev.y prev.w prev.h - [graphicsControls] gcx=(opXoffset + 10) gcw=(parent.w - gcx - 25) @@ -404,26 +404,25 @@ opYoffset=(opYoffset + buttonHeight + 4) [audioControls] aux=(opXoffset + 10) -auw=(parent.w - aux - 25) -auMidiPopup=(aux - 5) (opYoffset - 1) (auw + 5) (kLineHeight + 2) -opYoffset=(opYoffset + kLineHeight + 16) -auSubtitlesCheckbox=aux opYoffset (kFontHeight + 10 + 102) buttonHeight -opYoffset=(opYoffset + buttonHeight + 18) +auw=(parent.w - aux - 30) +auMidiPopup=(aux) (opYoffset - 1) (auw + 5) (kLineHeight + 2) +opYoffset=(opYoffset + buttonHeight + 4) [volumeControls] -vctextw=95 -vcxoff=(vctextw + 15) -vcMusicText=10 (opYoffset + 2) vctextw kLineHeight +vctextw=110 +vcxoff=(opXoffset + vctextw + 10) +vcx=(opXoffset + 10) +vcMusicText=vcx (opYoffset + 2) vctextw kLineHeight vcMusicText.align=kTextAlignRight vcMusicSlider=vcxoff opYoffset sliderWidth sliderHeight vcMusicLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight opYoffset=(opYoffset + sliderHeight + 8) -vcSfxText=10 (opYoffset + 2) vctextw kLineHeight +vcSfxText=vcx (opYoffset + 2) vctextw kLineHeight vcSfxText.align=kTextAlignRight vcSfxSlider=vcxoff opYoffset sliderWidth sliderHeight vcSfxLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight opYoffset=(opYoffset + sliderHeight + 8) -vcSpeechText=10 (opYoffset + 2) vctextw kLineHeight +vcSpeechText=vcx (opYoffset + 2) vctextw kLineHeight vcSpeechText.align=kTextAlignRight vcSpeechSlider=vcxoff opYoffset sliderWidth sliderHeight vcSpeechLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight @@ -442,6 +441,21 @@ opYoffset=(opYoffset + buttonHeight + midiControlsSpacing) mcGSCheckbox=mcx opYoffset (kFontHeight + 10 + 142) buttonHeight opYoffset=(opYoffset + buttonHeight + midiControlsSpacing) +[subtitleControls] +sbx=(opXoffset + 10) +sbtextw=110 +sbYoff=(buttonHeight / 8) +sbOff=((sliderHeight - kLineHeight) / 2) +opYoffset=(opYoffset + sbYoff) +subToggleDesc=sbx (opYoffset + sbYoff) sbtextw buttonHeight +subToggleButton=prev.x2 opYoffset (buttonWidth + 34) sliderHeight +opYoffset=(opYoffset + buttonHeight + 6) +subSubtitleSpeedDesc=sbx (opYoffset + sbOff) sbtextw kLineHeight +subSubtitleSpeedDesc.align=kTextAlignRight +subSubtitleSpeedSlider=prev.x2 opYoffset sliderWidth sliderHeight +subSubtitleSpeedLabel=(prev.x2 + 10) (opYoffset + sbOff) 24 kLineHeight +opYoffset=(opYoffset + sliderHeight + 8) + [scummmain] ## Main dialog # note that scummmain size depends on overall height |