aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Crozat2017-09-05 19:43:18 +0100
committerThierry Crozat2018-01-23 02:15:32 +0000
commit696fcb6bb98a2e527ebba8c70548930fe3a6cb31 (patch)
tree7deca734a8796e15b69e5201e2918f985b853cba
parent275daa81c34e3ccf36457a69d6af0c7e672ada94 (diff)
downloadscummvm-rg350-696fcb6bb98a2e527ebba8c70548930fe3a6cb31.tar.gz
scummvm-rg350-696fcb6bb98a2e527ebba8c70548930fe3a6cb31.tar.bz2
scummvm-rg350-696fcb6bb98a2e527ebba8c70548930fe3a6cb31.zip
SUPERNOVA: Add saving/loading of playtime
-rw-r--r--engines/supernova/detection.cpp3
-rw-r--r--engines/supernova/supernova.cpp4
2 files changed, 7 insertions, 0 deletions
diff --git a/engines/supernova/detection.cpp b/engines/supernova/detection.cpp
index b587dbb623..bf7d6bf177 100644
--- a/engines/supernova/detection.cpp
+++ b/engines/supernova/detection.cpp
@@ -101,6 +101,7 @@ bool SupernovaMetaEngine::hasFeature(MetaEngineFeature f) const {
// fallthrough
case kSavesSupportCreationDate:
// fallthrough
+ case kSavesSupportPlayTime:
return true;
default:
return false;
@@ -187,6 +188,8 @@ SaveStateDescriptor SupernovaMetaEngine::querySaveMetaInfos(const char *target,
int minutes = saveTime & 0xFF;
desc.setSaveTime(hour, minutes);
+ uint32 playTime =savefile->readUint32LE();
+ desc.setPlayTime(playTime * 1000);
if (Graphics::checkThumbnailHeader(*savefile)) {
Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*savefile);
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp
index ad5d8af501..9526481fdf 100644
--- a/engines/supernova/supernova.cpp
+++ b/engines/supernova/supernova.cpp
@@ -148,6 +148,8 @@ Common::Error SupernovaEngine::run() {
CursorMan.replaceCursorPalette(initVGAPalette, 0, 16);
CursorMan.showMouse(true);
+ setTotalPlayTime(0);
+
int saveSlot = ConfMan.getInt("save_slot");
if (saveSlot >= 0) {
if (loadGameState(saveSlot).getCode() != Common::kNoError)
@@ -837,6 +839,7 @@ bool SupernovaEngine::loadGame(int slot) {
int descriptionSize = savefile->readSint16LE();
savefile->skip(descriptionSize);
savefile->skip(6);
+ setTotalPlayTime(savefile->readUint32LE() * 1000);
Graphics::skipThumbnail(*savefile);
_gm->deserialize(savefile);
@@ -866,6 +869,7 @@ bool SupernovaEngine::saveGame(int slot, const Common::String &description) {
savefile->write(description.c_str(), description.size() + 1);
savefile->writeUint32LE(saveDate);
savefile->writeUint16LE(saveTime);
+ savefile->writeUint32LE(getTotalPlayTime() / 1000);
Graphics::saveThumbnail(*savefile);
_gm->serialize(savefile);