aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/core/game_object.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2017-08-08 22:24:22 -0400
committerPaul Gilbert2017-08-08 22:24:22 -0400
commit660f7bf11479222689cf77060077fe47d65a465e (patch)
tree48798a2d991a3d9bb533efeb42ca41d9b485d5f1 /engines/titanic/core/game_object.cpp
parent6fac0ace2c844aa68c2482362021981ed1db931b (diff)
downloadscummvm-rg350-660f7bf11479222689cf77060077fe47d65a465e.tar.gz
scummvm-rg350-660f7bf11479222689cf77060077fe47d65a465e.tar.bz2
scummvm-rg350-660f7bf11479222689cf77060077fe47d65a465e.zip
TITANIC: Further improvements to arrow key movement
The movement code, when deciding on an item or link that matches the desired direction, will check five points on the object/links area.. center, left edge, right edge, top edge, and bottom edge. For each of these, it makes sure that at that point, clicking will actually get passed to it. Otherwise, it moves onto one of the other edges. This helps avoid issues where links weren't working because standard scene objects were partially obscuring them.
Diffstat (limited to 'engines/titanic/core/game_object.cpp')
-rw-r--r--engines/titanic/core/game_object.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index ab91a6decc..1519a2de66 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -289,18 +289,17 @@ bool CGameObject::checkPoint(const Point &pt, bool ignoreSurface, bool visibleOn
return pixel != transColor;
}
-bool CGameObject::findPoint(Point &pt) {
+bool CGameObject::findPoint(Quadrant quadrant, Point &pt) {
// Start by checking a centroid point in the bounds
if (!_bounds.isEmpty()) {
- pt = Point((_bounds.left + _bounds.right) / 2,
- (_bounds.top + _bounds.bottom) / 2);
+ pt = _bounds.getPoint(quadrant);
if (checkPoint(pt, false, true))
return true;
}
// Scan through all the area of the bounds to find a valid point
- for (pt.y = _bounds.top; pt.y < _bounds.bottom; ++pt.y) {
- for (pt.x = _bounds.left; pt.x < _bounds.right; ++pt.x) {
+ for (; pt.y < _bounds.bottom; ++pt.y, pt.x = _bounds.left) {
+ for (; pt.x < _bounds.right; ++pt.x) {
if (checkPoint(pt, false, true))
return true;
}