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
This commit is contained in:
Andre Heider 2009-02-25 21:43:57 +00:00
parent 1786ecabbf
commit 9af7fba681
5 changed files with 9 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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 */