diff options
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(); |