[Scummvm-cvs-logs] scummvm master -> c8aa1450a250646e59b6bdb0c5c16be86b854f0b

dreammaster dreammaster at scummvm.org
Sat Aug 29 03:18:27 CEST 2015


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:
c8aa1450a2 SHERLOCK: RT: Enforce wait cursor when pausing without control in scripts


Commit: c8aa1450a250646e59b6bdb0c5c16be86b854f0b
    https://github.com/scummvm/scummvm/commit/c8aa1450a250646e59b6bdb0c5c16be86b854f0b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-08-28T21:16:41-04:00

Commit Message:
SHERLOCK: RT: Enforce wait cursor when pausing without control in scripts

Changed paths:
    engines/sherlock/events.cpp
    engines/sherlock/events.h
    engines/sherlock/talk.cpp



diff --git a/engines/sherlock/events.cpp b/engines/sherlock/events.cpp
index 758ba12..77833f8 100644
--- a/engines/sherlock/events.cpp
+++ b/engines/sherlock/events.cpp
@@ -43,6 +43,7 @@ Events::Events(SherlockEngine *vm): _vm(vm) {
 	_rightPressed = _rightReleased = false;
 	_oldButtons = _oldRightButton = false;
 	_firstPress = false;
+	_waitCounter = 0;
 
 	if (_vm->_interactiveFl)
 		loadCursors("rmouse.vgs");
@@ -67,7 +68,7 @@ void Events::loadCursors(const Common::String &filename) {
 }
 
 void Events::setCursor(CursorId cursorId) {
-	if (cursorId == _cursorId)
+	if (cursorId == _cursorId || _waitCounter > 0)
 		return;
 
 	int hotspotX, hotspotY;
@@ -361,4 +362,14 @@ bool Events::checkInput() {
 	return kbHit() || _pressed || _released || _rightPressed || _rightReleased;
 }
 
+void Events::incWaitCounter() {
+	setCursor(WAIT);
+	++_waitCounter;		
+}
+
+void Events::decWaitCounter() {
+	assert(_waitCounter > 0);
+	--_waitCounter;
+}
+
 } // End of namespace Sherlock
diff --git a/engines/sherlock/events.h b/engines/sherlock/events.h
index 59d145b..a44f083 100644
--- a/engines/sherlock/events.h
+++ b/engines/sherlock/events.h
@@ -45,6 +45,7 @@ private:
 	ImageFile *_cursorImages;
 	int _mouseButtons;
 	Common::Point _mousePos;
+	int _waitCounter;
 
 	/**
 	 * Check whether it's time to display the next screen frame
@@ -188,6 +189,16 @@ public:
 	 * Checks to see to see if a key or a mouse button is pressed.
 	 */
 	bool checkInput();
+
+	/**
+	 * Increment the wait counter
+	 */
+	void incWaitCounter();
+
+	/**
+	 * Decrement the wait counter
+	 */
+	void decWaitCounter();
 };
 
 } // End of namespace Sherlock
diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp
index b31a273..a5c5bc8 100644
--- a/engines/sherlock/talk.cpp
+++ b/engines/sherlock/talk.cpp
@@ -1048,6 +1048,8 @@ OpcodeReturn Talk::cmdPauseWithoutControl(const byte *&str) {
 	Scene &scene = *_vm->_scene;
 	++str;
 
+	events.incWaitCounter();
+
 	for (int idx = 0; idx < (str[0] - 1); ++idx) {
 		scene.doBgAnim();
 		if (_talkToAbort)
@@ -1058,6 +1060,8 @@ OpcodeReturn Talk::cmdPauseWithoutControl(const byte *&str) {
 		events.setButtonState();
 	}
 
+	events.decWaitCounter();
+
 	_endStr = false;
 	return RET_SUCCESS;
 }






More information about the Scummvm-git-logs mailing list