DRAGONS: work on pathfinding

This commit is contained in:
Eric Fry 2019-02-18 22:57:53 +11:00 committed by Eugene Sandulenko
parent e74331f38d
commit 3cc1746bc3

View File

@ -260,8 +260,9 @@ bool Actor::pathfinding_maybe(int16 target_x, int16 target_y, int16 unkTypeMaybe
priority = getEngine()->_scene->getPriorityAtPosition(Common::Point(target_x + x_offset, target_y + y_offset));
if ((unkTypeMaybe == 0 && priority - 1 < 8) || (unkTypeMaybe == 1 && priority -1 < 0x10)) {
target_x += x_offset;
target_y += y_offset;
//TODO FIXME
// target_x += x_offset;
// target_y += y_offset;
x_related_idx = -1;
break;
}
@ -406,13 +407,13 @@ uint16 Actor::pathfindingUnk(int16 actor_x, int16 actor_y, int16 target_x, int16
}
// 0x80034d28
int16 x = actor_x;
int16 y = actor_y;
int32 x = actor_x << 0x10;
int32 y = actor_y << 0x10;
for(;;) {
if (x+1 == target_x && y+1 == target_y) {
if ((x+0x8000) >> 0x10 == target_x && (y+0x8000) >> 0x10 == target_y) {
return 1;
}
int16 priority = getEngine()->_scene->getPriorityAtPosition(Common::Point(x, y));
int16 priority = getEngine()->_scene->getPriorityAtPosition(Common::Point(x>>0x10, y>>0x10));
if ( priority < 0) {
priority = 1;
}