[Scummvm-git-logs] scummvm branch-2-1 -> 8c11e7e40691c120d8e40e4166107e944577d671

athrxx athrxx at scummvm.org
Mon Jan 6 22:54:51 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:
8c11e7e406 KYRA: (LOK) - fix shakeScreen


Commit: 8c11e7e40691c120d8e40e4166107e944577d671
    https://github.com/scummvm/scummvm/commit/8c11e7e40691c120d8e40e4166107e944577d671
Author: athrxx (athrxx at scummvm.org)
Date: 2020-01-06T23:53:53+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 are other issues with shakeScreen outside the Kyra code that have to be addressed separately. E. g. (at least with SDL2)  WindowedGraphicsManager:: populateDisplayAreaDrawRect() does not take into account the scaling when applying the shake offsets. In fullscreen mode the offsets seem to be even more wrong. I haven't fully understood this yet, since am not familiar with these parts of the code.

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


diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index f53400a..f1466a9 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -3221,12 +3221,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