[Scummvm-git-logs] scummvm branch-2-1 -> f9733c2b255da92db03bad1a46eb826696255d1d

athrxx athrxx at scummvm.org
Tue Jan 7 21:53:18 UTC 2020


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:
fb561bc6bf KYRA: (LOK) - implement FM-TOWNS specific screen shake
f9733c2b25 GRAPHICS: Fix screen shake x/y offsets scaling


Commit: fb561bc6bf58cc55a09b47282c2151c4b2bc0539
    https://github.com/scummvm/scummvm/commit/fb561bc6bf58cc55a09b47282c2151c4b2bc0539
Author: athrxx (athrxx at scummvm.org)
Date: 2020-01-07T22:51:59+01:00

Commit Message:
KYRA: (LOK) - implement FM-TOWNS specific screen shake

(the FM-TOWNS version has a better shake animation)

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


diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index f1466a9..bc59062 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -3220,26 +3220,31 @@ 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;
+	static const int8 _shakeParaPC[] = { 32, 0, -4, 32, 0, 0 };
+	static const int8 _shakeParaFMTOWNS[] = { 32, 0, -4, 48, 0, 4, 32, -4, 0, 32, 4, 0, 32, 0, 0 };
 
-		// 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);
-		_system->updateScreen();
+	const int8 *data = _shakeParaPC;
+	int steps = ARRAYSIZE(_shakeParaPC) / 3;
 
-		int diff = delayuntil - _system->getMillis();
-		if (diff > 0)
-			_system->delayMillis(diff);
-		delayuntil = _system->getMillis() + 16;
-		_system->setShakePos(0, 0);
-		_system->updateScreen();
+	// The FM-TOWNS version has a slightly better shake animation
+	// TODO: check PC-98 version
+	if (_vm->gameFlags().platform == Common::kPlatformFMTowns) {
+		data = _shakeParaFMTOWNS;
+		steps = ARRAYSIZE(_shakeParaFMTOWNS) / 3;
+	}
 
-		diff = delayuntil - _system->getMillis();
-		if (diff > 0)
-			_system->delayMillis(diff);
+	while (times--) {
+		for (int i = 0; i < steps; ++i) {
+			// The original PC version did not need an artificial delay, but we do.
+			// Or the shake will be too fast to be actually seen.
+			uint32 delayuntil = _system->getMillis() + data[0];
+			_system->setShakePos(data[1], data[2]);
+			_system->updateScreen();
+			int diff = delayuntil - _system->getMillis();
+			if (diff > 0)
+				_system->delayMillis(diff);
+			data += 3;
+		}
 	}
 }
 


Commit: f9733c2b255da92db03bad1a46eb826696255d1d
    https://github.com/scummvm/scummvm/commit/f9733c2b255da92db03bad1a46eb826696255d1d
Author: athrxx (athrxx at scummvm.org)
Date: 2020-01-07T22:52:00+01:00

Commit Message:
GRAPHICS: Fix screen shake x/y offsets scaling

The x and y offsets need to be scaled the same way as the rest of the screen output.

Changed paths:
    backends/graphics/windowed.h


diff --git a/backends/graphics/windowed.h b/backends/graphics/windowed.h
index 1a31b99..6d5884b 100644
--- a/backends/graphics/windowed.h
+++ b/backends/graphics/windowed.h
@@ -396,9 +396,9 @@ private:
 					width = fracToInt(height * displayAspect);
 			}
 		}
-
-		drawRect.left = ((_windowWidth - width) / 2) + _gameScreenShakeXOffset;
-		drawRect.top = ((_windowHeight - height) / 2) + _gameScreenShakeYOffset;
+		
+		drawRect.left = ((_windowWidth - width) / 2) + _gameScreenShakeXOffset * _windowWidth / getWidth();
+		drawRect.top = ((_windowHeight - height) / 2) + _gameScreenShakeYOffset * _windowHeight / getHeight();
 		drawRect.setWidth(width);
 		drawRect.setHeight(height);
 	}




More information about the Scummvm-git-logs mailing list