aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2009-06-06 17:36:06 +0000
committerEugene Sandulenko2009-06-06 17:36:06 +0000
commitc295f524b23af358192ddb352454ebf995dd51b0 (patch)
tree57729a84140851767378088739f8282f6332519a
parent4ceec0dfbbc1978c8c59bcf83e3eb75caa9d0e19 (diff)
downloadscummvm-rg350-c295f524b23af358192ddb352454ebf995dd51b0.tar.gz
scummvm-rg350-c295f524b23af358192ddb352454ebf995dd51b0.tar.bz2
scummvm-rg350-c295f524b23af358192ddb352454ebf995dd51b0.zip
Implement feature request #1180217: "GUI: Mute option"
svn-id: r41233
-rw-r--r--backends/events/default/default-events.cpp5
-rw-r--r--backends/platform/sdl/events.cpp5
-rw-r--r--common/events.h1
-rw-r--r--engines/engine.cpp22
-rw-r--r--engines/engine.h5
-rw-r--r--gui/options.cpp18
-rw-r--r--gui/options.h2
-rw-r--r--gui/themes/scummclassic.zipbin45730 -> 45221 bytes
-rw-r--r--gui/themes/scummmodern.zipbin148944 -> 148602 bytes
-rw-r--r--gui/themes/scummmodern/scummmodern_layout.stx9
10 files changed, 62 insertions, 5 deletions
diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp
index 9b2c8df287..06851c5185 100644
--- a/backends/events/default/default-events.cpp
+++ b/backends/events/default/default-events.cpp
@@ -553,6 +553,11 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
_shouldRTL = true;
break;
+ case Common::EVENT_MUTE:
+ if (g_engine)
+ g_engine->flipMute();
+ break;
+
case Common::EVENT_QUIT:
if (ConfMan.getBool("confirm_exit")) {
if (_confirmExitDialogActive) {
diff --git a/backends/platform/sdl/events.cpp b/backends/platform/sdl/events.cpp
index b4fc5e0777..feb2c9a9c5 100644
--- a/backends/platform/sdl/events.cpp
+++ b/backends/platform/sdl/events.cpp
@@ -252,6 +252,11 @@ bool OSystem_SDL::pollEvent(Common::Event &event) {
}
#endif
+ if ((ev.key.keysym.mod & KMOD_CTRL) && ev.key.keysym.sym == 'u') {
+ event.type = Common::EVENT_MUTE;
+ return true;
+ }
+
// Ctrl-Alt-<key> will change the GFX mode
if ((b & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) {
diff --git a/common/events.h b/common/events.h
index f6a07e3341..e13d95cf47 100644
--- a/common/events.h
+++ b/common/events.h
@@ -61,6 +61,7 @@ enum EventType {
EVENT_MAINMENU = 15,
EVENT_RTL = 16,
+ EVENT_MUTE = 17,
EVENT_QUIT = 10,
EVENT_SCREEN_CHANGED = 11,
diff --git a/engines/engine.cpp b/engines/engine.cpp
index 269bb0bc28..0847e27246 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -304,9 +304,25 @@ void Engine::syncSoundSettings() {
int soundVolumeSFX = ConfMan.getInt("sfx_volume");
int soundVolumeSpeech = ConfMan.getInt("speech_volume");
- _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic);
- _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, soundVolumeSFX);
- _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech);
+ bool mute = false;
+ if (ConfMan.hasKey("mute"))
+ mute = ConfMan.getBool("mute");
+
+ _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, (mute ? 0 : soundVolumeMusic));
+ _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, (mute ? 0 : soundVolumeSFX));
+ _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, (mute ? 0 : soundVolumeSpeech));
+}
+
+void Engine::flipMute() {
+ bool mute = false;
+
+ if (ConfMan.hasKey("mute")) {
+ mute = !ConfMan.getBool("mute");
+ }
+
+ ConfMan.setBool("mute", mute);
+
+ syncSoundSettings();
}
Common::Error Engine::loadGameState(int slot) {
diff --git a/engines/engine.h b/engines/engine.h
index 45477f408d..ff3ce6c326 100644
--- a/engines/engine.h
+++ b/engines/engine.h
@@ -176,6 +176,11 @@ public:
virtual void syncSoundSettings();
/**
+ * Flip mute all sound option.
+ */
+ virtual void flipMute();
+
+ /**
* Load a game state.
* @param slot the slot from which a savestate should be loaded
* @return returns kNoError on success, else an error code.
diff --git a/gui/options.cpp b/gui/options.cpp
index 415d7ca357..2e23a4dc61 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -119,6 +119,7 @@ void OptionsDialog::init() {
_speechVolumeDesc = 0;
_speechVolumeSlider = 0;
_speechVolumeLabel = 0;
+ _muteCheckbox = 0;
_subToggleDesc = 0;
_subToggleButton = 0;
_subSpeedDesc = 0;
@@ -240,12 +241,19 @@ void OptionsDialog::open() {
vol = ConfMan.getInt("speech_volume", _domain);
_speechVolumeSlider->setValue(vol);
_speechVolumeLabel->setValue(vol);
+
+ bool val = false;
+ if (ConfMan.hasKey("mute", _domain)) {
+ val = ConfMan.getBool("mute", _domain);
+ } else {
+ ConfMan.setBool("mute", false);
+ }
+ _muteCheckbox->setState(val);
}
// Subtitle options
if (_subToggleButton) {
- int speed;
- int sliderMaxValue = _subSpeedSlider->getMaxValue();
+ int speed; int sliderMaxValue = _subSpeedSlider->getMaxValue();
_subMode = getSubtitleMode(ConfMan.getBool("subtitles", _domain), ConfMan.getBool("speech_mute", _domain));
_subToggleButton->setLabel(_subModeDesc[_subMode]);
@@ -300,10 +308,12 @@ void OptionsDialog::close() {
ConfMan.setInt("music_volume", _musicVolumeSlider->getValue(), _domain);
ConfMan.setInt("sfx_volume", _sfxVolumeSlider->getValue(), _domain);
ConfMan.setInt("speech_volume", _speechVolumeSlider->getValue(), _domain);
+ ConfMan.setBool("mute", _muteCheckbox->getState(), _domain);
} else {
ConfMan.removeKey("music_volume", _domain);
ConfMan.removeKey("sfx_volume", _domain);
ConfMan.removeKey("speech_volume", _domain);
+ ConfMan.removeKey("mute", _domain);
}
}
@@ -514,6 +524,7 @@ void OptionsDialog::setVolumeSettingsState(bool enabled) {
_speechVolumeDesc->setEnabled(enabled);
_speechVolumeSlider->setEnabled(enabled);
_speechVolumeLabel->setEnabled(enabled);
+ _muteCheckbox->setEnabled(enabled);
}
void OptionsDialog::setSubtitleSettingsState(bool enabled) {
@@ -640,6 +651,9 @@ void OptionsDialog::addVolumeControls(GuiObject *boss, const String &prefix) {
_musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
_musicVolumeLabel->setFlags(WIDGET_CLEARBG);
+ _muteCheckbox = new CheckboxWidget(boss, prefix + "vcMuteCheckbox", "Mute All", 0, 0);
+
+
_sfxVolumeDesc = new StaticTextWidget(boss, prefix + "vcSfxText", "SFX volume:");
_sfxVolumeSlider = new SliderWidget(boss, prefix + "vcSfxSlider", kSfxVolumeChanged);
_sfxVolumeLabel = new StaticTextWidget(boss, prefix + "vcSfxLabel", "100%");
diff --git a/gui/options.h b/gui/options.h
index 53fc5e2d01..4edf12a0df 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -145,6 +145,8 @@ private:
StaticTextWidget *_speechVolumeDesc;
SliderWidget *_speechVolumeSlider;
StaticTextWidget *_speechVolumeLabel;
+
+ CheckboxWidget *_muteCheckbox;
};
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 798f4d292f..7dcf3402ed 100644
--- a/gui/themes/scummclassic.zip
+++ b/gui/themes/scummclassic.zip
Binary files differ
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index a67b11f244..9838b8b2f4 100644
--- a/gui/themes/scummmodern.zip
+++ b/gui/themes/scummmodern.zip
Binary files differ
diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index 736fce87f2..6246b6c965 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -252,6 +252,11 @@
/>
<widget name = 'vcSfxLabel'
type = 'SmallLabel'
+ width = "40"
+ />
+ <space/>
+ <widget name = 'vcMuteCheckbox'
+ type = 'Checkbox'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0'>
@@ -592,8 +597,12 @@
/>
<widget name = 'vcSfxLabel'
type = 'SmallLabel'
+ width = "40"
/>
</layout>
+ <widget name = 'vcMuteCheckbox'
+ type = 'Checkbox'
+ />
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '8'>
<widget name = 'vcSpeechText'
type = 'OptionsLabel'