aboutsummaryrefslogtreecommitdiff
path: root/engines/cine
diff options
context:
space:
mode:
authorKari Salminen2008-07-28 08:44:49 +0000
committerKari Salminen2008-07-28 08:44:49 +0000
commit16fe053ab4535865b7f52a274cc886a682caf7d4 (patch)
tree0e41cc25cc05be677676720b20742be8396bbc91 /engines/cine
parentb5a7735ffcad29c533edf22944262c1339d5bf82 (diff)
downloadscummvm-rg350-16fe053ab4535865b7f52a274cc886a682caf7d4.tar.gz
scummvm-rg350-16fe053ab4535865b7f52a274cc886a682caf7d4.tar.bz2
scummvm-rg350-16fe053ab4535865b7f52a274cc886a682caf7d4.zip
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. svn-id: r33362
Diffstat (limited to 'engines/cine')
-rw-r--r--engines/cine/anim.h9
-rw-r--r--engines/cine/cine.h1
-rw-r--r--engines/cine/various.cpp34
3 files changed, 34 insertions, 10 deletions
diff --git a/engines/cine/anim.h b/engines/cine/anim.h
index c04513149c..c3665bf4ce 100644
--- a/engines/cine/anim.h
+++ b/engines/cine/anim.h
@@ -53,12 +53,19 @@ namespace Cine {
* 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 {
diff --git a/engines/cine/cine.h b/engines/cine/cine.h
index 884520d65f..eaae555812 100644
--- a/engines/cine/cine.h
+++ b/engines/cine/cine.h
@@ -100,6 +100,7 @@ private:
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);
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index b4bbcc2bb9..6efb441049 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -582,6 +582,11 @@ void CineEngine::resetEngine() {
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 @@ bool CineEngine::loadPlainSaveFW(Common::SeekableReadStream &in, CineSaveGameFor
loadMsg(currentMsgName);
}
- setMouseCursor(MOUSE_CURSOR_NORMAL);
-
if (strlen(currentDatName)) {
/* i = saveVar2;
saveVar2 = 0;
@@ -768,6 +771,8 @@ bool CineEngine::makeLoad(char *saveName) {
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 @@ bool CineEngine::makeLoad(char *saveName) {
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 @@ bool CineEngine::makeLoad(char *saveName) {
// 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) {