diff options
Diffstat (limited to 'engines/mortevielle/actions.cpp')
-rw-r--r-- | engines/mortevielle/actions.cpp | 252 |
1 files changed, 144 insertions, 108 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index b68dd48b0f..e13220d248 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -40,7 +40,7 @@ namespace Mortevielle { * @remarks Originally called 'taller' */ void MortevielleEngine::fctMove() { - int oldMenu = (_menu._moveMenu[6]._menuId << 8) | _menu._moveMenu[6]._actionId; + int oldMenu = (_menu->_moveMenu[6]._menuId << 8) | _menu->_moveMenu[6]._actionId; if ((_coreVar._currPlace == ROOM26) && (_currAction == oldMenu)) { _coreVar._currPlace = LANDING; _caff = _coreVar._currPlace; @@ -65,10 +65,10 @@ void MortevielleEngine::fctMove() { if (_num == 1) { _coreVar._currPlace = OWN_ROOM; - _menu.setDestinationText(OWN_ROOM); + _menu->setDestinationText(OWN_ROOM); } else if (_num == 7) { _coreVar._currPlace = ATTIC; - _menu.setDestinationText(ATTIC); + _menu->setDestinationText(ATTIC); } else if (_num != 6) _coreVar._currPlace = ROOM26; @@ -85,10 +85,10 @@ void MortevielleEngine::fctMove() { } exitRoom(); int menuChoice = 1; - oldMenu = (_menu._moveMenu[menuChoice]._menuId << 8) | _menu._moveMenu[menuChoice]._actionId; + oldMenu = (_menu->_moveMenu[menuChoice]._menuId << 8) | _menu->_moveMenu[menuChoice]._actionId; while (oldMenu != _currAction) { ++menuChoice; - oldMenu = (_menu._moveMenu[menuChoice]._menuId << 8) | _menu._moveMenu[menuChoice]._actionId; + oldMenu = (_menu->_moveMenu[menuChoice]._menuId << 8) | _menu->_moveMenu[menuChoice]._actionId; } switch (_coreVar._currPlace) { @@ -97,14 +97,14 @@ void MortevielleEngine::fctMove() { gotoManorFront(); else if (menuChoice == 2) checkManorDistance(); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); return; case INSIDE_WELL: if (menuChoice == 1) floodedInWell(); else if (menuChoice == 2) gotoManorBack(); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); return; case BUREAU: if (menuChoice == 1) @@ -193,7 +193,7 @@ void MortevielleEngine::fctMove() { if ((menuChoice < 5) || (menuChoice == 13) || (menuChoice == 14)) prepareDisplayText(); resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); } /** @@ -208,23 +208,32 @@ void MortevielleEngine::fctTake() { if (_currBitIndex > 0) _coreVar._faithScore += 3; if (_obpart) { - if (_coreVar._currPlace == PURPLE_ROOM) + switch (_coreVar._currPlace) { + case PURPLE_ROOM: _coreVar._purpleRoomObjectId = 0; - if (_coreVar._currPlace == ATTIC) { + break; + case ATTIC: if (_coreVar._atticBallHoleObjectId == _caff) _coreVar._atticBallHoleObjectId = 0; if (_coreVar._atticRodHoleObjectId == _caff) _coreVar._atticRodHoleObjectId = 0; - } - if (_coreVar._currPlace == CELLAR) + break; + case CELLAR: _coreVar._cellarObjectId = 0; - if (_coreVar._currPlace == CRYPT) + break; + case CRYPT: _coreVar._cryptObjectId = 0; - if (_coreVar._currPlace == SECRET_PASSAGE) + break; + case SECRET_PASSAGE: _coreVar._secretPassageObjectId = 0; - if (_coreVar._currPlace == WELL) + break; + case WELL: _coreVar._wellObjectId = 0; - _menu.unsetSearchMenu(); + break; + default: + break; + } + _menu->unsetSearchMenu(); _obpart = false; prepareDisplayText(); } else { @@ -258,38 +267,54 @@ void MortevielleEngine::fctTake() { if (_currBitIndex > 0) _coreVar._faithScore += 3; _crep = 997; - if ((_coreVar._currPlace == PURPLE_ROOM) && (_coreVar._purpleRoomObjectId != 0)) - putInHand(_coreVar._purpleRoomObjectId); - if ((_coreVar._currPlace == ATTIC) && (_num == 1) && (_coreVar._atticBallHoleObjectId != 0)) { - putInHand(_coreVar._atticBallHoleObjectId); - if ((_crep != 997) && (_crep != 139)) - displayAnimFrame(2, 7); - } - if ((_coreVar._currPlace == ATTIC) && (_num == 2) && (_coreVar._atticRodHoleObjectId != 0)) { - putInHand(_coreVar._atticRodHoleObjectId); - if ((_crep != 997) && (_crep != 139)) - displayAnimFrame(2, 6); - } - if ((_coreVar._currPlace == CELLAR) && (_coreVar._cellarObjectId != 0)) { - putInHand(_coreVar._cellarObjectId); - if ((_crep != 997) && (_crep != 139)) - displayAnimFrame(2, 2); - } - if ((_coreVar._currPlace == CRYPT) && (_coreVar._cryptObjectId != 0)) - putInHand(_coreVar._cryptObjectId); - - if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId != 0)) { - putInHand(_coreVar._secretPassageObjectId); - if ((_crep != 997) && (_crep != 139)) { - _crep = 182; - displayAnimFrame(2, 1); + + switch (_coreVar._currPlace) { + case PURPLE_ROOM: + if (_coreVar._purpleRoomObjectId != 0) + putInHand(_coreVar._purpleRoomObjectId); + break; + case ATTIC: + if ((_num == 1) && (_coreVar._atticBallHoleObjectId != 0)) { + putInHand(_coreVar._atticBallHoleObjectId); + if ((_crep != 997) && (_crep != 139)) + displayAnimFrame(2, 7); + } else if ((_num == 2) && (_coreVar._atticRodHoleObjectId != 0)) { + putInHand(_coreVar._atticRodHoleObjectId); + if ((_crep != 997) && (_crep != 139)) + displayAnimFrame(2, 6); } + break; + case CELLAR: + if (_coreVar._cellarObjectId != 0) { + putInHand(_coreVar._cellarObjectId); + if ((_crep != 997) && (_crep != 139)) + displayAnimFrame(2, 2); + } + break; + case CRYPT: + if (_coreVar._cryptObjectId != 0) + putInHand(_coreVar._cryptObjectId); + break; + case SECRET_PASSAGE: + if (_coreVar._secretPassageObjectId != 0) { + putInHand(_coreVar._secretPassageObjectId); + if ((_crep != 997) && (_crep != 139)) { + _crep = 182; + displayAnimFrame(2, 1); + } + } + break; + case WELL: + if (_coreVar._wellObjectId != 0) { + putInHand(_coreVar._wellObjectId); + if ((_crep != 997) && (_crep != 139)) + displayAnimFrame(2, 1); + } + break; + default: + break; } - if ((_coreVar._currPlace == WELL) && (_coreVar._wellObjectId != 0)) { - putInHand(_coreVar._wellObjectId); - if ((_crep != 997) && (_crep != 139)) - displayAnimFrame(2, 1); - } + if ((_crep != 997) && (_crep != 182) && (_crep != 139)) _crep = 999; } @@ -325,7 +350,7 @@ void MortevielleEngine::fctInventoryTake() { int oldMenu = 0; do { ++inventIndex; - oldMenu = (_menu._inventoryMenu[inventIndex]._menuId << 8) | _menu._inventoryMenu[inventIndex]._actionId; + oldMenu = (_menu->_inventoryMenu[inventIndex]._menuId << 8) | _menu->_inventoryMenu[inventIndex]._actionId; } while (oldMenu != _currAction); int cz = 0; int cy = 0; @@ -336,7 +361,7 @@ void MortevielleEngine::fctInventoryTake() { } while (cz != inventIndex); cz = _coreVar._inventory[cy]; _coreVar._inventory[cy] = 0; - _menu.setInventoryText(); + _menu->setInventoryText(); putInHand(cz); _crep = 998; clearDescriptionBar(); @@ -456,13 +481,24 @@ void MortevielleEngine::fctLook() { } return; } + int cx = _coreVar._currPlace; - if (_coreVar._currPlace == CHAPEL) + switch (_coreVar._currPlace) { + case CHAPEL: cx = 17; - if ((_coreVar._currPlace > MANOR_FRONT) && (_coreVar._currPlace < DOOR)) + break; + case MANOR_BACK: + case INSIDE_WELL: + case WELL: cx -= 4; - if (_coreVar._currPlace == ROOM26) + break; + case ROOM26: cx = 21; + break; + default: + break; + } + _crep = _tabdon[kArega + (cx * 7) + _num - 1]; if ((_coreVar._currPlace == ATTIC) && (_num == 8)) _crep = 126; @@ -536,7 +572,7 @@ void MortevielleEngine::fctSearch() { if (_curSearchObjId != 0) { _searchCount = 0; _heroSearching = true; - _menu.setSearchMenu(); + _menu->setSearchMenu(); prepareNextObject(); } else _crep = 997; @@ -607,7 +643,7 @@ void MortevielleEngine::fctOpen() { if (_caff == ROOM26) { if (_roomDoorId != OWN_ROOM) { - _currAction = _menu._opcodeEnter; + _currAction = _menu->_opcodeEnter; _syn = true; } else _crep = 997; @@ -663,11 +699,11 @@ void MortevielleEngine::fctOpen() { || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == BLUE_ROOM)) { if (getRandomNumber(1, 4) == 3) - _soundManager.startSpeech(7, 9, 1); + _soundManager->startSpeech(7, 9, 1); } _openObjects[i] = _num; displayAnimFrame(1, _num); - _soundManager.waitSpeech(); + _soundManager->waitSpeech(); } int tmpPlace = _coreVar._currPlace; if (_coreVar._currPlace == CRYPT) @@ -731,21 +767,21 @@ void MortevielleEngine::fctPlace() { displayAnimFrame(1, 1); handleDescriptionText(2, 165); displayEmptyHand(); - _soundManager.startSpeech(6, -9, 1); + _soundManager->startSpeech(6, -9, 1); // Do you want to enter the hidden passage? - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); if (answer == 1) { Common::String alertTxt = getString(582); - _dialogManager.show(alertTxt); + _dialogManager->show(alertTxt); - bool enterPassageFl = _dialogManager.showKnowledgeCheck(); - _mouse.hideMouse(); + bool enterPassageFl = _dialogManager->showKnowledgeCheck(); + _mouse->hideMouse(); clearScreen(); drawRightFrame(); clearDescriptionBar(); clearVerbBar(); - _mouse.showMouse(); + _mouse->showMouse(); prepareRoom(); drawClock(); if (_currBitIndex != 0) @@ -753,18 +789,18 @@ void MortevielleEngine::fctPlace() { else displayAloneText(); - _menu.displayMenu(); + _menu->displayMenu(); if (enterPassageFl) { _coreVar._currPlace = SECRET_PASSAGE; - _menu.setDestinationText(SECRET_PASSAGE); + _menu->setDestinationText(SECRET_PASSAGE); } else { - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); setPal(14); drawPicture(); displayAnimFrame(1, 2); displayAnimFrame(1, 1); alertTxt = getString(577); - _dialogManager.show(alertTxt); + _dialogManager->show(alertTxt); displayAnimFrame(2, 1); _crep = 166; } @@ -832,8 +868,8 @@ void MortevielleEngine::fctTurn() { _crep = 997; if ((_coreVar._currPlace == ATTIC) && (_coreVar._atticRodHoleObjectId == 159) && (_coreVar._atticBallHoleObjectId == 141)) { handleDescriptionText(2, 167); - _soundManager.startSpeech(7, 9, 1); - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + _soundManager->startSpeech(7, 9, 1); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); if (answer == 1) _endGame = true; else @@ -842,8 +878,8 @@ void MortevielleEngine::fctTurn() { if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) { handleDescriptionText(2, 175); clearVerbBar(); - _soundManager.startSpeech(6, -9, 1); - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + _soundManager->startSpeech(6, -9, 1); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); if (answer == 1) { _coreVar._currPlace = CRYPT; prepareDisplayText(); @@ -949,7 +985,7 @@ void MortevielleEngine::fctKnock() { displayTextInVerbBar(getEngineString(S_HIT)); if (_coreVar._currPlace == LANDING) { - _dialogManager.show(getEngineString(S_BEFORE_USE_DEP_MENU)); + _dialogManager->show(getEngineString(S_BEFORE_USE_DEP_MENU)); return; } @@ -967,7 +1003,7 @@ void MortevielleEngine::fctKnock() { if (_coreVar._currPlace == ROOM26) { int rand = (getRandomNumber(0, 8)) - 4; - _soundManager.startSpeech(11, rand, 1); + _soundManager->startSpeech(11, rand, 1); int pres = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId); if (_roomDoorId != OWN_ROOM) { if (pres != -500) { @@ -1132,7 +1168,7 @@ void MortevielleEngine::fctEat() { _coreVar._currPlace = DINING_ROOM; _caff = DINING_ROOM; resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); int day, hour, minute; updateHour(day, hour, minute); @@ -1168,7 +1204,7 @@ void MortevielleEngine::fctEat() { void MortevielleEngine::fctEnter() { if ((_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) { gotoDiningRoom(); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); } else if (_coreVar._currPlace == LANDING) showMoveMenuAlert(); else if (_roomDoorId == OWN_ROOM) @@ -1178,22 +1214,22 @@ void MortevielleEngine::fctEnter() { _coreVar._availableQuestion[8] = '*'; } else { int pres = 0; - if (!_blo) + if (!_outsideOnlyFl) pres = getPresence(_roomDoorId); if (pres != 0) { if ((_roomDoorId == TOILETS) || (_roomDoorId == BATHROOM)) _crep = 179; else { int randVal = (getRandomNumber(0, 10)) - 5; - _soundManager.startSpeech(7, randVal, 1); + _soundManager->startSpeech(7, randVal, 1); displayAnimFrame(1, 1); - _soundManager.waitSpeech(); + _soundManager->waitSpeech(); int charIndex = convertBitIndexToCharacterIndex(pres); ++_coreVar._faithScore; _coreVar._currPlace = LANDING; _currMenu = MENU_DISCUSS; - _currAction = (_menu._discussMenu[charIndex]._menuId << 8) | _menu._discussMenu[charIndex]._actionId; + _currAction = (_menu->_discussMenu[charIndex]._menuId << 8) | _menu->_discussMenu[charIndex]._actionId; _syn = true; if (_roomDoorId == JULIA_ROOM) { _col = true; @@ -1207,14 +1243,14 @@ void MortevielleEngine::fctEnter() { } } else { int randVal = (getRandomNumber(0, 10)) - 5; - _soundManager.startSpeech(7, randVal, 1); + _soundManager->startSpeech(7, randVal, 1); displayAnimFrame(1, 1); - _soundManager.waitSpeech(); + _soundManager->waitSpeech(); _coreVar._currPlace = _roomDoorId; prepareDisplayText(); resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); _roomDoorId = OWN_ROOM; _savedBitIndex = 0; _currBitIndex = 0; @@ -1237,7 +1273,7 @@ void MortevielleEngine::fctSleep() { prepareDisplayText(); drawPictureWithText(); resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); } clearVerbBar(); clearDescriptionBar(); @@ -1261,7 +1297,7 @@ void MortevielleEngine::fctSleep() { if (hour > 23) hour = 0; prepareRoom(); - answer = _dialogManager.show(getEngineString(S_YES_NO)); + answer = _dialogManager->show(getEngineString(S_YES_NO)); _anyone = false; } while (answer != 1); _crep = 998; @@ -1321,7 +1357,7 @@ void MortevielleEngine::fctLeave() { if (_crep == 0) _crep = nextPlace; resetRoomVariables(nextPlace); - _menu.setDestinationText(nextPlace); + _menu->setDestinationText(nextPlace); } } @@ -1337,7 +1373,7 @@ void MortevielleEngine::fctWait() { do { ++_currentHourCount; prepareRoom(); - if (!_blo) + if (!_outsideOnlyFl) getPresence(_coreVar._currPlace); if ((_currBitIndex != 0) && (_savedBitIndex == 0)) { _crep = 998; @@ -1351,7 +1387,7 @@ void MortevielleEngine::fctWait() { return; } handleDescriptionText(2, 102); - answer = _dialogManager.show(getEngineString(S_YES_NO)); + answer = _dialogManager->show(getEngineString(S_YES_NO)); } while (answer != 2); _crep = 998; if (!_anyone) @@ -1394,7 +1430,7 @@ void MortevielleEngine::fctDiscuss() { int oldMenu; do { ++cx; - oldMenu = (_menu._discussMenu[cx]._menuId << 8) | _menu._discussMenu[cx]._actionId; + oldMenu = (_menu->_discussMenu[cx]._menuId << 8) | _menu->_discussMenu[cx]._actionId; } while (oldMenu != _currAction); _caff = 69 + cx; drawPictureWithText(); @@ -1403,7 +1439,7 @@ void MortevielleEngine::fctDiscuss() { } testKey(false); menuUp(); - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); drawDiscussionBox(); startDialog(displId); @@ -1417,13 +1453,13 @@ void MortevielleEngine::fctDiscuss() { } lib[46] = lib[45]; lib[45] = ' '; - _mouse.showMouse(); + _mouse->showMouse(); do { choice = 0; int posX = 0; int posY = 0; for (int icm = 1; icm < 43; icm++) { - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (_coreVar._availableQuestion[icm] == '*') { // If question already asked, write it in reverse video if (questionAsked[icm]) @@ -1438,17 +1474,17 @@ void MortevielleEngine::fctDiscuss() { } else posY += 8; } - _screenSurface.putxy(320, 176); + _screenSurface->putxy(320, 176); displayQuestionText(lib[46], 0); char retKey = '\0'; bool click; do { bool dummyFl; - _mouse.moveMouse(dummyFl, retKey); + _mouse->moveMouse(dummyFl, retKey); if (shouldQuit()) return; - _mouse.getMousePosition(x, y, click); + _mouse->getMousePosition(x, y, click); x *= (3 - kResolutionScaler); if (x > 319) cx = 41; @@ -1462,7 +1498,7 @@ void MortevielleEngine::fctDiscuss() { posX = 320; else posX = 0; - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (questionAsked[choice]) displayQuestionText(lib[choice], 0); else @@ -1481,7 +1517,7 @@ void MortevielleEngine::fctDiscuss() { posX = 320; else posX = 0; - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (questionAsked[choice]) displayQuestionText(lib[choice], 0); else @@ -1494,7 +1530,7 @@ void MortevielleEngine::fctDiscuss() { posX = 320; else posX = 0; - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (questionAsked[ix]) displayQuestionText(lib[ix], 0); else @@ -1533,11 +1569,11 @@ void MortevielleEngine::fctDiscuss() { _coreVar._faithScore += 3; displId = 139; } - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); drawDiscussionBox(); startDialog(displId); - _mouse.showMouse(); + _mouse->showMouse(); if ((displId == 84) || (displId == 86)) { _coreVar._pctHintFound[5] = '*'; _coreVar._availableQuestion[7] = '*'; @@ -1551,32 +1587,32 @@ void MortevielleEngine::fctDiscuss() { _coreVar._pctHintFound[8] = '*'; _coreVar._availableQuestion[32] = '*'; } - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); - _mouse.showMouse(); + _mouse->showMouse(); } } while ((choice != 46) && (displId != 138)); if (_col) { _coreVar._faithScore += (3 * (_coreVar._faithScore / 10)); - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); drawDiscussionBox(); startDialog(138); - _mouse.showMouse(); + _mouse->showMouse(); _col = false; _coreVar._currPlace = LANDING; } _controlMenu = 0; - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); drawRightFrame(); - _mouse.showMouse(); + _mouse->showMouse(); showPeoplePresent(_currBitIndex); prepareRoom(); drawClock(); prepareDisplayText(); /* chech;*/ - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); clearVerbBar(); } @@ -1625,13 +1661,13 @@ void MortevielleEngine::endGame() { clearVerbBar(); handleDescriptionText(9, 1509); testKey(false); - _mouse.hideMouse(); + _mouse->hideMouse(); _caff = 70; - _text.taffich(); + _text->taffich(); clearScreen(); drawDiscussionBox(); startDialog(141); - _mouse.showMouse(); + _mouse->showMouse(); clearUpperLeftPart(); handleDescriptionText(9, 1509); handleDescriptionText(2, 142); @@ -1667,7 +1703,7 @@ void MortevielleEngine::askRestart() { _day = 0; handleDescriptionText(2, 180); - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); _quitGame = (answer != 1); } |