aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support
diff options
context:
space:
mode:
authorPaul Gilbert2016-10-25 23:10:46 -0400
committerPaul Gilbert2016-10-25 23:10:46 -0400
commit45d208b2ec058d2709c3a5da58abff41d08d782c (patch)
tree85262989cb76a9e78cf6156027f50a7ea799438d /engines/titanic/support
parenteb6fa08311d5b7b7dcdd6e8d0b14854fb097d97a (diff)
downloadscummvm-rg350-45d208b2ec058d2709c3a5da58abff41d08d782c.tar.gz
scummvm-rg350-45d208b2ec058d2709c3a5da58abff41d08d782c.tar.bz2
scummvm-rg350-45d208b2ec058d2709c3a5da58abff41d08d782c.zip
TITANIC: Further work on mouse cursor enablement logic
Diffstat (limited to 'engines/titanic/support')
-rw-r--r--engines/titanic/support/mouse_cursor.cpp35
-rw-r--r--engines/titanic/support/mouse_cursor.h26
-rw-r--r--engines/titanic/support/screen_manager.cpp6
3 files changed, 54 insertions, 13 deletions
diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp
index 18591e61ff..e1022c7f08 100644
--- a/engines/titanic/support/mouse_cursor.cpp
+++ b/engines/titanic/support/mouse_cursor.cpp
@@ -54,8 +54,8 @@ CMouseCursor::CursorEntry::~CursorEntry() {
}
CMouseCursor::CMouseCursor(CScreenManager *screenManager) :
- _screenManager(screenManager), _cursorId(CURSOR_HOURGLASS),
- _hideCount(0), _setCursorCount(0), _fieldE4(0), _fieldE8(0) {
+ _screenManager(screenManager), _cursorId(CURSOR_HOURGLASS), _hideCounter(0),
+ _cursorSuppressed(false), _setCursorCount(0), _fieldE4(0), _fieldE8(0) {
loadCursorImages();
setCursor(CURSOR_ARROW);
CursorMan.showMouse(true);
@@ -88,15 +88,34 @@ void CMouseCursor::loadCursorImages() {
}
void CMouseCursor::show() {
- --_hideCount;
- assert(_hideCount >= 0);
- if (_hideCount == 0)
- CursorMan.showMouse(true);
+ CursorMan.showMouse(!_cursorSuppressed);
}
void CMouseCursor::hide() {
- if (_hideCount++ == 0)
- CursorMan.showMouse(false);
+ CursorMan.showMouse(false);
+}
+
+void CMouseCursor::incHideCounter() {
+ if (_hideCounter++ == 0)
+ hide();
+}
+
+void CMouseCursor::decHideCounter() {
+ --_hideCounter;
+ assert(_hideCounter >= 0);
+ if (_hideCounter == 0)
+ show();
+}
+
+void CMouseCursor::suppressCursor() {
+ _cursorSuppressed = true;
+ hide();
+}
+
+void CMouseCursor::unsuppressCursor() {
+ _cursorSuppressed = false;
+ if (_hideCounter == 0)
+ show();
}
void CMouseCursor::setCursor(CursorId cursorId) {
diff --git a/engines/titanic/support/mouse_cursor.h b/engines/titanic/support/mouse_cursor.h
index 8881c9b182..8960c54f8a 100644
--- a/engines/titanic/support/mouse_cursor.h
+++ b/engines/titanic/support/mouse_cursor.h
@@ -66,7 +66,8 @@ private:
CursorId _cursorId;
CursorEntry _cursors[NUM_CURSORS];
uint _setCursorCount;
- int _hideCount;
+ int _hideCounter;
+ bool _cursorSuppressed;
int _fieldE4;
int _fieldE8;
@@ -89,6 +90,29 @@ public:
void hide();
/**
+ * Decrements the hide counter, and shows the mouse if
+ * it's reached zero
+ */
+ void incHideCounter();
+
+ /**
+ * Increments the hide counter, hiding the mouse if it's the first call
+ */
+ void decHideCounter();
+
+ /**
+ * Suppresses the cursor. When suppressed, the cursor isn't drawn,
+ * even if it's not otherwise being hidden
+ */
+ void suppressCursor();
+
+ /**
+ * Unflags the cursor as being suppressed, allowing it to be drawn
+ * again if it's enabled
+ */
+ void unsuppressCursor();
+
+ /**
* Set the cursor
*/
void setCursor(CursorId cursorId);
diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp
index 6d80428011..a688cf0f60 100644
--- a/engines/titanic/support/screen_manager.cpp
+++ b/engines/titanic/support/screen_manager.cpp
@@ -308,13 +308,11 @@ CVideoSurface *OSScreenManager::createSurface(const CResourceKey &key) {
}
void OSScreenManager::showCursor() {
- // TODO: Figure out what this method actually is
- // CScreenManager::_screenManagerPtr->_mouseCursor->show();
+ CScreenManager::_screenManagerPtr->_mouseCursor->unsuppressCursor();
}
void OSScreenManager::hideCursor() {
- // TODO: Figure out what this method actually is
- //CScreenManager::_screenManagerPtr->_mouseCursor->hide();
+ CScreenManager::_screenManagerPtr->_mouseCursor->suppressCursor();
}
void OSScreenManager::destroyFrontAndBackBuffers() {