diff options
-rw-r--r-- | engines/bladerunner/obstacles.cpp | 2 | ||||
-rw-r--r-- | engines/bladerunner/obstacles.h | 8 | ||||
-rw-r--r-- | engines/bladerunner/rect_float.h (renamed from engines/bladerunner/rect.h) | 16 |
3 files changed, 13 insertions, 13 deletions
diff --git a/engines/bladerunner/obstacles.cpp b/engines/bladerunner/obstacles.cpp index 06c19ad4af..62bb210bd1 100644 --- a/engines/bladerunner/obstacles.cpp +++ b/engines/bladerunner/obstacles.cpp @@ -247,7 +247,7 @@ bool Obstacles::mergePolygons(Polygon &polyA, Polygon &polyB) { return flagDidMergePolygons; } -void Obstacles::add(Rect rect) { +void Obstacles::add(RectFloat rect) { int polygonIndex = findEmptyPolygon(); if (polygonIndex < 0) { return; diff --git a/engines/bladerunner/obstacles.h b/engines/bladerunner/obstacles.h index 25124904ef..f133fe05ff 100644 --- a/engines/bladerunner/obstacles.h +++ b/engines/bladerunner/obstacles.h @@ -23,7 +23,7 @@ #ifndef BLADERUNNER_OBSTACLES_H #define BLADERUNNER_OBSTACLES_H -#include "bladerunner/rect.h" +#include "bladerunner/rect_float.h" #include "bladerunner/vector.h" namespace BladeRunner { @@ -52,7 +52,7 @@ class Obstacles { struct Polygon { bool isPresent; int verticeCount; - Rect rect; + RectFloat rect; Vector2 vertices[kPolygonVertexCount]; VertexType vertexType[kPolygonVertexCount]; @@ -79,8 +79,8 @@ public: ~Obstacles(); void clear(); - void add(Rect rect); - void add(float x0, float z0, float x1, float z1) { add(Rect(x0, z0, x1, z1)); } + void add(RectFloat rect); + 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; diff --git a/engines/bladerunner/rect.h b/engines/bladerunner/rect_float.h index a44ad87040..4b7fea31bd 100644 --- a/engines/bladerunner/rect.h +++ b/engines/bladerunner/rect_float.h @@ -20,8 +20,8 @@ * */ -#ifndef BLADERUNNER_RECT_H -#define BLADERUNNER_RECT_H +#ifndef BLADERUNNER_RECT_FLOAT_H +#define BLADERUNNER_RECT_FLOAT_H #include "common/debug.h" #include "common/types.h" @@ -29,16 +29,16 @@ namespace BladeRunner { -struct Rect { +struct RectFloat { float x0; float y0; float x1; float y1; - Rect() + RectFloat() : x0(0.0f), y0(0.0f), x1(0.0f), y1(0.0f) {} - Rect(float x0_, float y0_, float x1_, float y1_) + RectFloat(float x0_, float y0_, float x1_, float y1_) : x0(x0_), y0(y0_), x1(x1_), y1(y1_) {} @@ -57,12 +57,12 @@ struct Rect { } }; -inline bool overlaps(const Rect &a, const Rect &b) { +inline bool overlaps(const RectFloat &a, const RectFloat &b) { return !(a.y1 < b.y0 || a.y0 > b.y1 || a.x0 > b.x1 || a.x1 < b.x0); } -inline Rect merge(const Rect &a, const Rect &b) { - Rect c; +inline RectFloat merge(const RectFloat &a, const RectFloat &b) { + RectFloat c; c.x0 = MIN(a.x0, b.x0); c.y0 = MIN(a.y0, b.y0); c.x1 = MAX(a.x1, b.x1); |