diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/inter_v6.cpp | 18 | ||||
-rw-r--r-- | engines/gob/videoplayer.cpp | 57 | ||||
-rw-r--r-- | engines/gob/videoplayer.h | 9 |
3 files changed, 64 insertions, 20 deletions
diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index 560415a760..8e74ed42f1 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -125,6 +125,11 @@ void Inter_v6::o6_playVmdOrMusic() { props.x, props.y, props.startFrame, props.lastFrame, props.palCmd, props.palStart, props.palEnd, props.flags); + if (!strcmp(fileName, "RIEN")) { + _vm->_vidPlayer->closeAll(); + return; + } + close = false; if (props.lastFrame == -1) { close = true; @@ -152,7 +157,10 @@ void Inter_v6::o6_playVmdOrMusic() { return; } else if (props.lastFrame <= -10) { _vm->_vidPlayer->closeVideo(); - props.loop = true; + + if (!(props.flags & VideoPlayer::kFlagNoVideo)) + props.loop = true; + } else if (props.lastFrame < 0) { warning("Urban/Playtoons Stub: Unknown Video/Music command: %d, %s", props.lastFrame, fileName); return; @@ -166,8 +174,14 @@ void Inter_v6::o6_playVmdOrMusic() { _vm->_vidPlayer->evaluateFlags(props); + bool primary = true; + if (props.noBlock && (props.flags & VideoPlayer::kFlagNoVideo)) { + _vm->_vidPlayer->closeLiveSound(); + primary = false; + } + int slot = 0; - if ((fileName[0] != 0) && ((slot = _vm->_vidPlayer->openVideo(true, fileName, props)) < 0)) { + if ((fileName[0] != 0) && ((slot = _vm->_vidPlayer->openVideo(primary, fileName, props)) < 0)) { WRITE_VAR(11, (uint32) -1); return; } diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index 7233b7fe95..f279cb9744 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -222,6 +222,22 @@ bool VideoPlayer::closeVideo(int slot) { return true; } +void VideoPlayer::closeLiveSound() { + for (int i = 1; i < kVideoSlotCount; i++) { + Video *video = getVideoBySlot(i); + if (!video) + continue; + + if (video->live) + closeVideo(i); + } +} + +void VideoPlayer::closeAll() { + for (int i = 0; i < kVideoSlotCount; i++) + closeVideo(i); +} + bool VideoPlayer::play(int slot, Properties &properties) { Video *video = getVideoBySlot(slot); if (!video) @@ -253,11 +269,13 @@ bool VideoPlayer::play(int slot, Properties &properties) { properties.canceled = false; - if (primary && properties.noBlock) { - video->live = true; + if (properties.noBlock) { properties.waitEndFrame = false; - _liveProperties = properties; - updateLive(true); + + video->live = true; + video->properties = properties; + + updateLive(slot, true); return true; } @@ -311,40 +329,47 @@ bool VideoPlayer::isPlayingLive() const { } void VideoPlayer::updateLive(bool force) { - Video *video = getVideoBySlot(0); + for (int i = 0; i < kVideoSlotCount; i++) + updateLive(i, force); +} + +void VideoPlayer::updateLive(int slot, bool force) { + Video *video = getVideoBySlot(slot); if (!video || !video->live) return; - if (_liveProperties.startFrame >= (int32)(video->decoder->getFrameCount() - 1)) { + if (video->properties.startFrame >= (int32)(video->decoder->getFrameCount() - 1)) { // Video ended - if (!_liveProperties.loop) { - WRITE_VAR_OFFSET(212, (uint32)-1); + if (!video->properties.loop) { + if (!(video->properties.flags & kFlagNoVideo)) + WRITE_VAR_OFFSET(212, (uint32)-1); _vm->_vidPlayer->closeVideo(); return; } else { video->decoder->seek(0, SEEK_SET, true); - _liveProperties.startFrame = -1; + video->properties.startFrame = -1; } } - if (_liveProperties.startFrame == _liveProperties.lastFrame) + if (video->properties.startFrame == video->properties.lastFrame) // Current video sequence ended return; if (!force && (video->decoder->getTimeToNextFrame() > 0)) return; - WRITE_VAR_OFFSET(212, _liveProperties.startFrame + 1); + if (!(video->properties.flags & kFlagNoVideo)) + WRITE_VAR_OFFSET(212, video->properties.startFrame + 1); - bool backwards = _liveProperties.startFrame > _liveProperties.lastFrame; - playFrame(0, _liveProperties); + bool backwards = video->properties.startFrame > video->properties.lastFrame; + playFrame(slot, video->properties); - _liveProperties.startFrame += backwards ? -1 : 1; + video->properties.startFrame += backwards ? -1 : 1; - if (_liveProperties.fade) { + if (video->properties.fade) { _vm->_palAnim->fade(_vm->_global->_pPaletteDesc, -2, 0); - _liveProperties.fade = false; + video->properties.fade = false; } } diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h index 5df48fc6aa..bae1fe3702 100644 --- a/engines/gob/videoplayer.h +++ b/engines/gob/videoplayer.h @@ -110,6 +110,9 @@ public: int openVideo(bool primary, const Common::String &file, Properties &properties); bool closeVideo(int slot = 0); + void closeLiveSound(); + void closeAll(); + bool play(int slot, Properties &properties); void waitEndFrame(int slot, bool onlySound = false); @@ -149,6 +152,8 @@ private: SurfacePtr surface; + Properties properties; + bool live; Video(); @@ -161,8 +166,6 @@ private: static const char *_extensions[]; - Properties _liveProperties; - GobEngine *_vm; // _videoSlots[0] is reserved for the "primary" video @@ -188,6 +191,8 @@ private: void evalBgShading(Video &video); void copyPalette(const Video &video, int16 palStart, int16 palEnd); + + void updateLive(int slot, bool force = false); }; } // End of namespace Gob |