Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/gumps/AudioOptions_gump.cc b/gumps/AudioOptions_gump.cc
- index d1ef5b7d2..00a2b9879 100644
- --- a/gumps/AudioOptions_gump.cc
- +++ b/gumps/AudioOptions_gump.cc
- @@ -153,10 +153,9 @@ void AudioOptions_gump::rebuild_buttons() {
- rebuild_sfx_buttons();
- // speech on/off
- - buttons[id_speech_enabled] = std::make_unique<AudioEnabledToggle>(this, &AudioOptions_gump::toggle_speech_enabled,
- - speech_enabled, colx[2], rowy[11], 59);
- - if (speech_enabled)
- - rebuild_speech_buttons();
- + std::vector<std::string> speech_options = {"Subtitles only", "Voice only", "Voice + Subtitles"};
- + buttons[id_speech_enabled] = std::make_unique<AudioTextToggle>(this, &AudioOptions_gump::toggle_speech_enabled,
- + std::move(speech_options), speech_option, colx[2] - 49, rowy[11], 108);
- }
- void AudioOptions_gump::rebuild_midi_buttons() {
- @@ -226,17 +225,6 @@ void AudioOptions_gump::rebuild_sfx_buttons() {
- #endif
- }
- -void AudioOptions_gump::rebuild_speech_buttons() {
- - buttons[id_speech_subtitles].reset();
- -
- - if (!speech_enabled)
- - return;
- - else {
- - buttons[id_speech_subtitles] = std::make_unique<AudioEnabledToggle>(this, &AudioOptions_gump::toggle_speech_subtitles,
- - speech_subtitles, colx[2], rowy[12], 59);
- - }
- -}
- -
- void AudioOptions_gump::rebuild_mididriveroption_buttons() {
- std::string s = "Default";
- if (midi_driver != MidiDriver::getDriverCount()) s = MidiDriver::getDriverName(midi_driver);
- @@ -282,6 +270,12 @@ void AudioOptions_gump::load_settings() {
- const bool sfx_on = (Audio::get_ptr()->are_effects_enabled());
- speech_enabled = (Audio::get_ptr()->is_speech_enabled() ? 1 : 0);
- speech_subtitles = (Audio::get_ptr()->is_speech_with_subs() ? 1 : 0);
- + if (speech_enabled == 0)
- + speech_option = 0;
- + else if (speech_enabled == 1 && speech_subtitles == 0)
- + speech_option = 1;
- + else if (speech_enabled == 1 && speech_subtitles == 1)
- + speech_option = 2;
- midi_looping = (Audio::get_ptr()->is_music_looping_allowed() ? 1 : 0);
- speaker_type = true; // stereo
- sample_rate = 44100;
- @@ -478,16 +472,17 @@ void AudioOptions_gump::save_settings() {
- Audio::get_ptr()->set_effects_enabled(sfx_enabled != 0);
- if (!sfx_enabled) // Stop what's playing.
- Audio::get_ptr()->stop_sound_effects();
- - Audio::get_ptr()->set_speech_enabled(speech_enabled == 1);
- - Audio::get_ptr()->set_speech_with_subs(speech_subtitles == 1);
- + Audio::get_ptr()->set_speech_enabled(speech_option != 0);
- + Audio::get_ptr()->set_speech_with_subs(speech_option != 1);
- Audio::get_ptr()->set_allow_music_looping(midi_looping == 1);
- config->set("config/audio/enabled", audio_enabled ? "yes" : "no", false);
- config->set("config/audio/midi/enabled", midi_enabled ? "yes" : "no", false);
- config->set("config/audio/effects/enabled", sfx_enabled ? "yes" : "no", false);
- - config->set("config/audio/speech/enabled", speech_enabled ? "yes" : "no", false);
- - config->set("config/audio/speech/with_subs", speech_subtitles ? "yes" : "no", false);
- -
- + if (speech_option == 0 || speech_option == 1)
- + config->set("config/audio/speech/enabled", speech_option ? "yes" : "no", false);
- + if (speech_option == 1 || speech_option == 2)
- + config->set("config/audio/speech/with_subs", (speech_option & 2) ? "yes" : "no", false);
- config->set("config/audio/midi/chorus/enabled", (midi_reverb_chorus & 2) ? "yes" : "no", false);
- config->set("config/audio/midi/reverb/enabled", (midi_reverb_chorus & 1) ? "yes" : "no", false);
- config->set("config/audio/midi/looping", midi_looping ? "yes" : "no", false);
- @@ -598,8 +593,6 @@ void AudioOptions_gump::paint() {
- }
- #endif
- font->paint_text(iwin->get_ib8(), "Speech:", x + colx[0], y + rowy[11] + 1);
- - if (speech_enabled == 1)
- - font->paint_text(iwin->get_ib8(), "subtitles", x + colx[1], y + rowy[12] + 1);
- }
- gwin->set_painted();
- }
- diff --git a/gumps/AudioOptions_gump.h b/gumps/AudioOptions_gump.h
- index ae43eb146..31d6ec6f4 100644
- --- a/gumps/AudioOptions_gump.h
- +++ b/gumps/AudioOptions_gump.h
- @@ -70,6 +70,7 @@ class AudioOptions_gump : public Modal_gump {
- #ifdef ENABLE_MIDISFX
- int sfx_conversion;
- #endif
- + int speech_option;
- int speech_enabled;
- int speech_subtitles;
- @@ -104,7 +105,6 @@ class AudioOptions_gump : public Modal_gump {
- void rebuild_midi_driver_buttons();
- void rebuild_mididriveroption_buttons();
- void rebuild_sfx_buttons();
- - void rebuild_speech_buttons();
- void load_settings();
- void save_settings();
- @@ -151,9 +151,7 @@ class AudioOptions_gump : public Modal_gump {
- }
- void toggle_sfx_pack(int state);
- void toggle_speech_enabled(int state) {
- - speech_enabled = state;
- - rebuild_speech_buttons();
- - paint();
- + speech_option = state;
- }
- void toggle_speech_subtitles(int state) {
- speech_subtitles = state;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement