diff options
author | Johannes Schickel | 2010-10-29 16:53:46 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-10-29 16:53:46 +0000 |
commit | a5c28de26b8e98b424f03aa957c947cec969cfe5 (patch) | |
tree | 9660f6d0818679b2c8f57b4e285fc3b7fc859165 | |
parent | 447ca7ea696fb7edb26610ccb57605b28dcf7625 (diff) | |
download | scummvm-rg350-a5c28de26b8e98b424f03aa957c947cec969cfe5.tar.gz scummvm-rg350-a5c28de26b8e98b424f03aa957c947cec969cfe5.tar.bz2 scummvm-rg350-a5c28de26b8e98b424f03aa957c947cec969cfe5.zip |
SWORD1: Switch to the new play time counting of the Engine class.
svn-id: r53924
-rw-r--r-- | engines/sword1/control.cpp | 8 | ||||
-rw-r--r-- | engines/sword1/detection.cpp | 7 | ||||
-rw-r--r-- | engines/sword1/sword1.cpp | 2 | ||||
-rw-r--r-- | engines/sword1/sword1.h | 1 |
4 files changed, 6 insertions, 12 deletions
diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp index 8d9ca85829..aee49c4b60 100644 --- a/engines/sword1/control.cpp +++ b/engines/sword1/control.cpp @@ -1118,8 +1118,7 @@ void Control::saveGameToFile(uint8 slot) { outf->writeUint32BE(saveDate); outf->writeUint16BE(saveTime); - uint32 currentTime = _system->getMillis() / 1000; - outf->writeUint32BE(currentTime - SwordEngine::_systemVars.engineStartTime); + outf->writeUint32BE(g_engine->getTotalPlayTime() / 1000); _objMan->saveLiveList(liveBuf); for (cnt = 0; cnt < TOTAL_SECTIONS; cnt++) @@ -1181,10 +1180,9 @@ bool Control::restoreGameFromFile(uint8 slot) { inf->readUint16BE(); // save time if (saveVersion < 2) { // Before version 2 we didn't had play time feature - SwordEngine::_systemVars.engineStartTime = _system->getMillis() / 1000; // Start counting + g_engine->setTotalPlayTime(0); } else { - uint32 currentTime = _system->getMillis() / 1000; - SwordEngine::_systemVars.engineStartTime = currentTime - inf->readUint32BE(); // Engine start time + g_engine->setTotalPlayTime(inf->readUint32BE() * 1000); } _restoreBuf = (uint8*)malloc( diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp index e51a3d6a8d..9fc24e75e8 100644 --- a/engines/sword1/detection.cpp +++ b/engines/sword1/detection.cpp @@ -309,12 +309,9 @@ SaveStateDescriptor SwordMetaEngine::querySaveMetaInfos(const char *target, int desc.setSaveTime(hour, minutes); if (versionSave > 1) { - minutes = playTime / 60; - hour = minutes / 60; - minutes %= 60; - desc.setPlayTime(hour, minutes); + desc.setPlayTime(playTime * 1000); } else { //We have no playtime data - desc.setPlayTime(0, 0); + desc.setPlayTime(0); } delete in; diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp index 0d4f5b7445..ba1f77f896 100644 --- a/engines/sword1/sword1.cpp +++ b/engines/sword1/sword1.cpp @@ -563,7 +563,7 @@ void SwordEngine::checkCdFiles() { // check if we're running from cd, hdd or wha Common::Error SwordEngine::go() { _control->checkForOldSaveGames(); - SwordEngine::_systemVars.engineStartTime = _system->getMillis() / 1000; + setTotalPlayTime(0); uint16 startPos = ConfMan.getInt("boot_param"); _control->readSavegameDescriptions(); diff --git a/engines/sword1/sword1.h b/engines/sword1/sword1.h index 5b1deaa3ed..f4e60e9fa3 100644 --- a/engines/sword1/sword1.h +++ b/engines/sword1/sword1.h @@ -74,7 +74,6 @@ struct SystemVars { uint8 showText; uint8 language; bool isDemo; - uint32 engineStartTime; // Used for playtime Common::Platform platform; }; |