diff --git a/gumps/AudioOptions_gump.cc b/gumps/AudioOptions_gump.cc index 7e4f961c..6ba492f5 100644 --- a/gumps/AudioOptions_gump.cc +++ b/gumps/AudioOptions_gump.cc @@ -145,6 +145,8 @@ void AudioOptions_gump::rebuild_buttons() { // speech on/off buttons[id_speech_enabled] = std::make_unique(this, &AudioOptions_gump::toggle_speech_enabled, speech_enabled, colx[2], rowy[11], 59); + if (speech_enabled) + rebuild_speech_buttons(); } void AudioOptions_gump::rebuild_midi_buttons() { @@ -204,6 +206,17 @@ 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(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); @@ -340,6 +353,9 @@ void AudioOptions_gump::load_settings() { config->value("config/audio/midi/chorus/enabled", s, "no"); midi_reverb_chorus |= (s == "yes" ? 2 : 0); + config->value("config/audio/speech/with_subs", s, "no"); + speech_subtitles |= (s == "yes" ? 1 : 0); + std::string d = "config/disk/game/" + Game::get_gametitle() + "/waves"; config->value(d.c_str(), s, "---"); if (have_roland_pack && s == rolandpack) @@ -451,6 +467,7 @@ void AudioOptions_gump::save_settings() { 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); + config->set("config/audio/speech/with_subs", speech_subtitles ? "yes" : "no", false); std::string d = "config/disk/game/" + Game::get_gametitle() + "/waves"; std::string waves; @@ -556,6 +573,8 @@ 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 aa401d1a..54d84d6c 100644 --- a/gumps/AudioOptions_gump.h +++ b/gumps/AudioOptions_gump.h @@ -46,6 +46,7 @@ class AudioOptions_gump : public Modal_gump { id_sfx_pack, id_sfx_conv = id_sfx_pack, id_speech_enabled, + id_speech_subtitles, id_count }; std::array, id_count> buttons; @@ -70,6 +71,7 @@ class AudioOptions_gump : public Modal_gump { int sfx_conversion; #endif int speech_enabled; + int speech_subtitles; // Auxiliary variables for digital SFX packages: int nsfxopts, nsfxpacks; @@ -101,6 +103,7 @@ class AudioOptions_gump : public Modal_gump { void rebuild_midi_buttons(); void rebuild_mididriveroption_buttons(); void rebuild_sfx_buttons(); + void rebuild_speech_buttons(); void load_settings(); void save_settings(); @@ -146,6 +149,11 @@ 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(); + } + void toggle_speech_subtitles(int state) { + speech_subtitles = state; } };