[Scummvm-git-logs] scummvm master -> 32ca051485d6bce0939d8fec0676a1fd5d537fc2

m-kiewitz m_kiewitz at users.sourceforge.net
Wed Oct 12 21:48:43 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:
32ca051485 AGI: Make TIME_DELAY 0 to set the game to 40 fps


Commit: 32ca051485d6bce0939d8fec0676a1fd5d537fc2
    https://github.com/scummvm/scummvm/commit/32ca051485d6bce0939d8fec0676a1fd5d537fc2
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-10-12T21:48:35+02:00

Commit Message:
AGI: Make TIME_DELAY 0 to set the game to 40 fps

Original AGI TIME_DELAY 0 made the game run as fast
as possible. We didn't go that far, but it still seems to run
too fast. This should hopefully fix that.
See bug #9607

Changed paths:
    engines/agi/agi.h
    engines/agi/cycle.cpp
    engines/agi/global.cpp



diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 79d05c4..b8c30e9 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -978,7 +978,7 @@ public:
 	void inGameTimerUpdate();
 
 private:
-	uint32 _lastUsedPlayTimeInCycles; // 20 per second
+	uint32 _lastUsedPlayTimeInCycles; // 40 per second
 	uint32 _lastUsedPlayTimeInSeconds; // actual seconds
 	uint32 _passedPlayTimeCycles; // increased by 1 every time we passed a cycle
 
diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp
index 381c462..4148306 100644
--- a/engines/agi/cycle.cpp
+++ b/engines/agi/cycle.cpp
@@ -413,7 +413,27 @@ int AgiEngine::playGame() {
 			}
 		}
 
+		// Increment the delay value by one, so that we wait for at least 1 cycle
+		// In Original AGI 1 cycle was 50 milliseconds, so 20 frames per second
+		// So TIME_DELAY 1 resulted in around 20 frames per second
+		//               2 resulted in around 10 frames per second
+		//               0 however resulted in no limits at all, so the game ran as fast as possible
+		// We obviously do not want the game to run as fast as possible, so we will use 40 frames per second instead.
+		timeDelay = timeDelay * 2;
+		if (!timeDelay)
+			timeDelay = 1;
+
+		// Our cycle counter runs at 25 milliseconds.
+		// So time delay has to be 1 for the originally unlimited speed - for our 40 fps
+		//                         2 for 20 frames per second
+		//                         4 for 10 frames per second
+		//                         and so on.
+
 		if (_passedPlayTimeCycles >= timeDelay) {
+			// code to check for executed cycles
+			// TimeDate time;
+			// g_system->getTimeAndDate(time);
+			// warning("cycle %d", time.tm_sec);
 			inGameTimerResetPassedCycles();
 
 			interpretCycle();
diff --git a/engines/agi/global.cpp b/engines/agi/global.cpp
index 6f83f02..bd7e4e4 100644
--- a/engines/agi/global.cpp
+++ b/engines/agi/global.cpp
@@ -247,7 +247,7 @@ void AgiEngine::setVarSecondsTrigger(byte newSeconds) {
 // This is also called in the main loop, because the game needs to be sync'd to 20 cycles per second
 void AgiEngine::inGameTimerUpdate() {
 	uint32 curPlayTimeMilliseconds = inGameTimerGet();
-	uint32 curPlayTimeCycles = curPlayTimeMilliseconds / 50;
+	uint32 curPlayTimeCycles = curPlayTimeMilliseconds / 25;
 
 	if (curPlayTimeCycles == _lastUsedPlayTimeInCycles) {
 		// No difference, skip updating





More information about the Scummvm-git-logs mailing list