[Scummvm-git-logs] scummvm master -> 562ad967ff72b02206cc6c3884a18cc0c7604255
sluicebox
22204938+sluicebox at users.noreply.github.com
Fri Jul 9 17:34:02 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
562ad967ff SCI: kGetTime: Remove clock time query in tick mode
Commit: 562ad967ff72b02206cc6c3884a18cc0c7604255
https://github.com/scummvm/scummvm/commit/562ad967ff72b02206cc6c3884a18cc0c7604255
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-07-09T12:30:59-05:00
Commit Message:
SCI: kGetTime: Remove clock time query in tick mode
This is a mild optimization so that kGetTime only queries the time and
date when it actually uses the results. kGetTime is frequently called to
return the game time in ticks, and if each of those also calls
OSystem::getTimeAndDate() then that generates a lot of unnecessary
EventRecorder records.
Changed paths:
engines/sci/engine/kmisc.cpp
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 9c0b75a4e0..64e8ea6eb4 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -247,8 +247,6 @@ reg_t kGetTime(EngineState *s, int argc, reg_t *argv) {
TimeDate loc_time;
uint16 retval = 0; // Avoid spurious warning
- g_system->getTimeAndDate(loc_time);
-
int mode = (argc > 0) ? argv[0].toUint16() : 0;
// Modes 2 and 3 are supported since 0.629.
@@ -262,6 +260,7 @@ reg_t kGetTime(EngineState *s, int argc, reg_t *argv) {
debugC(kDebugLevelTime, "GetTime(elapsed) returns %d", retval);
break;
case KGETTIME_TIME_12HOUR :
+ g_system->getTimeAndDate(loc_time);
loc_time.tm_hour %= 12;
if (loc_time.tm_hour == 0) {
loc_time.tm_hour = 12;
@@ -270,11 +269,13 @@ reg_t kGetTime(EngineState *s, int argc, reg_t *argv) {
debugC(kDebugLevelTime, "GetTime(12h) returns %d", retval);
break;
case KGETTIME_TIME_24HOUR :
+ g_system->getTimeAndDate(loc_time);
retval = (loc_time.tm_hour << 11) | (loc_time.tm_min << 5) | (loc_time.tm_sec >> 1);
debugC(kDebugLevelTime, "GetTime(24h) returns %d", retval);
break;
case KGETTIME_DATE :
{
+ g_system->getTimeAndDate(loc_time);
// SCI0 late: Year since 1920 (0 = 1920, 1 = 1921, etc)
// SCI01 and newer: Year since 1980 (0 = 1980, 1 = 1981, etc)
// Atari ST SCI0 late versions use the newer base year.
More information about the Scummvm-git-logs
mailing list