From 05bed84a859589466e12c0a62311ce6959380d2b Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sun, 7 Aug 2016 11:26:43 +0200 Subject: MOHAWK: Rename the card and stack accessors --- engines/mohawk/console.cpp | 16 +-- engines/mohawk/riven.cpp | 6 +- engines/mohawk/riven.h | 4 +- engines/mohawk/riven_card.cpp | 4 +- engines/mohawk/riven_external.cpp | 274 +++++++++++++++++++------------------- engines/mohawk/riven_graphics.cpp | 4 +- engines/mohawk/riven_saveload.cpp | 4 +- engines/mohawk/riven_scripts.cpp | 38 +++--- engines/mohawk/riven_stack.cpp | 2 +- engines/mohawk/riven_vars.cpp | 2 +- 10 files changed, 177 insertions(+), 177 deletions(-) diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp index e28babdba3..417d9dd63f 100644 --- a/engines/mohawk/console.cpp +++ b/engines/mohawk/console.cpp @@ -412,7 +412,7 @@ bool RivenConsole::Cmd_ChangeCard(int argc, const char **argv) { } bool RivenConsole::Cmd_CurCard(int argc, const char **argv) { - debugPrintf("Current Card: %d\n", _vm->getCurCard()->getId()); + debugPrintf("Current Card: %d\n", _vm->getCard()->getId()); return true; } @@ -459,7 +459,7 @@ bool RivenConsole::Cmd_PlaySLST(int argc, const char **argv) { _vm->_sound->stopSound(); _vm->_sound->stopAllSLST(); - _vm->getCurCard()->playSound((uint16)atoi(argv[1])); + _vm->getCard()->playSound((uint16)atoi(argv[1])); return false; } @@ -472,7 +472,7 @@ bool RivenConsole::Cmd_StopSound(int argc, const char **argv) { } bool RivenConsole::Cmd_CurStack(int argc, const char **argv) { - debugPrintf("Current Stack: %s\n", _vm->getStackName(_vm->getCurStack()->getId()).c_str()); + debugPrintf("Current Stack: %s\n", _vm->getStackName(_vm->getStack()->getId()).c_str()); return true; } @@ -511,9 +511,9 @@ bool RivenConsole::Cmd_ChangeStack(int argc, const char **argv) { } bool RivenConsole::Cmd_Hotspots(int argc, const char **argv) { - Common::Array hotspots = _vm->getCurCard()->getHotspots(); + Common::Array hotspots = _vm->getCard()->getHotspots(); - debugPrintf("Current card (%d) has %d hotspots:\n", _vm->getCurCard()->getId(), hotspots.size()); + debugPrintf("Current card (%d) has %d hotspots:\n", _vm->getCard()->getId(), hotspots.size()); for (uint16 i = 0; i < hotspots.size(); i++) { RivenHotspot *hotspot = hotspots[i]; @@ -548,7 +548,7 @@ bool RivenConsole::Cmd_DumpScript(int argc, const char **argv) { return true; } - uint16 oldStack = _vm->getCurStack()->getId(); + uint16 oldStack = _vm->getStack()->getId(); uint newStack = kStackUnknown; for (uint i = kStackFirst; i <= kStackLast; i++) { @@ -630,8 +630,8 @@ bool RivenConsole::Cmd_ListZipCards(int argc, const char **argv) { } bool RivenConsole::Cmd_GetRMAP(int argc, const char **argv) { - uint32 rmapCode = _vm->getCurStack()->getCurrentCardGlobalId(); - debugPrintf("RMAP for %s %d = %08x\n", _vm->getStackName(_vm->getCurStack()->getId()).c_str(), _vm->getCurCard()->getId(), rmapCode); + uint32 rmapCode = _vm->getStack()->getCurrentCardGlobalId(); + debugPrintf("RMAP for %s %d = %08x\n", _vm->getStackName(_vm->getStack()->getId()).c_str(), _vm->getCard()->getId(), rmapCode); return true; } diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 9a60384498..8b7ee885ae 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -588,7 +588,7 @@ static void catherineIdleTimer(MohawkEngine_Riven *vm) { cathState = 1; // Play the movie, blocking - vm->_video->activateMLST(movie, vm->getCurCard()->getId()); + vm->_video->activateMLST(movie, vm->getCard()->getId()); vm->_cursor->hideCursor(); vm->_video->playMovieBlockingRiven(movie); vm->_cursor->showCursor(); @@ -722,7 +722,7 @@ static void sunnersBeachTimer(MohawkEngine_Riven *vm) { // Unlike the other cards' scripts which automatically // activate the MLST, we have to set it manually here. uint16 mlstID = vm->_rnd->getRandomNumberRng(3, 8); - vm->_video->activateMLST(mlstID, vm->getCurCard()->getId()); + vm->_video->activateMLST(mlstID, vm->getCard()->getId()); VideoHandle handle = vm->_video->playMovieRiven(mlstID); timerTime = handle->getDuration().msecs() + vm->_rnd->getRandomNumberRng(1, 30) * 1000; @@ -797,7 +797,7 @@ void MohawkEngine_Riven::checkSunnerAlertClick() { } void MohawkEngine_Riven::addZipVisitedCard(uint16 cardId, uint16 cardNameId) { - Common::String cardName = getCurStack()->getName(kCardNames, cardNameId); + Common::String cardName = getStack()->getName(kCardNames, cardNameId); if (cardName.empty()) return; ZipMode zip; diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h index 03788b5270..84b8f975b5 100644 --- a/engines/mohawk/riven.h +++ b/engines/mohawk/riven.h @@ -146,8 +146,8 @@ public: void changeToStack(uint16); void refreshCard(); Common::String getStackName(uint16 stack) const; - RivenCard *getCurCard() const { return _card; } - RivenStack *getCurStack() const { return _stack; } + RivenCard *getCard() const { return _card; } + RivenStack *getStack() const { return _stack; } // Hotspot functions/variables Common::Array _zipModeData; diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp index a5c64f262a..1395100294 100644 --- a/engines/mohawk/riven_card.cpp +++ b/engines/mohawk/riven_card.cpp @@ -262,7 +262,7 @@ Common::Array RivenCard::getHotspots() const { } RivenHotspot *RivenCard::getHotspotByName(const Common::String &name) const { - int16 nameId = _vm->getCurStack()->getIdFromName(kHotspotNames, name); + int16 nameId = _vm->getStack()->getIdFromName(kHotspotNames, name); for (uint i = 0; i < _hotspots.size(); i++) { if (_hotspots[i]->getNameId() == nameId) { @@ -510,7 +510,7 @@ Common::String RivenHotspot::getName() const { if (_nameResource < 0) return Common::String(); - return _vm->getCurStack()->getName(kHotspotNames, _nameResource); + return _vm->getStack()->getName(kHotspotNames, _nameResource); } uint16 RivenHotspot::getIndex() const { diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp index cf752d2f81..1a0f1e826e 100644 --- a/engines/mohawk/riven_external.cpp +++ b/engines/mohawk/riven_external.cpp @@ -199,7 +199,7 @@ void RivenExternal::setupCommands() { } void RivenExternal::runCommand(uint16 argc, uint16 *argv) { - Common::String externalCommandName = _vm->getCurStack()->getName(kExternalCommandNames, argv[0]); + Common::String externalCommandName = _vm->getStack()->getName(kExternalCommandNames, argv[0]); for (uint16 i = 0; i < _externalCommands.size(); i++) if (externalCommandName == _externalCommands[i]->desc) { @@ -314,8 +314,8 @@ void RivenExternal::resetDomeSliders(uint16 soundId, uint16 startHotspot) { } void RivenExternal::checkDomeSliders() { - RivenHotspot *resetSlidersHotspot = _vm->getCurCard()->getHotspotByName("ResetSliders"); - RivenHotspot *openDomeHotspot = _vm->getCurCard()->getHotspotByName("OpenDome"); + RivenHotspot *resetSlidersHotspot = _vm->getCard()->getHotspotByName("ResetSliders"); + RivenHotspot *openDomeHotspot = _vm->getCard()->getHotspotByName("OpenDome"); // Let's see if we're all matched up... if (_vm->_vars["adomecombo"] == _sliderState) { @@ -332,7 +332,7 @@ void RivenExternal::checkDomeSliders() { void RivenExternal::checkSliderCursorChange(uint16 startHotspot) { // Set the cursor based on _sliderState and what hotspot we're over for (uint16 i = 0; i < kDomeSliderSlotCount; i++) { - RivenHotspot *hotspot = _vm->getCurCard()->getHotspotByBlstId(startHotspot + i); + RivenHotspot *hotspot = _vm->getCard()->getHotspotByBlstId(startHotspot + i); if (hotspot->containsPoint(_vm->_system->getEventManager()->getMousePos())) { if (_sliderState & (1 << (24 - i))) _vm->_cursor->setCursor(kRivenOpenHandCursor); @@ -348,7 +348,7 @@ void RivenExternal::dragDomeSlider(uint16 soundId, uint16 startHotspot) { int16 foundSlider = -1; for (uint16 i = 0; i < kDomeSliderSlotCount; i++) { - RivenHotspot *hotspot = _vm->getCurCard()->getHotspotByBlstId(startHotspot + i); + RivenHotspot *hotspot = _vm->getCard()->getHotspotByBlstId(startHotspot + i); if (hotspot->containsPoint(_vm->_system->getEventManager()->getMousePos())) { // If the slider is not at this hotspot, we can't do anything else if (!(_sliderState & (1 << (24 - i)))) @@ -374,7 +374,7 @@ void RivenExternal::dragDomeSlider(uint16 soundId, uint16 startHotspot) { switch (event.type) { case Common::EVENT_MOUSEMOVE: if (foundSlider < 24 && !(_sliderState & (1 << (23 - foundSlider)))) { - RivenHotspot *nextHotspot = _vm->getCurCard()->getHotspotByBlstId(startHotspot + foundSlider + 1); + RivenHotspot *nextHotspot = _vm->getCard()->getHotspotByBlstId(startHotspot + foundSlider + 1); if (nextHotspot->containsPoint(event.mouse)) { // We've moved the slider right one space _sliderState &= ~(_sliderState & (1 << (24 - foundSlider))); @@ -386,7 +386,7 @@ void RivenExternal::dragDomeSlider(uint16 soundId, uint16 startHotspot) { drawDomeSliders(startHotspot); } } else if (foundSlider > 0 && !(_sliderState & (1 << (25 - foundSlider)))) { - RivenHotspot *previousHotspot = _vm->getCurCard()->getHotspotByBlstId(startHotspot + foundSlider - 1); + RivenHotspot *previousHotspot = _vm->getCard()->getHotspotByBlstId(startHotspot + foundSlider - 1); if (previousHotspot->containsPoint(event.mouse)) { // We've moved the slider left one space _sliderState &= ~(_sliderState & (1 << (24 - foundSlider))); @@ -419,14 +419,14 @@ void RivenExternal::drawDomeSliders(uint16 startHotspot) { // On pspit, the rect is different by two pixels // (alternatively, we could just use hotspot 3 here, but only on pspit is there a hotspot for this) - if (_vm->getCurStack()->getId() == kStackPspit) + if (_vm->getStack()->getId() == kStackPspit) dstAreaRect.translate(-2, 0); // Find out bitmap id uint16 bitmapId = _vm->findResourceID(ID_TBMP, "*sliders*"); for (uint16 i = 0; i < kDomeSliderSlotCount; i++) { - RivenHotspot *hotspot = _vm->getCurCard()->getHotspotByBlstId(startHotspot + i); + RivenHotspot *hotspot = _vm->getCard()->getHotspotByBlstId(startHotspot + i); Common::Rect srcRect = hotspot->getRect(); srcRect.translate(-dstAreaRect.left, -dstAreaRect.top); // Adjust the rect so it's in the destination area @@ -463,9 +463,9 @@ void RivenExternal::xaatrusopenbook(uint16 argc, uint16 *argv) { uint32 &page = _vm->_vars["aatruspage"]; // Set hotspots depending on the page - RivenHotspot *openBook = _vm->getCurCard()->getHotspotByName("openBook"); - RivenHotspot *nextPage = _vm->getCurCard()->getHotspotByName("nextpage"); - RivenHotspot *prevPage = _vm->getCurCard()->getHotspotByName("prevpage"); + RivenHotspot *openBook = _vm->getCard()->getHotspotByName("openBook"); + RivenHotspot *nextPage = _vm->getCard()->getHotspotByName("nextpage"); + RivenHotspot *prevPage = _vm->getCard()->getHotspotByName("prevpage"); if (page == 1) { prevPage->enable(false); nextPage->enable(false); @@ -477,7 +477,7 @@ void RivenExternal::xaatrusopenbook(uint16 argc, uint16 *argv) { } // Draw the image of the page - _vm->getCurCard()->drawPicture(page); + _vm->getCard()->drawPicture(page); } void RivenExternal::xaatrusbookback(uint16 argc, uint16 *argv) { @@ -503,7 +503,7 @@ void RivenExternal::xaatrusbookprevpage(uint16 argc, uint16 *argv) { // Now update the screen :) _vm->_gfx->scheduleTransition(1); - _vm->getCurCard()->drawPicture(page); + _vm->getCard()->drawPicture(page); } void RivenExternal::xaatrusbooknextpage(uint16 argc, uint16 *argv) { @@ -523,7 +523,7 @@ void RivenExternal::xaatrusbooknextpage(uint16 argc, uint16 *argv) { // Now update the screen :) _vm->_gfx->scheduleTransition(0); - _vm->getCurCard()->drawPicture(page); + _vm->getCard()->drawPicture(page); } void RivenExternal::xacathopenbook(uint16 argc, uint16 *argv) { @@ -531,9 +531,9 @@ void RivenExternal::xacathopenbook(uint16 argc, uint16 *argv) { uint32 page = _vm->_vars["acathpage"]; // Set hotspots depending on the page - RivenHotspot *openBook = _vm->getCurCard()->getHotspotByName("openBook"); - RivenHotspot *nextPage = _vm->getCurCard()->getHotspotByName("nextpage"); - RivenHotspot *prevPage = _vm->getCurCard()->getHotspotByName("prevpage"); + RivenHotspot *openBook = _vm->getCard()->getHotspotByName("openBook"); + RivenHotspot *nextPage = _vm->getCard()->getHotspotByName("nextpage"); + RivenHotspot *prevPage = _vm->getCard()->getHotspotByName("prevpage"); if (page == 1) { prevPage->enable(false); nextPage->enable(false); @@ -545,13 +545,13 @@ void RivenExternal::xacathopenbook(uint16 argc, uint16 *argv) { } // Draw the image of the page - _vm->getCurCard()->drawPicture(page); + _vm->getCard()->drawPicture(page); // Draw the white page edges if (page > 1 && page < 5) - _vm->getCurCard()->drawPicture(50); + _vm->getCard()->drawPicture(50); else if (page > 5) - _vm->getCurCard()->drawPicture(51); + _vm->getCard()->drawPicture(51); if (page == 28) { // Draw the telescope combination @@ -592,7 +592,7 @@ void RivenExternal::xacathbookprevpage(uint16 argc, uint16 *argv) { // Now update the screen :) _vm->_gfx->scheduleTransition(3); - _vm->getCurCard()->drawPicture(page); + _vm->getCard()->drawPicture(page); } void RivenExternal::xacathbooknextpage(uint16 argc, uint16 *argv) { @@ -609,7 +609,7 @@ void RivenExternal::xacathbooknextpage(uint16 argc, uint16 *argv) { // Now update the screen :) _vm->_gfx->scheduleTransition(2); - _vm->getCurCard()->drawPicture(page); + _vm->getCard()->drawPicture(page); } void RivenExternal::xtrapbookback(uint16 argc, uint16 *argv) { @@ -728,7 +728,7 @@ void RivenExternal::xblabopenbook(uint16 argc, uint16 *argv) { uint32 page = _vm->_vars["blabpage"]; // Draw the image of the page based on the blabbook variable - _vm->getCurCard()->drawPicture(page); + _vm->getCard()->drawPicture(page); if (page == 14) { // Draw the dome combination @@ -769,7 +769,7 @@ void RivenExternal::xblabbookprevpage(uint16 argc, uint16 *argv) { // Now update the screen :) _vm->_gfx->scheduleTransition(1); - _vm->getCurCard()->drawPicture(page); + _vm->getCard()->drawPicture(page); } void RivenExternal::xblabbooknextpage(uint16 argc, uint16 *argv) { @@ -786,16 +786,16 @@ void RivenExternal::xblabbooknextpage(uint16 argc, uint16 *argv) { // Now update the screen :) _vm->_gfx->scheduleTransition(0); - _vm->getCurCard()->drawPicture(page); + _vm->getCard()->drawPicture(page); } void RivenExternal::xsoundplug(uint16 argc, uint16 *argv) { if (_vm->_vars["bheat"] != 0) - _vm->getCurCard()->playSound(1); + _vm->getCard()->playSound(1); else if (_vm->_vars["bcratergg"] != 0) - _vm->getCurCard()->playSound(2); + _vm->getCard()->playSound(2); else - _vm->getCurCard()->playSound(3); + _vm->getCard()->playSound(3); } void RivenExternal::xbchangeboiler(uint16 argc, uint16 *argv) { @@ -810,60 +810,60 @@ void RivenExternal::xbchangeboiler(uint16 argc, uint16 *argv) { // Water is filling/draining from the boiler if (water == 0) { if (platform == 1) - _vm->_video->activateMLST(12, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(12, _vm->getCard()->getId()); else - _vm->_video->activateMLST(10, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(10, _vm->getCard()->getId()); } else if (heat == 1) { if (platform == 1) - _vm->_video->activateMLST(22, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(22, _vm->getCard()->getId()); else - _vm->_video->activateMLST(19, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(19, _vm->getCard()->getId()); } else { if (platform == 1) - _vm->_video->activateMLST(16, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(16, _vm->getCard()->getId()); else - _vm->_video->activateMLST(13, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(13, _vm->getCard()->getId()); } } else if (argv[0] == 2 && water != 0) { if (heat == 1) { // Turning on the heat if (platform == 1) - _vm->_video->activateMLST(23, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(23, _vm->getCard()->getId()); else - _vm->_video->activateMLST(20, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(20, _vm->getCard()->getId()); } else { // Turning off the heat if (platform == 1) - _vm->_video->activateMLST(18, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(18, _vm->getCard()->getId()); else - _vm->_video->activateMLST(15, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(15, _vm->getCard()->getId()); } } else if (argv[0] == 3) { if (platform == 1) { // Lowering the platform if (water == 1) { if (heat == 1) - _vm->_video->activateMLST(24, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(24, _vm->getCard()->getId()); else - _vm->_video->activateMLST(17, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(17, _vm->getCard()->getId()); } else - _vm->_video->activateMLST(11, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(11, _vm->getCard()->getId()); } else { // Raising the platform if (water == 1) { if (heat == 1) - _vm->_video->activateMLST(21, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(21, _vm->getCard()->getId()); else - _vm->_video->activateMLST(14, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(14, _vm->getCard()->getId()); } else - _vm->_video->activateMLST(9, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(9, _vm->getCard()->getId()); } } if (argc > 1) - _vm->getCurCard()->playSound(argv[1]); + _vm->getCard()->playSound(argv[1]); else if (argv[0] == 2) - _vm->getCurCard()->playSound(1); + _vm->getCard()->playSound(1); _vm->_cursor->setCursor(kRivenHideCursor); _vm->_video->playMovieBlockingRiven(11); @@ -872,10 +872,10 @@ void RivenExternal::xbchangeboiler(uint16 argc, uint16 *argv) { void RivenExternal::xbupdateboiler(uint16 argc, uint16 *argv) { if (_vm->_vars["bheat"] != 0) { if (_vm->_vars["bblrgrt"] == 0) { - _vm->_video->activateMLST(8, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(8, _vm->getCard()->getId()); _vm->_video->playMovieRiven(8); } else { - _vm->_video->activateMLST(7, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(7, _vm->getCard()->getId()); _vm->_video->playMovieRiven(7); } } else { @@ -966,13 +966,13 @@ void RivenExternal::xbait(uint16 argc, uint16 *argv) { _vm->_cursor->setCursor(kRivenMainCursor); _vm->_system->updateScreen(); - RivenHotspot *bait = _vm->getCurCard()->getHotspotByBlstId(9); - RivenHotspot *baitPlate = _vm->getCurCard()->getHotspotByBlstId(16); + RivenHotspot *bait = _vm->getCard()->getHotspotByBlstId(9); + RivenHotspot *baitPlate = _vm->getCard()->getHotspotByBlstId(16); // Set the bait if we put it on the plate if (baitPlate->containsPoint(_vm->_system->getEventManager()->getMousePos())) { _vm->_vars["bbait"] = 1; - _vm->getCurCard()->drawPicture(4); + _vm->getCard()->drawPicture(4); bait->enable(false); // Disable bait hotspot baitPlate->enable(true); // Enable baitplate hotspot @@ -996,18 +996,18 @@ void RivenExternal::xbfreeytram(uint16 argc, uint16 *argv) { } // Activate the MLST and play the video - _vm->_video->activateMLST(mlstId, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(mlstId, _vm->getCard()->getId()); _vm->_video->playMovieBlockingRiven(11); // Now play the second movie - _vm->_video->activateMLST(mlstId + 5, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(mlstId + 5, _vm->getCard()->getId()); _vm->_video->playMovieBlockingRiven(12); } void RivenExternal::xbaitplate(uint16 argc, uint16 *argv) { // Remove the pellet from the plate and put it in your hand _vm->_cursor->setCursor(kRivenPelletCursor); - _vm->getCurCard()->drawPicture(3); + _vm->getCard()->drawPicture(3); // Loop until the player lets go (or quits) Common::Event event; @@ -1029,13 +1029,13 @@ void RivenExternal::xbaitplate(uint16 argc, uint16 *argv) { _vm->_cursor->setCursor(kRivenMainCursor); _vm->_system->updateScreen(); - RivenHotspot *bait = _vm->getCurCard()->getHotspotByBlstId(9); - RivenHotspot *baitPlate = _vm->getCurCard()->getHotspotByBlstId(16); + RivenHotspot *bait = _vm->getCard()->getHotspotByBlstId(9); + RivenHotspot *baitPlate = _vm->getCard()->getHotspotByBlstId(16); // Set the bait if we put it on the plate, remove otherwise if (baitPlate->containsPoint(_vm->_system->getEventManager()->getMousePos())) { _vm->_vars["bbait"] = 1; - _vm->getCurCard()->drawPicture(4); + _vm->getCard()->drawPicture(4); bait->enable(false); // Disable bait hotspot baitPlate->enable(true); // Enable baitplate hotspot } else { @@ -1219,7 +1219,7 @@ void RivenExternal::xgrotatepins(uint16 argc, uint16 *argv) { void RivenExternal::xgpincontrols(uint16 argc, uint16 *argv) { // Handle a click on a section of an island - RivenHotspot *panel = _vm->getCurCard()->getHotspotByBlstId(13); + RivenHotspot *panel = _vm->getCard()->getHotspotByBlstId(13); // Get our mouse position and adjust it to the beginning of the hotspot Common::Point mousePos = _vm->_system->getEventManager()->getMousePos(); @@ -1369,7 +1369,7 @@ void RivenExternal::xgrviewer(uint16 argc, uint16 *argv) { } // Calculate how much we're moving - Common::String buttonName = _vm->getCurCard()->getCurHotspot()->getName(); + Common::String buttonName = _vm->getCard()->getCurHotspot()->getName(); uint32 buttonPos = buttonName.lastChar() - '0'; uint32 &curPos = _vm->_vars["grviewpos"]; @@ -1410,19 +1410,19 @@ void RivenExternal::xgplaywhark(uint16 argc, uint16 *argv) { // Activate the correct video based on the amount of times we've been visited switch (wharkVisits) { case 1: - _vm->_video->activateMLST(3, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(3, _vm->getCard()->getId()); break; case 2: // One of two random videos - _vm->_video->activateMLST(4 + _vm->_rnd->getRandomBit(), _vm->getCurCard()->getId()); + _vm->_video->activateMLST(4 + _vm->_rnd->getRandomBit(), _vm->getCard()->getId()); break; case 3: // One of two random videos - _vm->_video->activateMLST(6 + _vm->_rnd->getRandomBit(), _vm->getCurCard()->getId()); + _vm->_video->activateMLST(6 + _vm->_rnd->getRandomBit(), _vm->getCard()->getId()); break; case 4: // Red alert! Shields online! Brace yourself for impact! - _vm->_video->activateMLST(8, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(8, _vm->getCard()->getId()); break; } @@ -1440,7 +1440,7 @@ void RivenExternal::xglviewer(uint16 argc, uint16 *argv) { // (It shows the village from the middle of the lake) // Calculate how much we're moving - Common::String buttonName = _vm->getCurCard()->getCurHotspot()->getName(); + Common::String buttonName = _vm->getCard()->getCurHotspot()->getName(); uint32 buttonPos = buttonName.lastChar() - '0'; uint32 &curPos = _vm->_vars["glviewpos"]; @@ -1456,19 +1456,19 @@ void RivenExternal::xglviewer(uint16 argc, uint16 *argv) { curPos = newPos % 6; // Clip it to 0-5 // And update the screen with the new image - _vm->getCurCard()->drawPicture(curPos + 2); + _vm->getCard()->drawPicture(curPos + 2); } void RivenExternal::xglview_villageon(uint16 argc, uint16 *argv) { // Turn on the left viewer to 'village mode' _vm->_vars["glview"] = 2; - _vm->getCurCard()->drawPicture(_vm->_vars["glviewpos"] + 2); + _vm->getCard()->drawPicture(_vm->_vars["glviewpos"] + 2); } void RivenExternal::xglview_villageoff(uint16 argc, uint16 *argv) { // Turn off the left viewer when in 'village mode' (why is this external?) _vm->_vars["glview"] = 0; - _vm->getCurCard()->drawPicture(1); + _vm->getCard()->drawPicture(1); } static void catherineViewerIdleTimer(MohawkEngine_Riven *vm) { @@ -1496,7 +1496,7 @@ static void catherineViewerIdleTimer(MohawkEngine_Riven *vm) { cathState = 3; // Begin playing the new movie - vm->_video->activateMLST(movie, vm->getCurCard()->getId()); + vm->_video->activateMLST(movie, vm->getCard()->getId()); VideoHandle videoHandle = vm->_video->playMovieRiven(30); // Reset the timer @@ -1537,14 +1537,14 @@ void RivenExternal::xglview_prisonon(uint16 argc, uint16 *argv) { // Begin playing a movie immediately if Catherine is already in the viewer if (cathMovie == 8 || (cathMovie >= 13 && cathMovie <= 16)) { - _vm->_video->activateMLST(cathMovie, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(cathMovie, _vm->getCard()->getId()); VideoHandle videoHandle = _vm->_video->playMovieRiven(30); timeUntilNextMovie = videoHandle->getDuration().msecs() + _vm->_rnd->getRandomNumber(60) * 1000; } else { // Otherwise, just redraw the imager timeUntilNextMovie = _vm->_rnd->getRandomNumberRng(10, 20) * 1000; - _vm->getCurCard()->drawPicture(8); + _vm->getCard()->drawPicture(8); } // Create the timer for the next video @@ -1567,7 +1567,7 @@ void RivenExternal::xglview_prisonoff(uint16 argc, uint16 *argv) { _vm->_cursor->showCursor(); // Redraw the viewer - _vm->getCurCard()->drawPicture(1); + _vm->getCard()->drawPicture(1); } // ------------------------------------------------------------------------------------ @@ -1645,19 +1645,19 @@ void RivenExternal::xjtunnel103_pictfix(uint16 argc, uint16 *argv) { // Now, draw which icons are depressed based on the bits of the variable if (iconsDepressed & (1 << 0)) - _vm->getCurCard()->drawPicture(2); + _vm->getCard()->drawPicture(2); if (iconsDepressed & (1 << 1)) - _vm->getCurCard()->drawPicture(3); + _vm->getCard()->drawPicture(3); if (iconsDepressed & (1 << 2)) - _vm->getCurCard()->drawPicture(4); + _vm->getCard()->drawPicture(4); if (iconsDepressed & (1 << 3)) - _vm->getCurCard()->drawPicture(5); + _vm->getCard()->drawPicture(5); if (iconsDepressed & (1 << 22)) - _vm->getCurCard()->drawPicture(6); + _vm->getCard()->drawPicture(6); if (iconsDepressed & (1 << 23)) - _vm->getCurCard()->drawPicture(7); + _vm->getCard()->drawPicture(7); if (iconsDepressed & (1 << 24)) - _vm->getCurCard()->drawPicture(8); + _vm->getCard()->drawPicture(8); } void RivenExternal::xjtunnel104_pictfix(uint16 argc, uint16 *argv) { @@ -1666,21 +1666,21 @@ void RivenExternal::xjtunnel104_pictfix(uint16 argc, uint16 *argv) { // Now, draw which icons are depressed based on the bits of the variable if (iconsDepressed & (1 << 9)) - _vm->getCurCard()->drawPicture(2); + _vm->getCard()->drawPicture(2); if (iconsDepressed & (1 << 10)) - _vm->getCurCard()->drawPicture(3); + _vm->getCard()->drawPicture(3); if (iconsDepressed & (1 << 11)) - _vm->getCurCard()->drawPicture(4); + _vm->getCard()->drawPicture(4); if (iconsDepressed & (1 << 12)) - _vm->getCurCard()->drawPicture(5); + _vm->getCard()->drawPicture(5); if (iconsDepressed & (1 << 13)) - _vm->getCurCard()->drawPicture(6); + _vm->getCard()->drawPicture(6); if (iconsDepressed & (1 << 14)) - _vm->getCurCard()->drawPicture(7); + _vm->getCard()->drawPicture(7); if (iconsDepressed & (1 << 15)) - _vm->getCurCard()->drawPicture(8); + _vm->getCard()->drawPicture(8); if (iconsDepressed & (1 << 16)) - _vm->getCurCard()->drawPicture(9); + _vm->getCard()->drawPicture(9); } void RivenExternal::xjtunnel105_pictfix(uint16 argc, uint16 *argv) { @@ -1689,19 +1689,19 @@ void RivenExternal::xjtunnel105_pictfix(uint16 argc, uint16 *argv) { // Now, draw which icons are depressed based on the bits of the variable if (iconsDepressed & (1 << 3)) - _vm->getCurCard()->drawPicture(2); + _vm->getCard()->drawPicture(2); if (iconsDepressed & (1 << 4)) - _vm->getCurCard()->drawPicture(3); + _vm->getCard()->drawPicture(3); if (iconsDepressed & (1 << 5)) - _vm->getCurCard()->drawPicture(4); + _vm->getCard()->drawPicture(4); if (iconsDepressed & (1 << 6)) - _vm->getCurCard()->drawPicture(5); + _vm->getCard()->drawPicture(5); if (iconsDepressed & (1 << 7)) - _vm->getCurCard()->drawPicture(6); + _vm->getCard()->drawPicture(6); if (iconsDepressed & (1 << 8)) - _vm->getCurCard()->drawPicture(7); + _vm->getCard()->drawPicture(7); if (iconsDepressed & (1 << 9)) - _vm->getCurCard()->drawPicture(8); + _vm->getCard()->drawPicture(8); } void RivenExternal::xjtunnel106_pictfix(uint16 argc, uint16 *argv) { @@ -1710,21 +1710,21 @@ void RivenExternal::xjtunnel106_pictfix(uint16 argc, uint16 *argv) { // Now, draw which icons are depressed based on the bits of the variable if (iconsDepressed & (1 << 16)) - _vm->getCurCard()->drawPicture(2); + _vm->getCard()->drawPicture(2); if (iconsDepressed & (1 << 17)) - _vm->getCurCard()->drawPicture(3); + _vm->getCard()->drawPicture(3); if (iconsDepressed & (1 << 18)) - _vm->getCurCard()->drawPicture(4); + _vm->getCard()->drawPicture(4); if (iconsDepressed & (1 << 19)) - _vm->getCurCard()->drawPicture(5); + _vm->getCard()->drawPicture(5); if (iconsDepressed & (1 << 20)) - _vm->getCurCard()->drawPicture(6); + _vm->getCard()->drawPicture(6); if (iconsDepressed & (1 << 21)) - _vm->getCurCard()->drawPicture(7); + _vm->getCard()->drawPicture(7); if (iconsDepressed & (1 << 22)) - _vm->getCurCard()->drawPicture(8); + _vm->getCard()->drawPicture(8); if (iconsDepressed & (1 << 23)) - _vm->getCurCard()->drawPicture(9); + _vm->getCard()->drawPicture(9); } void RivenExternal::xvga1300_carriage(uint16 argc, uint16 *argv) { @@ -1734,12 +1734,12 @@ void RivenExternal::xvga1300_carriage(uint16 argc, uint16 *argv) { _vm->_system->updateScreen(); // Update _vm->_video->playMovieBlockingRiven(1); // Play handle movie _vm->_gfx->scheduleTransition(15); // Set pan down transition - _vm->changeToCard(_vm->getCurStack()->getCardStackId(0x18e77)); // Change to card facing up + _vm->changeToCard(_vm->getStack()->getCardStackId(0x18e77)); // Change to card facing up _vm->_cursor->setCursor(kRivenHideCursor); // Hide the cursor (again) _vm->_system->updateScreen(); // Update _vm->_video->playMovieBlockingRiven(4); // Play carriage beginning to drop _vm->_gfx->scheduleTransition(14); // Set pan up transition - _vm->changeToCard(_vm->getCurStack()->getCardStackId(0x183a9)); // Change to card looking straight again + _vm->changeToCard(_vm->getStack()->getCardStackId(0x183a9)); // Change to card looking straight again _vm->_video->playMovieBlockingRiven(2); if (_vm->_vars["jgallows"] == 1) { @@ -1774,16 +1774,16 @@ void RivenExternal::xvga1300_carriage(uint16 argc, uint16 *argv) { if (gotClick) { _vm->_gfx->scheduleTransition(16); // Schedule dissolve transition - _vm->changeToCard(_vm->getCurStack()->getCardStackId(0x18d4d)); // Move forward + _vm->changeToCard(_vm->getStack()->getCardStackId(0x18d4d)); // Move forward _vm->_cursor->setCursor(kRivenHideCursor); // Hide the cursor _vm->_system->updateScreen(); // Update _vm->_system->delayMillis(500); // Delay a half second before changing again _vm->_gfx->scheduleTransition(12); // Schedule pan left transition - _vm->changeToCard(_vm->getCurStack()->getCardStackId(0x18ab5)); // Turn right + _vm->changeToCard(_vm->getStack()->getCardStackId(0x18ab5)); // Turn right _vm->_cursor->setCursor(kRivenHideCursor); // Hide the cursor _vm->_system->updateScreen(); // Update _vm->_video->playMovieBlockingRiven(1); // Play carriage ride movie - _vm->changeToCard(_vm->getCurStack()->getCardStackId(0x17167)); // We have arrived at the top + _vm->changeToCard(_vm->getStack()->getCardStackId(0x17167)); // We have arrived at the top } else _vm->_video->playMovieBlockingRiven(3); // Too slow! } @@ -1849,7 +1849,7 @@ void RivenExternal::xhandlecontrolup(uint16 argc, uint16 *argv) { if (changeLevel == -1) { _vm->_video->playMovieBlockingRiven(1); _vm->_video->playMovieBlockingRiven(2); - _vm->changeToCard(_vm->getCurStack()->getCardStackId(0x1e374)); + _vm->changeToCard(_vm->getStack()->getCardStackId(0x1e374)); } } @@ -1860,7 +1860,7 @@ void RivenExternal::xhandlecontroldown(uint16 argc, uint16 *argv) { if (changeLevel == 1) { _vm->_video->playMovieBlockingRiven(1); _vm->_video->playMovieBlockingRiven(2); - _vm->changeToCard(_vm->getCurStack()->getCardStackId(0x1e374)); + _vm->changeToCard(_vm->getStack()->getCardStackId(0x1e374)); } } @@ -1887,10 +1887,10 @@ void RivenExternal::xhandlecontrolmid(uint16 argc, uint16 *argv) { // Play the elevator video and then change the card if (changeLevel == 1) { _vm->_video->playMovieBlockingRiven(5); - _vm->changeToCard(_vm->getCurStack()->getCardStackId(0x1e597)); + _vm->changeToCard(_vm->getStack()->getCardStackId(0x1e597)); } else { _vm->_video->playMovieBlockingRiven(4); - _vm->changeToCard(_vm->getCurStack()->getCardStackId(0x1e29c)); + _vm->changeToCard(_vm->getStack()->getCardStackId(0x1e29c)); } } @@ -1972,8 +1972,8 @@ void RivenExternal::xjschool280_resetright(uint16 argc, uint16 *argv) { void RivenExternal::redrawWharkNumberPuzzle(uint16 overlay, uint16 number) { // Update the screen for the whark number puzzle // We don't update the whole screen here because we don't want to overwrite the video data - _vm->getCurCard()->drawPicture(overlay); - _vm->getCurCard()->drawPicture(number + 1); + _vm->getCard()->drawPicture(overlay); + _vm->getCard()->drawPicture(number + 1); _vm->_gfx->updateScreen(Common::Rect(80, 212, 477, 392)); _vm->_system->updateScreen(); } @@ -2028,8 +2028,8 @@ void RivenExternal::xschool280_playwhark(uint16 argc, uint16 *argv) { } // Enable the correct hotspots for the movement now - RivenHotspot *rotateLeft = _vm->getCurCard()->getHotspotByName("rotateLeft"); - RivenHotspot *rotateRight = _vm->getCurCard()->getHotspotByName("rotateRight"); + RivenHotspot *rotateLeft = _vm->getCard()->getHotspotByName("rotateLeft"); + RivenHotspot *rotateRight = _vm->getCard()->getHotspotByName("rotateRight"); rotateLeft->enable(!rotateLeft->isEnabled()); rotateRight->enable(!rotateRight->isEnabled()); @@ -2082,7 +2082,7 @@ void RivenExternal::xbookclick(uint16 argc, uint16 *argv) { // Track down our hotspot Common::String hotspotName = Common::String::format("touchBook%d", argv[3]); - RivenHotspot *hotspot = _vm->getCurCard()->getHotspotByName(hotspotName); + RivenHotspot *hotspot = _vm->getCard()->getHotspotByName(hotspotName); Common::Rect hotspotRect = hotspot->getRect(); debug(0, "xbookclick:"); @@ -2136,14 +2136,14 @@ void RivenExternal::xbookclick(uint16 argc, uint16 *argv) { _vm->_scriptMan->stopAllScripts(); // Stop all running scripts (so we don't remain in the cage) _vm->_video->stopVideos(); // Stop all videos _vm->_cursor->setCursor(kRivenHideCursor); // Hide the cursor - _vm->getCurCard()->drawPicture(3); // Black out the screen + _vm->getCard()->drawPicture(3); // Black out the screen _vm->_sound->playSound(0); // Play the link sound - _vm->_video->activateMLST(7, _vm->getCurCard()->getId()); // Activate Gehn Link Video + _vm->_video->activateMLST(7, _vm->getCard()->getId()); // Activate Gehn Link Video _vm->_video->playMovieBlockingRiven(1); // Play Gehn Link Video _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->changeToCard(_vm->getCurStack()->getCardStackId(0x2885)); // Link out! + _vm->changeToCard(_vm->getStack()->getCardStackId(0x2885)); // Link out! return; } break; @@ -2192,9 +2192,9 @@ void RivenExternal::xooffice30_closebook(uint16 argc, uint16 *argv) { _vm->_video->playMovieBlockingRiven(1); // Set the hotspots into their correct states - RivenHotspot *closeBook = _vm->getCurCard()->getHotspotByName("closeBook"); - RivenHotspot *nullHotspot = _vm->getCurCard()->getHotspotByName("null"); - RivenHotspot *openBook = _vm->getCurCard()->getHotspotByName("openBook"); + RivenHotspot *closeBook = _vm->getCard()->getHotspotByName("closeBook"); + RivenHotspot *nullHotspot = _vm->getCard()->getHotspotByName("null"); + RivenHotspot *openBook = _vm->getCard()->getHotspotByName("openBook"); closeBook->enable(false); nullHotspot->enable(false); @@ -2212,7 +2212,7 @@ void RivenExternal::xobedroom5_closedrawer(uint16 argc, uint16 *argv) { } void RivenExternal::xogehnopenbook(uint16 argc, uint16 *argv) { - _vm->getCurCard()->drawPicture(_vm->_vars["ogehnpage"]); + _vm->getCard()->drawPicture(_vm->_vars["ogehnpage"]); } void RivenExternal::xogehnbookprevpage(uint16 argc, uint16 *argv) { @@ -2229,7 +2229,7 @@ void RivenExternal::xogehnbookprevpage(uint16 argc, uint16 *argv) { // Now update the screen :) _vm->_gfx->scheduleTransition(1); - _vm->getCurCard()->drawPicture(page); + _vm->getCard()->drawPicture(page); } void RivenExternal::xogehnbooknextpage(uint16 argc, uint16 *argv) { @@ -2246,7 +2246,7 @@ void RivenExternal::xogehnbooknextpage(uint16 argc, uint16 *argv) { // Now update the screen :) _vm->_gfx->scheduleTransition(0); - _vm->getCurCard()->drawPicture(page); + _vm->getCard()->drawPicture(page); } uint16 RivenExternal::getComboDigit(uint32 correctCombo, uint32 digit) { @@ -2283,7 +2283,7 @@ void RivenExternal::xgwatch(uint16 argc, uint16 *argv) { } // Now play the video for the watch - _vm->_video->activateMLST(1, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(1, _vm->getCard()->getId()); _vm->_video->playMovieBlockingRiven(1); // And, finally, refresh @@ -2367,7 +2367,7 @@ void RivenExternal::xrhideinventory(uint16 argc, uint16 *argv) { static void rebelPrisonWindowTimer(MohawkEngine_Riven *vm) { // Randomize a video out in the middle of Tay uint16 movie = vm->_rnd->getRandomNumberRng(2, 13); - vm->_video->activateMLST(movie, vm->getCurCard()->getId()); + vm->_video->activateMLST(movie, vm->getCard()->getId()); VideoHandle handle = vm->_video->playMovieRiven(movie); // Ensure the next video starts after this one ends @@ -2435,25 +2435,25 @@ void RivenExternal::xtexterior300_telescopedown(uint16 argc, uint16 *argv) { if (_vm->_vars["pcage"] == 2) { // The best ending: Catherine is free, Gehn is trapped, Atrus comes to rescue you. // And now we fall back to Earth... all the way... - _vm->_video->activateMLST(8, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(8, _vm->getCard()->getId()); runEndGame(8, 5000); } else if (_vm->_vars["agehn"] == 4) { // The ok ending: Catherine is still trapped, Gehn is trapped, Atrus comes to rescue you. // Nice going! Catherine and the islanders are all dead now! Just go back to your home... - _vm->_video->activateMLST(9, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(9, _vm->getCard()->getId()); runEndGame(9, 5000); } else if (_vm->_vars["atrapbook"] == 1) { // The bad ending: Catherine is trapped, Gehn is free, Atrus gets shot by Gehn, // And then you get shot by Cho. Nice going! Catherine and the islanders are dead // and you have just set Gehn free from Riven, not to mention you're dead. - _vm->_video->activateMLST(10, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(10, _vm->getCard()->getId()); runEndGame(10, 5000); } else { // The impossible ending: You don't have Catherine's journal and yet you were somehow // able to open the hatch on the telescope. The game provides an ending for those who // cheat, load a saved game with the combo, or just guess the telescope combo. Atrus // doesn't come and you just fall into the fissure. - _vm->_video->activateMLST(11, _vm->getCurCard()->getId()); + _vm->_video->activateMLST(11, _vm->getCard()->getId()); runEndGame(11, 5000); } } else { @@ -2523,7 +2523,7 @@ void RivenExternal::xtisland390_covercombo(uint16 argc, uint16 *argv) { // If we have hit the correct 5 buttons in a row, activate the hotspot to open up the // telescope cover. - RivenHotspot *openCover = _vm->getCurCard()->getHotspotByName("openCover"); + RivenHotspot *openCover = _vm->getCard()->getHotspotByName("openCover"); openCover->enable(correctDigits == 5); } @@ -2655,7 +2655,7 @@ void RivenExternal::setMarbleHotspots() { // Set the hotspots for (uint16 i = 0; i < kMarbleCount; i++) { uint32 marblePos = _vm->_vars[s_marbleNames[i]]; - RivenHotspot *marbleHotspot = _vm->getCurCard()->getHotspotByName(s_marbleNames[i]); + RivenHotspot *marbleHotspot = _vm->getCard()->getHotspotByName(s_marbleNames[i]); if (marblePos == 0) // In the receptacle marbleHotspot->setRect(_marbleBaseHotspots[i]); @@ -2668,7 +2668,7 @@ void RivenExternal::xt7800_setup(uint16 argc, uint16 *argv) { // First, let's store the base receptacle hotspots for the marbles if (_marbleBaseHotspots.empty()) for (uint16 i = 0; i < kMarbleCount; i++) { - RivenHotspot *marbleHotspot = _vm->getCurCard()->getHotspotByName(s_marbleNames[i]); + RivenHotspot *marbleHotspot = _vm->getCard()->getHotspotByName(s_marbleNames[i]); _marbleBaseHotspots.push_back(marbleHotspot->getRect()); } @@ -2683,7 +2683,7 @@ void RivenExternal::drawMarbles() { if (_vm->_vars["themarble"] - 1 == i) continue; - RivenHotspot *marbleHotspot = _vm->getCurCard()->getHotspotByName(s_marbleNames[i]); + RivenHotspot *marbleHotspot = _vm->getCard()->getHotspotByName(s_marbleNames[i]); Common::Rect rect = marbleHotspot->getRect(); // Trim the rect down a bit @@ -2708,7 +2708,7 @@ void RivenExternal::xtakeit(uint16 argc, uint16 *argv) { marble = 0; for (uint32 i = 0; i < kMarbleCount; i++) { - RivenHotspot *marbleHotspot = _vm->getCurCard()->getHotspotByName(s_marbleNames[i]); + RivenHotspot *marbleHotspot = _vm->getCard()->getHotspotByName(s_marbleNames[i]); if (marbleHotspot->containsPoint(_vm->_system->getEventManager()->getMousePos())) { marble = i + 1; break; @@ -2719,7 +2719,7 @@ void RivenExternal::xtakeit(uint16 argc, uint16 *argv) { assert(marble != 0); // Redraw the background - _vm->getCurCard()->drawPicture(1); + _vm->getCard()->drawPicture(1); // Loop until the player lets go (or quits) Common::Event event; diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp index 9346ae92cc..6931afbf09 100644 --- a/engines/mohawk/riven_graphics.cpp +++ b/engines/mohawk/riven_graphics.cpp @@ -264,7 +264,7 @@ void RivenGraphics::showInventory() { drawInventoryImage(101, g_demoExitRect); } else { // We don't want to show the inventory on setup screens or in other journals. - if (_vm->getCurStack()->getId() == kStackAspit) + if (_vm->getStack()->getId() == kStackAspit) return; // There are three books and three vars. We have three different @@ -432,7 +432,7 @@ void RivenGraphics::applyScreenUpdate(bool force) { if (_screenUpdateNesting <= 0 && !_screenUpdateRunning) { _screenUpdateRunning = true; - _vm->getCurCard()->runScript(kCardUpdateScript); + _vm->getCard()->runScript(kCardUpdateScript); _vm->_sound->triggerDrawSound(); updateScreen(); diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp index 6be876de2a..37b5b6893b 100644 --- a/engines/mohawk/riven_saveload.cpp +++ b/engines/mohawk/riven_saveload.cpp @@ -404,8 +404,8 @@ Common::Error RivenSaveLoad::saveGame(const int slot, const Common::String &desc Common::String filename = buildSaveFilename(slot); // Convert class variables to variable numbers - _vm->_vars["currentstackid"] = _vm->getCurStack()->getId(); - _vm->_vars["currentcardid"] = _vm->getCurCard()->getId(); + _vm->_vars["currentstackid"] = _vm->getStack()->getId(); + _vm->_vars["currentcardid"] = _vm->getCard()->getId(); Common::OutSaveFile *saveFile = _saveFileMan->openForSaving(filename); if (!saveFile) diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp index 3155c4347c..fabb8c6441 100644 --- a/engines/mohawk/riven_scripts.cpp +++ b/engines/mohawk/riven_scripts.cpp @@ -366,7 +366,7 @@ void RivenSimpleCommand::mohawkSwitch(uint16 op, uint16 argc, uint16 *argv) { // Command 9: enable hotspot (blst_id) void RivenSimpleCommand::enableHotspot(uint16 op, uint16 argc, uint16 *argv) { - RivenHotspot *hotspot = _vm->getCurCard()->getHotspotByBlstId(argv[0]); + RivenHotspot *hotspot = _vm->getCard()->getHotspotByBlstId(argv[0]); if (hotspot) { hotspot->enable(true); } @@ -377,7 +377,7 @@ void RivenSimpleCommand::enableHotspot(uint16 op, uint16 argc, uint16 *argv) { // Command 10: disable hotspot (blst_id) void RivenSimpleCommand::disableHotspot(uint16 op, uint16 argc, uint16 *argv) { - RivenHotspot *hotspot = _vm->getCurCard()->getHotspotByBlstId(argv[0]); + RivenHotspot *hotspot = _vm->getCard()->getHotspotByBlstId(argv[0]); if (hotspot) { hotspot->enable(false); } @@ -394,8 +394,8 @@ void RivenSimpleCommand::stopSound(uint16 op, uint16 argc, uint16 *argv) { // would cause all ambient sounds not to play. An alternative // fix would be to stop all scripts on a stack change, but this // does fine for now. - if (_vm->getCurStack()->getId() == kStackTspit && (_vm->getCurStack()->getCurrentCardGlobalId() == 0x6e9a || - _vm->getCurStack()->getCurrentCardGlobalId() == 0xfeeb)) + if (_vm->getStack()->getId() == kStackTspit && (_vm->getStack()->getCurrentCardGlobalId() == 0x6e9a || + _vm->getStack()->getCurrentCardGlobalId() == 0xfeeb)) return; // The argument is a bitflag for the setting. @@ -464,7 +464,7 @@ void RivenSimpleCommand::incrementVariable(uint16 op, uint16 argc, uint16 *argv) // Command 27: go to stack (stack name, code high, code low) void RivenSimpleCommand::changeStack(uint16 op, uint16 argc, uint16 *argv) { - Common::String stackName = _vm->getCurStack()->getName(kStackNames, argv[0]); + Common::String stackName = _vm->getStack()->getName(kStackNames, argv[0]); int8 index = -1; for (byte i = 0; i < 8; i++) @@ -478,7 +478,7 @@ void RivenSimpleCommand::changeStack(uint16 op, uint16 argc, uint16 *argv) { _vm->changeToStack(index); uint32 rmapCode = (argv[1] << 16) + argv[2]; - uint16 cardID = _vm->getCurStack()->getCardStackId(rmapCode); + uint16 cardID = _vm->getStack()->getCardStackId(rmapCode); _vm->changeToCard(cardID); } @@ -573,7 +573,7 @@ void RivenSimpleCommand::storeMovieOpcode(uint16 op, uint16 argc, uint16 *argv) void RivenSimpleCommand::activatePLST(uint16 op, uint16 argc, uint16 *argv) { _vm->_activatedPLST = true; - RivenCard::Picture picture = _vm->getCurCard()->getPicture(argv[0]); + RivenCard::Picture picture = _vm->getCard()->getPicture(argv[0]); _vm->_gfx->copyImageToScreen(picture.id, picture.rect.left, picture.rect.top, picture.rect.right, picture.rect.bottom); } @@ -581,23 +581,23 @@ void RivenSimpleCommand::activatePLST(uint16 op, uint16 argc, uint16 *argv) { void RivenSimpleCommand::activateSLST(uint16 op, uint16 argc, uint16 *argv) { // WORKAROUND: Disable the SLST that is played during Riven's intro. // Riven X does this too (spoke this over with Jeff) - if (_vm->getCurStack()->getId() == kStackTspit && _vm->getCurStack()->getCurrentCardGlobalId() == 0x6e9a && argv[0] == 2) + if (_vm->getStack()->getId() == kStackTspit && _vm->getStack()->getCurrentCardGlobalId() == 0x6e9a && argv[0] == 2) return; _vm->_activatedSLST = true; - SLSTRecord slstRecord = _vm->getCurCard()->getSound(argv[0]); + SLSTRecord slstRecord = _vm->getCard()->getSound(argv[0]); _vm->_sound->playSLST(slstRecord); } // Command 41: activate MLST record and play void RivenSimpleCommand::activateMLSTAndPlay(uint16 op, uint16 argc, uint16 *argv) { - _vm->_video->activateMLST(argv[0], _vm->getCurCard()->getId()); + _vm->_video->activateMLST(argv[0], _vm->getCard()->getId()); _vm->_video->playMovieRiven(argv[0]); } // Command 43: activate BLST record (card hotspot enabling lists) void RivenSimpleCommand::activateBLST(uint16 op, uint16 argc, uint16 *argv) { - _vm->getCurCard()->activateHotspotEnableRecord(argv[0]); + _vm->getCard()->activateHotspotEnableRecord(argv[0]); // Recheck our current hotspot because it may have now changed _vm->updateCurrentHotspot(); @@ -605,15 +605,15 @@ void RivenSimpleCommand::activateBLST(uint16 op, uint16 argc, uint16 *argv) { // Command 44: activate FLST record (information on which SFXE resource this card should use) void RivenSimpleCommand::activateFLST(uint16 op, uint16 argc, uint16 *argv) { - _vm->getCurCard()->activateWaterEffect(argv[0]); + _vm->getCard()->activateWaterEffect(argv[0]); } // Command 45: do zip mode void RivenSimpleCommand::zipMode(uint16 op, uint16 argc, uint16 *argv) { - assert(_vm->getCurCard() && _vm->getCurCard()->getCurHotspot()); + assert(_vm->getCard() && _vm->getCard()->getCurHotspot()); // Check the ZIPS records to see if we have a match to the hotspot name - Common::String hotspotName = _vm->getCurCard()->getCurHotspot()->getName(); + Common::String hotspotName = _vm->getCard()->getCurHotspot()->getName(); for (uint16 i = 0; i < _vm->_zipModeData.size(); i++) if (_vm->_zipModeData[i].name == hotspotName) { @@ -624,17 +624,17 @@ void RivenSimpleCommand::zipMode(uint16 op, uint16 argc, uint16 *argv) { // Command 46: activate MLST record (movie lists) void RivenSimpleCommand::activateMLST(uint16 op, uint16 argc, uint16 *argv) { - _vm->_video->activateMLST(argv[0], _vm->getCurCard()->getId()); + _vm->_video->activateMLST(argv[0], _vm->getCard()->getId()); } void RivenSimpleCommand::dump(byte tabs) { printTabs(tabs); if (_type == 7) { // Use the variable name - Common::String varName = _vm->getCurStack()->getName(kVariableNames, _arguments[0]); + Common::String varName = _vm->getStack()->getName(kVariableNames, _arguments[0]); debugN("%s = %d;\n", varName.c_str(), _arguments[1]); } else if (_type == 17) { // Use the external command name - Common::String externalCommandName = _vm->getCurStack()->getName(kVariableNames, _arguments[0]); + Common::String externalCommandName = _vm->getStack()->getName(kExternalCommandNames, _arguments[0]); debugN("%s(", externalCommandName.c_str()); uint16 varCount = _arguments[1]; for (uint16 j = 0; j < varCount; j++) { @@ -644,7 +644,7 @@ void RivenSimpleCommand::dump(byte tabs) { } debugN(");\n"); } else if (_type == 24) { // Use the variable name - Common::String varName = _vm->getCurStack()->getName(kVariableNames, _arguments[0]); + Common::String varName = _vm->getStack()->getName(kVariableNames, _arguments[0]); debugN("%s += %d;\n", varName.c_str(), _arguments[1]); } else { debugN("%s(", _opcodes[_type].desc); @@ -706,7 +706,7 @@ RivenSwitchCommand *RivenSwitchCommand::createFromStream(MohawkEngine_Riven *vm, } void RivenSwitchCommand::dump(byte tabs) { - Common::String varName = _vm->getCurStack()->getName(kVariableNames, _variableId); + Common::String varName = _vm->getStack()->getName(kVariableNames, _variableId); printTabs(tabs); debugN("switch (%s) {\n", varName.c_str()); for (uint16 j = 0; j < _branches.size(); j++) { printTabs(tabs + 1); diff --git a/engines/mohawk/riven_stack.cpp b/engines/mohawk/riven_stack.cpp index 54846f1139..b3dc6935d9 100644 --- a/engines/mohawk/riven_stack.cpp +++ b/engines/mohawk/riven_stack.cpp @@ -113,7 +113,7 @@ uint16 RivenStack::getCardStackId(uint32 globalId) const { } uint32 RivenStack::getCurrentCardGlobalId() const { - return _cardIdMap[_vm->getCurCard()->getId()]; + return _cardIdMap[_vm->getCard()->getId()]; } RivenNameList::RivenNameList() { diff --git a/engines/mohawk/riven_vars.cpp b/engines/mohawk/riven_vars.cpp index 2a19282c2b..7d17562aa2 100644 --- a/engines/mohawk/riven_vars.cpp +++ b/engines/mohawk/riven_vars.cpp @@ -269,7 +269,7 @@ static const char *variableNames[] = { }; uint32 &MohawkEngine_Riven::getStackVar(uint32 index) { - Common::String name = getCurStack()->getName(kVariableNames, index); + Common::String name = getStack()->getName(kVariableNames, index); if (!_vars.contains(name)) error("Could not find variable '%s' (stack variable %d)", name.c_str(), index); -- cgit v1.2.3