[Scummvm-cvs-logs] SF.net SVN: scummvm:[40754] scummvm/trunk/engines/sci/engine/kmisc.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu May 21 12:34:13 CEST 2009


Revision: 40754
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40754&view=rev
Author:   thebluegr
Date:     2009-05-21 10:34:13 +0000 (Thu, 21 May 2009)

Log Message:
-----------
Slight cleanup to kGetTime()

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kmisc.cpp

Modified: scummvm/trunk/engines/sci/engine/kmisc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmisc.cpp	2009-05-21 10:14:05 UTC (rev 40753)
+++ scummvm/trunk/engines/sci/engine/kmisc.cpp	2009-05-21 10:34:13 UTC (rev 40754)
@@ -132,13 +132,13 @@
 	g_system->getTimeAndDate(loc_time);
 	start_time = g_system->getMillis() - s->game_start_time;
 
-	if (argc && s->flags & GF_SCI0_OLDGETTIME) { // Use old semantics
-		retval = loc_time.tm_sec + loc_time.tm_min * 60 + (loc_time.tm_hour % 12) * 3600;
+	if ((s->flags & GF_SCI0_OLDGETTIME) && argc) { // Use old semantics
+		retval = (loc_time.tm_hour % 12) * 3600 + loc_time.tm_min * 60 + loc_time.tm_sec;
 		debugC(2, kDebugLevelTime, "GetTime(timeofday) returns %d", retval);
 		return make_reg(0, retval);
 	}
 
-	int mode = UKPV_OR_ALT(0, 0);
+	int mode = argc > 0 ? UKPV_OR_ALT(0, 0) : 0;
 
 	switch (mode) {
 	case _K_NEW_GETTIME_TICKS :
@@ -146,16 +146,15 @@
 		debugC(2, kDebugLevelTime, "GetTime(elapsed) returns %d", retval);
 		break;
 	case _K_NEW_GETTIME_TIME_12HOUR :
-		loc_time.tm_hour %= 12;
-		retval = (loc_time.tm_min << 6) | (loc_time.tm_hour << 12) | (loc_time.tm_sec);
+		retval = ((loc_time.tm_hour % 12) << 12) | (loc_time.tm_min << 6) | (loc_time.tm_sec);
 		debugC(2, kDebugLevelTime, "GetTime(12h) returns %d", retval);
 		break;
 	case _K_NEW_GETTIME_TIME_24HOUR :
-		retval = (loc_time.tm_min << 5) | (loc_time.tm_sec >> 1) | (loc_time.tm_hour << 11);
+		retval = (loc_time.tm_hour << 11) | (loc_time.tm_min << 5) | (loc_time.tm_sec >> 1);
 		debugC(2, kDebugLevelTime, "GetTime(24h) returns %d", retval);
 		break;
 	case _K_NEW_GETTIME_DATE :
-		retval = ((loc_time.tm_mon + 1) << 5) | loc_time.tm_mday | (((loc_time.tm_year + 1900) & 0x7f) << 9);
+		retval = loc_time.tm_mday | ((loc_time.tm_mon + 1) << 5) | (((loc_time.tm_year + 1900) & 0x7f) << 9);
 		debugC(2, kDebugLevelTime, "GetTime(date) returns %d", retval);
 		break;
 	default:


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list