From aa3cefa2c6826ab250562e60423890b0ebe93318 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 19 Aug 2010 11:41:13 +0000 Subject: 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 --- engines/sci/engine/kmovement.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines') 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. -- cgit v1.2.3