Skip to content

Commit

Permalink
MORTEVIELLE: Get rid of setParent() in Menu and MouseHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Jan 9, 2014
1 parent 0a5d925 commit d8d4a2c
Show file tree
Hide file tree
Showing 12 changed files with 190 additions and 191 deletions.
80 changes: 40 additions & 40 deletions engines/mortevielle/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -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) {
Expand All @@ -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)
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -224,7 +224,7 @@ void MortevielleEngine::fctTake() {
_coreVar._secretPassageObjectId = 0;
if (_coreVar._currPlace == WELL)
_coreVar._wellObjectId = 0;
_menu.unsetSearchMenu();
_menu->unsetSearchMenu();
_obpart = false;
prepareDisplayText();
} else {
Expand Down Expand Up @@ -325,7 +325,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;
Expand All @@ -336,7 +336,7 @@ void MortevielleEngine::fctInventoryTake() {
} while (cz != inventIndex);
cz = _coreVar._inventory[cy];
_coreVar._inventory[cy] = 0;
_menu.setInventoryText();
_menu->setInventoryText();
putInHand(cz);
_crep = 998;
clearDescriptionBar();
Expand Down Expand Up @@ -536,7 +536,7 @@ void MortevielleEngine::fctSearch() {
if (_curSearchObjId != 0) {
_searchCount = 0;
_heroSearching = true;
_menu.setSearchMenu();
_menu->setSearchMenu();
prepareNextObject();
} else
_crep = 997;
Expand Down Expand Up @@ -607,7 +607,7 @@ void MortevielleEngine::fctOpen() {

if (_caff == ROOM26) {
if (_roomDoorId != OWN_ROOM) {
_currAction = _menu._opcodeEnter;
_currAction = _menu->_opcodeEnter;
_syn = true;
} else
_crep = 997;
Expand Down Expand Up @@ -740,25 +740,25 @@ void MortevielleEngine::fctPlace() {
_dialogManager.show(alertTxt);

bool enterPassageFl = _dialogManager.showKnowledgeCheck();
_mouse.hideMouse();
_mouse->hideMouse();
clearScreen();
drawRightFrame();
clearDescriptionBar();
clearVerbBar();
_mouse.showMouse();
_mouse->showMouse();
prepareRoom();
drawClock();
if (_currBitIndex != 0)
showPeoplePresent(_currBitIndex);
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);
Expand Down Expand Up @@ -1132,7 +1132,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);
Expand Down Expand Up @@ -1168,7 +1168,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)
Expand All @@ -1193,7 +1193,7 @@ void MortevielleEngine::fctEnter() {
++_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;
Expand All @@ -1214,7 +1214,7 @@ void MortevielleEngine::fctEnter() {
_coreVar._currPlace = _roomDoorId;
prepareDisplayText();
resetRoomVariables(_coreVar._currPlace);
_menu.setDestinationText(_coreVar._currPlace);
_menu->setDestinationText(_coreVar._currPlace);
_roomDoorId = OWN_ROOM;
_savedBitIndex = 0;
_currBitIndex = 0;
Expand All @@ -1237,7 +1237,7 @@ void MortevielleEngine::fctSleep() {
prepareDisplayText();
drawPictureWithText();
resetRoomVariables(_coreVar._currPlace);
_menu.setDestinationText(_coreVar._currPlace);
_menu->setDestinationText(_coreVar._currPlace);
}
clearVerbBar();
clearDescriptionBar();
Expand Down Expand Up @@ -1321,7 +1321,7 @@ void MortevielleEngine::fctLeave() {
if (_crep == 0)
_crep = nextPlace;
resetRoomVariables(nextPlace);
_menu.setDestinationText(nextPlace);
_menu->setDestinationText(nextPlace);
}
}

Expand Down Expand Up @@ -1394,7 +1394,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();
Expand All @@ -1403,7 +1403,7 @@ void MortevielleEngine::fctDiscuss() {
}
testKey(false);
menuUp();
_mouse.hideMouse();
_mouse->hideMouse();
clearScreen();
drawDiscussionBox();
startDialog(displId);
Expand All @@ -1417,7 +1417,7 @@ void MortevielleEngine::fctDiscuss() {
}
lib[46] = lib[45];
lib[45] = ' ';
_mouse.showMouse();
_mouse->showMouse();
do {
choice = 0;
int posX = 0;
Expand All @@ -1444,11 +1444,11 @@ void MortevielleEngine::fctDiscuss() {
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;
Expand Down Expand Up @@ -1533,11 +1533,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] = '*';
Expand All @@ -1551,32 +1551,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();
}

Expand Down Expand Up @@ -1625,13 +1625,13 @@ void MortevielleEngine::endGame() {
clearVerbBar();
handleDescriptionText(9, 1509);
testKey(false);
_mouse.hideMouse();
_mouse->hideMouse();
_caff = 70;
_text.taffich();
clearScreen();
drawDiscussionBox();
startDialog(141);
_mouse.showMouse();
_mouse->showMouse();
clearUpperLeftPart();
handleDescriptionText(9, 1509);
handleDescriptionText(2, 142);
Expand Down

0 comments on commit d8d4a2c

Please sign in to comment.