SWORD25: Added a version field for savegame thumbnails

This commit is contained in:
md5 2011-05-13 19:19:58 +03:00
parent 7543c3ba5f
commit b3bc35c62a
2 changed files with 4 additions and 0 deletions

View File

@ -105,6 +105,7 @@ static bool decodeThumbnail(const byte *pFileData, uint fileSize, byte *&pUncomp
const byte *src = pFileData + 4; // skip header
width = READ_LE_UINT16(src); src += 2;
height = READ_LE_UINT16(src); src += 2;
src++; // version, ignored for now
pitch = width * 4;
uint32 totalSize = pitch * height;

View File

@ -39,6 +39,8 @@
namespace Sword25 {
#define THUMBNAIL_VERSION 1
bool Screenshot::saveToFile(Graphics::Surface *data, Common::WriteStream *stream) {
// Convert the RGBA data to RGB
const byte *pSrc = (const byte *)data->getBasePtr(0, 0);
@ -47,6 +49,7 @@ bool Screenshot::saveToFile(Graphics::Surface *data, Common::WriteStream *stream
stream->writeUint32BE(MKTAG('S','C','R','N')); // SCRN, short for "Screenshot"
stream->writeUint16LE(data->w);
stream->writeUint16LE(data->h);
stream->writeByte(THUMBNAIL_VERSION);
for (uint y = 0; y < data->h; y++) {
for (uint x = 0; x < data->w; x++) {