[Scummvm-cvs-logs] SF.net SVN: scummvm:[39130] scummvm/trunk/engines/sword1
hkz at users.sourceforge.net
hkz at users.sourceforge.net
Wed Mar 4 13:44:55 CET 2009
Revision: 39130
http://scummvm.svn.sourceforge.net/scummvm/?rev=39130&view=rev
Author: hkz
Date: 2009-03-04 12:44:55 +0000 (Wed, 04 Mar 2009)
Log Message:
-----------
sword1: removed custom checks for thumbnails, using graphics/thumbnail.h functions instead
Modified Paths:
--------------
scummvm/trunk/engines/sword1/control.cpp
scummvm/trunk/engines/sword1/control.h
scummvm/trunk/engines/sword1/detection.cpp
Modified: scummvm/trunk/engines/sword1/control.cpp
===================================================================
--- scummvm/trunk/engines/sword1/control.cpp 2009-03-04 12:31:18 UTC (rev 39129)
+++ scummvm/trunk/engines/sword1/control.cpp 2009-03-04 12:44:55 UTC (rev 39130)
@@ -1104,12 +1104,8 @@
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 @@
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 @@
newSave->writeUint32LE(SAVEGAME_HEADER);
newSave->write(desc, 40);
newSave->writeByte(SAVEGAME_VERSION);
- newSave->writeByte(NO_THUMBNAIL);
// Date / time
tm curTime;
Modified: scummvm/trunk/engines/sword1/control.h
===================================================================
--- scummvm/trunk/engines/sword1/control.h 2009-03-04 12:31:18 UTC (rev 39129)
+++ scummvm/trunk/engines/sword1/control.h 2009-03-04 12:44:55 UTC (rev 39130)
@@ -45,8 +45,6 @@
#define SAVEGAME_HEADER MKID_BE('BS_1')
#define SAVEGAME_VERSION 2
-#define HAS_THUMBNAIL 1
-#define NO_THUMBNAIL 0
#define MAX_BUTTONS 16
Modified: scummvm/trunk/engines/sword1/detection.cpp
===================================================================
--- scummvm/trunk/engines/sword1/detection.cpp 2009-03-04 12:31:18 UTC (rev 39129)
+++ scummvm/trunk/engines/sword1/detection.cpp 2009-03-04 12:44:55 UTC (rev 39130)
@@ -262,8 +262,10 @@
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)) {
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