ENGINE: Generalize SCUMM play time counting and move it into Engine.

This implements Max's idea on -devel
("Re: [Scummvm-devel] ATTN Engine authors: Advanced engine features") from
27.10.2010 on 11:12PM CEST.

Unlike the SCUMM implementation it stores the play time as ms instead of s.

The SCUMM engine was adapted to use this instead to reduce code duplication.

svn-id: r53892
This commit is contained in:
Johannes Schickel 2010-10-27 22:37:51 +00:00
parent 8a08ca1f39
commit 2ad28b8cd5
5 changed files with 52 additions and 15 deletions

View file

@ -378,10 +378,10 @@ bool ScummEngine::loadState(int slot, bool compat) {
return false;
}
_engineStartTime = _system->getMillis() / 1000 - infos.playtime;
resetTotalPlayTime(infos.playtime * 1000);
} else {
// start time counting
_engineStartTime = _system->getMillis() / 1000;
resetTotalPlayTime();
}
// Due to a bug in scummvm up to and including 0.3.0, save games could be saved
@ -797,7 +797,7 @@ void ScummEngine::saveInfos(Common::WriteStream* file) {
// still save old format for older versions
section.timeTValue = 0;
section.playtime = _system->getMillis() / 1000 - _engineStartTime;
section.playtime = getTotalPlayTime() / 1000;
TimeDate curTime;
_system->getTimeAndDate(curTime);