[Scummvm-git-logs] scummvm master -> 7c2265659aa69aed7aceecc76d660bef3d830b99

dreammaster dreammaster at scummvm.org
Sun Jan 22 03:16:49 CET 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7c2265659a TITANIC: Fix display of busy cursor across entire TV throw cutscene


Commit: 7c2265659aa69aed7aceecc76d660bef3d830b99
    https://github.com/scummvm/scummvm/commit/7c2265659aa69aed7aceecc76d660bef3d830b99
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-01-21T21:16:39-05:00

Commit Message:
TITANIC: Fix display of busy cursor across entire TV throw cutscene

Changed paths:
    engines/titanic/core/game_object.cpp
    engines/titanic/game_state.cpp
    engines/titanic/support/mouse_cursor.cpp
    engines/titanic/support/mouse_cursor.h


diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index bcdf77b..beee255 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 49779ad..964d6e6 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 86623da..eb58296 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 cd5e49f..325e31d 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);





More information about the Scummvm-git-logs mailing list