[Scummvm-cvs-logs] SF.net SVN: scummvm:[33362] scummvm/trunk/engines/cine

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Mon Jul 28 10:44:50 CEST 2008


Revision: 33362
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33362&view=rev
Author:   buddha_
Date:     2008-07-28 08:44:49 +0000 (Mon, 28 Jul 2008)

Log Message:
-----------
Made the savegame loading routine choose between loading a Future Wars or an Operation Stealth savegame format.
Added a stub for loading the Operation Stealth's temporary savegame format (Not yet implemented).
Made mouse cursor change to a disk icon when loading a savegame and back to normal after its done.

Modified Paths:
--------------
    scummvm/trunk/engines/cine/anim.h
    scummvm/trunk/engines/cine/cine.h
    scummvm/trunk/engines/cine/various.cpp

Modified: scummvm/trunk/engines/cine/anim.h
===================================================================
--- scummvm/trunk/engines/cine/anim.h	2008-07-28 08:44:14 UTC (rev 33361)
+++ scummvm/trunk/engines/cine/anim.h	2008-07-28 08:44:49 UTC (rev 33362)
@@ -53,12 +53,19 @@
  *   but don't try using them for anything else, it won't work.
  * - Introduced in revision 31444, got broken in revision 31453,
  *   got fixed in revision 32073 and used after that.
+ *
+ * TEMP_OS_FORMAT:
+ * - Temporary Operation Stealth savegame format.
+ * - NOT backward compatible and NOT to be supported in the future.
+ *   This format should ONLY be used during development and abandoned
+ *   later in favor of a better format!
  */
 enum CineSaveGameFormat {
 	ANIMSIZE_UNKNOWN,
 	ANIMSIZE_23,
 	ANIMSIZE_30_PTRS_BROKEN,
-	ANIMSIZE_30_PTRS_INTACT
+	ANIMSIZE_30_PTRS_INTACT,
+	TEMP_OS_FORMAT
 };
 
 struct AnimHeaderStruct {

Modified: scummvm/trunk/engines/cine/cine.h
===================================================================
--- scummvm/trunk/engines/cine/cine.h	2008-07-28 08:44:14 UTC (rev 33361)
+++ scummvm/trunk/engines/cine/cine.h	2008-07-28 08:44:49 UTC (rev 33362)
@@ -100,6 +100,7 @@
 	void initialize(void);
 	void resetEngine();
 	bool loadPlainSaveFW(Common::SeekableReadStream &in, CineSaveGameFormat saveGameFormat);
+	bool loadTempSaveOS(Common::SeekableReadStream &in);
 	bool makeLoad(char *saveName);
 	void makeSaveFW(Common::OutSaveFile &out);
 	void makeSaveOS(Common::OutSaveFile &out);

Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp	2008-07-28 08:44:14 UTC (rev 33361)
+++ scummvm/trunk/engines/cine/various.cpp	2008-07-28 08:44:49 UTC (rev 33362)
@@ -582,6 +582,11 @@
 	checkForPendingDataLoadSwitch = 0;
 }
 
+bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) {
+	warning("loadTempSaveOS: This is a stub. Temporary Operation Stealth savegame loading not yet implemented");
+	return false;
+}
+
 bool CineEngine::loadPlainSaveFW(Common::SeekableReadStream &in, CineSaveGameFormat saveGameFormat) {
 	int16 i;
 	int16 size;
@@ -740,8 +745,6 @@
 		loadMsg(currentMsgName);
 	}
 
-	setMouseCursor(MOUSE_CURSOR_NORMAL);
-
 	if (strlen(currentDatName)) {
 /*		i = saveVar2;
 		saveVar2 = 0;
@@ -768,6 +771,8 @@
 		return false;
 	}
 
+	setMouseCursor(MOUSE_CURSOR_DISK);
+
 	uint32 saveSize = saveFile->size();
 	if (saveSize == 0) { // Savefile's compressed using zlib format can't tell their unpacked size, test for it
 		// Can't get information about the savefile's size so let's try
@@ -791,6 +796,8 @@
 	enum CineSaveGameFormat saveGameFormat = detectSaveGameFormat(*in);
 
 	// Handle problematic savegame formats
+	bool load = true; // Should we try to load the savegame?
+	bool result = false;
 	if (saveGameFormat == ANIMSIZE_30_PTRS_BROKEN) {
 		// One might be able to load the ANIMSIZE_30_PTRS_BROKEN format but
 		// that's not implemented here because it was never used in a stable
@@ -798,21 +805,30 @@
 		// which introduced the problem, until revision 32073, which fixed it).
 		// Therefore be bail out if we detect this particular savegame format.
 		warning("Detected a known broken savegame format, not loading savegame");
-		return false;
+		load = false; // Don't load the savegame
 	} else if (saveGameFormat == ANIMSIZE_UNKNOWN) {
 		// If we can't detect the savegame format
 		// then let's try the default format and hope for the best.
 		warning("Couldn't detect the used savegame format, trying default savegame format. Things may break");
 		saveGameFormat = ANIMSIZE_30_PTRS_INTACT;
 	}
-	// Now we should have either of these formats
-	assert(saveGameFormat == ANIMSIZE_23 || saveGameFormat == ANIMSIZE_30_PTRS_INTACT);
 
-	// Reset the engine's state
-	resetEngine();
+	if (load) {
+		// Reset the engine's state
+		resetEngine();
+		
+		if (saveGameFormat == TEMP_OS_FORMAT) {
+			// Load the temporary Operation Stealth savegame format
+			result = loadTempSaveOS(*in);
+		} else {
+			// Load the plain Future Wars savegame format
+			result = loadPlainSaveFW(*in, saveGameFormat);
+		}
+	}
 
-	// Load the plain Future Wars savegame format
-	return loadPlainSaveFW(*in, saveGameFormat);
+	setMouseCursor(MOUSE_CURSOR_NORMAL);
+
+	return result;
 }
 
 void CineEngine::makeSaveFW(Common::OutSaveFile &out) {


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