aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/obstacles.h
diff options
context:
space:
mode:
authorThomas Fach-Pedersen2018-12-22 17:39:19 +0100
committerThomas Fach-Pedersen2019-01-14 18:50:30 +0100
commitc57e47f30dd4b719cf2535f14459a50f2d7e89e2 (patch)
tree6a5e3d13ee7f4de6c2465ee900ba604f8a9b83cb /engines/bladerunner/obstacles.h
parent26031080224d194da24bfa6c78258406c6855e7b (diff)
downloadscummvm-rg350-c57e47f30dd4b719cf2535f14459a50f2d7e89e2.tar.gz
scummvm-rg350-c57e47f30dd4b719cf2535f14459a50f2d7e89e2.tar.bz2
scummvm-rg350-c57e47f30dd4b719cf2535f14459a50f2d7e89e2.zip
BLADERUNNER: Obstacle path finding part 1
Diffstat (limited to 'engines/bladerunner/obstacles.h')
-rw-r--r--engines/bladerunner/obstacles.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/engines/bladerunner/obstacles.h b/engines/bladerunner/obstacles.h
index f133fe05ff..c05a453002 100644
--- a/engines/bladerunner/obstacles.h
+++ b/engines/bladerunner/obstacles.h
@@ -36,6 +36,7 @@ class Obstacles {
static const int kVertexCount = 150;
static const int kPolygonCount = 50;
static const int kPolygonVertexCount = 160;
+ static const int kMaxPathSize = 500;
enum VertexType {
BOTTOM_LEFT,
@@ -64,8 +65,8 @@ class Obstacles {
Polygon *_polygons;
Polygon *_polygonsBackup;
- Vector2 *_vertices;
- int _verticeCount;
+ Vector2 *_path;
+ int _pathSize;
int _count;
bool _backup;
@@ -83,19 +84,20 @@ public:
void add(float x0, float z0, float x1, float z1) { add(RectFloat(x0, z0, x1, z1)); }
int findEmptyPolygon() const;
static float getLength(float x0, float z0, float x1, float z1);
- bool find(const Vector3 &from, const Vector3 &to, Vector3 *next) const;
+ bool findNextWaypoint(const Vector3 &from, const Vector3 &to, Vector3 *next);
bool findIntersectionNearest(int polygonIndex, Vector2 from, Vector2 to,
int *outVertexIndex, float *outDistance, Vector2 *out) const;
bool findIntersectionFarthest(int polygonIndex, Vector2 from, Vector2 to,
int *outVertexIndex, float *outDistance, Vector2 *out) const;
+ float pathTotalDistance(const Vector2 *path, int pathSize, Vector2 from, Vector2 to) const;
bool findPolygonVerticeByXZ(int *polygonIndex, int *verticeIndex, int *verticeCount, float x, float z) const;
bool findPolygonVerticeByXZWithinTolerance(float x, float z, int *polygonIndex, int *verticeIndex) const;
- void clearVertices();
- void copyVerticesReverse();
- void copyVertices();
+ void clearPath();
+ int buildNegativePath(int polyIndex, int vertStartIndex, Vector2 startPos, int vertEndIndex, Vector2 endPos, Vector2 *path, int pathCapacity, bool *pathBlocked);
+ int buildPositivePath(int polyIndex, int vertStartIndex, Vector2 startPos, int vertEndIndex, Vector2 endPos, Vector2 *path, int pathCapacity, bool *pathBlocked);
void backup();
void restore();