aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorsluicebox2019-06-27 17:33:48 -0700
committerFilippos Karapetis2019-06-28 08:30:19 +0300
commit148a9b70583168be0ea52549868bd79f7a23b58d (patch)
treeaff68bd1c657b5c5d9fef8058943c333bb651ec1 /engines/sci/engine
parent13e7926849ca4f7968dd81616f6e11f46dcfeb19 (diff)
downloadscummvm-rg350-148a9b70583168be0ea52549868bd79f7a23b58d.tar.gz
scummvm-rg350-148a9b70583168be0ea52549868bd79f7a23b58d.tar.bz2
scummvm-rg350-148a9b70583168be0ea52549868bd79f7a23b58d.zip
SCI32: Fix kShakeScreen32 parameter count check
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kgraphics32.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
index f9c1edee42..c28f0cd380 100644
--- a/engines/sci/engine/kgraphics32.cpp
+++ b/engines/sci/engine/kgraphics32.cpp
@@ -155,7 +155,17 @@ reg_t kSetCursor32(EngineState *s, int argc, reg_t *argv) {
}
reg_t kShakeScreen32(EngineState *s, int argc, reg_t *argv) {
- g_sci->_gfxFrameout->shakeScreen(argv[0].toSint16(), (ShakeDirection)argv[1].toSint16());
+ int16 shakeCount = argv[0].toSint16();
+
+ // SSCI didn't check the parameter count and assumed a direction parameter
+ // was always passed. This parameter was optional in SCI16 and at least GK1
+ // and QFG4 scripts continued to not pass it. This would shake in a random
+ // direction depending on whatever happened to be in memory, or not at all.
+ // We treat direction as optional with a a vertical default as in SCI16 as
+ // that's what the scripts expect.
+ ShakeDirection directions = (argc > 1) ? (ShakeDirection)argv[1].toSint16() : kShakeVertical;
+
+ g_sci->_gfxFrameout->shakeScreen(shakeCount, directions);
return s->r_acc;
}