aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision
diff options
context:
space:
mode:
authorFilippos Karapetis2014-12-30 12:55:19 +0200
committerFilippos Karapetis2014-12-30 12:55:52 +0200
commit88ba96aa3cb76c7d251a60f32d41f415a40b3dc4 (patch)
treea6edaa7f76aba417bd45013049a066f104b8f33d /engines/zvision
parentdf605069552d680e203b7e16f3bcd0fb31825c2c (diff)
downloadscummvm-rg350-88ba96aa3cb76c7d251a60f32d41f415a40b3dc4.tar.gz
scummvm-rg350-88ba96aa3cb76c7d251a60f32d41f415a40b3dc4.tar.bz2
scummvm-rg350-88ba96aa3cb76c7d251a60f32d41f415a40b3dc4.zip
ZVISION: Fix an off-by-one error in the RLF decoder
A regression from 7f61a09478. The current frame is the currently displayed frame, not the frame that should be displayed next. Thanks to clone2727 and Marisa-Chan for the explanation and fixes
Diffstat (limited to 'engines/zvision')
-rw-r--r--engines/zvision/video/rlf_decoder.cpp16
-rw-r--r--engines/zvision/video/rlf_decoder.h4
2 files changed, 10 insertions, 10 deletions
diff --git a/engines/zvision/video/rlf_decoder.cpp b/engines/zvision/video/rlf_decoder.cpp
index 6e2000f93c..db598a25b6 100644
--- a/engines/zvision/video/rlf_decoder.cpp
+++ b/engines/zvision/video/rlf_decoder.cpp
@@ -56,7 +56,7 @@ RLFDecoder::RLFVideoTrack::RLFVideoTrack(Common::SeekableReadStream *stream)
_height(0),
_frameTime(0),
_frames(0),
- _curFrame(-1),
+ _displayedFrame(-1),
_frameBufferByteSize(0) {
if (!readHeader()) {
@@ -161,11 +161,11 @@ bool RLFDecoder::RLFVideoTrack::seek(const Audio::Timestamp &time) {
uint frame = getFrameAtTime(time);
assert(frame < (int)_frameCount);
- if ((uint)_curFrame == frame)
+ if ((uint)_displayedFrame == frame)
return true;
- int closestFrame = _curFrame;
- int distance = (int)frame - _curFrame;
+ int closestFrame = _displayedFrame;
+ int distance = (int)frame - closestFrame;
if (distance < 0) {
for (uint i = 0; i < _completeFrames.size(); ++i) {
@@ -189,18 +189,18 @@ bool RLFDecoder::RLFVideoTrack::seek(const Audio::Timestamp &time) {
applyFrameToCurrent(i);
}
- _curFrame = frame;
+ _displayedFrame = frame - 1;
return true;
}
const Graphics::Surface *RLFDecoder::RLFVideoTrack::decodeNextFrame() {
- if (_curFrame == (int)_frameCount)
+ if (_displayedFrame >= (int)_frameCount)
return NULL;
- applyFrameToCurrent(_curFrame);
+ _displayedFrame++;
+ applyFrameToCurrent(_displayedFrame);
- _curFrame++;
return &_currentFrameBuffer;
}
diff --git a/engines/zvision/video/rlf_decoder.h b/engines/zvision/video/rlf_decoder.h
index 740f3fdd43..8b8cbaecd5 100644
--- a/engines/zvision/video/rlf_decoder.h
+++ b/engines/zvision/video/rlf_decoder.h
@@ -46,7 +46,7 @@ private:
uint16 getWidth() const { return _width; }
uint16 getHeight() const { return _height; }
Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); /* RGB 555 */ }
- int getCurFrame() const { return _curFrame; }
+ int getCurFrame() const { return _displayedFrame; }
int getFrameCount() const { return _frameCount; }
const Graphics::Surface *decodeNextFrame();
bool isSeekable() const { return true; }
@@ -121,7 +121,7 @@ private:
Frame *_frames;
Common::Array<uint> _completeFrames;
- int _curFrame;
+ int _displayedFrame;
Graphics::Surface _currentFrameBuffer;
uint32 _frameBufferByteSize;