diff options
| author | Paul Gilbert | 2015-04-22 07:08:01 -0500 | 
|---|---|---|
| committer | Paul Gilbert | 2015-04-22 07:08:01 -0500 | 
| commit | acf0b01ad80acb54992a36c0123f3c951e2200e3 (patch) | |
| tree | 6c23709bba0013963c2587dfe154ffc5cd09dff1 /engines/sherlock/sherlock.cpp | |
| parent | 8b0e8cd505eebf199aa9888ce65012f1574b1233 (diff) | |
| download | scummvm-rg350-acf0b01ad80acb54992a36c0123f3c951e2200e3.tar.gz scummvm-rg350-acf0b01ad80acb54992a36c0123f3c951e2200e3.tar.bz2 scummvm-rg350-acf0b01ad80acb54992a36c0123f3c951e2200e3.zip  | |
SHERLOCK: Hook up saving and loading via GMM
Diffstat (limited to 'engines/sherlock/sherlock.cpp')
| -rw-r--r-- | engines/sherlock/sherlock.cpp | 43 | 
1 files changed, 37 insertions, 6 deletions
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  | 
