mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-26 12:48:16 +00:00
MOHAWK (Myst): Allow fuzzy matching in the space ship puzzle
Enabling this new option can make it easier for hearing impaired users to solve that puzzle
This commit is contained in:
parent
9382979b68
commit
fdbfb6160f
@ -99,6 +99,7 @@ MystOptionsWidget::MystOptionsWidget(GuiObject *boss, const Common::String &name
|
||||
_zipModeCheckbox(nullptr),
|
||||
_transitionsCheckbox(nullptr),
|
||||
_mystFlyByCheckbox(nullptr),
|
||||
_spaceshipFuzzyLogicCheckbox(nullptr),
|
||||
_languagePopUp(nullptr),
|
||||
_dropPageButton(nullptr),
|
||||
_showMapButton(nullptr),
|
||||
@ -119,6 +120,18 @@ MystOptionsWidget::MystOptionsWidget(GuiObject *boss, const Common::String &name
|
||||
_("The Myst fly by movie was not played by the original engine."));
|
||||
}
|
||||
|
||||
if (!isDemo) {
|
||||
/**
|
||||
* I18N:
|
||||
* This Option is for hard-of-hearing.
|
||||
* It makes it easier to solve the spaceship puzzle.
|
||||
* Normally game uses strict binary logic here.
|
||||
* We change it to use fuzzy logic.
|
||||
* By default the option is off.
|
||||
*/
|
||||
_spaceshipFuzzyLogicCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "MystGameOptionsDialog.FuzzyMode", _("~F~uzzy Logic in SpaceShip Active"));
|
||||
}
|
||||
|
||||
if (isInGame()) {
|
||||
MohawkEngine_Myst *vm = static_cast<MohawkEngine_Myst *>(g_engine);
|
||||
assert(vm);
|
||||
@ -161,6 +174,7 @@ void MystOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::Stri
|
||||
.addWidget("ZipMode", "Checkbox")
|
||||
.addWidget("Transistions", "Checkbox")
|
||||
.addWidget("PlayMystFlyBy", "Checkbox")
|
||||
.addWidget("FuzzyMode", "Checkbox")
|
||||
.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
|
||||
.addPadding(0, 0, 0, 0)
|
||||
.addWidget("LanguageDesc", "OptionsLabel")
|
||||
@ -193,6 +207,10 @@ void MystOptionsWidget::load() {
|
||||
_mystFlyByCheckbox->setState(ConfMan.getBool("playmystflyby", _domain));
|
||||
}
|
||||
|
||||
if (_spaceshipFuzzyLogicCheckbox) {
|
||||
_spaceshipFuzzyLogicCheckbox->setState(ConfMan.getBool("fuzzy_logic", _domain));
|
||||
}
|
||||
|
||||
if (_languagePopUp) {
|
||||
Common::Language language = Common::parseLanguage(ConfMan.get("language", _domain));
|
||||
const MystLanguage *languageDesc = MohawkEngine_Myst::getLanguageDesc(language);
|
||||
@ -229,6 +247,10 @@ bool MystOptionsWidget::save() {
|
||||
ConfMan.setBool("playmystflyby", _mystFlyByCheckbox->getState(), _domain);
|
||||
}
|
||||
|
||||
if (_spaceshipFuzzyLogicCheckbox) {
|
||||
ConfMan.setBool("fuzzy_logic", _spaceshipFuzzyLogicCheckbox->getState(), _domain);
|
||||
}
|
||||
|
||||
if (_languagePopUp) {
|
||||
MohawkEngine_Myst *vm = static_cast<MohawkEngine_Myst *>(g_engine);
|
||||
assert(vm);
|
||||
|
@ -100,6 +100,8 @@ private:
|
||||
GUI::CheckboxWidget *_zipModeCheckbox;
|
||||
GUI::CheckboxWidget *_transitionsCheckbox;
|
||||
GUI::CheckboxWidget *_mystFlyByCheckbox;
|
||||
GUI::CheckboxWidget *_spaceshipFuzzyLogicCheckbox;
|
||||
|
||||
GUI::PopUpWidget *_languagePopUp;
|
||||
|
||||
GUI::ButtonWidget *_dropPageButton;
|
||||
|
@ -26,6 +26,7 @@ void Mohawk::MohawkMetaEngine_Myst::registerDefaultSettings() {
|
||||
ConfMan.registerDefault("playmystflyby", false);
|
||||
ConfMan.registerDefault("zip_mode", false);
|
||||
ConfMan.registerDefault("transition_mode", false);
|
||||
ConfMan.registerDefault("fuzzy_logic", false);
|
||||
}
|
||||
|
||||
const Mohawk::MystLanguage *Mohawk::MohawkMetaEngine_Myst::listLanguages() {
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "mohawk/video.h"
|
||||
#include "mohawk/myst_stacks/myst.h"
|
||||
|
||||
#include "common/config-manager.h"
|
||||
#include "common/events.h"
|
||||
#include "common/math.h"
|
||||
#include "common/system.h"
|
||||
@ -2292,6 +2293,17 @@ uint16 Myst::rocketSliderGetSound(uint16 pos) {
|
||||
return (uint16)(9530 + (pos - 216) * 35.0 / 61.0);
|
||||
}
|
||||
|
||||
uint16 Myst::rocketCheckIfSoundMatches(uint16 sound1, uint16 sound2) {
|
||||
debugN("rocketCheckIfSoundMatches: %i %i (diff:% 3i) ", sound1, sound2, sound1 - sound2);
|
||||
if (!ConfMan.getBool("fuzzy_logic")) {
|
||||
debugN("strict\n");
|
||||
return sound1 == sound2;
|
||||
} else {
|
||||
debugN("fuzzy\n");
|
||||
return abs(sound1 - sound2) < 5;
|
||||
}
|
||||
}
|
||||
|
||||
void Myst::rocketCheckSolution() {
|
||||
_vm->_cursor->hideCursor();
|
||||
|
||||
@ -2302,35 +2314,35 @@ void Myst::rocketCheckSolution() {
|
||||
_vm->_sound->playEffect(soundId);
|
||||
_rocketSlider1->drawConditionalDataToScreen(2);
|
||||
_vm->wait(250);
|
||||
if (soundId != 9558)
|
||||
if (!rocketCheckIfSoundMatches(soundId, 9558))
|
||||
solved = false;
|
||||
|
||||
soundId = rocketSliderGetSound(_rocketSlider2->_pos.y);
|
||||
_vm->_sound->playEffect(soundId);
|
||||
_rocketSlider2->drawConditionalDataToScreen(2);
|
||||
_vm->wait(250);
|
||||
if (soundId != 9546)
|
||||
if (!rocketCheckIfSoundMatches(soundId, 9546))
|
||||
solved = false;
|
||||
|
||||
soundId = rocketSliderGetSound(_rocketSlider3->_pos.y);
|
||||
_vm->_sound->playEffect(soundId);
|
||||
_rocketSlider3->drawConditionalDataToScreen(2);
|
||||
_vm->wait(250);
|
||||
if (soundId != 9543)
|
||||
if (!rocketCheckIfSoundMatches(soundId, 9543))
|
||||
solved = false;
|
||||
|
||||
soundId = rocketSliderGetSound(_rocketSlider4->_pos.y);
|
||||
_vm->_sound->playEffect(soundId);
|
||||
_rocketSlider4->drawConditionalDataToScreen(2);
|
||||
_vm->wait(250);
|
||||
if (soundId != 9553)
|
||||
if (!rocketCheckIfSoundMatches(soundId, 9553))
|
||||
solved = false;
|
||||
|
||||
soundId = rocketSliderGetSound(_rocketSlider5->_pos.y);
|
||||
_vm->_sound->playEffect(soundId);
|
||||
_rocketSlider5->drawConditionalDataToScreen(2);
|
||||
_vm->wait(250);
|
||||
if (soundId != 9560)
|
||||
if (!rocketCheckIfSoundMatches(soundId, 9560))
|
||||
solved = false;
|
||||
|
||||
_vm->_sound->stopEffect();
|
||||
|
@ -312,6 +312,7 @@ protected:
|
||||
|
||||
void rocketSliderMove();
|
||||
uint16 rocketSliderGetSound(uint16 pos);
|
||||
uint16 rocketCheckIfSoundMatches(uint16 sound1, uint16 sound2);
|
||||
void rocketCheckSolution();
|
||||
|
||||
void libraryBookPageTurnLeft();
|
||||
|
Loading…
x
Reference in New Issue
Block a user