diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cryomni3d/cryomni3d.cpp | 3 | ||||
-rw-r--r-- | engines/cryomni3d/cryomni3d.h | 5 | ||||
-rw-r--r-- | engines/cryomni3d/fixed_image.cpp | 10 | ||||
-rw-r--r-- | engines/cryomni3d/versailles/engine.cpp | 8 | ||||
-rw-r--r-- | engines/cryomni3d/versailles/engine.h | 4 | ||||
-rw-r--r-- | engines/cryomni3d/versailles/saveload.cpp | 10 |
6 files changed, 39 insertions, 1 deletions
diff --git a/engines/cryomni3d/cryomni3d.cpp b/engines/cryomni3d/cryomni3d.cpp index ee788d6d8c..05d370c0a4 100644 --- a/engines/cryomni3d/cryomni3d.cpp +++ b/engines/cryomni3d/cryomni3d.cpp @@ -42,7 +42,8 @@ namespace CryOmni3D { CryOmni3DEngine::CryOmni3DEngine(OSystem *syst, const CryOmni3DGameDescription *gamedesc) : Engine(syst), _gameDescription(gamedesc), - _fontManager(), _sprites(), _dragStatus(kDragStatus_NoDrag), _autoRepeatNextEvent(-1u) { + _canLoadSave(false), _fontManager(), _sprites(), _dragStatus(kDragStatus_NoDrag), + _autoRepeatNextEvent(-1u) { if (!_mixer->isReady()) { error("Sound initialization failed"); } diff --git a/engines/cryomni3d/cryomni3d.h b/engines/cryomni3d/cryomni3d.h index df62764a9a..d1855a80e4 100644 --- a/engines/cryomni3d/cryomni3d.h +++ b/engines/cryomni3d/cryomni3d.h @@ -100,7 +100,10 @@ public: Common::Language getLanguage() const; bool hasFeature(EngineFeature f) const override; + bool canLoadGameStateCurrently() override { return _canLoadSave; } + bool canSaveGameStateCurrently() override { return _canLoadSave; } + void setCanLoadSave(bool canLoadSave) { _canLoadSave = canLoadSave; } static const uint kSaveDescriptionLen = 20; private: void pauseEngineIntern(bool); @@ -157,6 +160,8 @@ protected: void setBlackPalette(); protected: + bool _canLoadSave; + FontManager _fontManager; Sprites _sprites; Objects _objects; diff --git a/engines/cryomni3d/fixed_image.cpp b/engines/cryomni3d/fixed_image.cpp index 3e8428ab44..16a35f8f1a 100644 --- a/engines/cryomni3d/fixed_image.cpp +++ b/engines/cryomni3d/fixed_image.cpp @@ -188,10 +188,15 @@ void ZonFixedImage::manage() { _usedObject = nullptr; _key.reset(); + // As the game lets load/save from main menu displayed by cliking from the toolbar, + // it's safe to enable GMM Load/Save there + _engine.setCanLoadSave(true); + // Force poll events even when we must refresh the cursor if (!_engine.pollEvents() && !_refreshCursor) { g_system->updateScreen(); g_system->delayMillis(10); + _engine.setCanLoadSave(false); return; } _refreshCursor = false; @@ -202,9 +207,11 @@ void ZonFixedImage::manage() { if (_key == Common::KEYCODE_ESCAPE) { _exit = true; + _engine.setCanLoadSave(false); return; } else if (_engine.shouldAbort()) { _exit = true; + _engine.setCanLoadSave(false); return; } @@ -221,6 +228,7 @@ void ZonFixedImage::manage() { } // Return without any event to redo the loop and force refresh _refreshCursor = true; + _engine.setCanLoadSave(false); return; } @@ -268,6 +276,8 @@ void ZonFixedImage::manage() { g_system->updateScreen(); g_system->delayMillis(10); + + _engine.setCanLoadSave(false); } void ZonFixedImage::handleMouseZones(const Common::Array<Zone>::const_iterator ¤tZone) { diff --git a/engines/cryomni3d/versailles/engine.cpp b/engines/cryomni3d/versailles/engine.cpp index c8a8b110ad..ab9318f8c3 100644 --- a/engines/cryomni3d/versailles/engine.cpp +++ b/engines/cryomni3d/versailles/engine.cpp @@ -67,6 +67,12 @@ CryOmni3DEngine_Versailles::~CryOmni3DEngine_Versailles() { delete _fixedImage; } +bool CryOmni3DEngine_Versailles::hasFeature(EngineFeature f) const { + return CryOmni3DEngine::hasFeature(f) + || (f == kSupportsSavingDuringRuntime) + || (f == kSupportsLoadingDuringRuntime); +} + Common::Error CryOmni3DEngine_Versailles::run() { CryOmni3DEngine::run(); @@ -1135,6 +1141,7 @@ int CryOmni3DEngine_Versailles::handleWarp() { bool moving = true; uint actionId; showMouse(true); + _canLoadSave = true; while (!leftButtonPressed && !exit) { int xDelta = 0, yDelta = 0; uint movingCursor = -1; @@ -1219,6 +1226,7 @@ int CryOmni3DEngine_Versailles::handleWarp() { // Slow down loop but after updating screen g_system->delayMillis(10); } + _canLoadSave = false; showMouse(false); return actionId; } diff --git a/engines/cryomni3d/versailles/engine.h b/engines/cryomni3d/versailles/engine.h index 369f69ade9..83beddbd4b 100644 --- a/engines/cryomni3d/versailles/engine.h +++ b/engines/cryomni3d/versailles/engine.h @@ -217,6 +217,10 @@ public: CryOmni3DEngine_Versailles(OSystem *syst, const CryOmni3DGameDescription *gamedesc); virtual ~CryOmni3DEngine_Versailles(); + bool hasFeature(EngineFeature f) const override; + virtual Common::Error loadGameState(int slot) override; + virtual Common::Error saveGameState(int slot, const Common::String &desc) override; + Common::String prepareFileName(const Common::String &baseName, const char *extension) const { const char *const extensions[] = { extension, nullptr }; return prepareFileName(baseName, extensions); diff --git a/engines/cryomni3d/versailles/saveload.cpp b/engines/cryomni3d/versailles/saveload.cpp index 5aec69e5ff..2c14c3d624 100644 --- a/engines/cryomni3d/versailles/saveload.cpp +++ b/engines/cryomni3d/versailles/saveload.cpp @@ -30,6 +30,16 @@ namespace CryOmni3D { namespace Versailles { +Common::Error CryOmni3DEngine_Versailles::loadGameState(int slot) { + _loadedSave = slot + 1; + _abortCommand = kAbortLoadGame; + return Common::kNoError; +} + +Common::Error CryOmni3DEngine_Versailles::saveGameState(int slot, const Common::String &desc) { + saveGame(_isVisiting, slot + 1, desc); + return Common::kNoError; +} Common::String CryOmni3DEngine_Versailles::getSaveFileName(bool visit, uint saveNum) const { return Common::String::format("%s%s.%04u", _targetName.c_str(), visit ? "_visit" : "", saveNum); |