diff options
author | Colin Snover | 2016-11-04 15:12:59 -0500 |
---|---|---|
committer | Colin Snover | 2016-11-04 15:16:10 -0500 |
commit | fda89a9f5997081f4ccb59cb052a81b3f9452d80 (patch) | |
tree | 0f375250ba220ffc2004b846bac0421c8131e965 /engines | |
parent | 5a5945cbbb37fb63f8bc592a30d91bad311bd554 (diff) | |
download | scummvm-rg350-fda89a9f5997081f4ccb59cb052a81b3f9452d80.tar.gz scummvm-rg350-fda89a9f5997081f4ccb59cb052a81b3f9452d80.tar.bz2 scummvm-rg350-fda89a9f5997081f4ccb59cb052a81b3f9452d80.zip |
SCI32: Fix VMD playback stuttering when kEventFlagToFrame is used
For example, Shivers room 932 when subtitles are enabled.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/graphics/video32.cpp | 14 | ||||
-rw-r--r-- | engines/sci/graphics/video32.h | 6 |
2 files changed, 16 insertions, 4 deletions
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp index 5f3a7a38a0..e44c159c1d 100644 --- a/engines/sci/graphics/video32.cpp +++ b/engines/sci/graphics/video32.cpp @@ -487,6 +487,7 @@ VMDPlayer::VMDPlayer(SegManager *segMan, EventManager *eventMan) : _isOpen(false), _isInitialized(false), + _yieldFrame(0), _yieldInterval(0), _lastYieldedFrameNo(0), @@ -612,12 +613,12 @@ VMDPlayer::VMDStatus VMDPlayer::getStatus() const { VMDPlayer::EventFlags VMDPlayer::kernelPlayUntilEvent(const EventFlags flags, const int16 lastFrameNo, const int16 yieldInterval) { assert(lastFrameNo >= -1); - const int32 maxFrameNo = (int32)(_decoder->getFrameCount() - 1); + const int32 maxFrameNo = _decoder->getFrameCount() - 1; - if ((flags & kEventFlagToFrame) && lastFrameNo > 0) { - _decoder->setEndFrame(MIN<int32>(lastFrameNo, maxFrameNo)); + if (flags & kEventFlagToFrame) { + _yieldFrame = MIN<int32>(lastFrameNo, maxFrameNo); } else { - _decoder->setEndFrame(maxFrameNo); + _yieldFrame = maxFrameNo; } if (flags & kEventFlagYieldToVM) { @@ -755,6 +756,11 @@ VMDPlayer::EventFlags VMDPlayer::playUntilEvent(const EventFlags flags) { const int currentFrameNo = _decoder->getCurFrame(); + if (currentFrameNo == _yieldFrame) { + stopFlag = kEventFlagEnd; + break; + } + if (_yieldInterval > 0 && currentFrameNo != _lastYieldedFrameNo && (currentFrameNo % _yieldInterval) == 0 diff --git a/engines/sci/graphics/video32.h b/engines/sci/graphics/video32.h index 75b8fb2d21..c3ae891c2e 100644 --- a/engines/sci/graphics/video32.h +++ b/engines/sci/graphics/video32.h @@ -326,6 +326,12 @@ private: bool _isInitialized; /** + * For VMDs played with the `kEventFlagToFrame` flag, + * the target frame for yielding back to the SCI VM. + */ + int32 _yieldFrame; + + /** * For VMDs played with the `kEventFlagYieldToVM` flag, * the number of frames that should be rendered until * yielding back to the SCI VM. |