diff options
author | Colin Snover | 2017-07-22 16:08:44 -0500 |
---|---|---|
committer | Colin Snover | 2017-07-23 10:35:13 -0500 |
commit | 2ed18b86db51caacd123b5e95f4672685dc49799 (patch) | |
tree | 551f9120e241dd5a2c8242279ba784d65e4174c4 /engines/sci | |
parent | 0beb259278dfd18757bf9484a6123edf4b44864e (diff) | |
download | scummvm-rg350-2ed18b86db51caacd123b5e95f4672685dc49799.tar.gz scummvm-rg350-2ed18b86db51caacd123b5e95f4672685dc49799.tar.bz2 scummvm-rg350-2ed18b86db51caacd123b5e95f4672685dc49799.zip |
SCI32: Check for stop events before rendering the next frame
This should make things slightly more responsive and avoids
unnecessary rendering of frames that are just going to disappear
in a moment.
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/graphics/video32.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp index e0f83c6e82..07e5f3b27f 100644 --- a/engines/sci/graphics/video32.cpp +++ b/engines/sci/graphics/video32.cpp @@ -121,11 +121,13 @@ VideoPlayer::EventFlags VideoPlayer::playUntilEvent(const EventFlags flags, cons // keeps events queued from before the start of playback from accidentally // activating a video stop flag _eventMan->flushEvents(); + _decoder->start(); EventFlags stopFlag = kEventFlagNone; for (;;) { g_sci->sleep(MIN(_decoder->getTimeToNextFrame(), maxSleepMs)); + const Graphics::Surface *nextFrame = nullptr; // If a decoder needs more than one update per loop, this means we are // running behind and should skip rendering these frames (but must still @@ -143,10 +145,19 @@ VideoPlayer::EventFlags VideoPlayer::playUntilEvent(const EventFlags flags, cons renderFrame(*nextFrame); } + // Event checks must only happen *after* the decoder is updated (1) and + // frame rendered (2), otherwise (1) interval yields will get stuck + // forever on the current frame, and (2) other events will end up + // dropping the new frame entirely stopFlag = checkForEvent(flags); if (stopFlag != kEventFlagNone) { break; } + + // Only call to update the screen after the event check, otherwise + // whatever the game scripts try to change when the player yields to + // them will not make it into the hardware buffer until the next tick + g_sci->_gfxFrameout->updateScreen(); } return stopFlag; |