[Scummvm-git-logs] scummvm master -> 535c47fced43bf98eded5e401cb7ea78ebaae66e

bgK bastien.bouclet at gmail.com
Sat Aug 11 10:47:41 CEST 2018


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
56389b1a5d MOHAWK: RIVEN: Move input handling to a separate function
535c47fced MOHAWK: RIVEN: Delay less for slower systems


Commit: 56389b1a5d3adb2a836e63ae1d530a8866e833e6
    https://github.com/scummvm/scummvm/commit/56389b1a5d3adb2a836e63ae1d530a8866e833e6
Author: David Fioramonti (dafioram at gmail.com)
Date: 2018-08-11T10:47:37+02:00

Commit Message:
MOHAWK: RIVEN: Move input handling to a separate function

Simplifies doFrame().

Changed paths:
    engines/mohawk/riven.cpp


diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index a668052..37a7745 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -216,6 +216,30 @@ void MohawkEngine_Riven::doFrame() {
 		_stack->keyResetAction();
 	}
 
+	processInput();
+
+	_stack->onFrame();
+
+	if (!_scriptMan->runningQueuedScripts()) {
+		// Don't run queued scripts if we are calling from a queued script
+		// otherwise infinite looping will happen.
+		_scriptMan->runQueuedScripts();
+	}
+
+	if (shouldPerformAutoSave(_lastSaveTime)) {
+		tryAutoSaving();
+	}
+
+	_inventory->onFrame();
+
+	// Update the screen once per frame
+	_system->updateScreen();
+
+	// Cut down on CPU usage
+	_system->delayMillis(10);
+}
+
+void MohawkEngine_Riven::processInput() {
 	Common::Event event;
 	while (_eventMan->pollEvent(event)) {
 		switch (event.type) {
@@ -305,26 +329,6 @@ void MohawkEngine_Riven::doFrame() {
 			break;
 		}
 	}
-
-	_stack->onFrame();
-
-	if (!_scriptMan->runningQueuedScripts()) {
-		// Don't run queued scripts if we are calling from a queued script
-		// otherwise infinite looping will happen.
-		_scriptMan->runQueuedScripts();
-	}
-
-	if (shouldPerformAutoSave(_lastSaveTime)) {
-		tryAutoSaving();
-	}
-
-	_inventory->onFrame();
-
-	// Update the screen once per frame
-	_system->updateScreen();
-
-	// Cut down on CPU usage
-	_system->delayMillis(10);
 }
 
 void MohawkEngine_Riven::goToMainMenu() {


Commit: 535c47fced43bf98eded5e401cb7ea78ebaae66e
    https://github.com/scummvm/scummvm/commit/535c47fced43bf98eded5e401cb7ea78ebaae66e
Author: David Fioramonti (dafioram at gmail.com)
Date: 2018-08-11T10:47:37+02:00

Commit Message:
MOHAWK: RIVEN: Delay less for slower systems

Some systems may take longer to process the game loop
than others so we delay by a variable amount so faster
and slower system execute the game loop the same number
of times per second (the fps is capped at 100).

Slower systems that take longer than 10ms to process the game
loop won't have any delay.

Changed paths:
    engines/mohawk/riven.cpp
    engines/mohawk/riven.h


diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 37a7745..0571022 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -209,6 +209,7 @@ Common::Error MohawkEngine_Riven::run() {
 
 void MohawkEngine_Riven::doFrame() {
 	// Update background running things
+	uint32 loopStart = _system->getMillis();
 	_sound->updateSLST();
 	_video->updateMovies();
 
@@ -234,9 +235,11 @@ void MohawkEngine_Riven::doFrame() {
 
 	// Update the screen once per frame
 	_system->updateScreen();
+	uint32 loopElapsed = _system->getMillis() - loopStart;
 
 	// Cut down on CPU usage
-	_system->delayMillis(10);
+	if (loopElapsed < 10)
+		_system->delayMillis(10 - loopElapsed);
 }
 
 void MohawkEngine_Riven::processInput() {
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index b887fc1..e938d27 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -106,6 +106,7 @@ public:
 	bool hasFeature(EngineFeature f) const override;
 
 	void doFrame();
+	void processInput();
 
 private:
 	// Datafiles





More information about the Scummvm-git-logs mailing list