diff options
author | Bastien Bouclet | 2011-01-11 19:52:58 +0000 |
---|---|---|
committer | Bastien Bouclet | 2011-01-11 19:52:58 +0000 |
commit | b1de27ed8f54b7321eaee165f69c90ac73d262f7 (patch) | |
tree | 028c2051a41960f7c9996002325e05a8059508fd /engines/mohawk | |
parent | f6b7979277cc83e29ac9c6a7dc28a1e1e0dccfbf (diff) | |
download | scummvm-rg350-b1de27ed8f54b7321eaee165f69c90ac73d262f7.tar.gz scummvm-rg350-b1de27ed8f54b7321eaee165f69c90ac73d262f7.tar.bz2 scummvm-rg350-b1de27ed8f54b7321eaee165f69c90ac73d262f7.zip |
MOHAWK: Implement Myst imager videos seeking / looping
svn-id: r55208
Diffstat (limited to 'engines/mohawk')
-rw-r--r-- | engines/mohawk/myst_areas.cpp | 30 | ||||
-rw-r--r-- | engines/mohawk/myst_areas.h | 8 | ||||
-rw-r--r-- | engines/mohawk/myst_stacks/myst.cpp | 35 |
3 files changed, 43 insertions, 30 deletions
diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp index 9cbf79ddaf..c69fd47633 100644 --- a/engines/mohawk/myst_areas.cpp +++ b/engines/mohawk/myst_areas.cpp @@ -197,19 +197,23 @@ MystResourceType6::MystResourceType6(MohawkEngine_Myst *vm, Common::SeekableRead debugC(kDebugResource, "\tplayBlocking: %d", _playBlocking); debugC(kDebugResource, "\tplayOnCardChange: %d", _playOnCardChange); debugC(kDebugResource, "\tu3: %d", _u3); - - _videoRunning = false; } -void MystResourceType6::playMovie() { - if (!_videoRunning) { - if (_playBlocking) - _vm->_video->playMovie(_videoFile, _left, _top); - else - _vm->_video->playBackgroundMovie(_videoFile, _left, _top, _loop); +VideoHandle MystResourceType6::playMovie() { + // Check if the video is already running + VideoHandle handle = _vm->_video->findVideoHandle(_videoFile); - _videoRunning = true; + // If the video is not running, play it + if (handle == NULL_VID_HANDLE || _vm->_video->endOfVideo(handle)) { + if (_playBlocking) { + _vm->_video->playMovie(_videoFile, _left, _top); + handle = NULL_VID_HANDLE; + } else { + handle = _vm->_video->playBackgroundMovie(_videoFile, _left, _top, _loop); + } } + + return handle; } void MystResourceType6::handleCardChange() { @@ -218,12 +222,8 @@ void MystResourceType6::handleCardChange() { } bool MystResourceType6::isPlaying() { - if (_videoRunning) { - VideoHandle handle = _vm->_video->findVideoHandle(_videoFile); - return handle != NULL_VID_HANDLE && !_vm->_video->endOfVideo(handle); - } - - return false; + VideoHandle handle = _vm->_video->findVideoHandle(_videoFile); + return handle != NULL_VID_HANDLE && !_vm->_video->endOfVideo(handle); } MystResourceType7::MystResourceType7(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) : MystResource(vm, rlstStream, parent) { diff --git a/engines/mohawk/myst_areas.h b/engines/mohawk/myst_areas.h index b7a12b0875..43af2a73f7 100644 --- a/engines/mohawk/myst_areas.h +++ b/engines/mohawk/myst_areas.h @@ -24,6 +24,7 @@ */ #include "mohawk/myst.h" +#include "mohawk/video.h" #ifndef MYST_AREAS_H #define MYST_AREAS_H @@ -104,9 +105,10 @@ protected: class MystResourceType6 : public MystResourceType5 { public: MystResourceType6(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent); - void playMovie(); + VideoHandle playMovie(); void handleCardChange(); bool isPlaying(); + void setBlocking(bool blocking) { _playBlocking = blocking; } protected: static Common::String convertMystVideoName(Common::String name); @@ -118,9 +120,6 @@ protected: uint16 _playBlocking; uint16 _playOnCardChange; uint16 _u3; - -private: - bool _videoRunning; }; class MystResourceType7 : public MystResource { @@ -177,6 +176,7 @@ public: uint16 getList2(uint16 index); uint16 getList3(uint16 index); + uint16 getStepsH() { return _stepsH; } uint16 getStepsV() { return _stepsV; } Common::Point _pos; diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp index c33c32604a..adfb195fc9 100644 --- a/engines/mohawk/myst_stacks/myst.cpp +++ b/engines/mohawk/myst_stacks/myst.cpp @@ -1153,31 +1153,43 @@ void MystScriptParser_Myst::o_imagerPlayButton(uint16 op, uint16 var, uint16 arg break; case 1: // Mountain if (_state.imagerActive) { - // TODO: Play from 11180 to 16800 + // Mountains disappearing Common::String file = _vm->wrapMovieFilename("vltmntn", kMystStack); - _vm->_video->playBackgroundMovie(file, 159, 96, false); + VideoHandle mountain = _vm->_video->playBackgroundMovie(file, 159, 96, false); + _vm->_video->setVideoBounds(mountain, Graphics::VideoTimestamp(11180, 600), Graphics::VideoTimestamp(16800, 600)); _state.imagerActive = 0; } else { - // TODO: Play from 0 to 11180 + // Mountains appearing Common::String file = _vm->wrapMovieFilename("vltmntn", kMystStack); - _vm->_video->playBackgroundMovie(file, 159, 96, false); + VideoHandle mountain = _vm->_video->playBackgroundMovie(file, 159, 96, false); + _vm->_video->setVideoBounds(mountain, Graphics::VideoTimestamp(0, 600), Graphics::VideoTimestamp(11180, 600)); _state.imagerActive = 1; } break; case 2: // Water + _imagerMovie->setBlocking(false); + if (_state.imagerActive) { _vm->_sound->replaceSound(argv[1]); - // TODO: Play from 4204 to 6040 - _imagerMovie->playMovie(); + // Water disappearing + VideoHandle water = _imagerMovie->playMovie(); + _vm->_video->setVideoBounds(water, Graphics::VideoTimestamp(4204, 600), Graphics::VideoTimestamp(6040, 600)); + _vm->_video->setVideoLooping(water, false); _state.imagerActive = 0; } else { - // TODO: Play from 0 to 1814 - // Then play from 1814 to 4204, looping - _imagerMovie->playMovie(); + // Water appearing + VideoHandle water = _imagerMovie->playMovie(); + _vm->_video->setVideoBounds(water, Graphics::VideoTimestamp(0, 600), Graphics::VideoTimestamp(1814, 600)); + _vm->_video->waitUntilMovieEnds(water); + + // Water looping + water = _imagerMovie->playMovie(); + _vm->_video->setVideoBounds(water, Graphics::VideoTimestamp(1814, 600), Graphics::VideoTimestamp(4204, 600)); + _vm->_video->setVideoLooping(water, true); _state.imagerActive = 1; } @@ -2937,8 +2949,9 @@ void MystScriptParser_Myst::imager_run() { _imagerRunning = false; if (_state.imagerActive && _state.imagerSelection == 67) { - // TODO: play between 1814 and 4204 looping - _imagerMovie->playMovie(); + VideoHandle water = _imagerMovie->playMovie(); + _vm->_video->setVideoBounds(water, Graphics::VideoTimestamp(1814, 600), Graphics::VideoTimestamp(4204, 600)); + _vm->_video->setVideoLooping(water, true); } } |