diff options
author | Sven Hesse | 2011-01-20 18:17:39 +0000 |
---|---|---|
committer | Sven Hesse | 2011-01-20 18:17:39 +0000 |
commit | bb6c230587c65c92e1719809977e4625322dd2cb (patch) | |
tree | 7996d697e65930248da1113274b2abad2c87f222 | |
parent | 03415868b07cedd956185c5f5a56ff2daf09c735 (diff) | |
download | scummvm-rg350-bb6c230587c65c92e1719809977e4625322dd2cb.tar.gz scummvm-rg350-bb6c230587c65c92e1719809977e4625322dd2cb.tar.bz2 scummvm-rg350-bb6c230587c65c92e1719809977e4625322dd2cb.zip |
GOB: Implement looping live videos
Needed for the buttons in the Playtoons series
svn-id: r55359
-rw-r--r-- | engines/gob/inter_v6.cpp | 4 | ||||
-rw-r--r-- | engines/gob/videoplayer.cpp | 17 | ||||
-rw-r--r-- | engines/gob/videoplayer.h | 1 | ||||
-rw-r--r-- | graphics/video/coktel_decoder.cpp | 1 |
4 files changed, 16 insertions, 7 deletions
diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index 17008ce0d2..8916ee246a 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -153,8 +153,10 @@ void Inter_v6::o6_playVmdOrMusic() { } else if (props.lastFrame <= -10) { _vm->_vidPlayer->closeVideo(); - if (props.lastFrame <= -100) + if (props.lastFrame <= -100) { + props.loop = true; props.lastFrame += 100; + } if (((-props.lastFrame) % 10 == 3) && (props.lastFrame <= -20)) _vm->_sound->bgPlay(fileName, SOUND_WAV); diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index 6151bafa35..4c1f724609 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -40,7 +40,7 @@ VideoPlayer::Properties::Properties() : type(kVideoTypeTry), sprite(Draw::kFront x(-1), y(-1), width(-1), height(-1), flags(kFlagFrontSurface), switchColorMode(false), startFrame(-1), lastFrame(-1), endFrame(-1), forceSeek(false), breakKey(kShortKeyEscape), palCmd(8), palStart(0), palEnd(255), palFrame(-1), - fade(false), waitEndFrame(true), canceled(false) { + loop(false), fade(false), waitEndFrame(true), canceled(false) { } @@ -313,11 +313,16 @@ void VideoPlayer::updateLive(bool force) { if (_liveProperties.startFrame >= (int32)(video->decoder->getFrameCount() - 1)) { // Video ended - WRITE_VAR_OFFSET(212, (uint32)-1); - if (video->surface == _vm->_draw->_frontSurface) - _vm->_draw->forceBlit(true); - _vm->_vidPlayer->closeVideo(); - return; + if (!_liveProperties.loop) { + WRITE_VAR_OFFSET(212, (uint32)-1); + if (video->surface == _vm->_draw->_frontSurface) + _vm->_draw->forceBlit(true); + _vm->_vidPlayer->closeVideo(); + return; + } else { + video->decoder->seek(0, SEEK_SET, true); + _liveProperties.startFrame = -1; + } } if (_liveProperties.startFrame == _liveProperties.lastFrame) diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h index e1f6e01403..2235840c3f 100644 --- a/engines/gob/videoplayer.h +++ b/engines/gob/videoplayer.h @@ -90,6 +90,7 @@ public: int16 palEnd; ///< Palette entry to end at. int32 palFrame; ///< Frame to apply the palette command at. + bool loop; ///< Loop the video? bool fade; ///< Fade in? bool waitEndFrame; ///< Wait for the frame's time to run out? diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp index d95f4a89c0..1590db920b 100644 --- a/graphics/video/coktel_decoder.cpp +++ b/graphics/video/coktel_decoder.cpp @@ -1562,6 +1562,7 @@ bool VMDDecoder::seek(int32 frame, int whence, bool restart) { // Seek _stream->seek(_frames[frame + 1].offset); _curFrame = frame; + _startTime = g_system->getMillis() - ((frame + 2) * getStaticTimeToNextFrame()); _subtitle = -1; |