From 483cad039efec6ba28962e0a93e1e6a417487bf4 Mon Sep 17 00:00:00 2001 From: upthorn Date: Wed, 27 Jun 2012 00:54:50 -0700 Subject: COMPOSER: Enable autosaving. --- engines/composer/composer.cpp | 3 +++ engines/composer/composer.h | 2 +- engines/composer/saveload.cpp | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'engines/composer') diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp index e5b42361eb..f3e5958304 100644 --- a/engines/composer/composer.cpp +++ b/engines/composer/composer.cpp @@ -120,6 +120,7 @@ Common::Error ComposerEngine::run() { else warning("FPS in book.ini is zero. Defaulting to 8..."); uint32 lastDrawTime = 0; + _lastSaveTime = _system->getMillis(); while (!shouldQuit()) { for (uint i = 0; i < _pendingPageChanges.size(); i++) { @@ -173,6 +174,8 @@ Common::Error ComposerEngine::run() { loadGameState(ConfMan.getInt("save_slot")); ConfMan.removeKey("save_slot", Common::ConfigManager::kTransientDomain); } + if (shouldPerformAutoSave(_lastSaveTime)) + saveGameState(0, "Autosave"); while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_LBUTTONDOWN: diff --git a/engines/composer/composer.h b/engines/composer/composer.h index 5b44bf346a..9ae1c1dfbe 100644 --- a/engines/composer/composer.h +++ b/engines/composer/composer.h @@ -189,7 +189,7 @@ private: Audio::QueuingAudioStream *_audioStream; uint16 _currSoundPriority; - uint32 _currentTime, _lastTime, _timeDelta; + uint32 _currentTime, _lastTime, _timeDelta, _lastSaveTime; bool _needsUpdate; Common::Array _dirtyRects; diff --git a/engines/composer/saveload.cpp b/engines/composer/saveload.cpp index 3d62641c10..f0cf4210ac 100644 --- a/engines/composer/saveload.cpp +++ b/engines/composer/saveload.cpp @@ -372,6 +372,7 @@ Common::Error ComposerEngine::loadGameState(int slot) { Common::Error ComposerEngine::saveGameState(int slot, const Common::String &desc) { Common::String filename = makeSaveGameName(slot); Common::OutSaveFile *out; + _lastSaveTime = _system->getMillis(); if (!(out = _saveFileMan->openForSaving(filename))) return Common::kWritingFailed; -- cgit v1.2.3