diff options
author | Matthew Hoops | 2015-07-15 23:59:21 -0400 |
---|---|---|
committer | Matthew Hoops | 2015-07-17 20:05:00 -0400 |
commit | 7e6c8be7db2449c1f793b6fb01af5613282e7f27 (patch) | |
tree | 02fd969920a4c0a4aad285462eee2050885e620e /engines/mohawk/riven_external.cpp | |
parent | 95b1288329b12dce9d96a1a97a28f1bc457d605f (diff) | |
download | scummvm-rg350-7e6c8be7db2449c1f793b6fb01af5613282e7f27.tar.gz scummvm-rg350-7e6c8be7db2449c1f793b6fb01af5613282e7f27.tar.bz2 scummvm-rg350-7e6c8be7db2449c1f793b6fb01af5613282e7f27.zip |
MOHAWK: Make video handles actual objects
Diffstat (limited to 'engines/mohawk/riven_external.cpp')
-rw-r--r-- | engines/mohawk/riven_external.cpp | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp index cda0683028..c859248055 100644 --- a/engines/mohawk/riven_external.cpp +++ b/engines/mohawk/riven_external.cpp @@ -229,7 +229,7 @@ void RivenExternal::runCredits(uint16 video, uint32 delay) { VideoHandle videoHandle = _vm->_video->findVideoHandleRiven(video); while (!_vm->shouldQuit() && _vm->_gfx->getCurCreditsImage() <= 320) { - if (_vm->_video->getCurFrame(videoHandle) >= (int32)_vm->_video->getFrameCount(videoHandle) - 1) { + if (videoHandle->getCurFrame() >= (int32)videoHandle->getFrameCount() - 1) { if (nextCreditsFrameStart == 0) { // Set us up to start after delay ms nextCreditsFrameStart = _vm->_system->getMillis() + delay; @@ -265,10 +265,10 @@ void RivenExternal::runDomeCheck() { // Check if we clicked while the golden frame was showing VideoHandle video = _vm->_video->findVideoHandleRiven(1); - assert(video != NULL_VID_HANDLE); + assert(video); - int32 curFrame = _vm->_video->getCurFrame(video); - int32 frameCount = _vm->_video->getFrameCount(video); + int32 curFrame = video->getCurFrame(); + int32 frameCount = video->getFrameCount(); // The final frame of the video is the 'golden' frame (double meaning: the // frame that is the magic one is the one with the golden symbol) but we @@ -857,8 +857,12 @@ void RivenExternal::xbupdateboiler(uint16 argc, uint16 *argv) { _vm->_video->playMovieRiven(7); } } else { - _vm->_video->disableMovieRiven(7); - _vm->_video->disableMovieRiven(8); + VideoHandle handle = _vm->_video->findVideoHandleRiven(7); + if (handle) + handle->setEnabled(false); + handle = _vm->_video->findVideoHandleRiven(8); + if (handle) + handle->setEnabled(false); } } @@ -1149,8 +1153,8 @@ void RivenExternal::lowerPins() { // Play the video of the pins going down VideoHandle handle = _vm->_video->playMovieRiven(upMovie); - assert(handle != NULL_VID_HANDLE); - _vm->_video->setVideoBounds(handle, Audio::Timestamp(0, startTime, 600), Audio::Timestamp(0, startTime + 550, 600)); + assert(handle); + handle->setBounds(Audio::Timestamp(0, startTime, 600), Audio::Timestamp(0, startTime + 550, 600)); _vm->_video->waitUntilMovieEnds(handle); upMovie = 0; @@ -1181,8 +1185,8 @@ void RivenExternal::xgrotatepins(uint16 argc, uint16 *argv) { // Play the video of the pins rotating VideoHandle handle = _vm->_video->playMovieRiven(_vm->_vars["gupmoov"]); - assert(handle != NULL_VID_HANDLE); - _vm->_video->setVideoBounds(handle, Audio::Timestamp(0, startTime, 600), Audio::Timestamp(0, startTime + 1215, 600)); + assert(handle); + handle->setBounds(Audio::Timestamp(0, startTime, 600), Audio::Timestamp(0, startTime + 1215, 600)); _vm->_video->waitUntilMovieEnds(handle); } @@ -1265,9 +1269,9 @@ void RivenExternal::xgpincontrols(uint16 argc, uint16 *argv) { // Actually play the movie VideoHandle handle = _vm->_video->playMovieRiven(pinMovieCodes[imagePos - 1]); - assert(handle != NULL_VID_HANDLE); + assert(handle); uint32 startTime = 9630 - pinPos * 600; - _vm->_video->setVideoBounds(handle, Audio::Timestamp(0, startTime, 600), Audio::Timestamp(0, startTime + 550, 600)); + handle->setBounds(Audio::Timestamp(0, startTime, 600), Audio::Timestamp(0, startTime + 550, 600)); _vm->_video->waitUntilMovieEnds(handle); // Update the relevant variables @@ -1343,8 +1347,8 @@ void RivenExternal::xgrviewer(uint16 argc, uint16 *argv) { // Now play the movie VideoHandle handle = _vm->_video->playMovieRiven(1); - assert(handle != NULL_VID_HANDLE); - _vm->_video->setVideoBounds(handle, Audio::Timestamp(0, s_viewerTimeIntervals[curPos], 600), Audio::Timestamp(0, s_viewerTimeIntervals[newPos], 600)); + assert(handle); + handle->setBounds(Audio::Timestamp(0, s_viewerTimeIntervals[curPos], 600), Audio::Timestamp(0, s_viewerTimeIntervals[newPos], 600)); _vm->_video->waitUntilMovieEnds(handle); // Set the new position and let the card's scripts take over again @@ -1412,8 +1416,8 @@ void RivenExternal::xglviewer(uint16 argc, uint16 *argv) { // Now play the movie VideoHandle handle = _vm->_video->playMovieRiven(1); - assert(handle != NULL_VID_HANDLE); - _vm->_video->setVideoBounds(handle, Audio::Timestamp(0, s_viewerTimeIntervals[curPos], 600), Audio::Timestamp(0, s_viewerTimeIntervals[newPos], 600)); + assert(handle); + handle->setBounds(Audio::Timestamp(0, s_viewerTimeIntervals[curPos], 600), Audio::Timestamp(0, s_viewerTimeIntervals[newPos], 600)); _vm->_video->waitUntilMovieEnds(handle); // Set the new position to the variable @@ -1467,7 +1471,7 @@ static void catherineViewerIdleTimer(MohawkEngine_Riven *vm) { VideoHandle videoHandle = vm->_video->playMovieRiven(30); // Reset the timer - vm->installTimer(&catherineViewerIdleTimer, vm->_video->getDuration(videoHandle).msecs() + vm->_rnd->getRandomNumber(60) * 1000); + vm->installTimer(&catherineViewerIdleTimer, videoHandle->getDuration().msecs() + vm->_rnd->getRandomNumber(60) * 1000); } void RivenExternal::xglview_prisonon(uint16 argc, uint16 *argv) { @@ -1507,7 +1511,7 @@ void RivenExternal::xglview_prisonon(uint16 argc, uint16 *argv) { _vm->_video->activateMLST(cathMovie, _vm->getCurCard()); VideoHandle videoHandle = _vm->_video->playMovieRiven(30); - timeUntilNextMovie = _vm->_video->getDuration(videoHandle).msecs() + _vm->_rnd->getRandomNumber(60) * 1000; + timeUntilNextMovie = videoHandle->getDuration().msecs() + _vm->_rnd->getRandomNumber(60) * 1000; } else { // Otherwise, just redraw the imager timeUntilNextMovie = _vm->_rnd->getRandomNumberRng(10, 20) * 1000; @@ -1986,7 +1990,7 @@ void RivenExternal::xschool280_playwhark(uint16 argc, uint16 *argv) { Audio::Timestamp startTime = Audio::Timestamp(0, (11560 / 19) * (*posVar), 600); *posVar += number; // Adjust to the end Audio::Timestamp endTime = Audio::Timestamp(0, (11560 / 19) * (*posVar), 600); - _vm->_video->setVideoBounds(handle, startTime, endTime); + handle->setBounds(startTime, endTime); _vm->_video->waitUntilMovieEnds(handle); if (*posVar > 19) { @@ -2059,7 +2063,7 @@ void RivenExternal::xbookclick(uint16 argc, uint16 *argv) { debug(0, "\tHotspot = %d -> %d", argv[3], hotspotMap[argv[3] - 1]); // Just let the video play while we wait until Gehn opens the trap book for us - while (_vm->_video->getTime(video) < startTime && !_vm->shouldQuit()) { + while (video->getTime() < startTime && !_vm->shouldQuit()) { if (_vm->_video->updateMovies()) _vm->_system->updateScreen(); @@ -2084,7 +2088,7 @@ void RivenExternal::xbookclick(uint16 argc, uint16 *argv) { // OK, Gehn has opened the trap book and has asked us to go in. Let's watch // and see what the player will do... - while (_vm->_video->getTime(video) < endTime && !_vm->shouldQuit()) { + while (video->getTime() < endTime && !_vm->shouldQuit()) { bool updateScreen = _vm->_video->updateMovies(); Common::Event event; @@ -2335,7 +2339,7 @@ static void rebelPrisonWindowTimer(MohawkEngine_Riven *vm) { VideoHandle handle = vm->_video->playMovieRiven(movie); // Ensure the next video starts after this one ends - uint32 timeUntilNextVideo = vm->_video->getDuration(handle).msecs() + vm->_rnd->getRandomNumberRng(38, 58) * 1000; + uint32 timeUntilNextVideo = handle->getDuration().msecs() + vm->_rnd->getRandomNumberRng(38, 58) * 1000; // Save the time in case we leave the card and return vm->_vars["rvillagetime"] = timeUntilNextVideo + vm->getTotalPlayTime(); @@ -2434,7 +2438,7 @@ void RivenExternal::xtexterior300_telescopedown(uint16 argc, uint16 *argv) { static const uint32 timeIntervals[] = { 4320, 3440, 2560, 1760, 880, 0 }; uint16 movieCode = telescopeCover ? 1 : 2; VideoHandle handle = _vm->_video->playMovieRiven(movieCode); - _vm->_video->setVideoBounds(handle, Audio::Timestamp(0, timeIntervals[telescopePos], 600), Audio::Timestamp(0, timeIntervals[telescopePos - 1], 600)); + handle->setBounds(Audio::Timestamp(0, timeIntervals[telescopePos], 600), Audio::Timestamp(0, timeIntervals[telescopePos - 1], 600)); _vm->_sound->playSound(14); // Play the moving sound _vm->_video->waitUntilMovieEnds(handle); @@ -2467,7 +2471,7 @@ void RivenExternal::xtexterior300_telescopeup(uint16 argc, uint16 *argv) { static const uint32 timeIntervals[] = { 0, 800, 1680, 2560, 3440, 4320 }; uint16 movieCode = _vm->_vars["ttelecover"] ? 4 : 5; VideoHandle handle = _vm->_video->playMovieRiven(movieCode); - _vm->_video->setVideoBounds(handle, Audio::Timestamp(0, timeIntervals[telescopePos - 1], 600), Audio::Timestamp(0, timeIntervals[telescopePos], 600)); + handle->setBounds(Audio::Timestamp(0, timeIntervals[telescopePos - 1], 600), Audio::Timestamp(0, timeIntervals[telescopePos], 600)); _vm->_sound->playSound(14); // Play the moving sound _vm->_video->waitUntilMovieEnds(handle); |