[Scummvm-git-logs] scummvm master -> 015e37a003e39e37d03a3d59dd5046b672179c2d

AndywinXp noreply at scummvm.org
Sun May 22 20:08:48 UTC 2022


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:
015e37a003 SCUMM: Fix VAR_TIMER and VAR_TIMER_NEXT assignment


Commit: 015e37a003e39e37d03a3d59dd5046b672179c2d
    https://github.com/scummvm/scummvm/commit/015e37a003e39e37d03a3d59dd5046b672179c2d
Author: AndywinXp (andywinxp at gmail.com)
Date: 2022-05-22T22:08:44+02:00

Commit Message:
SCUMM: Fix VAR_TIMER and VAR_TIMER_NEXT assignment
Unless a slow host machine was used, the previous calculation always yielded 0.
Also, by disasms, those two timers should be assigned exactly in the same way as VAR_TMR_1, 2 and 3.

Changed paths:
    engines/scumm/scumm.cpp


diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 945e70052ff..736f75f2622 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -2103,14 +2103,6 @@ Common::Error ScummEngine::go() {
 		// that it will be in a different state each time you run the program.
 		_rnd.getRandomNumber(2);
 
-		// Notify the script about how much time has passed, in jiffies
-		// (the timing varies depending on the SCUMM version and the game)
-		uint32 diff = _system->getMillis() - _lastWaitTime;
-		if (VAR_TIMER != 0xFF)
-			VAR(VAR_TIMER) = diff * (_timerFrequency / 4) / 1000;
-		if (VAR_TIMER_TOTAL != 0xFF)
-			VAR(VAR_TIMER_TOTAL) += diff * (_timerFrequency / 4) / 1000;
-
 		// Determine how long to wait before the next loop iteration should start
 		int delta = (VAR_TIMER_NEXT != 0xFF) ? VAR(VAR_TIMER_NEXT) : 4;
 #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
@@ -2282,6 +2274,12 @@ void ScummEngine_v0::scummLoop(int delta) {
 }
 
 void ScummEngine::scummLoop(int delta) {
+	// Notify the script about how much time has passed, in jiffies
+	if (VAR_TIMER != 0xFF)
+		VAR(VAR_TIMER) = delta;
+	if (VAR_TIMER_TOTAL != 0xFF)
+		VAR(VAR_TIMER_TOTAL) += delta;
+
 	if (_game.version >= 3) {
 		VAR(VAR_TMR_1) += delta;
 		VAR(VAR_TMR_2) += delta;




More information about the Scummvm-git-logs mailing list