aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/toon/path.cpp26
-rw-r--r--engines/toon/path.h9
2 files changed, 9 insertions, 26 deletions
diff --git a/engines/toon/path.cpp b/engines/toon/path.cpp
index 5aae523455..63dbf1a442 100644
--- a/engines/toon/path.cpp
+++ b/engines/toon/path.cpp
@@ -232,7 +232,7 @@ bool PathFinding::findClosestWalkingPoint(int16 xx, int16 yy, int16 *fxx, int16
}
}
-bool PathFinding::walkLine(int16 x, int16 y, int16 x2, int16 y2) {
+void PathFinding::walkLine(int16 x, int16 y, int16 x2, int16 y2) {
uint32 bx = x << 16;
int32 dx = x2 - x;
uint32 by = y << 16;
@@ -249,20 +249,13 @@ bool PathFinding::walkLine(int16 x, int16 y, int16 x2, int16 y2) {
int32 cdy = (dy << 16) / t;
_tempPath.clear();
- i32Point p;
for (int32 i = t; i > 0; i--) {
- p.x = bx >> 16;
- p.y = by >> 16;
- _tempPath.insert_at(0, p);
+ _tempPath.insert_at(0, Common::Point(bx >> 16, by >> 16));
bx += cdx;
by += cdy;
}
- p.x = x2;
- p.y = y2;
- _tempPath.insert_at(0, p);
-
- return true;
+ _tempPath.insert_at(0, Common::Point(x2, y2));
}
bool PathFinding::lineIsWalkable(int16 x, int16 y, int16 x2, int16 y2) {
@@ -363,12 +356,8 @@ bool PathFinding::findPath(int16 x, int16 y, int16 destx, int16 desty) {
curX = destx;
curY = desty;
- Common::Array<i32Point> retPath;
-
- i32Point p;
- p.x = curX;
- p.y = curY;
- retPath.push_back(p);
+ Common::Array<Common::Point> retPath;
+ retPath.push_back(Common::Point(curX, curY));
int32 bestscore = _sq[destx + desty * _width];
@@ -402,10 +391,7 @@ bool PathFinding::findPath(int16 x, int16 y, int16 destx, int16 desty) {
if (bestX < 0 || bestY < 0)
break;
- i32Point pp;
- pp.x = bestX;
- pp.y = bestY;
- retPath.push_back(pp);
+ retPath.push_back(Common::Point(bestX, bestY));
if ((bestX == x && bestY == y)) {
_tempPath.clear();
diff --git a/engines/toon/path.h b/engines/toon/path.h
index f73415adc5..2a583e5bff 100644
--- a/engines/toon/path.h
+++ b/engines/toon/path.h
@@ -24,6 +24,7 @@
#define TOON_PATH_H
#include "common/array.h"
+#include "common/rect.h"
#include "toon/toon.h"
@@ -66,7 +67,7 @@ public:
bool isWalkable(int16 x, int16 y);
bool isLikelyWalkable(int16 x, int16 y);
bool lineIsWalkable(int16 x, int16 y, int16 x2, int16 y2);
- bool walkLine(int16 x, int16 y, int16 x2, int16 y2);
+ void walkLine(int16 x, int16 y, int16 x2, int16 y2);
void resetBlockingRects() { _numBlockingRects = 0; }
void addBlockingRect(int16 x1, int16 y1, int16 x2, int16 y2);
@@ -87,11 +88,7 @@ private:
int16 _width;
int16 _height;
- struct i32Point {
- int32 x, y;
- };
-
- Common::Array<i32Point> _tempPath;
+ Common::Array<Common::Point> _tempPath;
int16 _blockingRects[kMaxBlockingRects][5];
uint8 _numBlockingRects;