diff options
-rw-r--r-- | engines/sci/engine/game.cpp | 3 | ||||
-rw-r--r-- | engines/sci/engine/kernel.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cfsml | 3 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cpp | 5 | ||||
-rw-r--r-- | engines/sci/include/engine.h | 1 |
5 files changed, 9 insertions, 5 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index 5b73fc80e0..e2ca19b51f 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -764,7 +764,8 @@ int game_init(EngineState *s) { sys_string_acquire(s->sys_strings, SYS_STRING_PARSER_BASE, "parser-base", MAX_PARSER_BASE); s->parser_base = make_reg(s->sys_strings_segment, SYS_STRING_PARSER_BASE); - s->last_wait_time = g_system->getMillis(); + s->game_start_time = g_system->getMillis(); + s->last_wait_time = s->game_start_time; s->debug_mode = 0x0; // Disable all debugging s->onscreen_console = 0; // No onscreen console unless explicitly requested diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 5e847bb235..6a266c133b 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -497,7 +497,7 @@ reg_t kGetTime(EngineState *s, int funct_nr, int argc, reg_t *argv) { #endif g_system->getTimeAndDate(loc_time); - start_time = g_system->getMillis(); + start_time = g_system->getMillis() - s->game_start_time; if (s->version < SCI_VERSION_FTU_NEW_GETTIME) { // Use old semantics if (argc) { // Get seconds since last am/pm switch diff --git a/engines/sci/engine/savegame.cfsml b/engines/sci/engine/savegame.cfsml index 42afd7626d..a03643fc8a 100644 --- a/engines/sci/engine/savegame.cfsml +++ b/engines/sci/engine/savegame.cfsml @@ -765,7 +765,7 @@ int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename } */ // Calculate the time spent with this game - s->game_time = g_system->getMillis() / 1000; + s->game_time = (g_system->getMillis() - s->game_start_time) / 1000; %CFSMLWRITE SavegameMetadata meta INTO fh; %CFSMLWRITE EngineState s INTO fh; @@ -1108,6 +1108,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { // Time state: retval->last_wait_time = g_system->getMillis(); + retval->game_start_time = g_system->getMillis() - retval->game_time * 1000; // static parser information: retval->parser_rules = s->parser_rules; diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index e38d917291..66519f15ff 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -4819,7 +4819,7 @@ int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename } */ // Calculate the time spent with this game - s->game_time = g_system->getMillis() / 1000; + s->game_time = (g_system->getMillis() - s->game_start_time) / 1000; #line 818 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code @@ -5236,6 +5236,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { // Time state: retval->last_wait_time = g_system->getMillis(); + retval->game_start_time = g_system->getMillis() - retval->game_time * 1000; // static parser information: retval->parser_rules = s->parser_rules; @@ -5318,7 +5319,7 @@ bool get_savegame_metadata(Common::SeekableReadStream* stream, SavegameMetadata* } } // End of auto-generated CFSML data reader code -#line 1162 "engines/sci/engine/savegame.cfsml" +#line 1163 "engines/sci/engine/savegame.cfsml" if (read_eof) return false; diff --git a/engines/sci/include/engine.h b/engines/sci/include/engine.h index e1e8b6700b..036ccb1c64 100644 --- a/engines/sci/include/engine.h +++ b/engines/sci/include/engine.h @@ -174,6 +174,7 @@ struct EngineState { int pics_nr; drawn_pic_t *pics; + uint32 game_start_time; /* The time at which the interpreter was started */ uint32 last_wait_time; /* The last time the game invoked Wait() */ byte version_lock_flag; /* Set to 1 to disable any autodetection mechanisms */ |