From c8aa1450a250646e59b6bdb0c5c16be86b854f0b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 28 Aug 2015 21:16:41 -0400 Subject: SHERLOCK: RT: Enforce wait cursor when pausing without control in scripts --- engines/sherlock/events.cpp | 13 ++++++++++++- engines/sherlock/events.h | 11 +++++++++++ engines/sherlock/talk.cpp | 4 ++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/engines/sherlock/events.cpp b/engines/sherlock/events.cpp index 758ba12b6a..77833f8b3f 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 59d145bada..a44f08375b 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 b31a273a88..a5c5bc8944 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; } -- cgit v1.2.3