diff options
Diffstat (limited to 'engines/kyra/saveload_v1.cpp')
-rw-r--r-- | engines/kyra/saveload_v1.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/engines/kyra/saveload_v1.cpp b/engines/kyra/saveload_v1.cpp index d28a0b3f8b..c2ceee1d3b 100644 --- a/engines/kyra/saveload_v1.cpp +++ b/engines/kyra/saveload_v1.cpp @@ -33,8 +33,9 @@ #include "kyra/screen.h" #include "kyra/resource.h" #include "kyra/sound.h" +#include "kyra/timer.h" -#define CURRENT_VERSION 7 +#define CURRENT_VERSION 8 // TODO: our current savefiles still use the old // flag system to check the version, we should @@ -147,14 +148,7 @@ void KyraEngine_v1::loadGame(const char *fileName) { _poisonDeathCounter = in->readByte(); _animator->_brandonDrawFrame = in->readUint16BE(); - for (int i = 0; i < 32; i++) { - _timers[i].active = in->readByte(); - _timers[i].countdown = in->readSint32BE(); - _timers[i].nextRun = in->readUint32BE(); - if (_timers[i].nextRun != 0) - _timers[i].nextRun += _system->getMillis(); - } - _timerNextRun = 0; + _timer->loadDataFromFile(in, version); memset(_flagsTable, 0, sizeof(_flagsTable)); uint32 flagsSize = in->readUint32BE(); @@ -206,7 +200,7 @@ void KyraEngine_v1::loadGame(const char *fileName) { if (version >= 7) { _curSfxFile = in->readByte(); - // In the first version there this entry was introduced, + // In the first version when this entry was introduced, // it wasn't made sure that _curSfxFile was initialized // so if it's out of bounds we just set it to 0. if (_curSfxFile >= _soundFilesTownsCount || _curSfxFile < 0) @@ -323,14 +317,7 @@ void KyraEngine_v1::saveGame(const char *fileName, const char *saveName) { out->writeByte(_poisonDeathCounter); out->writeUint16BE(_animator->_brandonDrawFrame); - for (int i = 0; i < 32; i++) { - out->writeByte(_timers[i].active); - out->writeSint32BE(_timers[i].countdown); - if (_system->getMillis() >= _timers[i].nextRun) - out->writeUint32BE(0); - else - out->writeUint32BE(_timers[i].nextRun - _system->getMillis()); - } + _timer->saveDataToFile(out); out->writeUint32BE(sizeof(_flagsTable)); out->write(_flagsTable, sizeof(_flagsTable)); |