aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support/rect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/support/rect.cpp')
-rw-r--r--engines/titanic/support/rect.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/engines/titanic/support/rect.cpp b/engines/titanic/support/rect.cpp
index b39ffc1c45..f7f8f14d2f 100644
--- a/engines/titanic/support/rect.cpp
+++ b/engines/titanic/support/rect.cpp
@@ -42,4 +42,22 @@ void Rect::constrain(const Rect &r) {
}
}
+Point Rect::getPoint(Quadrant quadrant) {
+ if (isEmpty())
+ return Point(left, top);
+
+ switch (quadrant) {
+ case Q_LEFT:
+ return Point(MIN(left + 10, (int)right), (top + bottom) / 2);
+ case Q_RIGHT:
+ return Point(MAX(right - 10, (int)left), (top + bottom) / 2);
+ case Q_TOP:
+ return Point((left + right) / 2, MIN(top + 10, (int)bottom));
+ case Q_BOTTOM:
+ return Point((left + right) / 2, MAX(bottom - 10, (int)top));
+ default:
+ return Point((left + right) / 2, (top + bottom) / 2);
+ }
+}
+
} // End of namespace Titanic