aboutsummaryrefslogtreecommitdiff
path: root/engines/simon
diff options
context:
space:
mode:
authorTravis Howell2006-04-14 07:24:40 +0000
committerTravis Howell2006-04-14 07:24:40 +0000
commit081a7b737ae04e939707220fe8d4b91ae3419c54 (patch)
treeab367a041d65291d36e1e00735dc87fcfb73e913 /engines/simon
parentd3a0f122a93d0296107da43dc9fce649ef0fe7cb (diff)
downloadscummvm-rg350-081a7b737ae04e939707220fe8d4b91ae3419c54.tar.gz
scummvm-rg350-081a7b737ae04e939707220fe8d4b91ae3419c54.tar.bz2
scummvm-rg350-081a7b737ae04e939707220fe8d4b91ae3419c54.zip
A few corrections to path finding in FF
svn-id: r21876
Diffstat (limited to 'engines/simon')
-rw-r--r--engines/simon/items.cpp19
-rw-r--r--engines/simon/vga.cpp2
2 files changed, 8 insertions, 13 deletions
diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp
index a3ad35c85c..efe19cbeb8 100644
--- a/engines/simon/items.cpp
+++ b/engines/simon/items.cpp
@@ -1479,20 +1479,20 @@ void SimonEngine::o_getPathPosn() {
uint prev_i;
uint x_diff, y_diff;
uint best_i = 0, best_j = 0, best_dist = 0xFFFFFFFF;
+ uint maxPath = (getGameType() == GType_FF) ? 100 : 20;
if (getGameType() == GType_FF) {
x += _scrollX;
y += _scrollY;
}
-
if (getGameType() == GType_SIMON2) {
x += _scrollX * 8;
}
int end = (getGameType() == GType_FF) ? 9999 : 999;
- prev_i = 21 - _variableArray[12];
- for (i = 20; i != 0; --i) {
- p = (const uint16 *)_pathFindArray[20 - i];
+ prev_i = maxPath + 1 - readVariable(12);
+ for (i = maxPath; i != 0; --i) {
+ p = (const uint16 *)_pathFindArray[maxPath - i];
if (!p)
continue;
for (j = 0; readUint16Wrapper(&p[0]) != end; j++, p += 2) {
@@ -1507,19 +1507,14 @@ void SimonEngine::o_getPathPosn() {
if (x_diff < best_dist || x_diff == best_dist && prev_i == i) {
best_dist = x_diff;
- best_i = 21 - i;
+ best_i = maxPath + 1 - i;
best_j = j;
}
}
}
- if (getGameType() == GType_FF && getBitFlag(83)) {
- _variableArray[var_1] = best_i;
- _variableArray[var_2] = best_j;
- } else {
- _variableArray[var_1] = best_i;
- _variableArray[var_2] = best_j;
- }
+ writeVariable(var_1, best_i);
+ writeVariable(var_2, best_j);
}
void SimonEngine::o_scnTxtLongText() {
diff --git a/engines/simon/vga.cpp b/engines/simon/vga.cpp
index 364118360f..18b07bee0a 100644
--- a/engines/simon/vga.cpp
+++ b/engines/simon/vga.cpp
@@ -1863,7 +1863,7 @@ void SimonEngine::vc48_setPathFinder() {
int16 x, x2, y, y1, y2, ydiff;
uint pos = 0;
- while(vsp->x > readUint16Wrapper(p + 2)) {
+ while (vsp->x >= readUint16Wrapper(p + 2)) {
p += 2;
pos++;
}