aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2017-01-21 21:16:39 -0500
committerPaul Gilbert2017-01-21 21:16:39 -0500
commit7c2265659aa69aed7aceecc76d660bef3d830b99 (patch)
tree132eea44dce16176f2bf941d0c96ab26f1a27997
parentddc08c8fa25245445910c386cdb2bca38314a756 (diff)
downloadscummvm-rg350-7c2265659aa69aed7aceecc76d660bef3d830b99.tar.gz
scummvm-rg350-7c2265659aa69aed7aceecc76d660bef3d830b99.tar.bz2
scummvm-rg350-7c2265659aa69aed7aceecc76d660bef3d830b99.zip
TITANIC: Fix display of busy cursor across entire TV throw cutscene
-rw-r--r--engines/titanic/core/game_object.cpp18
-rw-r--r--engines/titanic/game_state.cpp4
-rw-r--r--engines/titanic/support/mouse_cursor.cpp36
-rw-r--r--engines/titanic/support/mouse_cursor.h22
4 files changed, 31 insertions, 49 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index bcdf77b675..beee255c2d 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -1151,7 +1151,15 @@ void CGameObject::lockMouse() {
gameMan->lockInputHandler();
if (CScreenManager::_screenManagerPtr->_mouseCursor)
- CScreenManager::_screenManagerPtr->_mouseCursor->hide();
+ CScreenManager::_screenManagerPtr->_mouseCursor->incBusyCount();
+}
+
+void CGameObject::unlockMouse() {
+ if (CScreenManager::_screenManagerPtr->_mouseCursor)
+ CScreenManager::_screenManagerPtr->_mouseCursor->decBusyCount();
+
+ CGameManager *gameMan = getGameManager();
+ gameMan->unlockInputHandler();
}
void CGameObject::hideMouse() {
@@ -1192,14 +1200,6 @@ void CGameObject::unlockInputHandler() {
getGameManager()->unlockInputHandler();
}
-void CGameObject::unlockMouse() {
- if (CScreenManager::_screenManagerPtr->_mouseCursor)
- CScreenManager::_screenManagerPtr->_mouseCursor->show();
-
- CGameManager *gameMan = getGameManager();
- gameMan->unlockInputHandler();
-}
-
void CGameObject::loadSurface() {
if (!_surface && !_resource.empty()) {
loadResource(_resource);
diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp
index 49779ad745..964d6e604a 100644
--- a/engines/titanic/game_state.cpp
+++ b/engines/titanic/game_state.cpp
@@ -83,11 +83,11 @@ void CGameState::setMode(GameStateMode newMode) {
_gameManager->lockInputHandler();
if (sm && sm->_mouseCursor)
- sm->_mouseCursor->setBusy();
+ sm->_mouseCursor->incBusyCount();
} else if (newMode != GSMODE_CUTSCENE && _mode == GSMODE_CUTSCENE) {
if (sm && sm->_mouseCursor)
- sm->_mouseCursor->clearBusy();
+ sm->_mouseCursor->decBusyCount();
if (_gameManager)
_gameManager->unlockInputHandler();
diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp
index 86623da044..eb58296502 100644
--- a/engines/titanic/support/mouse_cursor.cpp
+++ b/engines/titanic/support/mouse_cursor.cpp
@@ -55,7 +55,7 @@ CMouseCursor::CursorEntry::~CursorEntry() {
CMouseCursor::CMouseCursor(CScreenManager *screenManager) :
_screenManager(screenManager), _cursorId(CURSOR_HOURGLASS), _hideCounter(0),
- _hiddenCount(0), _cursorSuppressed(false), _setCursorCount(0), _inputEnabled(true), _fieldE8(0) {
+ _busyCount(0), _cursorSuppressed(false), _setCursorCount(0), _inputEnabled(true), _fieldE8(0) {
loadCursorImages();
setCursor(CURSOR_ARROW);
CursorMan.showMouse(true);
@@ -87,45 +87,45 @@ void CMouseCursor::loadCursorImages() {
}
}
-void CMouseCursor::show() {
- assert(_hiddenCount > 0);
-
- if (--_hiddenCount == 0)
- CursorMan.showMouse(!_cursorSuppressed);
+void CMouseCursor::incBusyCount() {
+ if (_busyCount == 0)
+ setCursor(CURSOR_HOURGLASS);
+ ++_busyCount;
}
-void CMouseCursor::hide() {
- CursorMan.showMouse(false);
- ++_hiddenCount;
+void CMouseCursor::decBusyCount() {
+ assert(_busyCount > 0);
+ if (--_busyCount == 0)
+ setCursor(CURSOR_ARROW);
}
void CMouseCursor::incHideCounter() {
if (_hideCounter++ == 0)
- hide();
+ CursorMan.showMouse(false);
}
void CMouseCursor::decHideCounter() {
--_hideCounter;
assert(_hideCounter >= 0);
if (_hideCounter == 0)
- show();
+ CursorMan.showMouse(true);
}
void CMouseCursor::suppressCursor() {
_cursorSuppressed = true;
- hide();
+ CursorMan.showMouse(false);
}
void CMouseCursor::unsuppressCursor() {
_cursorSuppressed = false;
if (_hideCounter == 0)
- show();
+ CursorMan.showMouse(true);
}
void CMouseCursor::setCursor(CursorId cursorId) {
++_setCursorCount;
- if (cursorId != _cursorId) {
+ if (cursorId != _cursorId && _busyCount == 0) {
// The original cursors supported partial alpha when rendering the cursor.
// Since we're using the ScummVM CursorMan, we can't do that, so we need
// to build up a surface of the cursor with even partially transparent
@@ -192,14 +192,6 @@ void CMouseCursor::enableControl() {
CScreenManager::_screenManagerPtr->_inputHandler->decLockCount();
}
-void CMouseCursor::setBusy() {
- setCursor(CURSOR_HOURGLASS);
-}
-
-void CMouseCursor::clearBusy() {
- setCursor(CURSOR_ARROW);
-}
-
void CMouseCursor::setPosition(const Point &pt, double duration) {
_moveStartPos = g_vm->_events->getMousePos();
_moveDestPos = pt;
diff --git a/engines/titanic/support/mouse_cursor.h b/engines/titanic/support/mouse_cursor.h
index cd5e49fb90..325e31de96 100644
--- a/engines/titanic/support/mouse_cursor.h
+++ b/engines/titanic/support/mouse_cursor.h
@@ -67,7 +67,7 @@ private:
CursorEntry _cursors[NUM_CURSORS];
uint _setCursorCount;
int _hideCounter;
- int _hiddenCount;
+ int _busyCount;
bool _cursorSuppressed;
int _fieldE8;
Common::Point _moveStartPos;
@@ -85,14 +85,15 @@ public:
~CMouseCursor();
/**
- * Make the mouse cursor visible
+ * Increment the busy count for the cursor, showing an hourglass
*/
- void show();
+ void incBusyCount();
/**
- * Hide the mouse cursor
+ * Decrements the busy count, resetting back to an arrow cursor
+ * when the count reaches zero
*/
- void hide();
+ void decBusyCount();
/**
* Decrements the hide counter, and shows the mouse if
@@ -143,17 +144,6 @@ public:
void enableControl();
/**
- * Shows the busy cursor
- */
- void setBusy();
-
- /**
- * Resets the cursor back to normal
- */
- void clearBusy();
-
-
- /**
* Move the mouse to a new position
*/
void setPosition(const Point &pt, double duration);