mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-21 03:31:40 +00:00
SCUMM: (Loom/Mac) - add music quality slider widget
This commit is contained in:
parent
aee2bf53bb
commit
c52bfe4f27
@ -1354,7 +1354,6 @@ void LoomEgaGameOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Commo
|
||||
}
|
||||
|
||||
void LoomEgaGameOptionsWidget::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
|
||||
|
||||
switch (cmd) {
|
||||
case kOvertureTicksChanged:
|
||||
updateOvertureTicksValue();
|
||||
@ -1371,6 +1370,86 @@ void LoomEgaGameOptionsWidget::updateOvertureTicksValue() {
|
||||
_overtureTicksValue->setLabel(Common::String::format("%d:%02d.%d", ticks / 600, (ticks % 600) / 10, ticks % 10));
|
||||
}
|
||||
|
||||
// Mac Loom options
|
||||
LoomMacGameOptionsWidget::LoomMacGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain) :
|
||||
ScummOptionsContainerWidget(boss, name, "LoomMacGameOptionsWidget", domain), _sndQualitySlider(nullptr), _sndQualityValue(nullptr), _enableOriginalGUICheckbox(nullptr), _quality(0) {
|
||||
GUI::StaticTextWidget *text = new GUI::StaticTextWidget(widgetsBoss(), "LoomMacGameOptionsWidget.SndQualityLabel", _("Music Quality:"));
|
||||
text->setAlign(Graphics::TextAlign::kTextAlignEnd);
|
||||
|
||||
_sndQualitySlider = new GUI::SliderWidget(widgetsBoss(), "LoomMacGameOptionsWidget.SndQuality", _("Select music quality. The original would determine the basic setup by hardware detection and speed tests, but it could also be changed in the game menu to some degree."), kQualitySliderUpdate);
|
||||
_sndQualitySlider->setMinValue(0);
|
||||
_sndQualitySlider->setMaxValue(9);
|
||||
_sndQualityValue = new GUI::StaticTextWidget(widgetsBoss(), "LoomMacGameOptionsWidget.SndQualityValue", Common::U32String());
|
||||
_sndQualityValue->setFlags(GUI::WIDGET_CLEARBG);
|
||||
updateQualitySlider();
|
||||
|
||||
createEnhancementsWidget(widgetsBoss(), "LoomMacGameOptionsWidget");
|
||||
_enableOriginalGUICheckbox = createOriginalGUICheckbox(widgetsBoss(), "LoomMacGameOptionsWidget.EnableOriginalGUI");
|
||||
}
|
||||
|
||||
void LoomMacGameOptionsWidget::load() {
|
||||
ScummOptionsContainerWidget::load();
|
||||
|
||||
_quality = 0;
|
||||
|
||||
if (ConfMan.hasKey("mac_snd_quality", _domain))
|
||||
_quality = ConfMan.getInt("mac_snd_quality", _domain);
|
||||
|
||||
// Migrate old bool setting...
|
||||
if (_quality == 0 && ConfMan.hasKey("mac_v3_low_quality_music", _domain)) {
|
||||
if (ConfMan.getBool("mac_v3_low_quality_music"))
|
||||
_quality = 1;
|
||||
}
|
||||
ConfMan.removeKey("mac_v3_low_quality_music", _domain);
|
||||
|
||||
_sndQualitySlider->setValue(_quality);
|
||||
updateQualitySlider();
|
||||
_enableOriginalGUICheckbox->setState(ConfMan.getBool("original_gui", _domain));
|
||||
}
|
||||
|
||||
bool LoomMacGameOptionsWidget::save() {
|
||||
bool res = ScummOptionsContainerWidget::save();
|
||||
ConfMan.setInt("mac_snd_quality", _quality, _domain);
|
||||
ConfMan.setBool("original_gui", _enableOriginalGUICheckbox->getState(), _domain);
|
||||
return res;
|
||||
}
|
||||
|
||||
void LoomMacGameOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const {
|
||||
layouts.addDialog(layoutName, overlayedLayout)
|
||||
.addLayout(GUI::ThemeLayout::kLayoutVertical, 5)
|
||||
.addPadding(0, 0, 0, 0)
|
||||
.addLayout(GUI::ThemeLayout::kLayoutVertical, 4)
|
||||
.addPadding(0, 0, 10, 0)
|
||||
.addWidget("EnableOriginalGUI", "Checkbox");
|
||||
addEnhancementsLayout(layouts)
|
||||
.closeLayout()
|
||||
.addLayout(GUI::ThemeLayout::kLayoutHorizontal, 12)
|
||||
.addPadding(0, 0, 10, 0)
|
||||
.addWidget("SndQualityLabel", "OptionsLabel")
|
||||
.addWidget("SndQuality", "Slider")
|
||||
.addWidget("SndQualityValue", "ShortOptionsLabel")
|
||||
.closeLayout()
|
||||
.closeLayout()
|
||||
.closeDialog();
|
||||
}
|
||||
|
||||
void LoomMacGameOptionsWidget::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
|
||||
switch (cmd) {
|
||||
case kQualitySliderUpdate:
|
||||
updateQualitySlider();
|
||||
break;
|
||||
default:
|
||||
GUI::OptionsContainerWidget::handleCommand(sender, cmd, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void LoomMacGameOptionsWidget::updateQualitySlider() {
|
||||
_quality = _sndQualitySlider->getValue();
|
||||
Common::U32String label(_quality == 0 ? "auto" : Common::String::format("%4d", _quality));
|
||||
_sndQualityValue->setLabel(label);
|
||||
}
|
||||
|
||||
// VGA Loom Playback Adjustment settings
|
||||
|
||||
LoomVgaGameOptionsWidget::LoomVgaGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain) :
|
||||
|
@ -298,6 +298,30 @@ private:
|
||||
void updateOvertureTicksValue();
|
||||
};
|
||||
|
||||
/**
|
||||
* Options widget for Mac Loom.
|
||||
*/
|
||||
class LoomMacGameOptionsWidget : public ScummOptionsContainerWidget {
|
||||
public:
|
||||
LoomMacGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain);
|
||||
~LoomMacGameOptionsWidget() override {};
|
||||
|
||||
void load() override;
|
||||
bool save() override;
|
||||
private:
|
||||
enum {
|
||||
kQualitySliderUpdate = 'QUAL'
|
||||
};
|
||||
void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
|
||||
void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
|
||||
void updateQualitySlider();
|
||||
|
||||
GUI::CheckboxWidget *_enableOriginalGUICheckbox;
|
||||
GUI::SliderWidget *_sndQualitySlider;
|
||||
GUI::StaticTextWidget *_sndQualityValue;
|
||||
int _quality;
|
||||
};
|
||||
|
||||
/**
|
||||
* Options widget for VGA Loom (DOS CD).
|
||||
*/
|
||||
|
@ -636,6 +636,9 @@ bool MacLoomGui::runOptionsDialog() {
|
||||
int scrolling = _vm->_snapScroll == 0;
|
||||
int fullAnimation = _vm->VAR(_vm->VAR_MACHINE_SPEED) == 1 ? 0 : 1;
|
||||
int textSpeed = _vm->_defaultTextSpeed;
|
||||
int musicQuality = ConfMan.hasKey("mac_snd_quality") ? ConfMan.getInt("mac_snd_quality") : 0;
|
||||
int musicQualityOption = (musicQuality == 0) ? 1 : (musicQuality - 1) % 3;
|
||||
musicQuality = (musicQuality == 0) ? (_vm->VAR(_vm->VAR_SOUNDCARD) == 10 ? 0 : 2) : (musicQuality - 1) / 3;
|
||||
|
||||
MacDialogWindow *window = createDialog(1000);
|
||||
|
||||
@ -651,7 +654,7 @@ bool MacLoomGui::runOptionsDialog() {
|
||||
window->setWidgetValue(11, textSpeed);
|
||||
|
||||
window->addPictureSlider(8, 9, true, 5, 69, 0, 2, 6, 4);
|
||||
window->setWidgetValue(12, 2/* TODO: save var*/);
|
||||
window->setWidgetValue(12, musicQualityOption);
|
||||
|
||||
// Machine rating
|
||||
window->addSubstitution(Common::String::format("%d", _vm->VAR(53)));
|
||||
@ -721,11 +724,10 @@ bool MacLoomGui::runOptionsDialog() {
|
||||
// the sequence files and mutes everything else)
|
||||
//
|
||||
|
||||
//_vm->VAR(_vm->VAR_SOUNDCARD) = window->getWidgetValue(12) == 0 ? 10 : 11;
|
||||
//((Player_V3M *)_vm->_musicEngine)->overrideQuality(_vm->VAR(_vm->VAR_SOUNDCARD) == 10);
|
||||
int musicQuality = (ConfMan.hasKey("mac_v3_low_quality_music") && ConfMan.getBool("mac_v3_low_quality_music")) ? 0 : (_vm->VAR(_vm->VAR_SOUNDCARD) == 10 ? 0 : 2);
|
||||
_vm->_musicEngine->setQuality(musicQuality * 3 + 1 + window->getWidgetValue(12));
|
||||
//ConfMan.setBool("mac_v3_low_quality_music", _vm->VAR(_vm->VAR_SOUNDCARD) == 10);
|
||||
musicQuality = musicQuality * 3 + 1 + window->getWidgetValue(12);
|
||||
_vm->_musicEngine->setQuality(musicQuality);
|
||||
ConfMan.setInt("mac_snd_quality", musicQuality);
|
||||
|
||||
debug(6, "MacLoomGui::runOptionsDialog(): music quality: %d - unimplemented!", window->getWidgetValue(12));
|
||||
|
||||
|
@ -567,7 +567,7 @@ SaveStateDescriptor ScummMetaEngine::querySaveMetaInfos(const char *target, int
|
||||
|
||||
GUI::OptionsContainerWidget *ScummMetaEngine::buildLoomOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
|
||||
Common::Platform platform = Common::parsePlatform(ConfMan.get("platform", target));
|
||||
if (platform != Common::kPlatformUnknown && platform != Common::kPlatformDOS)
|
||||
if (platform != Common::kPlatformUnknown && platform != Common::kPlatformDOS && platform != Common::kPlatformMacintosh)
|
||||
return nullptr;
|
||||
|
||||
Common::String extra = ConfMan.get("extra", target);
|
||||
@ -580,10 +580,11 @@ GUI::OptionsContainerWidget *ScummMetaEngine::buildLoomOptionsWidget(GUI::GuiObj
|
||||
|
||||
if (extra == "Steam")
|
||||
return MetaEngine::buildEngineOptionsWidget(boss, name, target);
|
||||
else if (platform == Common::kPlatformMacintosh)
|
||||
return new Scumm::LoomMacGameOptionsWidget(boss, name, target);
|
||||
|
||||
// These EGA Loom settings are only relevant for the EGA
|
||||
// version, since that is the only one that has an overture.
|
||||
|
||||
return new Scumm::LoomEgaGameOptionsWidget(boss, name, target);
|
||||
}
|
||||
|
||||
@ -653,7 +654,7 @@ static const ExtraGuiOption fmtownsTrimTo200 = {
|
||||
|
||||
static const ExtraGuiOption macV3LowQualityMusic = {
|
||||
_s("Play simplified music"),
|
||||
_s("This music was presumably intended for low-end Macs, and uses only one channel."),
|
||||
_s("This music was intended for low-end Macs, and uses only one channel."),
|
||||
"mac_v3_low_quality_music",
|
||||
false,
|
||||
0,
|
||||
@ -773,7 +774,7 @@ const ExtraGuiOptions ScummMetaEngine::getExtraGuiOptions(const Common::String &
|
||||
// The low quality music in Loom was probably intended for low-end
|
||||
// Macs. It plays only one channel, instead of three.
|
||||
|
||||
if (target.empty() || ((gameid == "loom" || gameid == "indy3") && platform == Common::kPlatformMacintosh && extra != "Steam")) {
|
||||
if (target.empty() || (gameid == "indy3" && platform == Common::kPlatformMacintosh && extra != "Steam")) {
|
||||
options.push_back(macV3LowQualityMusic);
|
||||
}
|
||||
|
||||
|
@ -2179,6 +2179,8 @@ void ScummEngine::setupMusic(int midi, const Common::Path &macInstrumentFile) {
|
||||
_musicEngine = MacSound::createPlayer(this);
|
||||
if (ConfMan.hasKey("mac_v3_low_quality_music") && ConfMan.getBool("mac_v3_low_quality_music"))
|
||||
_musicEngine->setQuality(MacSound::kQualityLowest);
|
||||
else if (ConfMan.hasKey("mac_snd_quality"))
|
||||
_musicEngine->setQuality(ConfMan.getInt("mac_snd_quality"));
|
||||
_sound->_musicType = MDT_MACINTOSH;
|
||||
}
|
||||
} else if (_game.platform == Common::kPlatformMacintosh && _game.id == GID_MONKEY) {
|
||||
|
@ -858,8 +858,10 @@ void ScummEngine::setSoundCardVarToCurrentConfig() {
|
||||
// 4 Roland
|
||||
switch (_sound->_musicType) {
|
||||
case MDT_MACINTOSH:
|
||||
if (_game.id == GID_INDY3 || _game.id == GID_LOOM)
|
||||
if (_game.id == GID_INDY3)
|
||||
VAR(VAR_SOUNDCARD) = (ConfMan.hasKey("mac_v3_low_quality_music") && ConfMan.getBool("mac_v3_low_quality_music")) ? 10 : 11;
|
||||
else if (_game.id == GID_LOOM)
|
||||
VAR(VAR_SOUNDCARD) = (ConfMan.hasKey("mac_snd_quality") && ConfMan.getInt("mac_snd_quality") > 0 && ConfMan.getInt("mac_snd_quality") < 4) ? 10 : 11;
|
||||
else
|
||||
VAR(VAR_SOUNDCARD) = 3;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user