diff options
author | Matthew Hoops | 2010-07-30 20:35:09 +0000 |
---|---|---|
committer | Matthew Hoops | 2010-07-30 20:35:09 +0000 |
commit | 8e705bb2e26f0900416e5649b869ee43706eeee5 (patch) | |
tree | 5f2926f5e3c2f90c5cf999606d941219090c20d0 /graphics | |
parent | 75b5ac38fbd2c75fab5d0f794a44ec906ee48c05 (diff) | |
download | scummvm-rg350-8e705bb2e26f0900416e5649b869ee43706eeee5.tar.gz scummvm-rg350-8e705bb2e26f0900416e5649b869ee43706eeee5.tar.bz2 scummvm-rg350-8e705bb2e26f0900416e5649b869ee43706eeee5.zip |
VIDEO: Fix FLIC looping
Thanks to salty-horse for finding this. Also, use Common::Rational directly to hold the frame rate to avoid rounding.
svn-id: r51516
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/video/flic_decoder.cpp | 15 | ||||
-rw-r--r-- | graphics/video/flic_decoder.h | 2 |
2 files changed, 8 insertions, 9 deletions
diff --git a/graphics/video/flic_decoder.cpp b/graphics/video/flic_decoder.cpp index b07e369cd8..524e157269 100644 --- a/graphics/video/flic_decoder.cpp +++ b/graphics/video/flic_decoder.cpp @@ -71,9 +71,8 @@ bool FlicDecoder::load(Common::SeekableReadStream &stream) { _fileStream->readUint16LE(); // flags // Note: The normal delay is a 32-bit integer (dword), whereas the overriden delay is a 16-bit integer (word) - // frameDelay is the FLIC "speed", in milliseconds. Our frameDelay is calculated in 1/100 ms, so we convert it here - uint32 frameDelay = 100 * _fileStream->readUint32LE(); - _frameRate = 100 * 1000 / frameDelay; + // the frame delay is the FLIC "speed", in milliseconds. + _frameRate = Common::Rational(1000, _fileStream->readUint32LE()); _fileStream->seek(80); _offsetFrame1 = _fileStream->readUint32LE(); @@ -209,10 +208,10 @@ Surface *FlicDecoder::decodeNextFrame() { chunkCount = _fileStream->readUint16LE(); // Note: The overriden delay is a 16-bit integer (word), whereas the normal delay is a 32-bit integer (dword) - // frameDelay is the FLIC "speed", in milliseconds. Our frameDelay is calculated in 1/100 ms, so we convert it here + // the frame delay is the FLIC "speed", in milliseconds. uint16 newFrameDelay = _fileStream->readUint16LE(); // "speed", in milliseconds if (newFrameDelay > 0) - _frameRate = 1000 / newFrameDelay; + _frameRate = Common::Rational(1000, newFrameDelay); _fileStream->readUint16LE(); // reserved, always 0 uint16 newWidth = _fileStream->readUint16LE(); @@ -268,15 +267,15 @@ Surface *FlicDecoder::decodeNextFrame() { _curFrame++; - if (_curFrame == 0) - _startTime = g_system->getMillis(); - // If we just processed the ring frame, set the next frame if (_curFrame == (int32)_frameCount) { _curFrame = 0; _fileStream->seek(_offsetFrame2); } + if (_curFrame == 0) + _startTime = g_system->getMillis(); + return _surface; } diff --git a/graphics/video/flic_decoder.h b/graphics/video/flic_decoder.h index 60d68889a2..60f4e3472c 100644 --- a/graphics/video/flic_decoder.h +++ b/graphics/video/flic_decoder.h @@ -91,7 +91,7 @@ private: Common::SeekableReadStream *_fileStream; Surface *_surface; uint32 _frameCount; - uint32 _frameRate; + Common::Rational _frameRate; Common::List<Common::Rect> _dirtyRects; }; |