diff options
author | RichieSams | 2013-09-07 18:04:42 -0500 |
---|---|---|
committer | RichieSams | 2013-09-07 18:04:42 -0500 |
commit | aea107071350a9566c1bd2a8362c2df937f29f67 (patch) | |
tree | c2c00217987352fb83113f837834329d872b52d5 /engines/zvision | |
parent | 47ee636f0503f39531371e3e611a4b6fb81906e0 (diff) | |
download | scummvm-rg350-aea107071350a9566c1bd2a8362c2df937f29f67.tar.gz scummvm-rg350-aea107071350a9566c1bd2a8362c2df937f29f67.tar.bz2 scummvm-rg350-aea107071350a9566c1bd2a8362c2df937f29f67.zip |
ZVISION: Allow RLF seeking without returning a frame
Diffstat (limited to 'engines/zvision')
-rw-r--r-- | engines/zvision/rlf_animation.cpp | 28 | ||||
-rw-r--r-- | engines/zvision/rlf_animation.h | 2 |
2 files changed, 22 insertions, 8 deletions
diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index ffc272c1c8..dfd3289f66 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -155,16 +155,13 @@ RlfAnimation::Frame RlfAnimation::readNextFrame() { return frame; } -const uint16 *RlfAnimation::getFrameData(uint frameNumber) { +void RlfAnimation::seekToFrame(int frameNumber) { assert(!_stream); - assert(frameNumber < _frameCount); + assert(frameNumber < _frameCount || frameNumber >= -1); - // Since this method is so expensive, first check to see if we can use - // getNextFrame() it's cheap. - if ((int)frameNumber == _currentFrame) { - return _currentFrameBuffer; - } else if (_currentFrame + 1 == (int)frameNumber) { - return getNextFrame(); + if (frameNumber == -1) { + _currentFrame = -1; + return; } int closestFrame = _currentFrame; @@ -182,6 +179,21 @@ const uint16 *RlfAnimation::getFrameData(uint frameNumber) { } _currentFrame = frameNumber; +} + +const uint16 *RlfAnimation::getFrameData(uint frameNumber) { + assert(!_stream); + assert(frameNumber < _frameCount); + + // Since this method is so expensive, first check to see if we can use + // getNextFrame() it's cheap. + if ((int)frameNumber == _currentFrame) { + return _currentFrameBuffer; + } else if (_currentFrame + 1 == (int)frameNumber) { + return getNextFrame(); + } + + seekToFrame(frameNumber); return _currentFrameBuffer; } diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h index 6f93934f1f..b7d2595295 100644 --- a/engines/zvision/rlf_animation.h +++ b/engines/zvision/rlf_animation.h @@ -77,6 +77,8 @@ public: uint height() { return _height; } uint32 frameTime() { return _frameTime; } + void seekToFrame(int frameNumber); + const uint16 *getFrameData(uint frameNumber); const uint16 *getNextFrame(); |