aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/core/view_item.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/core/view_item.cpp')
-rw-r--r--engines/titanic/core/view_item.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp
index 2b585160ea..5f51cfc931 100644
--- a/engines/titanic/core/view_item.cpp
+++ b/engines/titanic/core/view_item.cpp
@@ -374,7 +374,7 @@ bool CViewItem::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) {
if (!link)
continue;
- CursorId c = link->_cursorId;
+ CursorId c = getLinkCursor(link);
if ((move == LEFT && c == CURSOR_MOVE_LEFT) ||
(move == RIGHT && c == CURSOR_MOVE_RIGHT) ||
(move == FORWARDS && (c == CURSOR_MOVE_FORWARD ||
@@ -390,4 +390,26 @@ bool CViewItem::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) {
return false;
}
+CursorId CViewItem::getLinkCursor(CLinkItem *link) {
+ Common::Point pt(link->_bounds.left, link->_bounds.top);
+ Common::Array<CGameObject *> gameObjects;
+
+ // Scan for a restricted object covering the link
+ for (CTreeItem *treeItem = scan(this); treeItem; treeItem = treeItem->scan(this)) {
+ CGameObject *gameObject = dynamic_cast<CGameObject *>(treeItem);
+ if (gameObject) {
+ if (gameObject->checkPoint(pt, false, true))
+ gameObjects.push_back(gameObject);
+ }
+ }
+
+ for (int idx = (int)gameObjects.size() - 1; idx >= 0; --idx) {
+ if (gameObjects[idx]->_cursorId == CURSOR_INVALID)
+ return CURSOR_INVALID;
+ }
+
+ // No obscuring objects, so we're free to return the link's cursor
+ return link->_cursorId;
+}
+
} // End of namespace Titanic