From 3cc1746bc315521bebc081bbdaac6afd0b2aa954 Mon Sep 17 00:00:00 2001 From: Eric Fry Date: Mon, 18 Feb 2019 22:57:53 +1100 Subject: [PATCH] DRAGONS: work on pathfinding --- engines/dragons/actor.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/engines/dragons/actor.cpp b/engines/dragons/actor.cpp index fb76b5941f4..25b5abe53a0 100644 --- a/engines/dragons/actor.cpp +++ b/engines/dragons/actor.cpp @@ -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; }