[Scummvm-git-logs] scummvm master -> 32837a858fc9e337bb741c6c2d6f9903c91b7e39

athrxx noreply at scummvm.org
Wed Nov 17 23:37:59 UTC 2021


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:
32837a858f SCUMM: tweak screen shakes some more


Commit: 32837a858fc9e337bb741c6c2d6f9903c91b7e39
    https://github.com/scummvm/scummvm/commit/32837a858fc9e337bb741c6c2d6f9903c91b7e39
Author: athrxx (athrxx at scummvm.org)
Date: 2021-11-18T00:37:30+01:00

Commit Message:
SCUMM: tweak screen shakes some more

- fix Japanes FM-Towns: the shake positions have to be multiplied with the _textSurfaceMultiplier

- slightly reduce shake speed for SCUMM <=3

Changed paths:
    engines/scumm/gfx.cpp
    engines/scumm/scumm.cpp
    engines/scumm/scumm.h


diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index a256cb07cf..3240d2bb7e 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -4218,12 +4218,13 @@ void ScummEngine::updateScreenShakeEffect() {
 
 	while (now >= _shakeNextTick) {
 		_shakeFrame = (_shakeFrame + 1) % NUM_SHAKE_POSITIONS;
-		_system->setShakePos(0, -shake_positions[_shakeFrame]);
-		// In DOTT (and probably all other imuse games) this runs on the imuse timer which is a PIT 0 Timer at 291304 Hz.
+		_system->setShakePos(0, -shake_positions[_shakeFrame] * _textSurfaceMultiplier);
+		// In DOTT (and probably all other imuse games) this runs on the imuse timer which is a PIT 0 Timer at 291.304 Hz.
 		// Apparently it is the same timer setting for all sound drivers although it is set up not in the main executable
 		// but inside each respective ims driver during the driver load/init process. The screen shakes update every 8 ticks.
-		// I assume that this might be slightly different per SCUMM version, target platform etc...
-		_shakeTickCounter += ((1000000000 / 291304) * 8);
+		// LOOM uses either 236.696 Hz at 8 ticks delay or 473.297 Hz at 16 ticks delay, depending on the sound card selection.
+		// The outcome is the same...
+		_shakeTickCounter += ((1000000000 / _shakeTimerRate) * 8);
 		_shakeNextTick += (_shakeTickCounter / 1000);
 		_shakeTickCounter %= 1000;
 	}
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index e7cd938603..980a0f8079 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -109,7 +109,8 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
 	  _language(dr.language),
 	  _currentScript(0xFF), // Let debug() work on init stage
 	  _messageDialog(nullptr), _pauseDialog(nullptr), _versionDialog(nullptr),
-	  _rnd("scumm")
+	  _rnd("scumm"),
+	  _shakeTimerRate(dr.game.version <= 3 ? 236696 : 291304)
 	  {
 
 	_localizer = nullptr;
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index b522d7c29b..8ab7b5cdb5 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -995,6 +995,7 @@ protected:
 	uint _shakeFrame;
 	uint32 _shakeNextTick;
 	uint32 _shakeTickCounter;
+	const uint32 _shakeTimerRate;
 
 	void setShake(int mode);
 




More information about the Scummvm-git-logs mailing list