diff options
-rw-r--r-- | engines/sherlock/detection.cpp | 7 | ||||
-rw-r--r-- | engines/sherlock/saveload.cpp | 4 | ||||
-rw-r--r-- | engines/sherlock/sherlock.cpp | 43 | ||||
-rw-r--r-- | engines/sherlock/sherlock.h | 10 |
4 files changed, 52 insertions, 12 deletions
diff --git a/engines/sherlock/detection.cpp b/engines/sherlock/detection.cpp index 5d217bd1c5..c4d1c65fd5 100644 --- a/engines/sherlock/detection.cpp +++ b/engines/sherlock/detection.cpp @@ -106,6 +106,13 @@ bool SherlockMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSavesSupportThumbnail); } +bool Sherlock::SherlockEngine::hasFeature(EngineFeature f) const { + return + (f == kSupportsRTL) || + (f == kSupportsLoadingDuringRuntime) || + (f == kSupportsSavingDuringRuntime); +} + SaveStateList SherlockMetaEngine::listSaves(const char *target) const { return Sherlock::SaveManager(nullptr, "").getSavegameList(target); } diff --git a/engines/sherlock/saveload.cpp b/engines/sherlock/saveload.cpp index 207eff1ab4..7610c42d8c 100644 --- a/engines/sherlock/saveload.cpp +++ b/engines/sherlock/saveload.cpp @@ -383,10 +383,6 @@ void SaveManager::synchronize(Common::Serializer &s) { if (screen.fontNumber() != oldFont) journal.resetPosition(); - /* - char room_flags[MAX_ROOMS * 9]; - - */ _vm->_loadingSavedGame = true; _justLoaded = true; diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp index cd5d48033a..518a7aa86b 100644 --- a/engines/sherlock/sherlock.cpp +++ b/engines/sherlock/sherlock.cpp @@ -51,6 +51,7 @@ SherlockEngine::SherlockEngine(OSystem *syst, const SherlockGameDescription *gam _slowChess = false; _keyPadSpeed = 0; _loadGameSlot = -1; + _canLoadSave = false; } SherlockEngine::~SherlockEngine() { @@ -147,8 +148,11 @@ void SherlockEngine::sceneLoop() { // Handle any input from the keyboard or mouse handleInput(); - if (_scene->_hsavedPos.x == -1) + if (_scene->_hsavedPos.x == -1) { + _canLoadSave = true; _scene->doBgAnim(); + _canLoadSave = false; + } } _scene->freeScene(); @@ -160,7 +164,9 @@ void SherlockEngine::sceneLoop() { * Handle all player input */ void SherlockEngine::handleInput() { + _canLoadSave = true; _events->pollEventsAndWait(); + _canLoadSave = false; // See if a key or mouse button is pressed _events->setButtonState(); @@ -190,15 +196,10 @@ void SherlockEngine::setFlags(int flagNum) { _scene->checkSceneFlags(true); } -void SherlockEngine::freeSaveGameList() { - // TODO -} - void SherlockEngine::saveConfig() { // TODO } - /** * Synchronize the data for a savegame */ @@ -207,4 +208,34 @@ void SherlockEngine::synchronize(Common::Serializer &s) { s.syncAsByte(_flags[idx]); } +/** + * Returns true if a savegame can be loaded + */ +bool SherlockEngine::canLoadGameStateCurrently() { + return _canLoadSave; +} + +/** + * Returns true if the game can be saved + */ +bool SherlockEngine::canSaveGameStateCurrently() { + return _canLoadSave; +} + +/** + * Called by the GMM to load a savegame + */ +Common::Error SherlockEngine::loadGameState(int slot) { + _saves->loadGame(slot); + return Common::kNoError; +} + +/** + * Called by the GMM to save the game + */ +Common::Error SherlockEngine::saveGameState(int slot, const Common::String &desc) { + _saves->saveGame(slot, desc); + return Common::kNoError; +} + } // End of namespace Comet diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h index 09e969884c..916c9cd253 100644 --- a/engines/sherlock/sherlock.h +++ b/engines/sherlock/sherlock.h @@ -80,6 +80,8 @@ protected: virtual void showOpening() = 0; virtual void startScene() {} + + virtual bool hasFeature(EngineFeature f) const; public: const SherlockGameDescription *_gameDescription; Animation *_animation; @@ -108,12 +110,18 @@ public: bool _slowChess; int _keyPadSpeed; int _loadGameSlot; + bool _canLoadSave; public: SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc); virtual ~SherlockEngine(); virtual Common::Error run(); + virtual bool canLoadGameStateCurrently(); + virtual bool canSaveGameStateCurrently(); + virtual Common::Error loadGameState(int slot); + virtual Common::Error saveGameState(int slot, const Common::String &desc); + int getGameType() const; uint32 getGameID() const; uint32 getGameFeatures() const; @@ -128,8 +136,6 @@ public: void setFlags(int flagNum); - void freeSaveGameList(); - void saveConfig(); void synchronize(Common::Serializer &s); |