mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-17 15:18:11 +00:00
MOHAWK: Only allow saving/loading from the main event loop
This commit is contained in:
parent
becbe41527
commit
d6881100dd
@ -76,6 +76,7 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription
|
||||
_showResourceRects = false;
|
||||
_curCard = 0;
|
||||
_needsUpdate = false;
|
||||
_canSafelySaveLoad = false;
|
||||
_curResource = -1;
|
||||
_hoverResource = nullptr;
|
||||
|
||||
@ -267,7 +268,7 @@ Common::Error MohawkEngine_Myst::run() {
|
||||
_needsUpdate = _video->updateMovies();
|
||||
_scriptParser->runPersistentScripts();
|
||||
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
while (pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_MOUSEMOVE: {
|
||||
_needsUpdate = true;
|
||||
@ -312,7 +313,9 @@ Common::Error MohawkEngine_Myst::run() {
|
||||
_needsShowMap = false;
|
||||
_needsShowDemoMenu = false;
|
||||
|
||||
_canSafelySaveLoad = true;
|
||||
runDialog(*_optionsDialog);
|
||||
_canSafelySaveLoad = false;
|
||||
|
||||
if (_needsPageDrop) {
|
||||
dropPage();
|
||||
@ -350,6 +353,15 @@ Common::Error MohawkEngine_Myst::run() {
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
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::skippableWait(uint32 duration) {
|
||||
uint32 end = _system->getMillis() + duration;
|
||||
bool skipped = false;
|
||||
@ -1083,10 +1095,14 @@ Common::Error MohawkEngine_Myst::saveGameState(int slot, const Common::String &d
|
||||
|
||||
bool MohawkEngine_Myst::canLoadGameStateCurrently() {
|
||||
// No loading in the demo/makingof
|
||||
return !(getFeatures() & GF_DEMO) && getGameType() != GType_MAKINGOF;
|
||||
return _canSafelySaveLoad && !(getFeatures() & GF_DEMO) && getGameType() != GType_MAKINGOF;
|
||||
}
|
||||
|
||||
bool MohawkEngine_Myst::canSaveGameStateCurrently() {
|
||||
if (!_canSafelySaveLoad) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// There's a limited number of stacks the game can save in
|
||||
switch (_curStack) {
|
||||
case kChannelwoodStack:
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "mohawk/resource_cache.h"
|
||||
#include "mohawk/myst_scripts.h"
|
||||
|
||||
#include "common/events.h"
|
||||
#include "common/random.h"
|
||||
|
||||
namespace Mohawk {
|
||||
@ -240,6 +241,13 @@ private:
|
||||
|
||||
bool _runExitScript;
|
||||
|
||||
/**
|
||||
* Saving / Loading is only allowed from the main event loop
|
||||
*/
|
||||
bool _canSafelySaveLoad;
|
||||
|
||||
bool pollEvent(Common::Event &event);
|
||||
|
||||
void dropPage();
|
||||
|
||||
void loadCard();
|
||||
|
Loading…
Reference in New Issue
Block a user