aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-07 00:06:18 -0400
committerPaul Gilbert2016-04-07 00:06:18 -0400
commitbc7a7deb775568cdbe205e3f8c4f5ebd03e34141 (patch)
treeb1850e6500e1687762d7c38ab2b01f9c45986705 /engines
parent826dcf1f42fc1a5c5a4e7c34f395e51c6f5944df (diff)
downloadscummvm-rg350-bc7a7deb775568cdbe205e3f8c4f5ebd03e34141.tar.gz
scummvm-rg350-bc7a7deb775568cdbe205e3f8c4f5ebd03e34141.tar.bz2
scummvm-rg350-bc7a7deb775568cdbe205e3f8c4f5ebd03e34141.zip
TITANIC: Fix showing custom cursors when highlighting objects
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/core/view_item.cpp10
-rw-r--r--engines/titanic/support/mouse_cursor.cpp4
-rw-r--r--engines/titanic/support/mouse_cursor.h6
3 files changed, 16 insertions, 4 deletions
diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp
index 8120b3c671..d747f06ac8 100644
--- a/engines/titanic/core/view_item.cpp
+++ b/engines/titanic/core/view_item.cpp
@@ -209,9 +209,13 @@ bool CViewItem::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
bool CViewItem::MouseMoveMsg(CMouseMoveMsg *msg) {
CScreenManager *screenManager = CScreenManager::_screenManagerPtr;
+ uint changeCount = screenManager->_mouseCursor->getChangeCount();
if (handleMouseMsg(msg, true)) {
- screenManager->_mouseCursor->setCursor(CURSOR_ARROW);
+ // If the cursor hasn't been set in the call to handleMouseMsg,
+ // then reset it back to the default arrow cursor
+ if (screenManager->_mouseCursor->getChangeCount() == changeCount)
+ screenManager->_mouseCursor->setCursor(CURSOR_ARROW);
} else {
// Iterate through each link item, and if any is highlighted,
// change the mouse cursor to the designated cursor for the item
@@ -226,7 +230,7 @@ bool CViewItem::MouseMoveMsg(CMouseMoveMsg *msg) {
treeItem = treeItem->getNextSibling();
}
- if (!handleMouseMsg(msg, false))
+ if (!handleMouseMsg(msg, false) || (screenManager->_mouseCursor->getChangeCount() == changeCount))
screenManager->_mouseCursor->setCursor(CURSOR_ARROW);
}
@@ -244,7 +248,7 @@ bool CViewItem::handleMouseMsg(CMouseMsg *msg, bool flag) {
for (CTreeItem *treeItem = scan(this); treeItem; treeItem = treeItem->scan(this)) {
CGameObject *gameObject = dynamic_cast<CGameObject *>(treeItem);
if (gameObject) {
- if (gameObject->checkPoint(msg->_mousePos, 0, 1) &&
+ if (gameObject->checkPoint(msg->_mousePos, false, true) &&
(!flag || !gameObject->_field60)) {
if (gameObjects.size() < 256)
gameObjects.push_back(gameObject);
diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp
index c4c57c6f07..a2bd11657c 100644
--- a/engines/titanic/support/mouse_cursor.cpp
+++ b/engines/titanic/support/mouse_cursor.cpp
@@ -50,7 +50,7 @@ static const int CURSOR_DATA[NUM_CURSORS][4] = {
};
CMouseCursor::CMouseCursor(CScreenManager *screenManager) :
- _screenManager(screenManager), _cursorId(CURSOR_HOURGLASS) {
+ _screenManager(screenManager), _cursorId(CURSOR_HOURGLASS), _setCursorCount(0) {
loadCursorImages();
setCursor(CURSOR_ARROW);
}
@@ -90,6 +90,8 @@ void CMouseCursor::hide() {
}
void CMouseCursor::setCursor(CursorId cursorId) {
+ ++_setCursorCount;
+
if (cursorId != _cursorId) {
CursorEntry &ce = _cursors[cursorId - 1];
CVideoSurface &surface = *ce._videoSurface;
diff --git a/engines/titanic/support/mouse_cursor.h b/engines/titanic/support/mouse_cursor.h
index 831e207632..6e1e6f7c3e 100644
--- a/engines/titanic/support/mouse_cursor.h
+++ b/engines/titanic/support/mouse_cursor.h
@@ -61,6 +61,7 @@ private:
CScreenManager *_screenManager;
CursorId _cursorId;
CursorEntry _cursors[NUM_CURSORS];
+ uint _setCursorCount;
/**
* Load the images for each cursor
@@ -89,6 +90,11 @@ public:
* Updates the mouse cursor
*/
void update();
+
+ /**
+ * Returns the number of times the cursor has been set
+ */
+ uint getChangeCount() const { return _setCursorCount; }
};