diff options
author | Bastien Bouclet | 2018-05-17 20:46:42 +0200 |
---|---|---|
committer | Bastien Bouclet | 2018-05-17 20:49:28 +0200 |
commit | 6798f9c77ebe9c436c16cd1525554eb49bc1ba1d (patch) | |
tree | 3a6d86bb9759ecc5a09e1fe47ebf54d080e076d8 /engines/mohawk | |
parent | 44fd44ccc965b91a38c534e0a890772e83577c4b (diff) | |
download | scummvm-rg350-6798f9c77ebe9c436c16cd1525554eb49bc1ba1d.tar.gz scummvm-rg350-6798f9c77ebe9c436c16cd1525554eb49bc1ba1d.tar.bz2 scummvm-rg350-6798f9c77ebe9c436c16cd1525554eb49bc1ba1d.zip |
MOHAWK: Don't allow displaying the map when the game is not interactive
Fixes Trac#10526 and Trac#10531.
Diffstat (limited to 'engines/mohawk')
-rw-r--r-- | engines/mohawk/dialogs.cpp | 19 | ||||
-rw-r--r-- | engines/mohawk/myst.cpp | 30 | ||||
-rw-r--r-- | engines/mohawk/myst.h | 9 |
3 files changed, 36 insertions, 22 deletions
diff --git a/engines/mohawk/dialogs.cpp b/engines/mohawk/dialogs.cpp index f181db8707..5700a4641b 100644 --- a/engines/mohawk/dialogs.cpp +++ b/engines/mohawk/dialogs.cpp @@ -204,16 +204,19 @@ MystOptionsDialog::~MystOptionsDialog() { void MystOptionsDialog::open() { MohawkOptionsDialog::open(); - _dropPageButton->setEnabled(_vm->_gameState->_globals.heldPage != kNoPage); + bool canDropPage = _vm->isInteractive() && _vm->_gameState->_globals.heldPage != kNoPage; + _dropPageButton->setEnabled(canDropPage); - if (_showMapButton) - _showMapButton->setEnabled(_vm->_scriptParser && - _vm->_scriptParser->getMap()); + if (_showMapButton) { + bool canShowMap = _vm->isInteractive() && _vm->_scriptParser->getMap(); + _showMapButton->setEnabled(canShowMap); + } - // Return to menu button is not enabled on the menu - if (_returnToMenuButton) - _returnToMenuButton->setEnabled(_vm->_scriptParser && - _vm->getCurStack() != kDemoStack); + if (_returnToMenuButton) { + // Return to menu button is not enabled on the menu + bool canReturnToMenu = _vm->isInteractive() && _vm->getCurStack() != kDemoStack; + _returnToMenuButton->setEnabled(canReturnToMenu); + } // Zip mode is disabled in the demo if (_vm->getFeatures() & GF_DEMO) diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index bda69183c3..f324c8cad4 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -91,7 +91,7 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription _mouseClicked = false; _mouseMoved = false; _escapePressed = false; - _interactive = true; + _waitingOnBlockingOperation = false; _runExitScript = true; _needsPageDrop = false; @@ -310,7 +310,7 @@ void MohawkEngine_Myst::waitUntilMovieEnds(const VideoEntryPtr &video) { if (!video) return; - _interactive = false; + _waitingOnBlockingOperation = true; // Sanity check if (video->isLooping()) @@ -328,17 +328,17 @@ void MohawkEngine_Myst::waitUntilMovieEnds(const VideoEntryPtr &video) { // Ensure it's removed _video->removeEntry(video); - _interactive = true; + _waitingOnBlockingOperation = false; } void MohawkEngine_Myst::playSoundBlocking(uint16 id) { - _interactive = false; + _waitingOnBlockingOperation = true; _sound->playEffect(id); while (_sound->isEffectPlaying() && !shouldQuit()) { doFrame(); } - _interactive = true; + _waitingOnBlockingOperation = false; } Common::Error MohawkEngine_Myst::run() { @@ -389,10 +389,10 @@ Common::Error MohawkEngine_Myst::run() { void MohawkEngine_Myst::doFrame() { // Update any background videos _video->updateMovies(); - if (!_scriptParser->isScriptRunning() && _interactive) { - _interactive = false; + if (isInteractive()) { + _waitingOnBlockingOperation = true; _scriptParser->runPersistentScripts(); - _interactive = true; + _waitingOnBlockingOperation = false; } Common::Event event; @@ -446,7 +446,7 @@ void MohawkEngine_Myst::doFrame() { } if (_needsShowCredits) { - if (_interactive) { + if (isInteractive()) { _cursor->hideCursor(); changeToStack(kCreditsStack, 10000, 0, 0); _needsShowCredits = false; @@ -479,7 +479,7 @@ void MohawkEngine_Myst::doFrame() { } } - if (!_scriptParser->isScriptRunning() && _interactive) { + if (isInteractive()) { updateActiveResource(); checkCurrentResource(); } @@ -491,7 +491,7 @@ void MohawkEngine_Myst::doFrame() { } bool MohawkEngine_Myst::wait(uint32 duration, bool skippable) { - _interactive = false; + _waitingOnBlockingOperation = true; uint32 end = getTotalPlayTime() + duration; do { @@ -503,7 +503,7 @@ bool MohawkEngine_Myst::wait(uint32 duration, bool skippable) { } } while (getTotalPlayTime() < end && !shouldQuit()); - _interactive = true; + _waitingOnBlockingOperation = false; return false; } @@ -1165,8 +1165,12 @@ bool MohawkEngine_Myst::hasGameSaveSupport() const { return !(getFeatures() & GF_DEMO) && getGameType() != GType_MAKINGOF; } +bool MohawkEngine_Myst::isInteractive() { + return !_scriptParser->isScriptRunning() && !_waitingOnBlockingOperation; +} + bool MohawkEngine_Myst::canLoadGameStateCurrently() { - if (_scriptParser->isScriptRunning() || !_interactive) { + if (!isInteractive()) { return false; } diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h index 2758b7fdca..fcbdafa512 100644 --- a/engines/mohawk/myst.h +++ b/engines/mohawk/myst.h @@ -236,6 +236,13 @@ public: GUI::Debugger *getDebugger() override { return _console; } + /** + * Is the game currently interactive + * + * When the game is interactive, the user can interact with the game world + * and perform other operations such as loading saved games, ... + */ + bool isInteractive(); bool canLoadGameStateCurrently() override; bool canSaveGameStateCurrently() override; Common::Error loadGameState(int slot) override; @@ -284,7 +291,7 @@ private: bool _mouseClicked; bool _mouseMoved; bool _escapePressed; - bool _interactive; // Is the game currently interactive + bool _waitingOnBlockingOperation; Common::Array<MystCursorHint> _cursorHints; void loadCursorHints(); |