aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Bouclet2016-12-10 17:32:05 +0100
committerBastien Bouclet2016-12-10 17:34:24 +0100
commitfd794bd4a307478be8f6014d742d4e841121c404 (patch)
tree2e967aee897d9fbef02ee6e4528fd4e5438c6149
parent5f26c445c9661fa723ddbec23892d07beea0c89c (diff)
downloadscummvm-rg350-fd794bd4a307478be8f6014d742d4e841121c404.tar.gz
scummvm-rg350-fd794bd4a307478be8f6014d742d4e841121c404.tar.bz2
scummvm-rg350-fd794bd4a307478be8f6014d742d4e841121c404.zip
MOHAWK: Poll the events while drawing Myst transitions
Fixes #9594, the mouse cursor was hanging while transitions were drawn.
-rw-r--r--engines/mohawk/myst.cpp19
-rw-r--r--engines/mohawk/myst.h1
-rw-r--r--engines/mohawk/myst_graphics.cpp11
3 files changed, 31 insertions, 0 deletions
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 6b91e74bb2..e887436e98 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -401,6 +401,25 @@ bool MohawkEngine_Myst::skippableWait(uint32 duration) {
return skipped;
}
+void MohawkEngine_Myst::pollAndDiscardEvents() {
+ // Poll the events to update the mouse cursor position
+ Common::Event event;
+ while (_system->getEventManager()->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_KEYDOWN:
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_SPACE:
+ pauseGame();
+ break;
+ default:
+ break;
+ }
+ default:
+ break;
+ }
+ }
+}
+
void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcSound, uint16 linkDstSound) {
debug(2, "changeToStack(%d)", stack);
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index 0491e853b6..2414b71cb1 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -187,6 +187,7 @@ public:
uint16 getMainCursor() { return _mainCursor; }
void checkCursorHints();
MystArea *updateCurrentResource();
+ void pollAndDiscardEvents();
bool skippableWait(uint32 duration);
MystSoundBlock readSoundBlock(Common::ReadStream *stream) const;
diff --git a/engines/mohawk/myst_graphics.cpp b/engines/mohawk/myst_graphics.cpp
index 427fba4d22..333da402fa 100644
--- a/engines/mohawk/myst_graphics.cpp
+++ b/engines/mohawk/myst_graphics.cpp
@@ -243,6 +243,7 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
area.right = area.left + step;
_vm->_system->delayMillis(delay);
+ _vm->pollAndDiscardEvents();
copyBackBufferToScreen(area);
_vm->_system->updateScreen();
@@ -266,6 +267,7 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
area.left = area.right - step;
_vm->_system->delayMillis(delay);
+ _vm->pollAndDiscardEvents();
copyBackBufferToScreen(area);
_vm->_system->updateScreen();
@@ -309,6 +311,7 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
area.bottom = area.top + step;
_vm->_system->delayMillis(delay);
+ _vm->pollAndDiscardEvents();
copyBackBufferToScreen(area);
_vm->_system->updateScreen();
@@ -332,6 +335,7 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
area.top = area.bottom - step;
_vm->_system->delayMillis(delay);
+ _vm->pollAndDiscardEvents();
copyBackBufferToScreen(area);
_vm->_system->updateScreen();
@@ -456,6 +460,7 @@ void MystGraphics::transitionDissolve(Common::Rect rect, uint step) {
}
_vm->_system->unlockScreen();
+ _vm->pollAndDiscardEvents();
_vm->_system->updateScreen();
}
@@ -475,6 +480,7 @@ void MystGraphics::transitionSlideToLeft(Common::Rect rect, uint16 steps, uint16
simulatePreviousDrawDelay(dstRect);
_vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top),
_backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height());
+ _vm->pollAndDiscardEvents();
_vm->_system->updateScreen();
}
@@ -500,6 +506,7 @@ void MystGraphics::transitionSlideToRight(Common::Rect rect, uint16 steps, uint1
simulatePreviousDrawDelay(dstRect);
_vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top),
_backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height());
+ _vm->pollAndDiscardEvents();
_vm->_system->updateScreen();
}
@@ -525,6 +532,7 @@ void MystGraphics::transitionSlideToTop(Common::Rect rect, uint16 steps, uint16
simulatePreviousDrawDelay(dstRect);
_vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top),
_backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height());
+ _vm->pollAndDiscardEvents();
_vm->_system->updateScreen();
}
@@ -551,6 +559,7 @@ void MystGraphics::transitionSlideToBottom(Common::Rect rect, uint16 steps, uint
simulatePreviousDrawDelay(dstRect);
_vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top),
_backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height());
+ _vm->pollAndDiscardEvents();
_vm->_system->updateScreen();
}
@@ -575,6 +584,7 @@ void MystGraphics::transitionPartialToRight(Common::Rect rect, uint32 width, uin
simulatePreviousDrawDelay(dstRect);
_vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top),
_backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height());
+ _vm->pollAndDiscardEvents();
_vm->_system->updateScreen();
}
@@ -596,6 +606,7 @@ void MystGraphics::transitionPartialToLeft(Common::Rect rect, uint32 width, uint
simulatePreviousDrawDelay(dstRect);
_vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top),
_backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height());
+ _vm->pollAndDiscardEvents();
_vm->_system->updateScreen();
}