diff options
author | Bastien Bouclet | 2017-07-09 14:22:18 +0200 |
---|---|---|
committer | Bastien Bouclet | 2017-07-22 20:38:56 +0200 |
commit | 8f59348ec33ec7c4357b639e810ff131ab6461e1 (patch) | |
tree | 80a5a4c4f6fe9131c18225e8b65cff7e46c44fbf /engines/mohawk/myst.cpp | |
parent | ee9328323b7f6fc9796df51d88ed76e3a7ca67dd (diff) | |
download | scummvm-rg350-8f59348ec33ec7c4357b639e810ff131ab6461e1.tar.gz scummvm-rg350-8f59348ec33ec7c4357b639e810ff131ab6461e1.tar.bz2 scummvm-rg350-8f59348ec33ec7c4357b639e810ff131ab6461e1.zip |
MOHAWK: Myst: Start reworking mainloop detection
Diffstat (limited to 'engines/mohawk/myst.cpp')
-rw-r--r-- | engines/mohawk/myst.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index 35b1b6809f..7804fb52bd 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -70,7 +70,6 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription _mainCursor = kDefaultMystCursor; _showResourceRects = false; _curCard = 0; - _canSafelySaveLoad = false; _hoverResource = nullptr; _activeResource = nullptr; @@ -275,7 +274,7 @@ void MohawkEngine_Myst::doFrame() { _scriptParser->runPersistentScripts(); Common::Event event; - while (pollEvent(event)) { + while (_system->getEventManager()->pollEvent(event)) { switch (event.type) { case Common::EVENT_MOUSEMOVE: { if (_clickedResource && _clickedResource->isEnabled()) { @@ -312,11 +311,9 @@ void MohawkEngine_Myst::doFrame() { _needsShowDemoMenu = false; _needsShowCredits = false; - _canSafelySaveLoad = true; runDialog(*_optionsDialog); if (_optionsDialog->getLoadSlot() >= 0) loadGameState(_optionsDialog->getLoadSlot()); - _canSafelySaveLoad = false; if (_needsPageDrop) { dropPage(); @@ -356,15 +353,6 @@ void MohawkEngine_Myst::doFrame() { _system->delayMillis(10); } -bool MohawkEngine_Myst::pollEvent(Common::Event &event) { - // Saving / Loading is allowed from the GMM only when the main event loop is running - _canSafelySaveLoad = true; - bool eventReturned = _eventMan->pollEvent(event); - _canSafelySaveLoad = false; - - return eventReturned; -} - bool MohawkEngine_Myst::wait(uint32 duration, bool skippable) { uint32 end = getTotalPlayTime() + duration; bool skipped = false; @@ -1122,12 +1110,25 @@ bool MohawkEngine_Myst::hasGameSaveSupport() const { } bool MohawkEngine_Myst::canLoadGameStateCurrently() { - // No loading in the demo/makingof - return _canSafelySaveLoad && hasGameSaveSupport(); + if (_scriptParser->isScriptRunning()) { + return false; + } + + if (_clickedResource) { + // Can't save while dragging resources + return false; + } + + if (!hasGameSaveSupport()) { + // No loading in the demo/makingof + return false; + } + + return true; } bool MohawkEngine_Myst::canSaveGameStateCurrently() { - if (!_canSafelySaveLoad) { + if (!canLoadGameStateCurrently()) { return false; } |