diff options
author | sluicebox | 2019-11-15 02:10:37 -0800 |
---|---|---|
committer | Eugene Sandulenko | 2019-11-19 00:20:40 +0100 |
commit | 336a79f0780664448fc28f35d2751618321d7f22 (patch) | |
tree | 62706cafa8e7cd00df9b1febb206883c0f33431d /engines | |
parent | b8390fa161c0c324af0e52a4f3a740cca9e9a479 (diff) | |
download | scummvm-rg350-336a79f0780664448fc28f35d2751618321d7f22.tar.gz scummvm-rg350-336a79f0780664448fc28f35d2751618321d7f22.tar.bz2 scummvm-rg350-336a79f0780664448fc28f35d2751618321d7f22.zip |
SCI: Add horizontal shake to kShakeScreen
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 20 | ||||
-rw-r--r-- | engines/sci/graphics/screen.cpp | 19 |
2 files changed, 24 insertions, 15 deletions
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index f7464d460c..6b75e2c493 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -1189,27 +1189,27 @@ void GfxFrameout::throttle() { } void GfxFrameout::shakeScreen(int16 numShakes, const ShakeDirection direction) { - if (direction & kShakeHorizontal) { - // Used by QFG4 room 750 - warning("TODO: Horizontal shake not implemented"); - return; - } - while (numShakes--) { if (g_engine->shouldQuit()) { break; } + int shakeXOffset = 0; + if (direction & kShakeHorizontal) { + shakeXOffset = _isHiRes ? 8 : 4; + } + + int shakeYOffset = 0; if (direction & kShakeVertical) { - g_system->setShakePos(0, _isHiRes ? 8 : 4); + shakeYOffset = _isHiRes ? 8 : 4; } + g_system->setShakePos(shakeXOffset, shakeYOffset); + updateScreen(); g_sci->getEngineState()->sleep(3); - if (direction & kShakeVertical) { - g_system->setShakePos(0, 0); - } + g_system->setShakePos(0, 0); updateScreen(); g_sci->getEngineState()->sleep(3); diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index cd81fdf36f..4bb9f5f6f6 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -604,14 +604,23 @@ void GfxScreen::setShakePos(uint16 shakeXOffset, uint16 shakeYOffset) { void GfxScreen::kernelShakeScreen(uint16 shakeCount, uint16 directions) { while (shakeCount--) { - if (directions & kShakeVertical) - setShakePos(0, 10); - // TODO: horizontal shakes + + uint16 shakeXOffset = 0; + if (directions & kShakeHorizontal) { + shakeXOffset = 10; + } + + uint16 shakeYOffset = 0; + if (directions & kShakeVertical) { + shakeYOffset = 10; + } + + setShakePos(shakeXOffset, shakeYOffset); + g_system->updateScreen(); g_sci->getEngineState()->sleep(3); - if (directions & kShakeVertical) - setShakePos(0, 0); + setShakePos(0, 0); g_system->updateScreen(); g_sci->getEngineState()->sleep(3); |