diff options
author | athrxx | 2020-01-06 23:17:05 +0100 |
---|---|---|
committer | athrxx | 2020-01-06 23:46:00 +0100 |
commit | 2f16ddc982f7267a2361ee437a3b3330b5493b3e (patch) | |
tree | d99c1a07d309c41f7851bc92a01386d156801208 | |
parent | 0d7d1ed2f8335a6423e287efb9c253908e53f3c5 (diff) | |
download | scummvm-rg350-2f16ddc982f7267a2361ee437a3b3330b5493b3e.tar.gz scummvm-rg350-2f16ddc982f7267a2361ee437a3b3330b5493b3e.tar.bz2 scummvm-rg350-2f16ddc982f7267a2361ee437a3b3330b5493b3e.zip |
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).
-rw-r--r-- | engines/kyra/graphics/screen.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp index 148f2d8f37..7d8c1b1535 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); } } |