[Scummvm-git-logs] scummvm master -> 2f16ddc982f7267a2361ee437a3b3330b5493b3e

athrxx athrxx at scummvm.org
Mon Jan 6 22:46:36 UTC 2020


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:
2f16ddc982 KYRA: (LOK) - fix shakeScreen


Commit: 2f16ddc982f7267a2361ee437a3b3330b5493b3e
    https://github.com/scummvm/scummvm/commit/2f16ddc982f7267a2361ee437a3b3330b5493b3e
Author: athrxx (athrxx at scummvm.org)
Date: 2020-01-06T23:46:00+01:00

Commit Message:
KYRA: (LOK) - fix shakeScreen

This has become too fast for modern systems and needs an extra delay. Otherwise the screen shake won't be actually noticed.

There seem to be other issues with shakeScreen outside the Kyra code that have to be addressed separately (improper scaling of the shake offsets).

Changed paths:
    engines/kyra/graphics/screen.cpp


diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index 148f2d8..7d8c1b1 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -3171,12 +3171,25 @@ void Screen::rectClip(int &x, int &y, int w, int h) {
 
 void Screen::shakeScreen(int times) {
 	while (times--) {
+		// The original did not need an artificial delay, but we do.
+		// Or the shake will be too fast to be actually seen.
+		uint32 delayuntil = _system->getMillis() + 16;
+
 		// seems to be 1 line (320 pixels) offset in the original
-		// 4 looks more like dosbox though, maybe check this again
-		_system->setShakePos(0, 4);
+		// -4 looks more like dosbox though, maybe check this again		
+		_system->setShakePos(0, -4);
 		_system->updateScreen();
+
+		int diff = delayuntil - _system->getMillis();
+		if (diff > 0)
+			_system->delayMillis(diff);
+		delayuntil = _system->getMillis() + 16;
 		_system->setShakePos(0, 0);
 		_system->updateScreen();
+
+		diff = delayuntil - _system->getMillis();
+		if (diff > 0)
+			_system->delayMillis(diff);
 	}
 }
 




More information about the Scummvm-git-logs mailing list