GUI: Add "use original gui" checkbox in Loom and MI CD

Add the "use original gui" checkbox to the custom Loom EGA/VGA
and Monkey 1 CD version game options window.
Also slightly change to layout for consistency with
the other games.
This commit is contained in:
Walter Agazzi 2022-11-11 10:38:23 +01:00 committed by Eugene Sandulenko
parent 5cdddbd644
commit a21f8c574f
2 changed files with 41 additions and 8 deletions

View File

@ -921,6 +921,10 @@ GUI::CheckboxWidget *ScummOptionsContainerWidget::createEnhancementsCheckbox(Gui
return new GUI::CheckboxWidget(boss, name, _("Enable game-specific enhancements"), _("Allow ScummVM to make small enhancements to the game, usually based on other versions of the same game.")); return new GUI::CheckboxWidget(boss, name, _("Enable game-specific enhancements"), _("Allow ScummVM to make small enhancements to the game, usually based on other versions of the same game."));
} }
GUI::CheckboxWidget *ScummOptionsContainerWidget::createOriginalGUICheckbox(GuiObject *boss, const Common::String &name) {
return new GUI::CheckboxWidget(boss, name, _("Enable the original GUI and Menu"), _("Allow the game to use the in-engine graphical interface and the original save/load menu."));
}
void ScummOptionsContainerWidget::updateAdjustmentSlider(GUI::SliderWidget *slider, GUI::StaticTextWidget *value) { void ScummOptionsContainerWidget::updateAdjustmentSlider(GUI::SliderWidget *slider, GUI::StaticTextWidget *value) {
int adjustment = slider->getValue(); int adjustment = slider->getValue();
const char *sign = ""; const char *sign = "";
@ -962,6 +966,8 @@ LoomEgaGameOptionsWidget::LoomEgaGameOptionsWidget(GuiObject *boss, const Common
_overtureTicksValue->setFlags(GUI::WIDGET_CLEARBG); _overtureTicksValue->setFlags(GUI::WIDGET_CLEARBG);
_enableEnhancementsCheckbox = createEnhancementsCheckbox(widgetsBoss(), "LoomEgaGameOptionsDialog.EnableEnhancements"); _enableEnhancementsCheckbox = createEnhancementsCheckbox(widgetsBoss(), "LoomEgaGameOptionsDialog.EnableEnhancements");
_enableOriginalGUICheckbox = createOriginalGUICheckbox(widgetsBoss(), "LoomEgaGameOptionsDialog.EnableOriginalGUI");
_enableOriginalGUICheckbox->setVisible(false); // TODO: remove when implemented
} }
void LoomEgaGameOptionsWidget::load() { void LoomEgaGameOptionsWidget::load() {
@ -974,25 +980,31 @@ void LoomEgaGameOptionsWidget::load() {
updateOvertureTicksValue(); updateOvertureTicksValue();
_enableEnhancementsCheckbox->setState(ConfMan.getBool("enable_enhancements", _domain)); _enableEnhancementsCheckbox->setState(ConfMan.getBool("enable_enhancements", _domain));
_enableOriginalGUICheckbox->setState(ConfMan.getBool("original_gui", _domain));
} }
bool LoomEgaGameOptionsWidget::save() { bool LoomEgaGameOptionsWidget::save() {
ConfMan.setInt("loom_overture_ticks", _overtureTicksSlider->getValue(), _domain); ConfMan.setInt("loom_overture_ticks", _overtureTicksSlider->getValue(), _domain);
ConfMan.setBool("enable_enhancements", _enableEnhancementsCheckbox->getState(), _domain); ConfMan.setBool("enable_enhancements", _enableEnhancementsCheckbox->getState(), _domain);
ConfMan.setBool("original_gui", _enableOriginalGUICheckbox->getState(), _domain);
return true; return true;
} }
void LoomEgaGameOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const { void LoomEgaGameOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const {
layouts.addDialog(layoutName, overlayedLayout) layouts.addDialog(layoutName, overlayedLayout)
.addLayout(GUI::ThemeLayout::kLayoutVertical, 12) .addLayout(GUI::ThemeLayout::kLayoutVertical, 5)
.addPadding(0, 0, 0, 0) .addPadding(0, 0, 0, 0)
.addLayout(GUI::ThemeLayout::kLayoutVertical, 4)
.addPadding(0, 0, 10, 0)
.addWidget("EnableOriginalGUI", "Checkbox")
.addWidget("EnableEnhancements", "Checkbox")
.closeLayout()
.addLayout(GUI::ThemeLayout::kLayoutHorizontal, 12) .addLayout(GUI::ThemeLayout::kLayoutHorizontal, 12)
.addPadding(0, 0, 12, 0) .addPadding(0, 0, 10, 0)
.addWidget("OvertureTicksLabel", "OptionsLabel") .addWidget("OvertureTicksLabel", "OptionsLabel")
.addWidget("OvertureTicks", "WideSlider") .addWidget("OvertureTicks", "WideSlider")
.addWidget("OvertureTicksValue", "ShortOptionsLabel") .addWidget("OvertureTicksValue", "ShortOptionsLabel")
.closeLayout() .closeLayout()
.addWidget("EnableEnhancements", "Checkbox")
.closeLayout() .closeLayout()
.closeDialog(); .closeDialog();
} }
@ -1038,6 +1050,7 @@ LoomVgaGameOptionsWidget::LoomVgaGameOptionsWidget(GuiObject *boss, const Common
_playbackAdjustmentValue->setFlags(GUI::WIDGET_CLEARBG); _playbackAdjustmentValue->setFlags(GUI::WIDGET_CLEARBG);
_enableEnhancementsCheckbox = createEnhancementsCheckbox(widgetsBoss(), "LoomVgaGameOptionsDialog.EnableEnhancements"); _enableEnhancementsCheckbox = createEnhancementsCheckbox(widgetsBoss(), "LoomVgaGameOptionsDialog.EnableEnhancements");
_enableOriginalGUICheckbox = createOriginalGUICheckbox(widgetsBoss(), "LoomVgaGameOptionsDialog.EnableOriginalGUI");
} }
void LoomVgaGameOptionsWidget::load() { void LoomVgaGameOptionsWidget::load() {
@ -1050,25 +1063,31 @@ void LoomVgaGameOptionsWidget::load() {
updatePlaybackAdjustmentValue(); updatePlaybackAdjustmentValue();
_enableEnhancementsCheckbox->setState(ConfMan.getBool("enable_enhancements", _domain)); _enableEnhancementsCheckbox->setState(ConfMan.getBool("enable_enhancements", _domain));
_enableOriginalGUICheckbox->setState(ConfMan.getBool("original_gui", _domain));
} }
bool LoomVgaGameOptionsWidget::save() { bool LoomVgaGameOptionsWidget::save() {
ConfMan.setInt("loom_playback_adjustment", _playbackAdjustmentSlider->getValue(), _domain); ConfMan.setInt("loom_playback_adjustment", _playbackAdjustmentSlider->getValue(), _domain);
ConfMan.setBool("enable_enhancements", _enableEnhancementsCheckbox->getState(), _domain); ConfMan.setBool("enable_enhancements", _enableEnhancementsCheckbox->getState(), _domain);
ConfMan.setBool("original_gui", _enableOriginalGUICheckbox->getState(), _domain);
return true; return true;
} }
void LoomVgaGameOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const { void LoomVgaGameOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const {
layouts.addDialog(layoutName, overlayedLayout) layouts.addDialog(layoutName, overlayedLayout)
.addLayout(GUI::ThemeLayout::kLayoutVertical, 12) .addLayout(GUI::ThemeLayout::kLayoutVertical, 5)
.addPadding(0, 0, 0, 0) .addPadding(0, 0, 0, 0)
.addLayout(GUI::ThemeLayout::kLayoutVertical, 4)
.addPadding(0, 0, 10, 0)
.addWidget("EnableOriginalGUI", "Checkbox")
.addWidget("EnableEnhancements", "Checkbox")
.closeLayout()
.addLayout(GUI::ThemeLayout::kLayoutHorizontal, 12) .addLayout(GUI::ThemeLayout::kLayoutHorizontal, 12)
.addPadding(0, 0, 12, 0) .addPadding(0, 0, 10, 0)
.addWidget("PlaybackAdjustmentLabel", "OptionsLabel") .addWidget("PlaybackAdjustmentLabel", "OptionsLabel")
.addWidget("PlaybackAdjustment", "WideSlider") .addWidget("PlaybackAdjustment", "WideSlider")
.addWidget("PlaybackAdjustmentValue", "ShortOptionsLabel") .addWidget("PlaybackAdjustmentValue", "ShortOptionsLabel")
.closeLayout() .closeLayout()
.addWidget("EnableEnhancements", "Checkbox")
.closeLayout() .closeLayout()
.closeDialog(); .closeDialog();
} }
@ -1122,6 +1141,7 @@ MI1CdGameOptionsWidget::MI1CdGameOptionsWidget(GuiObject *boss, const Common::St
_outlookAdjustmentValue->setFlags(GUI::WIDGET_CLEARBG); _outlookAdjustmentValue->setFlags(GUI::WIDGET_CLEARBG);
_enableEnhancementsCheckbox = createEnhancementsCheckbox(widgetsBoss(), "MI1CdGameOptionsDialog.EnableEnhancements"); _enableEnhancementsCheckbox = createEnhancementsCheckbox(widgetsBoss(), "MI1CdGameOptionsDialog.EnableEnhancements");
_enableOriginalGUICheckbox = createOriginalGUICheckbox(widgetsBoss(), "MI1CdGameOptionsDialog.EnableOriginalGUI");
} }
void MI1CdGameOptionsWidget::load() { void MI1CdGameOptionsWidget::load() {
@ -1140,19 +1160,26 @@ void MI1CdGameOptionsWidget::load() {
updateOutlookAdjustmentValue(); updateOutlookAdjustmentValue();
_enableEnhancementsCheckbox->setState(ConfMan.getBool("enable_enhancements", _domain)); _enableEnhancementsCheckbox->setState(ConfMan.getBool("enable_enhancements", _domain));
_enableOriginalGUICheckbox->setState(ConfMan.getBool("original_gui", _domain));
} }
bool MI1CdGameOptionsWidget::save() { bool MI1CdGameOptionsWidget::save() {
ConfMan.setInt("mi1_intro_adjustment", _introAdjustmentSlider->getValue(), _domain); ConfMan.setInt("mi1_intro_adjustment", _introAdjustmentSlider->getValue(), _domain);
ConfMan.setInt("mi1_outlook_adjustment", _outlookAdjustmentSlider->getValue(), _domain); ConfMan.setInt("mi1_outlook_adjustment", _outlookAdjustmentSlider->getValue(), _domain);
ConfMan.setBool("enable_enhancements", _enableEnhancementsCheckbox->getState(), _domain); ConfMan.setBool("enable_enhancements", _enableEnhancementsCheckbox->getState(), _domain);
ConfMan.setBool("original_gui", _enableOriginalGUICheckbox->getState(), _domain);
return true; return true;
} }
void MI1CdGameOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const { void MI1CdGameOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const {
layouts.addDialog(layoutName, overlayedLayout) layouts.addDialog(layoutName, overlayedLayout)
.addLayout(GUI::ThemeLayout::kLayoutVertical, 12) .addLayout(GUI::ThemeLayout::kLayoutVertical, 5)
.addPadding(0, 0, 0, 0) .addPadding(0, 0, 0, 0)
.addLayout(GUI::ThemeLayout::kLayoutVertical, 4)
.addPadding(0, 0, 10, 0)
.addWidget("EnableOriginalGUI", "Checkbox")
.addWidget("EnableEnhancements", "Checkbox")
.closeLayout()
.addLayout(GUI::ThemeLayout::kLayoutHorizontal, 12) .addLayout(GUI::ThemeLayout::kLayoutHorizontal, 12)
.addPadding(0, 0, 12, 0) .addPadding(0, 0, 12, 0)
.addWidget("IntroAdjustmentLabel", "OptionsLabel") .addWidget("IntroAdjustmentLabel", "OptionsLabel")
@ -1165,7 +1192,6 @@ void MI1CdGameOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common:
.addWidget("OutlookAdjustment", "WideSlider") .addWidget("OutlookAdjustment", "WideSlider")
.addWidget("OutlookAdjustmentValue", "ShortOptionsLabel") .addWidget("OutlookAdjustmentValue", "ShortOptionsLabel")
.closeLayout() .closeLayout()
.addWidget("EnableEnhancements", "Checkbox")
.closeLayout() .closeLayout()
.closeDialog(); .closeDialog();
} }

View File

@ -226,6 +226,7 @@ public:
} }
GUI::CheckboxWidget *createEnhancementsCheckbox(GuiObject *boss, const Common::String &name); GUI::CheckboxWidget *createEnhancementsCheckbox(GuiObject *boss, const Common::String &name);
GUI::CheckboxWidget *createOriginalGUICheckbox(GuiObject *boss, const Common::String &name);
void updateAdjustmentSlider(GUI::SliderWidget *slider, GUI::StaticTextWidget *value); void updateAdjustmentSlider(GUI::SliderWidget *slider, GUI::StaticTextWidget *value);
}; };
@ -249,6 +250,8 @@ private:
void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override; void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
GUI::CheckboxWidget *_enableEnhancementsCheckbox; GUI::CheckboxWidget *_enableEnhancementsCheckbox;
GUI::CheckboxWidget *_enableOriginalGUICheckbox;
GUI::SliderWidget *_overtureTicksSlider; GUI::SliderWidget *_overtureTicksSlider;
GUI::StaticTextWidget *_overtureTicksValue; GUI::StaticTextWidget *_overtureTicksValue;
@ -275,6 +278,8 @@ private:
void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override; void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
GUI::CheckboxWidget *_enableEnhancementsCheckbox; GUI::CheckboxWidget *_enableEnhancementsCheckbox;
GUI::CheckboxWidget *_enableOriginalGUICheckbox;
GUI::SliderWidget *_playbackAdjustmentSlider; GUI::SliderWidget *_playbackAdjustmentSlider;
GUI::StaticTextWidget *_playbackAdjustmentValue; GUI::StaticTextWidget *_playbackAdjustmentValue;
@ -302,6 +307,8 @@ private:
void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override; void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
GUI::CheckboxWidget *_enableEnhancementsCheckbox; GUI::CheckboxWidget *_enableEnhancementsCheckbox;
GUI::CheckboxWidget *_enableOriginalGUICheckbox;
GUI::SliderWidget *_introAdjustmentSlider; GUI::SliderWidget *_introAdjustmentSlider;
GUI::StaticTextWidget *_introAdjustmentValue; GUI::StaticTextWidget *_introAdjustmentValue;
GUI::SliderWidget *_outlookAdjustmentSlider; GUI::SliderWidget *_outlookAdjustmentSlider;