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)); 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)) { if ((unkTypeMaybe == 0 && priority - 1 < 8) || (unkTypeMaybe == 1 && priority -1 < 0x10)) {
target_x += x_offset; //TODO FIXME
target_y += y_offset; // target_x += x_offset;
// target_y += y_offset;
x_related_idx = -1; x_related_idx = -1;
break; break;
} }
@ -406,13 +407,13 @@ uint16 Actor::pathfindingUnk(int16 actor_x, int16 actor_y, int16 target_x, int16
} }
// 0x80034d28 // 0x80034d28
int16 x = actor_x; int32 x = actor_x << 0x10;
int16 y = actor_y; int32 y = actor_y << 0x10;
for(;;) { for(;;) {
if (x+1 == target_x && y+1 == target_y) { if ((x+0x8000) >> 0x10 == target_x && (y+0x8000) >> 0x10 == target_y) {
return 1; 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) { if ( priority < 0) {
priority = 1; priority = 1;
} }