From c7fa1074fbc55e9e519f9c7e08dea9603af22e61 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 17 May 2010 21:59:05 +0000 Subject: Change VideoDecoder::getCurFrame() to mean the last frame drawn instead of the next frame to draw. This is patch 1 from patch #2963496 (VideoDecoder Rewrite). svn-id: r49063 --- engines/sci/video/seq_decoder.cpp | 6 ++++-- engines/sci/video/vmd_decoder.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'engines/sci/video') diff --git a/engines/sci/video/seq_decoder.cpp b/engines/sci/video/seq_decoder.cpp index ef2622704d..ccce873a15 100644 --- a/engines/sci/video/seq_decoder.cpp +++ b/engines/sci/video/seq_decoder.cpp @@ -61,7 +61,7 @@ bool SeqDecoder::loadFile(const char *fileName, int frameDelay) { return false; // Seek to the first frame - _videoInfo.currentFrame = 0; + _videoInfo.currentFrame = -1; _videoInfo.width = SCREEN_WIDTH; _videoInfo.height = SCREEN_HEIGHT; @@ -129,6 +129,8 @@ bool SeqDecoder::decodeNextFrame() { _fileStream->seek(offset); + _videoInfo.currentFrame++; + if (_videoInfo.currentFrame == 0) _videoInfo.startTime = g_system->getMillis(); @@ -151,7 +153,7 @@ bool SeqDecoder::decodeNextFrame() { delete[] buf; } - return ++_videoInfo.currentFrame < _videoInfo.frameCount; + return !endOfVideo(); } #define WRITE_TO_BUFFER(n) \ diff --git a/engines/sci/video/vmd_decoder.cpp b/engines/sci/video/vmd_decoder.cpp index 4e56e51054..9e95521ebb 100644 --- a/engines/sci/video/vmd_decoder.cpp +++ b/engines/sci/video/vmd_decoder.cpp @@ -75,7 +75,7 @@ bool VMDDecoder::loadFile(const char *fileName) { _videoInfo.frameCount = _vmdDecoder->getFramesCount(); _videoInfo.frameRate = _vmdDecoder->getFrameRate(); _videoInfo.frameDelay = _videoInfo.frameRate * 100; - _videoInfo.currentFrame = 0; + _videoInfo.currentFrame = -1; _videoInfo.firstframeOffset = 0; // not really necessary for VMDs if (_vmdDecoder->hasExtraData()) @@ -103,6 +103,8 @@ void VMDDecoder::closeFile() { } bool VMDDecoder::decodeNextFrame() { + _videoInfo.currentFrame++; + if (_videoInfo.currentFrame == 0) _videoInfo.startTime = g_system->getMillis(); @@ -113,7 +115,7 @@ bool VMDDecoder::decodeNextFrame() { setPalette(_palette); } - return ++_videoInfo.currentFrame < _videoInfo.frameCount; + return !endOfVideo(); } void VMDDecoder::getPalette() { -- cgit v1.2.3