aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
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;
+ }
}
}