aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2010-08-19 11:41:13 +0000
committerFilippos Karapetis2010-08-19 11:41:13 +0000
commitaa3cefa2c6826ab250562e60423890b0ebe93318 (patch)
tree9773c2934265d90a4043b18515d1eea817c00d6d
parent2bd5077d2ee711dc4224fe97c69479c36b190c6f (diff)
downloadscummvm-rg350-aa3cefa2c6826ab250562e60423890b0ebe93318.tar.gz
scummvm-rg350-aa3cefa2c6826ab250562e60423890b0ebe93318.tar.bz2
scummvm-rg350-aa3cefa2c6826ab250562e60423890b0ebe93318.zip
SCI: Fixed bug #3039768 - "QFG3: Glitch When Making Thief Sign to Rope Maker", by fixing the implementation of kSetJump, based on Greg's SCI code. kSetJump returned an incorrect result, causing the actor to jump outside the screen
svn-id: r52207
-rw-r--r--engines/sci/engine/kmovement.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp
index ef6b46e478..08be34bb5d 100644
--- a/engines/sci/engine/kmovement.cpp
+++ b/engines/sci/engine/kmovement.cpp
@@ -129,7 +129,7 @@ reg_t kSetJump(EngineState *s, int argc, reg_t *argv) {
// Compute x step
if (tmp != 0)
- vx = (int)(dx * sqrt(gy / (2.0 * tmp)));
+ vx = (int16)((float)(dx * sqrt(gy / (2.0 * tmp))));
else
vx = 0;
@@ -145,7 +145,7 @@ reg_t kSetJump(EngineState *s, int argc, reg_t *argv) {
// FIXME: This choice of vy makes t roughly (2+sqrt(2))/gy * sqrt(dy);
// so if gy==3, then t is roughly sqrt(dy)...
- vy = (int)sqrt((double)gy * ABS(2 * dy)) + 1;
+ vy = (int)sqrt((float)gy * ABS(2 * dy)) + 1;
} else {
// As stated above, the vertical direction is correlated to the horizontal by the
// (non-zero) factor c.