aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorMax Horn2007-03-09 22:31:27 +0000
committerMax Horn2007-03-09 22:31:27 +0000
commite8e33e8077194e19b3a019958cface772bec656f (patch)
treeea438a9121397bf35bf714f8ab2797765aab8536 /engines/scumm
parent3b09bc6c00578810763a04e8251cc075972d2ff7 (diff)
downloadscummvm-rg350-e8e33e8077194e19b3a019958cface772bec656f.tar.gz
scummvm-rg350-e8e33e8077194e19b3a019958cface772bec656f.tar.bz2
scummvm-rg350-e8e33e8077194e19b3a019958cface772bec656f.zip
Some more fraction data & an optimized formula (I still have no clue what that tries to compute, though :)
svn-id: r26043
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/he/logic_he.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/engines/scumm/he/logic_he.cpp b/engines/scumm/he/logic_he.cpp
index c982533d5b..7c06cb812f 100644
--- a/engines/scumm/he/logic_he.cpp
+++ b/engines/scumm/he/logic_he.cpp
@@ -357,13 +357,12 @@ int32 LogicHErace::op_1140(int32 *args) {
double projX = args[0] - 2 * scalarProduct * args[2];
double projY = args[1] - 2 * scalarProduct * args[3];
- // 0.86956525 = 1/1.15 = 20/23 = 40/46
- projX *= 0.86956525; // FIXME: Why is this here?
+ projX = projX * 20.0 / 23.0; // FIXME: Why is this here?
writeScummVar(108, (int32)projX);
if (args[3] >= 0) // FIXME: Why is this here?
- projY *= 0.83333331f; // FIXME: This value looks like 5/6
+ projY = projY * 5.0 / 6.0;
writeScummVar(109, (int32)projY);
@@ -684,13 +683,19 @@ int LogicHEfootball::op_1006(int32 *args) {
// 2.9411764e-4 = 1/3400
// 5.3050399e-2 = 1/18.85 = 20/377
// 1.1764706e-2 = 1/85 = 40/3400
+ // 1.2360656e-1 = 377/3050
res = (1.0 - a1 * 2.9411764e-4 * 5.3050399e-2) * 1.2360656e-1 * args[0] +
a1 * 1.1764706e-2 + 46;
+
+ // Shortened / optimized version of that formula:
+ // res = (377.0 - a1 / 170.0) / 3050.0 * args[0] + a1 / 85.0 + 46;
+
writeScummVar(108, (int32)res);
// 1.2360656e-1 = 377/3050
// 1.1588235e-1 = 197/1700 = 394/3400
res = 640.0 - args[2] * 1.2360656e-1 - a1 * 1.1588235e-1 - 26;
+
writeScummVar(109, (int32)res);
return 1;
@@ -724,6 +729,7 @@ int LogicHEfootball::op_1010(int32 *args) {
// 2.9411764e-4 = 1/3400
// 5.3050399e-2 = 1/18.85 = 20/377
// 1.1764706e-2 = 1/85 = 40/3400
+ // 1.2360656e-1 = 377/3050
double a0 = ((double)args[0] - 46 - a1 * 1.1764706e-2) /
((1.0 - a1 * 2.9411764e-4 * 5.3050399e-2) * 1.2360656e-1);