aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-10-25 18:43:20 -0400
committerPaul Gilbert2016-10-25 18:43:20 -0400
commit20092fb386f752ba5083c0e173380d0be535003d (patch)
tree6f5093f3641db2d6c331d23e1e7ad0549a6d2cde /engines/titanic
parentb4515d087257e1ab27712dc1bffece3f1cd39391 (diff)
downloadscummvm-rg350-20092fb386f752ba5083c0e173380d0be535003d.tar.gz
scummvm-rg350-20092fb386f752ba5083c0e173380d0be535003d.tar.bz2
scummvm-rg350-20092fb386f752ba5083c0e173380d0be535003d.zip
TITANIC: Implement hide counting for mouse cursor hide/show
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/game_state.cpp4
-rw-r--r--engines/titanic/input_handler.cpp5
-rw-r--r--engines/titanic/support/mouse_cursor.cpp11
-rw-r--r--engines/titanic/support/mouse_cursor.h1
-rw-r--r--engines/titanic/support/screen_manager.cpp6
5 files changed, 19 insertions, 8 deletions
diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp
index ea94deec35..51c1ea41cf 100644
--- a/engines/titanic/game_state.cpp
+++ b/engines/titanic/game_state.cpp
@@ -79,14 +79,14 @@ void CGameState::load(SimpleFile *file) {
void CGameState::setMode(GameStateMode newMode) {
CScreenManager *sm = CScreenManager::_screenManagerPtr;
- if (newMode == GSMODE_CUTSCENE && newMode != _mode) {
+ if (newMode == GSMODE_CUTSCENE && _mode != GSMODE_CUTSCENE) {
if (_gameManager)
_gameManager->lockInputHandler();
if (sm && sm->_mouseCursor)
sm->_mouseCursor->hide();
- } else if (newMode != GSMODE_CUTSCENE && newMode != _mode) {
+ } else if (newMode != GSMODE_CUTSCENE && _mode == GSMODE_CUTSCENE) {
if (sm && sm->_mouseCursor)
sm->_mouseCursor->show();
diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp
index 9fa2b0073c..d19f8b16cb 100644
--- a/engines/titanic/input_handler.cpp
+++ b/engines/titanic/input_handler.cpp
@@ -49,7 +49,10 @@ void CInputHandler::incLockCount() {
}
void CInputHandler::decLockCount() {
- if (--_lockCount == 0 && _inputTranslator) {
+ --_lockCount;
+ assert(_lockCount >= 0);
+
+ if (_lockCount == 0 && _inputTranslator) {
if (_dragging && !_inputTranslator->isMousePressed()) {
CMouseButtonUpMsg upMsg(_mousePos, MK_LBUTTON);
handleMessage(upMsg);
diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp
index 4dd1ab4366..18591e61ff 100644
--- a/engines/titanic/support/mouse_cursor.cpp
+++ b/engines/titanic/support/mouse_cursor.cpp
@@ -55,9 +55,10 @@ CMouseCursor::CursorEntry::~CursorEntry() {
CMouseCursor::CMouseCursor(CScreenManager *screenManager) :
_screenManager(screenManager), _cursorId(CURSOR_HOURGLASS),
- _setCursorCount(0), _fieldE4(0), _fieldE8(0) {
+ _hideCount(0), _setCursorCount(0), _fieldE4(0), _fieldE8(0) {
loadCursorImages();
setCursor(CURSOR_ARROW);
+ CursorMan.showMouse(true);
}
CMouseCursor::~CMouseCursor() {
@@ -87,11 +88,15 @@ void CMouseCursor::loadCursorImages() {
}
void CMouseCursor::show() {
- CursorMan.showMouse(true);
+ --_hideCount;
+ assert(_hideCount >= 0);
+ if (_hideCount == 0)
+ CursorMan.showMouse(true);
}
void CMouseCursor::hide() {
- CursorMan.showMouse(false);
+ if (_hideCount++ == 0)
+ CursorMan.showMouse(false);
}
void CMouseCursor::setCursor(CursorId cursorId) {
diff --git a/engines/titanic/support/mouse_cursor.h b/engines/titanic/support/mouse_cursor.h
index 08de28e29d..8881c9b182 100644
--- a/engines/titanic/support/mouse_cursor.h
+++ b/engines/titanic/support/mouse_cursor.h
@@ -66,6 +66,7 @@ private:
CursorId _cursorId;
CursorEntry _cursors[NUM_CURSORS];
uint _setCursorCount;
+ int _hideCount;
int _fieldE4;
int _fieldE8;
diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp
index 2e9bbcb6de..6d80428011 100644
--- a/engines/titanic/support/screen_manager.cpp
+++ b/engines/titanic/support/screen_manager.cpp
@@ -308,11 +308,13 @@ CVideoSurface *OSScreenManager::createSurface(const CResourceKey &key) {
}
void OSScreenManager::showCursor() {
- CScreenManager::_screenManagerPtr->_mouseCursor->show();
+ // TODO: Figure out what this method actually is
+ // CScreenManager::_screenManagerPtr->_mouseCursor->show();
}
void OSScreenManager::hideCursor() {
- CScreenManager::_screenManagerPtr->_mouseCursor->hide();
+ // TODO: Figure out what this method actually is
+ //CScreenManager::_screenManagerPtr->_mouseCursor->hide();
}
void OSScreenManager::destroyFrontAndBackBuffers() {