From c6e095715c8901799aa384d2076742a2bd2e00f6 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Fri, 29 Jan 2010 21:51:21 +0000 Subject: SCI: adding shakeScreen() for gui32 for lsl6 svn-id: r47681 --- engines/sci/engine/kgraphics.cpp | 5 ++++- engines/sci/graphics/gui32.cpp | 14 ++++++++++++++ engines/sci/graphics/gui32.h | 2 ++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 11f03348c7..464c460621 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -1070,7 +1070,10 @@ reg_t kShakeScreen(EngineState *s, int argc, reg_t *argv) { int16 shakeCount = (argc > 0) ? argv[0].toUint16() : 1; int16 directions = (argc > 1) ? argv[1].toUint16() : 1; - s->_gui->shakeScreen(shakeCount, directions); + if (s->_gui) + s->_gui->shakeScreen(shakeCount, directions); + else + s->_gui32->shakeScreen(shakeCount, directions); return s->r_acc; } diff --git a/engines/sci/graphics/gui32.cpp b/engines/sci/graphics/gui32.cpp index 9220e83a2b..e517496ef0 100644 --- a/engines/sci/graphics/gui32.cpp +++ b/engines/sci/graphics/gui32.cpp @@ -75,6 +75,20 @@ void SciGui32::textSize(const char *text, int16 font, int16 maxWidth, int16 *tex *textHeight = 0; } +void SciGui32::shakeScreen(uint16 shakeCount, uint16 directions) { + while (shakeCount--) { + if (directions & SCI_SHAKE_DIRECTION_VERTICAL) + _screen->setVerticalShakePos(10); + // TODO: horizontal shakes + g_system->updateScreen(); + g_system->delayMillis(50); + if (directions & SCI_SHAKE_DIRECTION_VERTICAL) + _screen->setVerticalShakePos(0); + g_system->updateScreen(); + g_system->delayMillis(50); + } +} + uint16 SciGui32::onControl(byte screenMask, Common::Rect rect) { Common::Rect adjustedRect = rect; uint16 result; diff --git a/engines/sci/graphics/gui32.h b/engines/sci/graphics/gui32.h index 6098606a35..84fe7fef74 100644 --- a/engines/sci/graphics/gui32.h +++ b/engines/sci/graphics/gui32.h @@ -46,6 +46,8 @@ public: void textSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight); + void shakeScreen(uint16 shakeCount, uint16 directions); + uint16 onControl(byte screenMask, Common::Rect rect); void setNowSeen(reg_t objectReference); bool canBeHere(reg_t curObject, reg_t listReference); -- cgit v1.2.3