mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-03 23:52:41 +00:00
parent
4ceec0dfbb
commit
c295f524b2
@ -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) {
|
||||
|
@ -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)) {
|
||||
|
||||
|
@ -61,6 +61,7 @@ enum EventType {
|
||||
|
||||
EVENT_MAINMENU = 15,
|
||||
EVENT_RTL = 16,
|
||||
EVENT_MUTE = 17,
|
||||
|
||||
EVENT_QUIT = 10,
|
||||
EVENT_SCREEN_CHANGED = 11,
|
||||
|
@ -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) {
|
||||
|
@ -175,6 +175,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
|
||||
|
@ -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%");
|
||||
|
@ -145,6 +145,8 @@ private:
|
||||
StaticTextWidget *_speechVolumeDesc;
|
||||
SliderWidget *_speechVolumeSlider;
|
||||
StaticTextWidget *_speechVolumeLabel;
|
||||
|
||||
CheckboxWidget *_muteCheckbox;
|
||||
};
|
||||
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user