MOHAWK: MYST: Add option to simulate CD-ROM loading times during card transition

This commit is contained in:
Lothar Serra Mari 2021-06-13 21:15:41 +02:00
parent d3a5925677
commit 552813545d
5 changed files with 41 additions and 0 deletions

View File

@ -100,6 +100,7 @@ MystOptionsWidget::MystOptionsWidget(GuiObject *boss, const Common::String &name
_transitionsCheckbox(nullptr),
_mystFlyByCheckbox(nullptr),
_spaceshipFuzzyLogicCheckbox(nullptr),
_addCdromDelayCheckbox(nullptr),
_languagePopUp(nullptr),
_dropPageButton(nullptr),
_showMapButton(nullptr),
@ -134,6 +135,8 @@ MystOptionsWidget::MystOptionsWidget(GuiObject *boss, const Common::String &name
_spaceshipFuzzyLogicCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "MystGameOptionsDialog.FuzzyMode", _("~F~uzzy Logic in SpaceShip Active"));
}
_addCdromDelayCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "MystGameOptionsDialog.CdromDelay", _("Simulate loading times of old CD drives"));
if (isInGame()) {
MohawkEngine_Myst *vm = static_cast<MohawkEngine_Myst *>(g_engine);
assert(vm);
@ -177,6 +180,7 @@ void MystOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::Stri
.addWidget("Transistions", "Checkbox")
.addWidget("PlayMystFlyBy", "Checkbox")
.addWidget("FuzzyMode", "Checkbox")
.addWidget("CdromDelay", "Checkbox")
.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
.addPadding(0, 0, 0, 0)
.addWidget("LanguageDesc", "OptionsLabel")
@ -213,6 +217,10 @@ void MystOptionsWidget::load() {
_spaceshipFuzzyLogicCheckbox->setState(ConfMan.getBool("fuzzy_logic", _domain));
}
if (_addCdromDelayCheckbox) {
_addCdromDelayCheckbox->setState(ConfMan.getBool("cdromdelay", _domain));
}
if (_languagePopUp) {
Common::Language language = Common::parseLanguage(ConfMan.get("language", _domain));
const MystLanguage *languageDesc = MohawkEngine_Myst::getLanguageDesc(language);
@ -253,6 +261,10 @@ bool MystOptionsWidget::save() {
ConfMan.setBool("fuzzy_logic", _spaceshipFuzzyLogicCheckbox->getState(), _domain);
}
if (_addCdromDelayCheckbox) {
ConfMan.setBool("cdromdelay", _addCdromDelayCheckbox->getState(), _domain);
}
if (_languagePopUp) {
MohawkEngine_Myst *vm = static_cast<MohawkEngine_Myst *>(g_engine);
assert(vm);

View File

@ -101,6 +101,7 @@ private:
GUI::CheckboxWidget *_transitionsCheckbox;
GUI::CheckboxWidget *_mystFlyByCheckbox;
GUI::CheckboxWidget *_spaceshipFuzzyLogicCheckbox;
GUI::CheckboxWidget *_addCdromDelayCheckbox;
GUI::PopUpWidget *_languagePopUp;

View File

@ -917,6 +917,17 @@ void MohawkEngine_Myst::changeToStack(MystStack stackId, uint16 card, uint16 lin
_cache.clear();
_gfx->clearCache();
// Add artificial CD-ROM delay
if (ConfMan.getBool("cdromdelay")) {
if (_stack->getStackId() != kIntroStack || _stack->getStackId() != kMenuStack) {
// Pretty arbitrary delays to mimic a period correct 4x drive
// TODO: Since the disc layout of the original CD-ROMs is known,
// it should be possible to adapt the delay depending on the
// target stack in order to replicate the original loading times.
g_system->delayMillis(_rnd->getRandomNumberRng(500,750));
}
}
changeToCard(card, kTransitionCopy);
if (linkDstSound)
@ -942,6 +953,19 @@ void MohawkEngine_Myst::changeToCard(uint16 card, TransitionType transition) {
_card->leave();
}
// Add artificial CD-ROM delay
if (ConfMan.getBool("cdromdelay")) {
if (_stack->getStackId() != kIntroStack && _stack->getStackId() != kMenuStack) {
// The original engine disables the mouse cursor when loading new cards.
_cursor->hideCursor();
_system->updateScreen();
// Pretty arbitrary delays to mimic a period correct 4x drive
g_system->delayMillis(_rnd->getRandomNumberRng(175,225));
_cursor->showCursor();
}
}
_card = MystCardPtr(new MystCard(this, card));
_card->enter();

View File

@ -147,6 +147,9 @@ public:
uint16 getMainCursor() { return _mainCursor; }
void refreshCursor();
bool wait(uint32 duration, bool skippable = false);
bool addCdRomDelay;
uint minCdRomDelay;
uint maxCdRomDelay;
/** Update the game state according to events and update the screen */
void doFrame();

View File

@ -27,6 +27,7 @@ void Mohawk::MohawkMetaEngine_Myst::registerDefaultSettings() {
ConfMan.registerDefault("zip_mode", false);
ConfMan.registerDefault("transition_mode", false);
ConfMan.registerDefault("fuzzy_logic", false);
ConfMan.registerDefault("cdromdelay", false);
}
const Mohawk::MystLanguage *Mohawk::MohawkMetaEngine_Myst::listLanguages() {