diff options
Diffstat (limited to 'engines/fullpipe/stateloader.cpp')
-rw-r--r-- | engines/fullpipe/stateloader.cpp | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index 703190be0b..5b89b6b0e2 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -22,6 +22,13 @@ #include "fullpipe/fullpipe.h" +#include "fullpipe/constants.h" +#include "fullpipe/gameloader.h" +#include "fullpipe/interaction.h" +#include "fullpipe/objects.h" +#include "fullpipe/scene.h" +#include "fullpipe/statics.h" + #include "common/file.h" #include "common/array.h" #include "common/list.h" @@ -29,15 +36,6 @@ #include "graphics/thumbnail.h" -#include "fullpipe/objects.h" -#include "fullpipe/gameloader.h" -#include "fullpipe/scene.h" -#include "fullpipe/statics.h" -#include "fullpipe/interaction.h" -#include "fullpipe/gameloader.h" - -#include "fullpipe/constants.h" - namespace Fullpipe { bool GameLoader::readSavegame(const char *fname) { @@ -69,6 +67,11 @@ bool GameLoader::readSavegame(const char *fname) { Common::Array<byte> map(800); saveFile->read(map.data(), 800); + FullpipeSavegameHeader header2; + if (Fullpipe::readSavegameHeader(saveFile.get(), header2)) { + g_fp->setTotalPlayTime(header2.playtime * 1000); + } + { Common::MemoryReadStream tempStream(map.data(), 800, DisposeAfterUse::NO); MfcArchive temp(&tempStream); @@ -185,10 +188,10 @@ void fillDummyHeader(Fullpipe::FullpipeSavegameHeader &header) { // This is wrong header, perhaps it is original savegame. Thus fill out dummy values header.date = (20 << 24) | (9 << 16) | 2016; header.time = (9 << 8) | 56; - header.playtime = 1000; + header.playtime = 0; } -bool readSavegameHeader(Common::InSaveFile *in, FullpipeSavegameHeader &header) { +WARN_UNUSED_RESULT bool readSavegameHeader(Common::InSaveFile *in, FullpipeSavegameHeader &header, bool skipThumbnail) { uint oldPos = in->pos(); in->seek(-4, SEEK_END); @@ -232,13 +235,13 @@ bool readSavegameHeader(Common::InSaveFile *in, FullpipeSavegameHeader &header) header.description = header.saveName; // Get the thumbnail - header.thumbnail = Common::SharedPtr<Graphics::Surface>(Graphics::loadThumbnail(*in), Graphics::SurfaceDeleter()); + if (!Graphics::loadThumbnail(*in, header.thumbnail, skipThumbnail)) { + in->seek(oldPos, SEEK_SET); // Rewind the file + return false; + } in->seek(oldPos, SEEK_SET); // Rewind the file - if (!header.thumbnail) - return false; - return true; } |