aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFabio Battaglia2009-03-04 12:44:55 +0000
committerFabio Battaglia2009-03-04 12:44:55 +0000
commitcdc9f46bd921b5135f5f8a5881823377cebd6e55 (patch)
tree195df7fcb62ae17929cc7a8ba99381bb439215d3 /engines
parent7270c879194837627968af9717ff7100e46741cf (diff)
downloadscummvm-rg350-cdc9f46bd921b5135f5f8a5881823377cebd6e55.tar.gz
scummvm-rg350-cdc9f46bd921b5135f5f8a5881823377cebd6e55.tar.bz2
scummvm-rg350-cdc9f46bd921b5135f5f8a5881823377cebd6e55.zip
sword1: removed custom checks for thumbnails, using graphics/thumbnail.h functions instead
svn-id: r39130
Diffstat (limited to 'engines')
-rw-r--r--engines/sword1/control.cpp20
-rw-r--r--engines/sword1/control.h2
-rw-r--r--engines/sword1/detection.cpp6
3 files changed, 9 insertions, 19 deletions
diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp
index 575f031cc7..3e90f713bb 100644
--- a/engines/sword1/control.cpp
+++ b/engines/sword1/control.cpp
@@ -1104,12 +1104,8 @@ void Control::saveGameToFile(uint8 slot) {
outf->write(_saveNames[slot].c_str(), 40);
outf->writeByte(SAVEGAME_VERSION);
- if (!isPanelShown()) {
- outf->writeByte(HAS_THUMBNAIL);
- // Thumbnail
+ if (!isPanelShown()) // Generate a thumbnail only if we are outside of game menu
Graphics::saveThumbnail(*outf);
- } else // at this point we can't save a thumbnail of the game screen, as the save menu is shown
- outf->writeByte(NO_THUMBNAIL);
// Date / time
tm curTime;
@@ -1175,16 +1171,11 @@ bool Control::restoreGameFromFile(uint8 slot) {
return false;
}
- bool hasThumbnail = inf->readByte();
+ if (saveVersion < 2) // These older version of the savegames used a flag to signal presence of thumbnail
+ inf->skip(1);
- if (hasThumbnail) {
- // We don't need the thumbnail here, so just read it and discard it
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- Graphics::loadThumbnail(*inf, *thumbnail);
- delete thumbnail;
- thumbnail = 0;
- }
+ if (Graphics::checkThumbnailHeader(*inf))
+ Graphics::skipThumbnailHeader(*inf);
inf->readUint32BE(); // save date
inf->readUint16BE(); // save time
@@ -1281,7 +1272,6 @@ bool Control::convertSaveGame(uint8 slot, char* desc) {
newSave->writeUint32LE(SAVEGAME_HEADER);
newSave->write(desc, 40);
newSave->writeByte(SAVEGAME_VERSION);
- newSave->writeByte(NO_THUMBNAIL);
// Date / time
tm curTime;
diff --git a/engines/sword1/control.h b/engines/sword1/control.h
index d1796734a8..6b0d838f96 100644
--- a/engines/sword1/control.h
+++ b/engines/sword1/control.h
@@ -45,8 +45,6 @@ class Sound;
#define SAVEGAME_HEADER MKID_BE('BS_1')
#define SAVEGAME_VERSION 2
-#define HAS_THUMBNAIL 1
-#define NO_THUMBNAIL 0
#define MAX_BUTTONS 16
diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index 436b4d86b9..16e564c5a7 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -262,8 +262,10 @@ SaveStateDescriptor SwordMetaEngine::querySaveMetaInfos(const char *target, int
desc.setDeletableFlag(true);
desc.setWriteProtectedFlag(false);
- bool hasThumbnail = in->readByte();
- if (hasThumbnail) {
+ if (versionSave < 2) // These older version of the savegames used a flag to signal presence of thumbnail
+ in->skip(1);
+
+ if (Graphics::checkThumbnailHeader(*in)) {
Graphics::Surface *thumbnail = new Graphics::Surface();
assert(thumbnail);
if (!Graphics::loadThumbnail(*in, *thumbnail)) {