From 8a168f028bfdf084892abd623942a0c3f9f8de58 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 3 Sep 2010 19:13:58 +0000 Subject: MOHAWK: Improve support for the Riven Demo - The exit button now appears and is functional - The intro movies now play on start up - Add shortcuts for returning to the menu/playing the intro videos again - Make the text when hitting a boundary match the original - Change the wording of the browser button message - Note: The demo's extras.mhk (not the full game's!) is required now svn-id: r52509 --- engines/mohawk/graphics.cpp | 49 +++++++++++++---------- engines/mohawk/riven.cpp | 84 +++++++++++++++++++++++++-------------- engines/mohawk/riven.h | 1 + engines/mohawk/riven_external.cpp | 54 +++++++++++++++++++++---- engines/mohawk/riven_external.h | 2 + engines/mohawk/video.cpp | 8 ++-- 6 files changed, 137 insertions(+), 61 deletions(-) (limited to 'engines') diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp index 8a7caa9d2b..fb0bf86f42 100644 --- a/engines/mohawk/graphics.cpp +++ b/engines/mohawk/graphics.cpp @@ -597,28 +597,35 @@ void RivenGraphics::showInventory() { // Clear the inventory area clearInventoryArea(); - // The demo doesn't have the inventory system and we don't want - // to show the inventory on setup screens or in other journals. - if (_vm->getFeatures() & GF_DEMO || _vm->getCurStack() == aspit) - return; - - // There are three books and three vars. We have three different - // combinations. At the start you have just Atrus' journal. Later, - // you get Catherine's journal and the trap book. Near the end, - // you lose the trap book and have just the two journals. - - bool hasCathBook = *_vm->matchVarToString("acathbook") != 0; - bool hasTrapBook = *_vm->matchVarToString("atrapbook") != 0; - - if (!hasCathBook) { - drawInventoryImage(101, g_atrusJournalRect1); - } else if (!hasTrapBook) { - drawInventoryImage(101, g_atrusJournalRect2); - drawInventoryImage(102, g_cathJournalRect2); + // Draw the demo's exit button + if (_vm->getFeatures() & GF_DEMO) { + // extras.mhk tBMP 101 contains "EXIT" instead of Atrus' journal in the demo! + // The demo's extras.mhk contains all the other inventory/marble/credits image + // but has hacked tBMP 101 with "EXIT". *sigh* + drawInventoryImage(101, g_demoExitRect); } else { - drawInventoryImage(101, g_atrusJournalRect3); - drawInventoryImage(102, g_cathJournalRect3); - drawInventoryImage(100, g_trapBookRect3); + // We don't want to show the inventory on setup screens or in other journals. + if (_vm->getCurStack() == aspit) + return; + + // There are three books and three vars. We have three different + // combinations. At the start you have just Atrus' journal. Later, + // you get Catherine's journal and the trap book. Near the end, + // you lose the trap book and have just the two journals. + + bool hasCathBook = *_vm->matchVarToString("acathbook") != 0; + bool hasTrapBook = *_vm->matchVarToString("atrapbook") != 0; + + if (!hasCathBook) { + drawInventoryImage(101, g_atrusJournalRect1); + } else if (!hasTrapBook) { + drawInventoryImage(101, g_atrusJournalRect2); + drawInventoryImage(102, g_cathJournalRect2); + } else { + drawInventoryImage(101, g_atrusJournalRect3); + drawInventoryImage(102, g_cathJournalRect3); + drawInventoryImage(100, g_trapBookRect3); + } } _vm->_system->updateScreen(); diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 4c53f867d3..47ea728a53 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -44,6 +44,7 @@ Common::Rect *g_cathJournalRect2; Common::Rect *g_atrusJournalRect3; Common::Rect *g_cathJournalRect3; Common::Rect *g_trapBookRect3; +Common::Rect *g_demoExitRect; MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescription *gamedesc) : MohawkEngine(syst, gamedesc) { _showHotspots = false; @@ -73,6 +74,7 @@ MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescriptio g_atrusJournalRect3 = new Common::Rect(222, 402, 240, 426); g_cathJournalRect3 = new Common::Rect(291, 408, 311, 419); g_trapBookRect3 = new Common::Rect(363, 396, 386, 432); + g_demoExitRect = new Common::Rect(291, 408, 317, 419); } MohawkEngine_Riven::~MohawkEngine_Riven() { @@ -92,6 +94,7 @@ MohawkEngine_Riven::~MohawkEngine_Riven() { delete g_atrusJournalRect3; delete g_cathJournalRect3; delete g_trapBookRect3; + delete g_demoExitRect; } GUI::Debugger *MohawkEngine_Riven::getDebugger() { @@ -114,29 +117,33 @@ Common::Error MohawkEngine_Riven::run() { initVars(); - // Open extras.mhk for common images (non-existant in the demo) - if (!(getFeatures() & GF_DEMO)) { - _extrasFile = new MohawkArchive(); - _extrasFile->open("extras.mhk"); - } + // Open extras.mhk for common images + _extrasFile = new MohawkArchive(); + _extrasFile->open("extras.mhk"); // Start at main cursor _gfx->changeCursor(kRivenMainCursor); - // Load game from launcher/command line if requested - if (ConfMan.hasKey("save_slot") && !(getFeatures() & GF_DEMO)) { + // Let's begin, shall we? + if (getFeatures() & GF_DEMO) { + // Start the demo off with the videos + changeToStack(aspit); + changeToCard(6); + } else if (ConfMan.hasKey("save_slot")) { + // Load game from launcher/command line if requested uint32 gameToLoad = ConfMan.getInt("save_slot"); Common::StringArray savedGamesList = _saveLoad->generateSaveGameList(); if (gameToLoad > savedGamesList.size()) error ("Could not find saved game"); _saveLoad->loadGame(savedGamesList[gameToLoad]); - } else { // Otherwise, start us off at aspit's card 1 + } else { + // Otherwise, start us off at aspit's card 1 (the main menu) changeToStack(aspit); changeToCard(1); } Common::Event event; - while (!_gameOver) { + while (!_gameOver && !shouldQuit()) { bool needsUpdate = _gfx->runScheduledWaterEffects(); needsUpdate |= _video->updateBackgroundMovies(); @@ -145,11 +152,13 @@ Common::Error MohawkEngine_Riven::run() { case Common::EVENT_MOUSEMOVE: checkHotspotChange(); - // Check to show the inventory - if (_eventMan->getMousePos().y >= 392) - _gfx->showInventory(); - else - _gfx->hideInventory(); + if (!(getFeatures() & GF_DEMO)) { + // Check to show the inventory, but it is always "showing" in the demo + if (_eventMan->getMousePos().y >= 392) + _gfx->showInventory(); + else + _gfx->hideInventory(); + } needsUpdate = true; break; @@ -192,13 +201,22 @@ Common::Error MohawkEngine_Riven::run() { runDialog(*_optionsDialog); updateZipMode(); break; - case Common::KEYCODE_ESCAPE: - if (getFeatures() & GF_DEMO) { + case Common::KEYCODE_r: + // Return to the main menu in the demo on ctrl+r + if (event.kbd.flags & Common::KBD_CTRL && getFeatures() & GF_DEMO) { if (_curStack != aspit) changeToStack(aspit); changeToCard(1); } break; + case Common::KEYCODE_p: + // Play the intro videos in the demo on ctrl+p + if (event.kbd.flags & Common::KBD_CTRL && getFeatures() & GF_DEMO) { + if (_curStack != aspit) + changeToStack(aspit); + changeToCard(6); + } + break; default: break; } @@ -211,17 +229,6 @@ Common::Error MohawkEngine_Riven::run() { if (_curHotspot >= 0) runHotspotScript(_curHotspot, kMouseInsideScript); - if (shouldQuit()) { - if (_eventMan->shouldRTL() && (getFeatures() & GF_DEMO) && !(_curStack == aspit && _curCard == 12)) { - if (_curStack != aspit) - changeToStack(aspit); - changeToCard(12); - _eventMan->resetRTL(); - continue; - } - return Common::kNoError; - } - // Update the screen if we need to if (needsUpdate) _system->updateScreen(); @@ -471,8 +478,27 @@ void MohawkEngine_Riven::checkInventoryClick() { if (mousePos.y < 392) return; - // No inventory in the demo or opening screens. - if (getFeatures() & GF_DEMO || _curStack == aspit) + // In the demo, check if we've clicked the exit button + if (getFeatures() & GF_DEMO) { + if (g_demoExitRect->contains(mousePos)) { + if (_curStack == aspit && _curCard == 1) { + // From the main menu, go to the "quit" screen + changeToCard(12); + } else if (_curStack == aspit && _curCard == 12) { + // From the "quit" screen, just quit + _gameOver = true; + } else { + // Otherwise, return to the main menu + if (_curStack != aspit) + changeToStack(aspit); + changeToCard(1); + } + } + return; + } + + // No inventory shown on aspit + if (_curStack == aspit) return; // Set the return stack/card id's. diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h index d65dd7db05..98135bd861 100644 --- a/engines/mohawk/riven.h +++ b/engines/mohawk/riven.h @@ -74,6 +74,7 @@ extern Common::Rect *g_cathJournalRect2; extern Common::Rect *g_atrusJournalRect3; extern Common::Rect *g_cathJournalRect3; extern Common::Rect *g_trapBookRect3; +extern Common::Rect *g_demoExitRect; struct RivenHotspot { uint16 blstID; diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp index 8f5b947bb8..6d492df33a 100644 --- a/engines/mohawk/riven_external.cpp +++ b/engines/mohawk/riven_external.cpp @@ -68,6 +68,8 @@ void RivenExternal::setupCommands() { COMMAND(xadisablemenureturn); COMMAND(xaenablemenureturn); COMMAND(xalaunchbrowser); + COMMAND(xadisablemenuintro); + COMMAND(xaenablemenuintro); // bspit (Bookmaking Island) external commands COMMAND(xblabopenbook); @@ -204,8 +206,8 @@ void RivenExternal::runCommand(uint16 argc, uint16 *argv) { } void RivenExternal::runDemoBoundaryDialog() { - GUI::MessageDialog dialog("This demo does not allow you\n" - "to visit that part of Riven."); + GUI::MessageDialog dialog("Exploration beyond this point available only within the full version of\n" + "the game."); dialog.runModal(); } @@ -596,22 +598,60 @@ void RivenExternal::xarestoregame(uint16 argc, uint16 *argv) { } void RivenExternal::xadisablemenureturn(uint16 argc, uint16 *argv) { - // Dummy function -- implemented in Mohawk::go + // This function would normally enable the Windows menu item for + // returning to the main menu. Ctrl+r will do this instead. + // The original also had this shortcut. } void RivenExternal::xaenablemenureturn(uint16 argc, uint16 *argv) { - // Dummy function -- implemented in Mohawk::go + // This function would normally enable the Windows menu item for + // returning to the main menu. Ctrl+r will do this instead. + // The original also had this shortcut. } void RivenExternal::xalaunchbrowser(uint16 argc, uint16 *argv) { // Well, we can't launch a browser for obvious reasons ;) + // The original text is as follows (for reference): + + // If you have an auto-dial configured connection to the Internet, + // please select YES below. + // + // America Online and CompuServe users may experience difficulty. If + // you find that you are unable to connect, please quit the Riven + // Demo, launch your browser and type in the following URL: + // + // www.redorb.com/buyriven + // + // Would you like to attempt to make the connection? + // + // [YES] [NO] + GUI::MessageDialog dialog("At this point, the Riven Demo would\n" - "open up a web browser to bring you to\n" - "the Riven website. ScummVM cannot do\n" - "that. Visit the site on your own."); + "ask if you would like to open a web browser\n" + "to bring you to the Red Orb store to buy\n" + "the game. ScummVM cannot do that and\n" + "the site no longer exists."); dialog.runModal(); } +void RivenExternal::xadisablemenuintro(uint16 argc, uint16 *argv) { + // This function would normally enable the Windows menu item for + // playing the intro. Ctrl+p will play the intro movies instead. + // The original also had this shortcut. + + // Hide the "exit" button here + _vm->_gfx->hideInventory(); +} + +void RivenExternal::xaenablemenuintro(uint16 argc, uint16 *argv) { + // This function would normally enable the Windows menu item for + // playing the intro. Ctrl+p will play the intro movies instead. + // The original also had this shortcut. + + // Show the "exit" button here + _vm->_gfx->showInventory(); +} + // ------------------------------------------------------------------------------------ // bspit (Bookmaking Island) external commands // ------------------------------------------------------------------------------------ diff --git a/engines/mohawk/riven_external.h b/engines/mohawk/riven_external.h index 887520416e..da22e3bd81 100644 --- a/engines/mohawk/riven_external.h +++ b/engines/mohawk/riven_external.h @@ -95,6 +95,8 @@ private: void xadisablemenureturn(uint16 argc, uint16 *argv); void xaenablemenureturn(uint16 argc, uint16 *argv); void xalaunchbrowser(uint16 argc, uint16 *argv); + void xadisablemenuintro(uint16 argc, uint16 *argv); + void xaenablemenuintro(uint16 argc, uint16 *argv); // ----------------------------------------------------- // bspit (Boiler Island) external commands diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp index a266ebf518..b7ee4c8a2c 100644 --- a/engines/mohawk/video.cpp +++ b/engines/mohawk/video.cpp @@ -123,7 +123,7 @@ void VideoManager::waitUntilMovieEnds(VideoHandle videoHandle) { delete _videoStreams[videoHandle].video; _videoStreams[videoHandle].video = 0; - _videoStreams[videoHandle].id = 0; + _videoStreams[videoHandle].id = 0xffff; _videoStreams[videoHandle].filename.clear(); } @@ -156,7 +156,7 @@ bool VideoManager::updateBackgroundMovies() { } else { delete _videoStreams[i].video; _videoStreams[i].video = 0; - _videoStreams[i].id = 0; + _videoStreams[i].id = 0xffff; _videoStreams[i].filename.clear(); continue; } @@ -292,7 +292,7 @@ void VideoManager::stopMovie(uint16 id) { if (_mlstRecords[i].movieID == _videoStreams[j].id) { delete _videoStreams[j].video; _videoStreams[j].video = 0; - _videoStreams[j].id = 0; + _videoStreams[j].id = 0xffff; _videoStreams[j].filename.clear(); return; } @@ -368,7 +368,7 @@ VideoHandle VideoManager::createVideoHandle(Common::String filename, uint16 x, u entry.x = x; entry.y = y; entry.filename = filename; - entry.id = 0; + entry.id = 0xffff; entry.loop = loop; entry.enabled = true; -- cgit v1.2.3