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/agos/animation.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'engines/agos/animation.cpp') diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp index 8155bfb8d9..eccb51c732 100644 --- a/engines/agos/animation.cpp +++ b/engines/agos/animation.cpp @@ -272,7 +272,7 @@ void MoviePlayerDXA::playVideo() { _vm->clearSurfaces(); } - while (getCurFrame() < getFrameCount() && !_skipMovie && !_vm->shouldQuit()) + while (!endOfVideo() && !_skipMovie && !_vm->shouldQuit()) handleNextFrame(); } @@ -318,18 +318,18 @@ void MoviePlayerDXA::startSound() { } void MoviePlayerDXA::nextFrame() { - if (_bgSoundStream && _vm->_mixer->isSoundHandleActive(_bgSound) && (_vm->_mixer->getSoundElapsedTime(_bgSound) * getFrameRate()) / 1000 < (uint32)getCurFrame()) { + if (_bgSoundStream && _vm->_mixer->isSoundHandleActive(_bgSound) && (_vm->_mixer->getSoundElapsedTime(_bgSound) * getFrameRate()) / 1000 <= (uint32)getCurFrame()) { copyFrameToBuffer(_vm->getBackBuf(), 465, 222, _vm->_screenWidth); return; } - if (_vm->_interactiveVideo == TYPE_LOOPING && getCurFrame() == getFrameCount()) { + if (_vm->_interactiveVideo == TYPE_LOOPING && endOfVideo()) { _fileStream->seek(_videoInfo.firstframeOffset); - _videoInfo.currentFrame = 0; + _videoInfo.currentFrame = -1; startSound(); } - if (getCurFrame() < getFrameCount()) { + if (!endOfVideo()) { decodeNextFrame(); if (_vm->_interactiveVideo == TYPE_OMNITV) { copyFrameToBuffer(_vm->getBackBuf(), 465, 222, _vm->_screenWidth); @@ -370,10 +370,10 @@ bool MoviePlayerDXA::processFrame() { copyFrameToBuffer((byte *)screen->pixels, (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, _vm->_screenWidth); _vm->_system->unlockScreen(); - if ((_bgSoundStream == NULL) || ((int)(_mixer->getSoundElapsedTime(_bgSound) * getFrameRate()) / 1000 < getCurFrame() + 1)) { + if ((_bgSoundStream == NULL) || ((int)(_mixer->getSoundElapsedTime(_bgSound) * getFrameRate()) / 1000 <= getCurFrame())) { if (_bgSoundStream && _mixer->isSoundHandleActive(_bgSound)) { - while (_mixer->isSoundHandleActive(_bgSound) && (_mixer->getSoundElapsedTime(_bgSound) * getFrameRate()) / 1000 < (uint32)getCurFrame()) { + while (_mixer->isSoundHandleActive(_bgSound) && (_mixer->getSoundElapsedTime(_bgSound) * getFrameRate()) / 1000 <= (uint32)getCurFrame()) { _vm->_system->delayMillis(10); } // In case the background sound ends prematurely, update @@ -421,7 +421,7 @@ bool MoviePlayerSMK::load() { } void MoviePlayerSMK::playVideo() { - while (getCurFrame() < getFrameCount() && !_skipMovie && !_vm->shouldQuit()) + while (!endOfVideo() && !_skipMovie && !_vm->shouldQuit()) handleNextFrame(); } @@ -440,12 +440,12 @@ void MoviePlayerSMK::handleNextFrame() { } void MoviePlayerSMK::nextFrame() { - if (_vm->_interactiveVideo == TYPE_LOOPING && getCurFrame() == getFrameCount()) { + if (_vm->_interactiveVideo == TYPE_LOOPING && endOfVideo()) { _fileStream->seek(_videoInfo.firstframeOffset); - _videoInfo.currentFrame = 0; + _videoInfo.currentFrame = -1; } - if (getCurFrame() < getFrameCount()) { + if (!endOfVideo()) { decodeNextFrame(); if (_vm->_interactiveVideo == TYPE_OMNITV) { copyFrameToBuffer(_vm->getBackBuf(), 465, 222, _vm->_screenWidth); -- cgit v1.2.3