Advertisement
dominus

Untitled

Jan 23rd, 2022
1,117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.55 KB | None | 0 0
  1. diff --git a/gumps/AudioOptions_gump.cc b/gumps/AudioOptions_gump.cc
  2. index 7e4f961c..6ba492f5 100644
  3. --- a/gumps/AudioOptions_gump.cc
  4. +++ b/gumps/AudioOptions_gump.cc
  5. @@ -145,6 +145,8 @@ void AudioOptions_gump::rebuild_buttons() {
  6.     // speech on/off
  7.     buttons[id_speech_enabled] = std::make_unique<AudioEnabledToggle>(this, &AudioOptions_gump::toggle_speech_enabled,
  8.             speech_enabled, colx[2], rowy[11], 59);
  9. +   if (speech_enabled)
  10. +       rebuild_speech_buttons();
  11.  }
  12.  
  13.  void AudioOptions_gump::rebuild_midi_buttons() {
  14. @@ -204,6 +206,17 @@ void AudioOptions_gump::rebuild_sfx_buttons() {
  15.  #endif
  16.  }
  17.  
  18. +void AudioOptions_gump::rebuild_speech_buttons() {
  19. +   buttons[id_speech_subtitles].reset();
  20. +
  21. +   if (!speech_enabled)
  22. +       return;
  23. +   else {
  24. +       buttons[id_speech_subtitles] = std::make_unique<AudioEnabledToggle>(this, &AudioOptions_gump::toggle_speech_subtitles,
  25. +               speech_subtitles, colx[2], rowy[12], 59);
  26. +   }
  27. +}
  28. +
  29.  void AudioOptions_gump::rebuild_mididriveroption_buttons() {
  30.     std::string s = "Default";
  31.     if (midi_driver != MidiDriver::getDriverCount()) s = MidiDriver::getDriverName(midi_driver);
  32. @@ -340,6 +353,9 @@ void AudioOptions_gump::load_settings() {
  33.     config->value("config/audio/midi/chorus/enabled", s, "no");
  34.     midi_reverb_chorus |= (s == "yes" ? 2 : 0);
  35.  
  36. +   config->value("config/audio/speech/with_subs", s, "no");
  37. +   speech_subtitles |= (s == "yes" ? 1 : 0);
  38. +
  39.     std::string d = "config/disk/game/" + Game::get_gametitle() + "/waves";
  40.     config->value(d.c_str(), s, "---");
  41.     if (have_roland_pack && s == rolandpack)
  42. @@ -451,6 +467,7 @@ void AudioOptions_gump::save_settings() {
  43.     config->set("config/audio/midi/chorus/enabled", (midi_reverb_chorus & 2) ? "yes" : "no", false);
  44.     config->set("config/audio/midi/reverb/enabled", (midi_reverb_chorus & 1) ? "yes" : "no", false);
  45.     config->set("config/audio/midi/looping", midi_looping ? "yes" : "no", false);
  46. +   config->set("config/audio/speech/with_subs", speech_subtitles ? "yes" : "no", false);
  47.  
  48.     std::string d = "config/disk/game/" + Game::get_gametitle() + "/waves";
  49.     std::string waves;
  50. @@ -556,6 +573,8 @@ void AudioOptions_gump::paint() {
  51.         }
  52.  #endif
  53.         font->paint_text(iwin->get_ib8(), "Speech:", x + colx[0], y + rowy[11] + 1);
  54. +       if (speech_enabled == 1)
  55. +           font->paint_text(iwin->get_ib8(), "subtitles", x + colx[1], y + rowy[12] + 1);
  56.     }
  57.     gwin->set_painted();
  58.  }
  59. diff --git a/gumps/AudioOptions_gump.h b/gumps/AudioOptions_gump.h
  60. index aa401d1a..54d84d6c 100644
  61. --- a/gumps/AudioOptions_gump.h
  62. +++ b/gumps/AudioOptions_gump.h
  63. @@ -46,6 +46,7 @@ class AudioOptions_gump : public Modal_gump {
  64.         id_sfx_pack,
  65.         id_sfx_conv = id_sfx_pack,
  66.         id_speech_enabled,
  67. +       id_speech_subtitles,
  68.         id_count
  69.     };
  70.     std::array<std::unique_ptr<Gump_button>, id_count> buttons;
  71. @@ -70,6 +71,7 @@ class AudioOptions_gump : public Modal_gump {
  72.     int sfx_conversion;
  73.  #endif
  74.     int speech_enabled;
  75. +   int speech_subtitles;
  76.  
  77.     // Auxiliary variables for digital SFX packages:
  78.     int nsfxopts, nsfxpacks;
  79. @@ -101,6 +103,7 @@ class AudioOptions_gump : public Modal_gump {
  80.     void rebuild_midi_buttons();
  81.     void rebuild_mididriveroption_buttons();
  82.     void rebuild_sfx_buttons();
  83. +   void rebuild_speech_buttons();
  84.  
  85.     void load_settings();
  86.     void save_settings();
  87. @@ -146,6 +149,11 @@ class AudioOptions_gump : public Modal_gump {
  88.     void toggle_sfx_pack(int state);
  89.     void toggle_speech_enabled(int state) {
  90.         speech_enabled = state;
  91. +       rebuild_speech_buttons();
  92. +       paint();
  93. +   }
  94. +   void toggle_speech_subtitles(int state) {
  95. +       speech_subtitles = state;
  96.     }
  97.  };
  98.  
  99.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement