aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/star_control/fpoint.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/star_control/fpoint.h')
-rw-r--r--engines/titanic/star_control/fpoint.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/engines/titanic/star_control/fpoint.h b/engines/titanic/star_control/fpoint.h
index f2cef18ea5..33181d937b 100644
--- a/engines/titanic/star_control/fpoint.h
+++ b/engines/titanic/star_control/fpoint.h
@@ -34,6 +34,25 @@ public:
public:
FPoint() : _x(0), _y(0) {}
FPoint(double x, double y) : _x(x), _y(y) {}
+
+ bool operator==(const FPoint &p) const { return _x == p._x && _y == p._y; }
+ bool operator!=(const FPoint &p) const { return _x != p._x || _y != p._y; }
+
+ void operator+=(const FPoint &delta) {
+ _x += delta._x;
+ _y += delta._y;
+ }
+
+ void operator-=(const FPoint &delta) {
+ _x -= delta._x;
+ _y -= delta._y;
+ }
+
+ /**
+ * Normalises the X and Y coordinates as fractions relative to the
+ * value of the hypotenuse formed by a triangle from the origin (0,0)
+ */
+ void normalize();
};
} // End of namespace Titanic