diff options
-rw-r--r-- | engines/sci/event.cpp | 7 | ||||
-rw-r--r-- | engines/sci/event.h | 1 | ||||
-rw-r--r-- | engines/sci/graphics/video32.cpp | 17 |
3 files changed, 12 insertions, 13 deletions
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp index 873b6bb48a..b1be46aded 100644 --- a/engines/sci/event.cpp +++ b/engines/sci/event.cpp @@ -408,6 +408,13 @@ SciEvent EventManager::getSciEvent(uint32 mask) { return event; } +void EventManager::flushEvents() { + Common::EventManager *em = g_system->getEventManager(); + Common::Event event; + while (em->pollEvent(event)); + _events.clear(); +} + #ifdef ENABLE_SCI32 void EventManager::setHotRectanglesActive(const bool active) { _hotRectanglesActive = active; diff --git a/engines/sci/event.h b/engines/sci/event.h index b06d2ae429..614a5a64e7 100644 --- a/engines/sci/event.h +++ b/engines/sci/event.h @@ -138,6 +138,7 @@ public: void updateScreen(); SciEvent getSciEvent(uint32 mask); + void flushEvents(); private: SciEvent getScummVMEvent(); diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp index 22be48c0f8..e0f83c6e82 100644 --- a/engines/sci/graphics/video32.cpp +++ b/engines/sci/graphics/video32.cpp @@ -56,18 +56,6 @@ namespace Graphics { struct Surface; } namespace Sci { -static void flushEvents(EventManager *eventMan) { - // Flushing all the keyboard and mouse events out of the event manager - // keeps events queued from before the start of playback from accidentally - // activating a video stop flag - for (;;) { - const SciEvent event = eventMan->getSciEvent(SCI_EVENT_ANY & ~SCI_EVENT_QUIT); - if (event.type == SCI_EVENT_NONE) { - break; - } - } -} - bool VideoPlayer::open(const Common::String &fileName) { if (!_decoder->loadFile(fileName)) { warning("Failed to load %s", fileName.c_str()); @@ -129,7 +117,10 @@ bool VideoPlayer::endHQVideo() { } VideoPlayer::EventFlags VideoPlayer::playUntilEvent(const EventFlags flags, const uint32 maxSleepMs) { - flushEvents(_eventMan); + // Flushing all the keyboard and mouse events out of the event manager + // keeps events queued from before the start of playback from accidentally + // activating a video stop flag + _eventMan->flushEvents(); _decoder->start(); EventFlags stopFlag = kEventFlagNone; |