void RivenSimpleCommand::activateMLST(const MLSTRecord &mlstRecord) const { RivenVideo *ptr = _vm->_video->openSlot(mlstRecord.playbackSlot); ptr->load(mlstRecord.movieID); ptr->moveTo(mlstRecord.left, mlstRecord.top); ptr->setLooping(mlstRecord.loop != 0); ptr->setVolume(mlstRecord.volume); }
void OSpit::xooffice30_closebook(const ArgumentArray &args) { // Close the blank linking book if it's open uint32 &book = _vm->_vars["odeskbook"]; if (book != 1) return; // Set the variable to be "closed" book = 0; // Play the movie RivenVideo *video = _vm->_video->openSlot(1); video->seek(0); video->playBlocking(); // Set the hotspots into their correct states RivenHotspot *closeBook = _vm->getCard()->getHotspotByName("closeBook"); RivenHotspot *nullHotspot = _vm->getCard()->getHotspotByName("null"); RivenHotspot *openBook = _vm->getCard()->getHotspotByName("openBook"); closeBook->enable(false); nullHotspot->enable(false); openBook->enable(true); _vm->getCard()->drawPicture(1); }
void BSpit::valveChangePosition(uint32 valvePosition, uint16 videoId, uint16 pictureId) { RivenVideo *video = _vm->_video->openSlot(videoId); video->seek(0); video->playBlocking(); _vm->getCard()->drawPicture(pictureId); // If we changed state and the new state is that the valve is flowing to // the boiler, we need to update the boiler state. if (valvePosition == 1) { // Check which way the water is going at the boiler if (_vm->_vars["bidvlv"] == 1) { if (_vm->_vars["bblrarm"] == 1 && _vm->_vars["bblrwtr"] == 1) { // If the pipe is open, make sure the water is drained out _vm->_vars["bheat"] = 0; _vm->_vars["bblrwtr"] = 0; _vm->_sound->playCardSound("bBlrFar"); } if (_vm->_vars["bblrarm"] == 0 && _vm->_vars["bblrwtr"] == 0) { // If the pipe is closed, fill the boiler again _vm->_vars["bheat"] = _vm->_vars["bblrvalve"]; _vm->_vars["bblrwtr"] = 1; _vm->_sound->playCardSound("bBlrFar"); } } else { // Have the grating inside the boiler match the switch outside _vm->_vars["bblrgrt"] = (_vm->_vars["bblrsw"] == 1) ? 0 : 1; } } _vm->_vars["bvalve"] = valvePosition; }
void BSpit::xbfreeytram(const ArgumentArray &args) { // Play a random Ytram movie after freeing it uint16 mlstId; switch (_vm->_vars["bytram"]) { case 1: mlstId = 11; break; case 2: mlstId = 12; break; default: // The original did rand(13, 14) mlstId = _vm->_rnd->getRandomNumberRng(13, 15); break; } // Play the video _vm->getCard()->playMovie(mlstId); RivenVideo *first = _vm->_video->openSlot(11); first->playBlocking(); // Now play the second movie _vm->getCard()->playMovie(mlstId + 5); RivenVideo *second = _vm->_video->openSlot(12); second->playBlocking(); _vm->getCard()->drawPicture(4); }
// Command 41: activate MLST record and play void RivenSimpleCommand::activateMLSTAndPlay(uint16 op, const ArgumentArray &args) { MLSTRecord mlstRecord = _vm->getCard()->getMovie(args[0]); activateMLST(mlstRecord); RivenVideo *video = _vm->_video->openSlot(mlstRecord.playbackSlot); video->enable(); video->play(); }
void ASpit::xatrapbookclose(const ArgumentArray &args) { // Close the trap book _vm->_vars["atrap"] = 0; pageTurn(kRivenTransitionWipeRight); // Stop the flyby movie to prevent a glitch where the book does not actually // close because the movie continues to draw over the closed book picture. // This glitch also happened in the original engine with transitions disabled. RivenVideo *flyby = _vm->_video->getSlot(1); flyby->close(); _vm->getCard()->enter(false); }
void BSpit::xbupdateboiler(const ArgumentArray &args) { if (_vm->_vars["bheat"] != 0) { if (_vm->_vars["bblrgrt"] == 0) { _vm->getCard()->playMovie(8); } else { _vm->getCard()->playMovie(7); } } else { RivenVideo *video = _vm->_video->getSlot(7); if (video) { video->disable(); video->stop(); } video = _vm->_video->getSlot(8); if (video) { video->disable(); video->stop(); } } }
void BSpit::xbchipper(const ArgumentArray &args) { Common::Point startPos = getMouseDragStartPosition(); bool pulledLever = false; while (mouseIsDown() && !_vm->hasGameEnded()) { Common::Point pos = getMousePosition(); if (pos.y > startPos.y) { pulledLever = true; break; } _vm->doFrame(); } if (pulledLever) { RivenVideo *video = _vm->_video->openSlot(2); video->seek(0); video->playBlocking(); } }
void OSpit::xgwatch(const ArgumentArray &args) { // Hide the cursor _vm->_cursor->setCursor(kRivenHideCursor); uint32 prisonCombo = _vm->_vars["pcorrectorder"]; byte curSound = 0; while (curSound < 5 && !_vm->hasGameEnded()) { // Play a sound every half second _vm->_sound->playSound(getComboDigit(prisonCombo, curSound) + 13); _vm->delay(500); curSound++; } // Now play the video for the watch _vm->getCard()->playMovie(1); RivenVideo *watchVideo = _vm->_video->openSlot(1); watchVideo->playBlocking(); }
void PSpit::catherineIdleTimer() { uint32 &cathCheck = _vm->_vars["pcathcheck"]; uint32 &cathState = _vm->_vars["acathstate"]; uint16 movie; // Choose a random movie based on where Catherine is if (cathCheck == 0) { static const int movieList[] = { 5, 6, 7, 8 }; cathCheck = 1; movie = movieList[_vm->_rnd->getRandomNumber(3)]; } else if (cathState == 1) { static const int movieList[] = { 11, 14 }; movie = movieList[_vm->_rnd->getRandomBit()]; } else { static const int movieList[] = { 9, 10, 12, 13 }; movie = movieList[_vm->_rnd->getRandomNumber(3)]; } // Update her state if she moves from left/right or right/left, resp. if (movie == 5 || movie == 7 || movie == 11 || movie == 14) cathState = 2; else cathState = 1; // Play the movie, blocking _vm->getCard()->playMovie(movie); RivenVideo *video = _vm->_video->openSlot(movie); video->playBlocking(); // Install the next timer for the next video uint32 timeUntilNextMovie = _vm->_rnd->getRandomNumber(120) * 1000; _vm->_vars["pcathtime"] = timeUntilNextMovie + _vm->getTotalPlayTime(); installTimer(TIMER(PSpit, catherineIdleTimer), timeUntilNextMovie); }
void RivenVideoManager::updateMovies() { for (VideoList::iterator it = _videos.begin(); it != _videos.end(); it++) { RivenVideo *video = *it; // Check of the video has reached the end if (video->endOfVideo()) { if (video->isPlaying() && video->isLooping()) { // Seek back if looping video->seek(0); } else { continue; } } // Check if we need to draw a frame if (video->needsUpdate()) { video->drawNextFrame(); } } }
void OSpit::xobedroom5_closedrawer(const ArgumentArray &args) { // Close the drawer if open when clicking on the journal. RivenVideo *video = _vm->_video->openSlot(2); video->playBlocking(); _vm->_vars["ostanddrawer"] = 0; }
// Command 34: stop a movie void RivenSimpleCommand::stopMovie(uint16 op, const ArgumentArray &args) { RivenVideo *video = _vm->_video->openSlot(args[0]); video->stop(); }
// Command 33: play background movie - nonblocking (movie_id) void RivenSimpleCommand::playMovie(uint16 op, const ArgumentArray &args) { RivenVideo *video = _vm->_video->openSlot(args[0]); video->enable(); video->play(); }
// Command 28: disable a movie void RivenSimpleCommand::disableMovie(uint16 op, const ArgumentArray &args) { RivenVideo *video = _vm->_video->openSlot(args[0]); if (video) video->disable(); }
// Command 32: play foreground movie - blocking (movie_id) void RivenSimpleCommand::playMovieBlocking(uint16 op, const ArgumentArray &args) { RivenVideo *video = _vm->_video->openSlot(args[0]); video->setLooping(false); video->enable(); video->playBlocking(); }
void OSpit::xbookclick(const ArgumentArray &args) { // Let's hook onto our video RivenVideo *video = _vm->_video->getSlot(args[0]); // Convert from the standard QuickTime base time to milliseconds // The values are in terms of 1/600 of a second. // Have I said how much I just *love* QuickTime? </sarcasm> uint32 startTime = args[1] * 1000 / 600; uint32 endTime = args[2] * 1000 / 600; // Track down our hotspot Common::String hotspotName = Common::String::format("touchBook%d", args[3]); RivenHotspot *hotspot = _vm->getCard()->getHotspotByName(hotspotName); Common::Rect hotspotRect = hotspot->getRect(); debug(0, "xbookclick:"); debug(0, "\tVideo Code = %d", args[0]); debug(0, "\tStart Time = %dms", startTime); debug(0, "\tEnd Time = %dms", endTime); debug(0, "\tHotspot = %d -> %s", args[3], hotspotName.c_str()); // Just let the video play while we wait until Gehn opens the trap book for us while (video->getTime() < startTime && !_vm->hasGameEnded()) { _vm->doFrame(); } // Break out if we're quitting if (_vm->hasGameEnded()) return; // 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 (video->getTime() < endTime && !_vm->hasGameEnded()) { if (hotspotRect.contains(getMousePosition())) _vm->_cursor->setCursor(kRivenOpenHandCursor); else _vm->_cursor->setCursor(kRivenMainCursor); if (mouseIsDown()) { if (hotspotRect.contains(getMousePosition())) { // OK, we've used the trap book! We go for ride lady! _vm->_video->closeVideos(); // Stop all videos _vm->_cursor->setCursor(kRivenHideCursor); // Hide the cursor _vm->_gfx->scheduleTransition(kRivenTransitionBlend); _vm->getCard()->drawPicture(3); // Black out the screen _vm->_sound->playSound(0); // Play the link sound _vm->delay(12000); _vm->getCard()->playMovie(7); // Activate Gehn Link Video RivenVideo *linkVideo = _vm->_video->openSlot(1); // Play Gehn Link Video linkVideo->playBlocking(); _vm->_vars["ocage"] = 1; _vm->_vars["agehn"] = 4; // Set Gehn to the trapped state _vm->_vars["atrapbook"] = 1; // We've got the trap book again _vm->_sound->playSound(0); // Play the link sound again _vm->_gfx->scheduleTransition(kRivenTransitionBlend); _vm->changeToCard(_vm->getStack()->getCardStackId(0x2885)); // Link out! _vm->_inventory->forceVisible(true); _vm->delay(2000); _vm->_inventory->forceVisible(false); _vm->_scriptMan->stopAllScripts(); // Stop all running scripts (so we don't remain in the cage) return; } } _vm->doFrame(); } // Break out if we're quitting if (_vm->hasGameEnded()) return; // If there was no click and this is the third time Gehn asks us to // use the trap book, he will shoot the player. Dead on arrival. // Run the credits from here. if (_vm->_vars["agehn"] == 3) { runCredits(args[0], 5000, 995); return; } // There was no click, so just play the rest of the video. video->playBlocking(); }
void BSpit::xbchangeboiler(const ArgumentArray &args) { uint32 heat = _vm->_vars["bheat"]; uint32 water = _vm->_vars["bblrwtr"]; uint32 platform = _vm->_vars["bblrgrt"]; // Stop any background videos _vm->_video->closeVideos(); if (args[0] == 1) { // Water is filling/draining from the boiler if (water == 0) { if (platform == 1) _vm->getCard()->playMovie(12); else _vm->getCard()->playMovie(10); } else if (heat == 1) { if (platform == 1) _vm->getCard()->playMovie(22); else _vm->getCard()->playMovie(19); } else { if (platform == 1) _vm->getCard()->playMovie(16); else _vm->getCard()->playMovie(13); } } else if (args[0] == 2 && water != 0) { if (heat == 1) { // Turning on the heat if (platform == 1) _vm->getCard()->playMovie(23); else _vm->getCard()->playMovie(20); } else { // Turning off the heat if (platform == 1) _vm->getCard()->playMovie(18); else _vm->getCard()->playMovie(15); } } else if (args[0] == 3) { if (platform == 1) { // Lowering the platform if (water == 1) { if (heat == 1) _vm->getCard()->playMovie(24); else _vm->getCard()->playMovie(17); } else { _vm->getCard()->playMovie(11); } } else { // Raising the platform if (water == 1) { if (heat == 1) _vm->getCard()->playMovie(21); else _vm->getCard()->playMovie(14); } else { _vm->getCard()->playMovie(9); } } } if (args.size() > 1) _vm->getCard()->playSound(args[1]); else if (args[0] == 2) _vm->getCard()->playSound(1); RivenVideo *video = _vm->_video->openSlot(11); video->playBlocking(); }