[Scummvm-git-logs] scummvm master -> c4368a7cd205dd8bcadc485819bb0ad8ae18b2c7

eriktorbjorn eriktorbjorn at telia.com
Mon Sep 5 19:02:47 CEST 2016


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:
c4368a7cd2 MACVENTURE: Make opcode $ca return current time, not played time


Commit: c4368a7cd205dd8bcadc485819bb0ad8ae18b2c7
    https://github.com/scummvm/scummvm/commit/c4368a7cd205dd8bcadc485819bb0ad8ae18b2c7
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2016-09-05T18:58:14+02:00

Commit Message:
MACVENTURE: Make opcode $ca return current time, not played time

This is used by some games to determine the appropriate greeting,
e.g. "Good evening" if you play the game in the evening.

Changed paths:
    engines/macventure/script.cpp



diff --git a/engines/macventure/script.cpp b/engines/macventure/script.cpp
index 87ba717..2a1ffcf 100644
--- a/engines/macventure/script.cpp
+++ b/engines/macventure/script.cpp
@@ -1044,19 +1044,20 @@ void ScriptEngine::opc9WAIT(EngineState *state, EngineFrame *frame) {
 }
 
 void ScriptEngine::opcaTIME(EngineState *state, EngineFrame *frame) {
-	for (uint i = 0; i < 3; i++) {// We skip year, month and date
-		state->push(0x00);
-	}
+	TimeDate t;
+	g_system->getTimeAndDate(t);
+
+	int year = 1900 + t.tm_year;
+	int month = 1 + t.tm_mon;
+
+	state->push(year);
+	state->push(month);
+	state->push(t.tm_mday);
+	state->push(t.tm_hour);
+	state->push(t.tm_min);
+	state->push(t.tm_sec);
 
-	uint32 totalPlayTime = _engine->getTotalPlayTime() / 1000; // In seconds
-	int16 hours = totalPlayTime / 3600;
-	totalPlayTime %= 3600;
-	state->push(hours);
-	int16 minutes = totalPlayTime / 60;
-	totalPlayTime %= 60;
-	state->push(minutes);
-	state->push(totalPlayTime);
-	debugC(2, kMVDebugScript, "Saved time: h[%d] m[%d] s[%d]", hours, minutes, totalPlayTime);
+	debugC(2, kMVDebugScript, "Saved time: Y[%d] M[%d] D[%d] h[%d] m[%d] s[%d]", year, month, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);
 }
 
 void ScriptEngine::opcbDAY(EngineState *state, EngineFrame *frame) {





More information about the Scummvm-git-logs mailing list