aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2012-03-27 00:50:29 +0300
committerFilippos Karapetis2012-03-27 00:50:29 +0300
commit5e10737015faa15d225f70b364096982923eb415 (patch)
treed26d0da4b15fc1af3d05795e67358a273348fe3b /engines
parent85ca13db4b192b5993f1b291d90cce85ad94fb98 (diff)
downloadscummvm-rg350-5e10737015faa15d225f70b364096982923eb415.tar.gz
scummvm-rg350-5e10737015faa15d225f70b364096982923eb415.tar.bz2
scummvm-rg350-5e10737015faa15d225f70b364096982923eb415.zip
AGI: Add played time information to saved games
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/agi.cpp1
-rw-r--r--engines/agi/detection.cpp7
-rw-r--r--engines/agi/saveload.cpp12
3 files changed, 16 insertions, 4 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 3adcf96e01..45c00a76ac 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -702,6 +702,7 @@ Common::Error AgiBase::init() {
Common::Error AgiEngine::go() {
CursorMan.showMouse(true);
+ setTotalPlayTime(0);
if (_game.state < STATE_LOADED) {
do {
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index 7c7394e87e..805fe7d366 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -187,7 +187,8 @@ bool AgiMetaEngine::hasFeature(MetaEngineFeature f) const {
(f == kSupportsDeleteSave) ||
(f == kSavesSupportMetaInfo) ||
(f == kSavesSupportThumbnail) ||
- (f == kSavesSupportCreationDate);
+ (f == kSavesSupportCreationDate) ||
+ (f == kSavesSupportPlayTime);
}
bool AgiBase::hasFeature(EngineFeature f) const {
@@ -305,6 +306,10 @@ SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int sl
uint32 saveDate = in->readUint32BE();
uint16 saveTime = in->readUint16BE();
+ if (saveVersion >= 6) {
+ uint32 playTime = in->readUint32BE();
+ desc.setPlayTime(playTime * 1000);
+ }
int day = (saveDate >> 24) & 0xFF;
int month = (saveDate >> 16) & 0xFF;
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index 04054daacd..8e524c8d9a 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -42,7 +42,7 @@
#include "agi/keyboard.h"
#include "agi/menu.h"
-#define SAVEGAME_VERSION 5
+#define SAVEGAME_VERSION 6
//
// Version 0 (Sarien): view table has 64 entries
@@ -51,6 +51,7 @@
// Version 3 (ScummVM): added AGIPAL save/load support
// Version 4 (ScummVM): added thumbnails and save creation date/time
// Version 5 (ScummVM): Added game md5
+// Version 6 (ScummVM): Added game played time
//
namespace Agi {
@@ -86,12 +87,14 @@ int AgiEngine::saveGame(const Common::String &fileName, const Common::String &de
uint32 saveDate = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF);
uint16 saveTime = ((curTime.tm_hour & 0xFF) << 8) | ((curTime.tm_min) & 0xFF);
+ uint32 playTime = g_engine->getTotalPlayTime() / 1000;
out->writeUint32BE(saveDate);
debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing save date (%d)", saveDate);
out->writeUint16BE(saveTime);
debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing save time (%d)", saveTime);
- // TODO: played time
+ out->writeUint32BE(playTime);
+ debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing play time (%d)", playTime);
out->writeByte(_game.state);
debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing game state (%d)", _game.state);
@@ -298,7 +301,10 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
in->readUint32BE(); // save date
in->readUint16BE(); // save time
- // TODO: played time
+ if (saveVersion >= 6) {
+ uint32 playTime = in->readUint32BE();
+ g_engine->setTotalPlayTime(playTime * 1000);
+ }
}
_game.state = (State)in->readByte();