From bab55f3a1d8f24e959fa98bda3a775452cc14198 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 8 Aug 2010 00:55:27 +0000 Subject: GOB: Adapt the remaining bits to the new VideoPlayer interface svn-id: r51895 --- engines/gob/inter_v2.cpp | 2 +- engines/gob/mult.cpp | 2 +- engines/gob/mult_v2.cpp | 6 ++-- engines/gob/scenery.cpp | 18 ++++++++---- engines/gob/videoplayer.cpp | 70 ++------------------------------------------- engines/gob/videoplayer.h | 28 +----------------- 6 files changed, 21 insertions(+), 105 deletions(-) (limited to 'engines') diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index 752d794127..0003332e47 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -481,7 +481,7 @@ void Inter_v2::o2_loadMultObject() { if ((((int32) *(obj.pPosX)) == -1234) && (((int32) *(obj.pPosY)) == -4321)) { if (obj.videoSlot > 0) - _vm->_vidPlayer->slotClose(obj.videoSlot - 1); + _vm->_vidPlayer->closeVideo(obj.videoSlot - 1); obj.videoSlot = 0; obj.lastLeft = -1; diff --git a/engines/gob/mult.cpp b/engines/gob/mult.cpp index 667cd0d758..f744f14faf 100644 --- a/engines/gob/mult.cpp +++ b/engines/gob/mult.cpp @@ -452,7 +452,7 @@ void Mult::clearObjectVideos() { for (int i = 0; i < _objCount; i++) if (_objects[i].videoSlot > 0) - _vm->_vidPlayer->slotClose(_objects[i].videoSlot - 1); + _vm->_vidPlayer->closeVideo(_objects[i].videoSlot - 1); } } // End of namespace Gob diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp index d9e94199c3..47cd74b454 100644 --- a/engines/gob/mult_v2.cpp +++ b/engines/gob/mult_v2.cpp @@ -710,7 +710,7 @@ void Mult_v2::newCycleAnim(Mult_Object &animObj) { } else { if (animObj.videoSlot > 0) { _vm->_video->retrace(); - _vm->_vidPlayer->slotWaitEndFrame(animObj.videoSlot - 1, true); + _vm->_vidPlayer->waitEndFrame(animObj.videoSlot - 1, true); } } @@ -775,7 +775,7 @@ void Mult_v2::newCycleAnim(Mult_Object &animObj) { animData.isStatic = 1; animData.frame = 0; if ((animData.animation < 0) && (animObj.videoSlot > 0)) { - _vm->_vidPlayer->slotClose(animObj.videoSlot - 1); + _vm->_vidPlayer->closeVideo(animObj.videoSlot - 1); animObj.videoSlot = 0; } @@ -788,7 +788,7 @@ void Mult_v2::newCycleAnim(Mult_Object &animObj) { /* if ((animData.animation < 0) && (animObj.videoSlot > 0)) { if (_vm->_vidPlayer->getFlags(animObj.videoSlot - 1) & 0x1000) { - _vm->_vidPlayer->slotClose(animObj.videoSlot - 1); + _vm->_vidPlayer->closeVideo(animObj.videoSlot - 1); animObj.videoSlot = 0; } } diff --git a/engines/gob/scenery.cpp b/engines/gob/scenery.cpp index 89adffc5ea..7fd1429aac 100644 --- a/engines/gob/scenery.cpp +++ b/engines/gob/scenery.cpp @@ -621,15 +621,21 @@ void Scenery::updateAnim(int16 layer, int16 frame, int16 animation, int16 flags, // Seek to frame if (_vm->_vidPlayer->getCurrentFrame(obj.videoSlot - 1) < 256) { - while (((int32)_vm->_vidPlayer->getCurrentFrame(obj.videoSlot - 1)) <= frame) - _vm->_vidPlayer->slotPlay(obj.videoSlot - 1); + VideoPlayer::Properties props; + + props.lastFrame = frame + 1; + _vm->_vidPlayer->play(obj.videoSlot - 1, props); + } else { - int16 curFrame = _vm->_vidPlayer->getCurrentFrame(obj.videoSlot - 1); + int16 curFrame = _vm->_vidPlayer->getCurrentFrame(obj.videoSlot - 1) + 1; uint8 frameWrap = curFrame / 256; frame = (frame + 1) % 256; - while (((int32)_vm->_vidPlayer->getCurrentFrame(obj.videoSlot - 1)) < (frameWrap * 256 + frame)) - _vm->_vidPlayer->slotPlay(obj.videoSlot - 1); + VideoPlayer::Properties props; + + props.lastFrame = frameWrap * 256 + frame; + + _vm->_vidPlayer->play(obj.videoSlot - 1, props); } /* @@ -718,7 +724,7 @@ void Scenery::updateAnim(int16 layer, int16 frame, int16 animation, int16 flags, _vm->_draw->_spriteLeft = _vm->_vidPlayer->getWidth(obj.videoSlot - 1) - (destX + _vm->_draw->_spriteRight); - _vm->_vidPlayer->slotCopyFrame(obj.videoSlot - 1, _vm->_draw->_backSurface->getVidMem(), + _vm->_vidPlayer->copyFrame(obj.videoSlot - 1, _vm->_draw->_backSurface->getVidMem(), _vm->_draw->_spriteLeft, _vm->_draw->_spriteTop, _vm->_draw->_spriteRight, _vm->_draw->_spriteBottom, _vm->_draw->_destSpriteX, _vm->_draw->_destSpriteY, diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index 1fe05dfbf0..427130935e 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -253,12 +253,13 @@ bool VideoPlayer::play(int slot, Properties &properties) { return true; } -void VideoPlayer::waitEndFrame(int slot) { +void VideoPlayer::waitEndFrame(int slot, bool onlySound) { Video *video = getVideoBySlot(slot); if (!video) return; - _vm->_util->delay(video->decoder->getTimeToNextFrame()); + if (!onlySound || video->decoder->hasSound()) + _vm->_util->delay(video->decoder->getTimeToNextFrame()); } bool VideoPlayer::playFrame(int slot, Properties &properties) { @@ -702,71 +703,6 @@ Graphics::CoktelDecoder *VideoPlayer::openVideo(const Common::String &file, Prop return video; } - - - -// Obsolete, to be deleted - -bool VideoPlayer::primaryOpen(const char *videoFile, int16 x, int16 y, - int32 flags, Type which, int16 width, int16 height) { - - return false; -} - -bool VideoPlayer::primaryPlay(int16 startFrame, int16 lastFrame, int16 breakKey, - uint16 palCmd, int16 palStart, int16 palEnd, - int16 palFrame, int16 endFrame, bool fade, int16 reverseTo, bool forceSeek) { - - return false; -} - -void VideoPlayer::primaryClose() { -} - -int VideoPlayer::slotOpen(const char *videoFile, Type which, int16 width, int16 height) { - return -1; -} - -void VideoPlayer::slotPlay(int slot, int16 frame) { -} - -void VideoPlayer::slotClose(int slot) { -} - -void VideoPlayer::slotCopyFrame(int slot, byte *dest, - uint16 left, uint16 top, uint16 width, uint16 height, - uint16 x, uint16 y, uint16 pitch, int16 transp) { - -#if 0 - if ((slot < 0) || (slot >= kVideoSlotCount) || !_videoSlots[slot]) - return; - - /*_videoSlots[slot]->getVideo()->copyCurrentFrame(dest, - left, top, width, height, x, y, pitch, transp);*/ -#endif -} - -void VideoPlayer::slotCopyPalette(int slot, int16 palStart, int16 palEnd) { -} - -void VideoPlayer::slotWaitEndFrame(int slot, bool onlySound) { -#if 0 - Graphics::CoktelDecoder *video = getVideoBySlot(slot); - - if (video) { - /* - Graphics::CoktelDecoder &cVideo = *video->getVideo(); - - if (!onlySound || (cVideo.getFeatures() & Graphics::CoktelDecoder::kFeaturesSound)) - cVideo.waitEndFrame(); - */ - } -#endif -} - -void VideoPlayer::slotSetDoubleMode(int slot, bool doubleMode) { -} - void VideoPlayer::copyPalette(const Video &video, int16 palStart, int16 palEnd) { if (!video.decoder->hasPalette()) return; diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h index 2e7e3f396a..e40142d26d 100644 --- a/engines/gob/videoplayer.h +++ b/engines/gob/videoplayer.h @@ -103,7 +103,7 @@ public: bool closeVideo(int slot = 0); bool play(int slot, Properties &properties); - void waitEndFrame(int slot); + void waitEndFrame(int slot, bool onlySound = false); bool slotIsOpen(int slot = 0) const; @@ -128,32 +128,6 @@ public: uint16 left, uint16 top, uint16 width, uint16 height, uint16 x, uint16 y, uint16 pitch, int16 transp = -1) const; - - // Obsolete, to be deleted - - bool primaryOpen(const char *videoFile, int16 x = -1, int16 y = -1, - int32 flags = kFlagFrontSurface, Type which = kVideoTypeTry, - int16 width = -1, int16 height = -1); - bool primaryPlay(int16 startFrame = -1, int16 lastFrame = -1, - int16 breakKey = kShortKeyEscape, - uint16 palCmd = 8, int16 palStart = 0, int16 palEnd = 255, - int16 palFrame = -1, int16 endFrame = -1, bool fade = false, - int16 reverseTo = -1, bool forceSeek = false); - void primaryClose(); - - int slotOpen(const char *videoFile, Type which = kVideoTypeTry, - int16 width = -1, int16 height = -1); - void slotPlay(int slot, int16 frame = -1); - void slotClose(int slot); - void slotCopyFrame(int slot, byte *dest, - uint16 left, uint16 top, uint16 width, uint16 height, - uint16 x, uint16 y, uint16 pitch, int16 transp = -1); - void slotCopyPalette(int slot, int16 palStart = -1, int16 palEnd = -1); - void slotWaitEndFrame(int slot = -1, bool onlySound = false); - - void slotSetDoubleMode(int slot, bool doubleMode); - - private: struct Video { Graphics::CoktelDecoder *decoder; -- cgit v1.2.3