From 36c7e7d252b1a41f551fdb47512d5095e4dfe488 Mon Sep 17 00:00:00 2001 From: Omer Mor Date: Thu, 14 Apr 2016 21:17:49 +0300 Subject: SCI: Fixed KGetTime with SYSDATE subop in SCI0-LATE. SSCI implementation of the SYSDATE subop of the GetTime kernel function was changed between SCI0-LATE and SCI01: The base year used was changed from 1920 to 1980. This subop is used in "Codename: Iceman" (Say "ask for date" to a passing girl on the beach). The Atari ST version of "Codename: Iceman" use the 1980 base year. The Amiga version of "Codename: Iceman" appears to return the time instead of date, with 0 for the YEAR part. --- engines/sci/engine/kmisc.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index f4bb4ff85b..0a5f26476f 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -243,10 +243,18 @@ reg_t kGetTime(EngineState *s, int argc, reg_t *argv) { debugC(kDebugLevelTime, "GetTime(24h) returns %d", retval); break; case KGETTIME_DATE : - // Year since 1980 (0 = 1980, 1 = 1981, etc.) - retval = loc_time.tm_mday | ((loc_time.tm_mon + 1) << 5) | (((loc_time.tm_year - 80) & 0x7f) << 9); + { + // 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. + int baseYear = 80; + if (getSciVersion() == SCI_VERSION_0_LATE && g_sci->getPlatform() == Common::kPlatformDOS) { + baseYear = 20; + } + retval = loc_time.tm_mday | ((loc_time.tm_mon + 1) << 5) | (((loc_time.tm_year - baseYear) & 0x7f) << 9); debugC(kDebugLevelTime, "GetTime(date) returns %d", retval); break; + } default: error("Attempt to use unknown GetTime mode %d", mode); break; -- cgit v1.2.3