[Scummvm-cvs-logs] SF.net SVN: scummvm:[35024] scummvm/trunk/engines/sky

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Nov 12 21:41:19 CET 2008


Revision: 35024
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35024&view=rev
Author:   thebluegr
Date:     2008-11-12 20:41:19 +0000 (Wed, 12 Nov 2008)

Log Message:
-----------
Saving and loading from the GMM is now supported in the sky engine

Modified Paths:
--------------
    scummvm/trunk/engines/sky/control.h
    scummvm/trunk/engines/sky/detection.cpp
    scummvm/trunk/engines/sky/sky.h

Modified: scummvm/trunk/engines/sky/control.h
===================================================================
--- scummvm/trunk/engines/sky/control.h	2008-11-12 14:30:16 UTC (rev 35023)
+++ scummvm/trunk/engines/sky/control.h	2008-11-12 20:41:19 UTC (rev 35024)
@@ -191,6 +191,12 @@
 	uint16 quickXRestore(uint16 slot);
 	bool loadSaveAllowed(void);
 
+	uint16 _selectedGame;
+	uint16 saveGameToFile(void);
+
+	void loadDescriptions(Common::StringList &list);
+	void saveDescriptions(const Common::StringList &list);
+
 private:
 	int displayMessage(const char *altButton, const char *message, ...);
 
@@ -216,14 +222,10 @@
 	void drawCross(uint16 x, uint16 y);
 
 	uint16 saveRestorePanel(bool allowSave);
-	void loadDescriptions(Common::StringList &list);
-	void saveDescriptions(const Common::StringList &list);
 	void setUpGameSprites(const Common::StringList &saveGameNames, dataFileHeader **nameSprites, uint16 firstNum, uint16 selectedGame);
 	void showSprites(dataFileHeader **nameSprites, bool allowSave);
 	void handleKeyPress(Common::KeyState kbd, Common::String &textBuf);
 
-	uint16 _selectedGame;
-	uint16 saveGameToFile(void);
 	uint32 prepareSaveData(uint8 *destBuf);
 
 	bool autoSaveExists(void);

Modified: scummvm/trunk/engines/sky/detection.cpp
===================================================================
--- scummvm/trunk/engines/sky/detection.cpp	2008-11-12 14:30:16 UTC (rev 35023)
+++ scummvm/trunk/engines/sky/detection.cpp	2008-11-12 20:41:19 UTC (rev 35024)
@@ -93,7 +93,9 @@
 
 bool Sky::SkyEngine::hasFeature(EngineFeature f) const {
 	return
-		(f == kSupportsRTL);
+		(f == kSupportsRTL) ||
+		(f == kSupportsLoadingDuringRuntime) ||
+		(f == kSupportsSavingDuringRuntime);
 }
 
 GameList SkyMetaEngine::getSupportedGames() const {
@@ -223,3 +225,41 @@
 #else
 	REGISTER_PLUGIN_STATIC(SKY, PLUGIN_TYPE_ENGINE, SkyMetaEngine);
 #endif
+
+namespace Sky {
+Common::Error SkyEngine::loadGameState(int slot) {
+	uint16 result = _skyControl->quickXRestore(slot);
+	return (result == GAME_RESTORED) ? Common::kNoError : Common::kUnknownError;
+}
+
+Common::Error SkyEngine::saveGameState(int slot, const char *desc) {
+	if (slot == 0)
+		return Common::kWritePermissionDenied;	// we can't overwrite the auto save
+
+	// Set the save slot and save the game
+	_skyControl->_selectedGame = slot - 1;
+	if (_skyControl->saveGameToFile() != GAME_SAVED)
+		return Common::kWritePermissionDenied;
+
+	// Load current save game descriptions
+	Common::StringList saveGameTexts;
+	saveGameTexts.resize(MAX_SAVE_GAMES+1);
+	_skyControl->loadDescriptions(saveGameTexts);
+
+	// Update the save game description at the given slot
+	saveGameTexts[slot - 1] = desc;
+	// Save the updated descriptions
+	_skyControl->saveDescriptions(saveGameTexts);
+
+	return Common::kNoError;
+}
+
+bool SkyEngine::canLoadGameStateCurrently() { 
+	return _systemVars.pastIntro && _skyControl->loadSaveAllowed();
+}
+
+bool SkyEngine::canSaveGameStateCurrently() { 
+	return _systemVars.pastIntro && _skyControl->loadSaveAllowed();
+}
+
+} // End of namespace Sky

Modified: scummvm/trunk/engines/sky/sky.h
===================================================================
--- scummvm/trunk/engines/sky/sky.h	2008-11-12 14:30:16 UTC (rev 35023)
+++ scummvm/trunk/engines/sky/sky.h	2008-11-12 20:41:19 UTC (rev 35024)
@@ -82,6 +82,11 @@
 	static bool isDemo(void);
 	static bool isCDVersion(void);
 
+	Common::Error loadGameState(int slot);
+	Common::Error saveGameState(int slot, const char *desc);
+	bool canLoadGameStateCurrently();
+	bool canSaveGameStateCurrently();
+
 	static void *fetchItem(uint32 num);
 	static void *_itemList[300];
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list