diff options
author | Paul Gilbert | 2014-08-28 21:36:48 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-08-28 21:36:48 -0400 |
commit | 729f03f42c88f2caaa6616e530cf4543a6cca536 (patch) | |
tree | 9ca92d42869c5d848d51b8b2f1e97ab6a46ef04c | |
parent | 1d8f23985aa8eaf718388ba3d6ccae5824a530aa (diff) | |
download | scummvm-rg350-729f03f42c88f2caaa6616e530cf4543a6cca536.tar.gz scummvm-rg350-729f03f42c88f2caaa6616e530cf4543a6cca536.tar.bz2 scummvm-rg350-729f03f42c88f2caaa6616e530cf4543a6cca536.zip |
ACCESS: Fixes for playVideo
-rw-r--r-- | engines/access/scripts.cpp | 1 | ||||
-rw-r--r-- | engines/access/video.cpp | 26 |
2 files changed, 19 insertions, 8 deletions
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp index 2d6fc5040b..f92a6d73a5 100644 --- a/engines/access/scripts.cpp +++ b/engines/access/scripts.cpp @@ -668,7 +668,6 @@ void Scripts::cmdSetVideoSound() { _data->seek(startPos); cmdSetVideo(); - _data->skip(2); _vm->_video->_soundFrame = _data->readUint16LE(); _vm->_video->_soundFlag = false; } diff --git a/engines/access/video.cpp b/engines/access/video.cpp index 8197b91923..4b9a875931 100644 --- a/engines/access/video.cpp +++ b/engines/access/video.cpp @@ -49,7 +49,7 @@ void VideoPlayer::setVideo(ASurface *vidSurface, const Common::Point &pt, FileId _videoData = _vm->_files->loadFile(videoFile); // Load in header - _frameCount = _videoData->_stream->readUint16LE(); + _header._frameCount = _videoData->_stream->readUint16LE(); _header._width = _videoData->_stream->readUint16LE(); _header._height = _videoData->_stream->readUint16LE(); _videoData->_stream->skip(1); @@ -105,19 +105,31 @@ void VideoPlayer::playVideo() { // Skip count number of pixels // Loop across lines if necessary - while ((pDest - pLine + count) >= _xCount) { + while (count >= (pLine + _xCount - pDest)) { + count -= (pLine + _xCount - pDest); pLine += _vidSurface->pitch; pDest = pLine; - count -= _xCount; } // Skip any remaining pixels in the new line pDest += count; } else { - // Readcount number of pixels - assert(count <= (pDest - pLine)); - _videoData->_stream->read(pDest, count); - pDest += count; + // Read count number of pixels + + // Load across lines if necessary + while (count >= (pLine + _xCount - pDest)) { + int lineCount = (pLine + _xCount - pDest); + _videoData->_stream->read(pDest, lineCount); + count -= lineCount; + pLine += _vidSurface->pitch; + pDest = pLine; + } + + // Load remainder of pixels on line + if (count > 0) { + _videoData->_stream->read(pDest, count); + pDest += count; + } } } |