[Scummvm-cvs-logs] scummvm master -> 0b4802c24b35af7dd233a6f06b77ef72cb684a54

bluegr md5 at scummvm.org
Thu Sep 22 23:29:19 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0b4802c24b SCI: Fixed bug #3413020 - "SCI: Longbow: Robin is stuck in the final monk chase scene"


Commit: 0b4802c24b35af7dd233a6f06b77ef72cb684a54
    https://github.com/scummvm/scummvm/commit/0b4802c24b35af7dd233a6f06b77ef72cb684a54
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-09-22T14:22:44-07:00

Commit Message:
SCI: Fixed bug #3413020 - "SCI: Longbow: Robin is stuck in the final monk chase scene"

Special thanks to wjp for his work on bisecting to find the regression and
for checking against the KQ5CD disasm

Changed paths:
    engines/sci/engine/kmath.cpp



diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp
index ef795d7..7570856 100644
--- a/engines/sci/engine/kmath.cpp
+++ b/engines/sci/engine/kmath.cpp
@@ -37,6 +37,14 @@ reg_t kRandom(EngineState *s, int argc, reg_t *argv) {
 		//  some codes in sq4 are also random and 5 digit (if i remember correctly)
 		const uint16 fromNumber = argv[0].toUint16();
 		const uint16 toNumber = argv[1].toUint16();
+		// Some scripts may request a range in the reverse order (from largest
+		// to smallest). An example can be found in Longbow, room 710, where a
+		// random number is requested from 119 to 83. In this case, we're
+		// supposed to return toNumber (determined by the KQ5CD disasm).
+		// Fixes bug #3413020.
+		if (fromNumber > toNumber)
+			return make_reg(0, toNumber);
+
 		uint16 range = toNumber - fromNumber + 1;
 		// calculating range is exactly how sierra sci did it and is required for hoyle 4
 		//  where we get called with kRandom(0, -1) and we are supposed to give back values from 0 to 0






More information about the Scummvm-git-logs mailing list