diff options
Diffstat (limited to 'engines/mohawk/riven_external.cpp')
-rw-r--r-- | engines/mohawk/riven_external.cpp | 126 |
1 files changed, 76 insertions, 50 deletions
diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp index 21464a6a48..8848716967 100644 --- a/engines/mohawk/riven_external.cpp +++ b/engines/mohawk/riven_external.cpp @@ -23,6 +23,7 @@ * */ +#include "mohawk/cursors.h" #include "mohawk/graphics.h" #include "mohawk/riven.h" #include "mohawk/riven_external.h" @@ -70,6 +71,8 @@ void RivenExternal::setupCommands() { COMMAND(xalaunchbrowser); COMMAND(xadisablemenuintro); COMMAND(xaenablemenuintro); + COMMAND(xademoquit); + COMMAND(xaexittomain); // bspit (Bookmaking Island) external commands COMMAND(xblabopenbook); @@ -257,7 +260,7 @@ void RivenExternal::runDomeCheck() { *_vm->getVar("domecheck") = 1; } -void RivenExternal::resetDomeSliders(uint16 bitmapId, uint16 soundId, uint16 startHotspot) { +void RivenExternal::resetDomeSliders(uint16 soundId, uint16 startHotspot) { // The rightmost slider should move left until it finds the next slider, // then those two continue until they find the third slider. This continues // until all five sliders have returned their starting slots. @@ -278,8 +281,8 @@ void RivenExternal::resetDomeSliders(uint16 bitmapId, uint16 soundId, uint16 sta // so we should redraw and play a tick sound if (slidersFound) { _vm->_sound->playSound(soundId); - drawDomeSliders(bitmapId, startHotspot); - _vm->_system->delayMillis(10); + drawDomeSliders(startHotspot); + _vm->_system->delayMillis(100); } } } @@ -308,15 +311,15 @@ void RivenExternal::checkSliderCursorChange(uint16 startHotspot) { for (uint16 i = 0; i < kDomeSliderSlotCount; i++) { if (_vm->_hotspots[i + startHotspot].rect.contains(_vm->_system->getEventManager()->getMousePos())) { if (_sliderState & (1 << (24 - i))) - _vm->_gfx->changeCursor(kRivenOpenHandCursor); + _vm->_cursor->setCursor(kRivenOpenHandCursor); else - _vm->_gfx->changeCursor(kRivenMainCursor); + _vm->_cursor->setCursor(kRivenMainCursor); break; } } } -void RivenExternal::dragDomeSlider(uint16 bitmapId, uint16 soundId, uint16 resetSlidersHotspot, uint16 openDomeHotspot, uint16 startHotspot) { +void RivenExternal::dragDomeSlider(uint16 soundId, uint16 resetSlidersHotspot, uint16 openDomeHotspot, uint16 startHotspot) { int16 foundSlider = -1; for (uint16 i = 0; i < kDomeSliderSlotCount; i++) { @@ -335,7 +338,7 @@ void RivenExternal::dragDomeSlider(uint16 bitmapId, uint16 soundId, uint16 reset return; // We've clicked down, so show the closed hand cursor - _vm->_gfx->changeCursor(kRivenClosedHandCursor); + _vm->_cursor->setCursor(kRivenClosedHandCursor); bool done = false; while (!done) { @@ -351,7 +354,7 @@ void RivenExternal::dragDomeSlider(uint16 bitmapId, uint16 soundId, uint16 reset // Now play a click sound and redraw _vm->_sound->playSound(soundId); - drawDomeSliders(bitmapId, startHotspot); + drawDomeSliders(startHotspot); } else if (foundSlider > 0 && !(_sliderState & (1 << (25 - foundSlider))) && _vm->_hotspots[foundSlider + startHotspot - 1].rect.contains(event.mouse)) { // We've moved the slider left one space _sliderState &= ~(_sliderState & (1 << (24 - foundSlider))); @@ -360,7 +363,7 @@ void RivenExternal::dragDomeSlider(uint16 bitmapId, uint16 soundId, uint16 reset // Now play a click sound and redraw _vm->_sound->playSound(soundId); - drawDomeSliders(bitmapId, startHotspot); + drawDomeSliders(startHotspot); } else _vm->_system->updateScreen(); // A normal update for the cursor break; @@ -378,7 +381,7 @@ void RivenExternal::dragDomeSlider(uint16 bitmapId, uint16 soundId, uint16 reset checkDomeSliders(resetSlidersHotspot, openDomeHotspot); } -void RivenExternal::drawDomeSliders(uint16 bitmapId, uint16 startHotspot) { +void RivenExternal::drawDomeSliders(uint16 startHotspot) { Common::Rect dstAreaRect = Common::Rect(200, 250, 420, 319); // On pspit, the rect is different by two pixels @@ -386,6 +389,9 @@ void RivenExternal::drawDomeSliders(uint16 bitmapId, uint16 startHotspot) { if (_vm->getCurStack() == pspit) dstAreaRect.translate(-2, 0); + // Find out bitmap id + uint16 bitmapId = _vm->findResourceID(ID_TBMP, "*sliders*"); + for (uint16 i = 0; i < kDomeSliderSlotCount; i++) { Common::Rect srcRect = _vm->_hotspots[startHotspot + i].rect; srcRect.translate(-dstAreaRect.left, -dstAreaRect.top); // Adjust the rect so it's in the destination area @@ -652,6 +658,26 @@ void RivenExternal::xaenablemenuintro(uint16 argc, uint16 *argv) { _vm->_gfx->showInventory(); } +void RivenExternal::xademoquit(uint16 argc, uint16 *argv) { + // Exactly as it says on the tin. In the demo, this function quits. + _vm->setGameOver(); +} + +void RivenExternal::xaexittomain(uint16 argc, uint16 *argv) { + // One could potentially implement this function, but there would be no + // point. This function is only used in the demo's aspit card 9 update + // screen script. However, card 9 is not accessible from the game without + // jumping to the card and there's nothing going on in the card so it + // never gets called. There's also no card 9 in the full game, so the + // functionality of this card was likely removed before release. The + // demo executable references some other external commands relating to + // setting and getting the volume, as well as drawing the volume. I'd + // venture to guess that this would have been some sort of options card + // replaced with the Windows/Mac API in the final product. + // + // Yeah, this function is just dummied and holds a big comment ;) +} + // ------------------------------------------------------------------------------------ // bspit (Bookmaking Island) external commands // ------------------------------------------------------------------------------------ @@ -801,7 +827,7 @@ void RivenExternal::xbchangeboiler(uint16 argc, uint16 *argv) { else if (argv[0] == 2) _vm->_sound->playSLST(1, _vm->getCurCard()); - _vm->_gfx->changeCursor(kRivenHideCursor); + _vm->_cursor->setCursor(kRivenHideCursor); _vm->_video->playMovieBlocking(11); } @@ -833,7 +859,7 @@ void RivenExternal::xbcheckcatch(uint16 argc, uint16 *argv) { void RivenExternal::xbait(uint16 argc, uint16 *argv) { // Set the cursor to the pellet - _vm->_gfx->changeCursor(kRivenPelletCursor); + _vm->_cursor->setCursor(kRivenPelletCursor); // Loop until the player lets go (or quits) Common::Event event; @@ -852,7 +878,7 @@ void RivenExternal::xbait(uint16 argc, uint16 *argv) { } // Set back the cursor - _vm->_gfx->changeCursor(kRivenMainCursor); + _vm->_cursor->setCursor(kRivenMainCursor); // Set the bait if we put it on the plate if (_vm->_hotspots[9].rect.contains(_vm->_system->getEventManager()->getMousePos())) { @@ -872,7 +898,7 @@ void RivenExternal::xbaitplate(uint16 argc, uint16 *argv) { // Remove the pellet from the plate and put it in your hand _vm->_gfx->drawPLST(3); _vm->_gfx->updateScreen(); - _vm->_gfx->changeCursor(kRivenPelletCursor); + _vm->_cursor->setCursor(kRivenPelletCursor); // Loop until the player lets go (or quits) Common::Event event; @@ -891,7 +917,7 @@ void RivenExternal::xbaitplate(uint16 argc, uint16 *argv) { } // Set back the cursor - _vm->_gfx->changeCursor(kRivenMainCursor); + _vm->_cursor->setCursor(kRivenMainCursor); // Set the bait if we put it on the plate, remove otherwise if (_vm->_hotspots[9].rect.contains(_vm->_system->getEventManager()->getMousePos())) { @@ -912,11 +938,11 @@ void RivenExternal::xbisland190_opencard(uint16 argc, uint16 *argv) { } void RivenExternal::xbisland190_resetsliders(uint16 argc, uint16 *argv) { - resetDomeSliders(701, 41, 2); + resetDomeSliders(41, 2); } void RivenExternal::xbisland190_slidermd(uint16 argc, uint16 *argv) { - dragDomeSlider(701, 41, 27, 28, 2); + dragDomeSlider(41, 27, 28, 2); } void RivenExternal::xbisland190_slidermw(uint16 argc, uint16 *argv) { @@ -942,7 +968,7 @@ void RivenExternal::xvalvecontrol(uint16 argc, uint16 *argv) { bool done = false; // Set the cursor to the closed position - _vm->_gfx->changeCursor(kRivenClosedHandCursor); + _vm->_cursor->setCursor(kRivenClosedHandCursor); _vm->_system->updateScreen(); while (!done) { @@ -959,24 +985,24 @@ void RivenExternal::xvalvecontrol(uint16 argc, uint16 *argv) { // FIXME: These values for changes in x/y could be tweaked. if (*valve == 0 && changeY <= -10) { *valve = 1; - _vm->_gfx->changeCursor(kRivenHideCursor); + _vm->_cursor->setCursor(kRivenHideCursor); _vm->_video->playMovieBlocking(2); _vm->refreshCard(); } else if (*valve == 1) { if (changeX >= 0 && changeY >= 10) { *valve = 0; - _vm->_gfx->changeCursor(kRivenHideCursor); + _vm->_cursor->setCursor(kRivenHideCursor); _vm->_video->playMovieBlocking(3); _vm->refreshCard(); } else if (changeX <= -10 && changeY <= 10) { *valve = 2; - _vm->_gfx->changeCursor(kRivenHideCursor); + _vm->_cursor->setCursor(kRivenHideCursor); _vm->_video->playMovieBlocking(1); _vm->refreshCard(); } } else if (*valve == 2 && changeX >= 10) { *valve = 1; - _vm->_gfx->changeCursor(kRivenHideCursor); + _vm->_cursor->setCursor(kRivenHideCursor); _vm->_video->playMovieBlocking(4); _vm->refreshCard(); } @@ -1031,15 +1057,15 @@ void RivenExternal::xgpincontrols(uint16 argc, uint16 *argv) { } void RivenExternal::xgisland25_opencard(uint16 argc, uint16 *argv) { - checkDomeSliders(29, 30); + checkDomeSliders(28, 29); } void RivenExternal::xgisland25_resetsliders(uint16 argc, uint16 *argv) { - resetDomeSliders(161, 16, 2); + resetDomeSliders(16, 2); } void RivenExternal::xgisland25_slidermd(uint16 argc, uint16 *argv) { - dragDomeSlider(161, 16, 29, 30, 2); + dragDomeSlider(16, 28, 29, 2); } void RivenExternal::xgisland25_slidermw(uint16 argc, uint16 *argv) { @@ -1056,7 +1082,7 @@ void RivenExternal::xgisland1490_domecheck(uint16 argc, uint16 *argv) { void RivenExternal::xgplateau3160_dopools(uint16 argc, uint16 *argv) { // Play the deactivation of a pool if one is active and a different one is activated - _vm->_gfx->changeCursor(kRivenHideCursor); + _vm->_cursor->setCursor(kRivenHideCursor); _vm->_video->playMovieBlocking(*_vm->getVar("glkbtns") * 2); } @@ -1264,11 +1290,11 @@ void RivenExternal::xjtunnel106_pictfix(uint16 argc, uint16 *argv) { void RivenExternal::xvga1300_carriage(uint16 argc, uint16 *argv) { // Run the gallows's carriage - _vm->_gfx->changeCursor(kRivenHideCursor); // Hide the cursor + _vm->_cursor->setCursor(kRivenHideCursor); // Hide the cursor _vm->_video->playMovieBlocking(1); // Play handle movie _vm->_gfx->scheduleTransition(15); // Set pan down transition _vm->changeToCard(_vm->matchRMAPToCard(0x18e77)); // Change to card facing up - _vm->_gfx->changeCursor(kRivenHideCursor); // Hide the cursor (again) + _vm->_cursor->setCursor(kRivenHideCursor); // Hide the cursor (again) _vm->_video->playMovieBlocking(4); // Play carriage beginning to drop _vm->_gfx->scheduleTransition(14); // Set pan up transition _vm->changeToCard(_vm->matchRMAPToCard(0x183a9)); // Change to card looking straight again @@ -1302,16 +1328,16 @@ void RivenExternal::xvga1300_carriage(uint16 argc, uint16 *argv) { _vm->_system->delayMillis(10); } - _vm->_gfx->changeCursor(kRivenHideCursor); // Hide the cursor + _vm->_cursor->setCursor(kRivenHideCursor); // Hide the cursor if (gotClick) { _vm->_gfx->scheduleTransition(16); // Schedule dissolve transition _vm->changeToCard(_vm->matchRMAPToCard(0x18d4d)); // Move forward - _vm->_gfx->changeCursor(kRivenHideCursor); // Hide the cursor + _vm->_cursor->setCursor(kRivenHideCursor); // Hide the cursor _vm->_system->delayMillis(500); // Delay a half second before changing again _vm->_gfx->scheduleTransition(12); // Schedule pan left transition _vm->changeToCard(_vm->matchRMAPToCard(0x18ab5)); // Turn right - _vm->_gfx->changeCursor(kRivenHideCursor); // Hide the cursor + _vm->_cursor->setCursor(kRivenHideCursor); // Hide the cursor _vm->_video->playMovieBlocking(1); // Play carriage ride movie _vm->changeToCard(_vm->matchRMAPToCard(0x17167)); // We have arrived at the top } else @@ -1319,11 +1345,11 @@ void RivenExternal::xvga1300_carriage(uint16 argc, uint16 *argv) { } void RivenExternal::xjdome25_resetsliders(uint16 argc, uint16 *argv) { - resetDomeSliders(_vm->getFeatures() & GF_DVD ? 547 : 548, 81, 2); + resetDomeSliders(81, 2); } void RivenExternal::xjdome25_slidermd(uint16 argc, uint16 *argv) { - dragDomeSlider(_vm->getFeatures() & GF_DVD ? 547: 548, 81, 29, 28, 2); + dragDomeSlider(81, 29, 28, 2); } void RivenExternal::xjdome25_slidermw(uint16 argc, uint16 *argv) { @@ -1344,7 +1370,7 @@ int RivenExternal::jspitElevatorLoop() { Common::Event event; int changeLevel = 0; - _vm->_gfx->changeCursor(kRivenClosedHandCursor); + _vm->_cursor->setCursor(kRivenClosedHandCursor); _vm->_system->updateScreen(); for (;;) { while (_vm->_system->getEventManager()->pollEvent(event)) { @@ -1360,7 +1386,7 @@ int RivenExternal::jspitElevatorLoop() { _vm->_system->updateScreen(); break; case Common::EVENT_LBUTTONUP: - _vm->_gfx->changeCursor(kRivenMainCursor); + _vm->_cursor->setCursor(kRivenMainCursor); _vm->_system->updateScreen(); return changeLevel; default: @@ -1502,7 +1528,7 @@ void RivenExternal::xorollcredittime(uint16 argc, uint16 *argv) { void RivenExternal::xbookclick(uint16 argc, uint16 *argv) { // Hide the cursor - _vm->_gfx->changeCursor(kRivenHideCursor); + _vm->_cursor->setCursor(kRivenHideCursor); // Let's hook onto our video VideoHandle video = _vm->_video->findVideoHandle(argv[0]); @@ -1542,9 +1568,9 @@ void RivenExternal::xbookclick(uint16 argc, uint16 *argv) { // Update our hotspot stuff if (hotspotRect.contains(_vm->_system->getEventManager()->getMousePos())) - _vm->_gfx->changeCursor(kRivenOpenHandCursor); + _vm->_cursor->setCursor(kRivenOpenHandCursor); else - _vm->_gfx->changeCursor(kRivenMainCursor); + _vm->_cursor->setCursor(kRivenMainCursor); // OK, Gehn has opened the trap book and has asked us to go in. Let's watch // and see what the player will do... @@ -1556,9 +1582,9 @@ void RivenExternal::xbookclick(uint16 argc, uint16 *argv) { switch (event.type) { case Common::EVENT_MOUSEMOVE: if (hotspotRect.contains(_vm->_system->getEventManager()->getMousePos())) - _vm->_gfx->changeCursor(kRivenOpenHandCursor); + _vm->_cursor->setCursor(kRivenOpenHandCursor); else - _vm->_gfx->changeCursor(kRivenMainCursor); + _vm->_cursor->setCursor(kRivenMainCursor); updateScreen = false; // Don't update twice, changing the cursor already updates the screen break; case Common::EVENT_LBUTTONUP: @@ -1566,7 +1592,7 @@ void RivenExternal::xbookclick(uint16 argc, uint16 *argv) { // OK, we've used the trap book! We go for ride lady! _vm->_scriptMan->stopAllScripts(); // Stop all running scripts (so we don't remain in the cage) _vm->_video->stopVideos(); // Stop all videos - _vm->_gfx->changeCursor(kRivenHideCursor); // Hide the cursor + _vm->_cursor->setCursor(kRivenHideCursor); // Hide the cursor _vm->_gfx->drawPLST(3); // Black out the screen _vm->_gfx->updateScreen(); // Update the screen _vm->_sound->playSound(0); // Play the link sound @@ -1595,7 +1621,7 @@ void RivenExternal::xbookclick(uint16 argc, uint16 *argv) { return; // Hide the cursor again - _vm->_gfx->changeCursor(kRivenHideCursor); + _vm->_cursor->setCursor(kRivenHideCursor); // 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. @@ -1692,7 +1718,7 @@ uint16 RivenExternal::getComboDigit(uint32 correctCombo, uint32 digit) { void RivenExternal::xgwatch(uint16 argc, uint16 *argv) { // Hide the cursor - _vm->_gfx->changeCursor(kRivenHideCursor); + _vm->_cursor->setCursor(kRivenHideCursor); uint32 *prisonCombo = _vm->getVar("pcorrectorder"); uint32 soundTime = _vm->_system->getMillis() - 500; // Start the first sound instantly @@ -1762,11 +1788,11 @@ void RivenExternal::xpisland25_opencard(uint16 argc, uint16 *argv) { } void RivenExternal::xpisland25_resetsliders(uint16 argc, uint16 *argv) { - resetDomeSliders(58, 10, 6); + resetDomeSliders(10, 6); } void RivenExternal::xpisland25_slidermd(uint16 argc, uint16 *argv) { - dragDomeSlider(58, 10, 31, 5, 6); + dragDomeSlider(10, 31, 5, 6); } void RivenExternal::xpisland25_slidermw(uint16 argc, uint16 *argv) { @@ -1853,7 +1879,7 @@ void RivenExternal::xtexterior300_telescopedown(uint16 argc, uint16 *argv) { } else { // ...the telescope can't move down anymore. // Play the sound of not being able to move - _vm->_gfx->changeCursor(kRivenHideCursor); + _vm->_cursor->setCursor(kRivenHideCursor); _vm->_sound->playSoundBlocking(13); } } else { @@ -1880,7 +1906,7 @@ void RivenExternal::xtexterior300_telescopeup(uint16 argc, uint16 *argv) { // Check if we can't move up anymore if (*telescopePos == 5) { // Play the sound of not being able to move - _vm->_gfx->changeCursor(kRivenHideCursor); + _vm->_cursor->setCursor(kRivenHideCursor); _vm->_sound->playSoundBlocking(13); return; } @@ -1988,7 +2014,7 @@ void RivenExternal::xt7500_checkmarbles(uint16 argc, uint16 *argv) { void RivenExternal::xt7600_setupmarbles(uint16 argc, uint16 *argv) { // Draw the small marbles when we're a step away from the waffle - uint16 baseBitmapId = (_vm->getFeatures() & GF_DVD) ? 539 : 526; + uint16 baseBitmapId = _vm->findResourceID(ID_TBMP, "*tsmallred"); bool waffleDown = *_vm->getVar("twaffle") != 0; // Note that each of the small marble images is exactly 4x2 @@ -2146,11 +2172,11 @@ void RivenExternal::xtisland5056_opencard(uint16 argc, uint16 *argv) { } void RivenExternal::xtisland5056_resetsliders(uint16 argc, uint16 *argv) { - resetDomeSliders(_vm->getFeatures() & GF_DVD ? 813 : 798, 37, 3); + resetDomeSliders(37, 3); } void RivenExternal::xtisland5056_slidermd(uint16 argc, uint16 *argv) { - dragDomeSlider(_vm->getFeatures() & GF_DVD ? 813 : 798, 37, 29, 30, 3); + dragDomeSlider(37, 29, 30, 3); } void RivenExternal::xtisland5056_slidermw(uint16 argc, uint16 *argv) { |