aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorathrxx2020-01-07 20:13:42 +0100
committerathrxx2020-01-07 22:47:31 +0100
commit70d7de0b98cb0bf181f18125defab1ffb2d1efb5 (patch)
treeb9fe6619d5bba43f21da9dd0ebf63453a878c02d /engines/kyra
parent3dd3b616858ed3aeda4cd0cb047f19efb588f7b2 (diff)
downloadscummvm-rg350-70d7de0b98cb0bf181f18125defab1ffb2d1efb5.tar.gz
scummvm-rg350-70d7de0b98cb0bf181f18125defab1ffb2d1efb5.tar.bz2
scummvm-rg350-70d7de0b98cb0bf181f18125defab1ffb2d1efb5.zip
KYRA: (LOK) - implement FM-TOWNS specific screen shake
(the FM-TOWNS version has a better shake animation)
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/graphics/screen.cpp39
1 files changed, 22 insertions, 17 deletions
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index 7d8c1b1535..dd264a1551 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -3170,26 +3170,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;
+ }
}
}