GNAP: Compute the thumbnail when opening the device so that it doesn't show the large hand in savegames

This commit is contained in:
Strangerke 2016-05-19 07:06:48 +02:00
parent 3bf35331ab
commit 97ac77b5f1
3 changed files with 12 additions and 3 deletions

View File

@ -97,6 +97,7 @@ GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) :
Engine::syncSoundSettings();
_scene = nullptr;
_music = nullptr;
_tempThumbnail = nullptr;
_wasSavegameLoaded = false;
for (int i = 0; i < kMaxTimers; ++i)
@ -112,6 +113,7 @@ GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) :
GnapEngine::~GnapEngine() {
delete _random;
delete _music;
delete _tempThumbnail;
}
Common::Error GnapEngine::run() {

View File

@ -248,6 +248,8 @@ public:
MusicPlayer *_music;
Graphics::Font *_font;
Common::MemoryWriteStreamDynamic *_tempThumbnail;
int _lastUpdateClock;
int _debugLevel;

View File

@ -210,8 +210,11 @@ void GnapEngine::runMenu() {
_menuStatus = 0;
_menuDone = false;
createMenuSprite();//??? CHECKME Crashes when done in loadStockDat() find out why
delete _tempThumbnail;
_tempThumbnail = new Common::MemoryWriteStreamDynamic;
Graphics::saveThumbnail(*_tempThumbnail);
createMenuSprite();
insertDeviceIconActive();
for (int i = 0; i < 7; ++i) {
@ -577,7 +580,9 @@ void GnapEngine::writeSavegameHeader(Common::OutSaveFile *out, GnapSavegameHeade
out->writeString(header._saveName);
out->writeByte('\0');
Graphics::saveThumbnail(*out);
// This implies the menu is used
// If we want to save/load at any time, then a check should be added
out->write(_tempThumbnail->getData(), _tempThumbnail->size());
// Write out the save date/time
TimeDate td;
@ -608,7 +613,7 @@ bool GnapEngine::readSavegameHeader(Common::InSaveFile *in, GnapSavegameHeader &
while ((ch = (char)in->readByte()) != '\0')
header._saveName += ch;
// TODO: Get the thumbnail
// Get the thumbnail, saved in v2 or later
if (header._version == 1)
header._thumbnail = nullptr;
else {