aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics
diff options
context:
space:
mode:
authorColin Snover2016-08-02 09:49:04 -0500
committerColin Snover2016-08-19 13:57:40 -0500
commit6e2e862d8e5db0c8e786525fff2e2ae1f878f919 (patch)
tree1e996531be3b6083667e33cd52254d66f748f313 /engines/sci/graphics
parentb74532fc1e3dfe034eff5df7f284feac7502b354 (diff)
downloadscummvm-rg350-6e2e862d8e5db0c8e786525fff2e2ae1f878f919.tar.gz
scummvm-rg350-6e2e862d8e5db0c8e786525fff2e2ae1f878f919.tar.bz2
scummvm-rg350-6e2e862d8e5db0c8e786525fff2e2ae1f878f919.zip
SCI32: Implement kShakeScreen for SCI32
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r--engines/sci/graphics/frameout.cpp24
-rw-r--r--engines/sci/graphics/frameout.h5
-rw-r--r--engines/sci/graphics/helpers.h6
-rw-r--r--engines/sci/graphics/screen.cpp7
4 files changed, 35 insertions, 7 deletions
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 4bd7b46914..c0d8f15c74 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -1274,6 +1274,30 @@ void GfxFrameout::showRect(const Common::Rect &rect) {
}
}
+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 (direction & kShakeVertical) {
+ g_system->setShakePos(_isHiRes ? 8 : 4);
+ }
+
+ g_system->updateScreen();
+ g_sci->getEngineState()->wait(3);
+
+ if (direction & kShakeVertical) {
+ g_system->setShakePos(0);
+ }
+
+ g_system->updateScreen();
+ g_sci->getEngineState()->wait(3);
+ }
+}
+
#pragma mark -
#pragma mark Mouse cursor
diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index de90fc7414..92e38fa70f 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -366,6 +366,11 @@ public:
*/
void showRect(const Common::Rect &rect);
+ /**
+ * Shakes the screen.
+ */
+ void shakeScreen(const int16 numShakes, const ShakeDirection direction);
+
#pragma mark -
#pragma mark Mouse cursor
private:
diff --git a/engines/sci/graphics/helpers.h b/engines/sci/graphics/helpers.h
index 3fcc83c5e2..1da3749c90 100644
--- a/engines/sci/graphics/helpers.h
+++ b/engines/sci/graphics/helpers.h
@@ -40,8 +40,10 @@ namespace Sci {
#define MAX_CACHED_FONTS 20
#define MAX_CACHED_VIEWS 50
-#define SCI_SHAKE_DIRECTION_VERTICAL 1
-#define SCI_SHAKE_DIRECTION_HORIZONTAL 2
+enum ShakeDirection {
+ kShakeVertical = 1,
+ kShakeHorizontal = 2
+};
typedef int GuiResourceId; // is a resource-number and -1 means no parameter given
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index 394a43350c..601ab9f09f 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -30,9 +30,6 @@
#include "sci/engine/state.h"
#include "sci/graphics/screen.h"
#include "sci/graphics/view.h"
-#ifdef ENABLE_SCI32
-#include "sci/graphics/frameout.h"
-#endif
namespace Sci {
@@ -612,13 +609,13 @@ void GfxScreen::setVerticalShakePos(uint16 shakePos) {
void GfxScreen::kernelShakeScreen(uint16 shakeCount, uint16 directions) {
while (shakeCount--) {
- if (directions & SCI_SHAKE_DIRECTION_VERTICAL)
+ if (directions & kShakeVertical)
setVerticalShakePos(10);
// TODO: horizontal shakes
g_system->updateScreen();
g_sci->getEngineState()->wait(3);
- if (directions & SCI_SHAKE_DIRECTION_VERTICAL)
+ if (directions & kShakeVertical)
setVerticalShakePos(0);
g_system->updateScreen();