diff options
author | Paul Gilbert | 2015-08-28 21:16:41 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-08-28 21:16:41 -0400 |
commit | c8aa1450a250646e59b6bdb0c5c16be86b854f0b (patch) | |
tree | 79aff40d343257dbabcc6a7e650f8a23d45d7143 | |
parent | 31235218ea5d0bfb2f6f620253024bdeb93e2130 (diff) | |
download | scummvm-rg350-c8aa1450a250646e59b6bdb0c5c16be86b854f0b.tar.gz scummvm-rg350-c8aa1450a250646e59b6bdb0c5c16be86b854f0b.tar.bz2 scummvm-rg350-c8aa1450a250646e59b6bdb0c5c16be86b854f0b.zip |
SHERLOCK: RT: Enforce wait cursor when pausing without control in scripts
-rw-r--r-- | engines/sherlock/events.cpp | 13 | ||||
-rw-r--r-- | engines/sherlock/events.h | 11 | ||||
-rw-r--r-- | engines/sherlock/talk.cpp | 4 |
3 files changed, 27 insertions, 1 deletions
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; } |