aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorAndre Heider2009-02-25 21:43:57 +0000
committerAndre Heider2009-02-25 21:43:57 +0000
commit9af7fba681fa1f0b48ec7c8d13305404b5f82efb (patch)
treed0674187220786687c4ac014c216ea898aa55ab2 /engines
parent1786ecabbf567b60cf628d0235b52b5343c013ad (diff)
downloadscummvm-rg350-9af7fba681fa1f0b48ec7c8d13305404b5f82efb.tar.gz
scummvm-rg350-9af7fba681fa1f0b48ec7c8d13305404b5f82efb.tar.bz2
scummvm-rg350-9af7fba681fa1f0b48ec7c8d13305404b5f82efb.zip
reintroduce game_start_time (removed it in r38701), since the interpreter can be restarted and it can be retrieved via script function (eg. LSL3 about box)
svn-id: r38888
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/game.cpp3
-rw-r--r--engines/sci/engine/kernel.cpp2
-rw-r--r--engines/sci/engine/savegame.cfsml3
-rw-r--r--engines/sci/engine/savegame.cpp5
-rw-r--r--engines/sci/include/engine.h1
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 */