diff options
author | James Brown | 2004-01-18 05:52:04 +0000 |
---|---|---|
committer | James Brown | 2004-01-18 05:52:04 +0000 |
commit | ad46828d1c8fb68c3c44c5c38c5ac9b2031a2fc9 (patch) | |
tree | 4253ac14e5934508d7a455cafdf1fec88d0af866 /sword2 | |
parent | a95818d29a706095517ada079f316ad74f20a86d (diff) | |
download | scummvm-rg350-ad46828d1c8fb68c3c44c5c38c5ac9b2031a2fc9.tar.gz scummvm-rg350-ad46828d1c8fb68c3c44c5c38c5ac9b2031a2fc9.tar.bz2 scummvm-rg350-ad46828d1c8fb68c3c44c5c38c5ac9b2031a2fc9.zip |
BS1 cutscene support. Also bugfixes (don't crash if cutscene ogg unavailable)
svn-id: r12465
Diffstat (limited to 'sword2')
-rw-r--r-- | sword2/driver/animation.cpp | 28 | ||||
-rw-r--r-- | sword2/driver/animation.h | 1 |
2 files changed, 22 insertions, 7 deletions
diff --git a/sword2/driver/animation.cpp b/sword2/driver/animation.cpp index 5d37f3fdbf..d36db9275a 100644 --- a/sword2/driver/animation.cpp +++ b/sword2/driver/animation.cpp @@ -132,6 +132,7 @@ bool AnimationState::init(const char *name) { info = mpeg2_info(decoder); framenum = 0; + ticks = _vm->_system->get_msecs(); /* Play audio - TODO: Sync with video?*/ @@ -316,12 +317,18 @@ bool AnimationState::decodeFrame() { */ #ifdef BACKEND_8BIT - if (checkPaletteSwitch() || - (bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < (framenum+3)){ + if (checkPaletteSwitch() || (bgSoundStream == NULL) || + (bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < (framenum+3)){ + _vm->_graphics->plotYUV(lut, sequence_i->width, sequence_i->height, info->display_fbuf->buf); - while ((bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < framenum+1); - _vm->_system->delay_msecs(10); + if (bgSoundStream) { + while ((bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < framenum+1); + _vm->_system->delay_msecs(10); + } else { + ticks += 83; + _vm->sleepUntil(ticks); + } _vm->_graphics->setNeedFullRedraw(); @@ -332,11 +339,18 @@ bool AnimationState::decodeFrame() { #else - if ((bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < (framenum+3)){ + if ((bgSoundStream == NULL) || + (bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < (framenum+3)){ + plotYUV(lookup2, sequence_i->width, sequence_i->height, info->display_fbuf->buf); - while ((bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < framenum+1); - _vm->_system->delay_msecs(10); + if (bgSoundStream) { + while ((bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < framenum+1); + _vm->_system->delay_msecs(10); + } else { + ticks += 83; + _vm->sleepUntil(ticks); + } } else printf("dropped frame %i\n", framenum); diff --git a/sword2/driver/animation.h b/sword2/driver/animation.h index cc2b896f11..a30585b1b8 100644 --- a/sword2/driver/animation.h +++ b/sword2/driver/animation.h @@ -70,6 +70,7 @@ private: Sword2Engine *_vm; int framenum; + int ticks; #ifdef USE_MPEG2 mpeg2dec_t *decoder; |