aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/core/project_item.cpp3
-rw-r--r--engines/titanic/events.cpp11
-rw-r--r--engines/titanic/events.h13
3 files changed, 24 insertions, 3 deletions
diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp
index 1093a5c6e7..205eecfd2f 100644
--- a/engines/titanic/core/project_item.cpp
+++ b/engines/titanic/core/project_item.cpp
@@ -177,6 +177,7 @@ void CProjectItem::loadGame(int slotId) {
TitanicSavegameHeader header;
readSavegameHeader(&file, header);
delete header._thumbnail;
+ g_vm->_events->setTotalPlayTicks(header._totalFrames);
// Load the contents in
CProjectItem *newProject = loadData(&file);
@@ -545,7 +546,7 @@ void CProjectItem::writeSavegameHeader(SimpleFile *file, TitanicSavegameHeader &
file->writeUint16LE(td.tm_mday);
file->writeUint16LE(td.tm_hour);
file->writeUint16LE(td.tm_min);
- file->writeUint32LE(g_vm->_events->getFrameCounter());
+ file->writeUint32LE(g_vm->_events->getTotalPlayTicks());
}
Graphics::Surface *CProjectItem::createThumbnail() {
diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp
index d29a19dec6..0d0fcaf753 100644
--- a/engines/titanic/events.cpp
+++ b/engines/titanic/events.cpp
@@ -31,7 +31,7 @@
namespace Titanic {
Events::Events(TitanicEngine *vm): _vm(vm), _frameCounter(1),
- _priorFrameTime(0), _specialButtons(0) {
+ _totalFrames(0), _priorFrameTime(0), _specialButtons(0) {
}
void Events::pollEvents() {
@@ -109,6 +109,7 @@ bool Events::checkForNextFrameCounter() {
uint32 milli = g_system->getMillis();
if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) {
++_frameCounter;
+ ++_totalFrames;
_priorFrameTime = milli;
// Handle any idle updates
@@ -130,6 +131,14 @@ uint32 Events::getTicksCount() const {
return _frameCounter * GAME_FRAME_TIME;
}
+uint32 Events::getTotalPlayTicks() const {
+ return _totalFrames;
+}
+
+void Events::setTotalPlayTicks(uint frames) {
+ _totalFrames = frames;
+}
+
void Events::sleep(uint time) {
uint32 delayEnd = g_system->getMillis() + time;
diff --git a/engines/titanic/events.h b/engines/titanic/events.h
index 52e900c2ef..e14fbd8637 100644
--- a/engines/titanic/events.h
+++ b/engines/titanic/events.h
@@ -91,6 +91,7 @@ private:
Common::Stack<CEventTarget *> _eventTargets;
uint32 _frameCounter;
uint32 _priorFrameTime;
+ uint _totalFrames;
Common::Point _mousePos;
uint _specialButtons;
@@ -147,11 +148,21 @@ public:
uint32 getFrameCounter() const { return _frameCounter; }
/**
- * Get the elapsed playtime
+ * Return the current game ticks
*/
uint32 getTicksCount() const;
/**
+ * Get the total number of playtime frames/ticks
+ */
+ uint32 getTotalPlayTicks() const;
+
+ /**
+ * Set the total number of frames/ticks played
+ */
+ void setTotalPlayTicks(uint frames);
+
+ /**
* Sleep for a specified period of time
*/
void sleep(uint time);