aboutsummaryrefslogtreecommitdiff
path: root/engines/mortevielle/actions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/mortevielle/actions.cpp')
-rw-r--r--engines/mortevielle/actions.cpp289
1 files changed, 165 insertions, 124 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp
index 3e3db5b224..b68dd48b0f 100644
--- a/engines/mortevielle/actions.cpp
+++ b/engines/mortevielle/actions.cpp
@@ -91,31 +91,41 @@ void MortevielleEngine::fctMove() {
oldMenu = (_menu._moveMenu[menuChoice]._menuId << 8) | _menu._moveMenu[menuChoice]._actionId;
}
- if (_coreVar._currPlace == MOUNTAIN) {
+ switch (_coreVar._currPlace) {
+ case MOUNTAIN:
if (menuChoice == 1)
gotoManorFront();
else if (menuChoice == 2)
checkManorDistance();
_menu.setDestinationText(_coreVar._currPlace);
return;
- } else if (_coreVar._currPlace == INSIDE_WELL) {
+ case INSIDE_WELL:
if (menuChoice == 1)
floodedInWell();
else if (menuChoice == 2)
gotoManorBack();
_menu.setDestinationText(_coreVar._currPlace);
return;
- } else if ((_coreVar._currPlace == BUREAU) && (menuChoice == 1))
- menuChoice = 6;
- else if (_coreVar._currPlace == KITCHEN) {
+ case BUREAU:
+ if (menuChoice == 1)
+ menuChoice = 6;
+ break;
+ case KITCHEN:
if (menuChoice == 2)
menuChoice = 6;
else if (menuChoice == 5)
menuChoice = 16;
- } else if ((_coreVar._currPlace == CELLAR) && (menuChoice == 3))
- menuChoice = 6;
- else if (((_coreVar._currPlace == LANDING) || (_coreVar._currPlace == ROOM26)) && (menuChoice == 4))
- menuChoice = 6;
+ break;
+ case CELLAR:
+ if (menuChoice == 3)
+ menuChoice = 6;
+ break;
+ case LANDING:
+ case ROOM26:
+ if (menuChoice == 4)
+ menuChoice = 6;
+ break;
+ }
if ((_coreVar._currPlace > MOUNTAIN) && (_coreVar._currPlace != ROOM26))
menuChoice += 10;
@@ -132,32 +142,40 @@ void MortevielleEngine::fctMove() {
else if ((_coreVar._currPlace == WELL) && (menuChoice > 13) && (menuChoice != 17))
menuChoice = 15;
- if (menuChoice == 1)
+ switch (menuChoice) {
+ case 1:
_coreVar._currPlace = BUREAU;
- else if (menuChoice == 2)
+ break;
+ case 2:
_coreVar._currPlace = KITCHEN;
- else if (menuChoice == 3)
+ break;
+ case 3:
_coreVar._currPlace = CELLAR;
- else if (menuChoice == 4)
+ break;
+ case 4:
_coreVar._currPlace = LANDING;
- else if (menuChoice == 5)
- menuChoice = 12;
- else if (menuChoice == 6)
- menuChoice = 11;
-
- if (menuChoice == 11)
- gotoDiningRoom();
- else if (menuChoice == 12)
+ break;
+ case 5:
+ case 12:
gotoManorFront();
- else if (menuChoice == 13)
+ break;
+ case 6:
+ case 11:
+ gotoDiningRoom();
+ break;
+ case 13:
_coreVar._currPlace = CHAPEL;
- else if (menuChoice == 14)
+ break;
+ case 14:
_coreVar._currPlace = WELL;
- else if (menuChoice == 15)
+ break;
+ case 15:
checkManorDistance();
- else if (menuChoice == 16)
+ break;
+ case 16:
gotoManorBack();
- else if (menuChoice == 17) {
+ break;
+ case 17:
if ((_coreVar._wellObjectId != 120) && (_coreVar._wellObjectId != 140))
_crep = 997;
else if (_coreVar._wellObjectId == 120)
@@ -169,7 +187,9 @@ void MortevielleEngine::fctMove() {
_coreVar._currPlace = INSIDE_WELL;
prepareDisplayText();
}
+ break;
}
+
if ((menuChoice < 5) || (menuChoice == 13) || (menuChoice == 14))
prepareDisplayText();
resetRoomVariables(_coreVar._currPlace);
@@ -340,7 +360,7 @@ void MortevielleEngine::fctLift() {
++_coreVar._faithScore;
_crep = 997;
if ((_coreVar._currPlace == PURPLE_ROOM) && (_coreVar._purpleRoomObjectId != 0))
- treg(_coreVar._purpleRoomObjectId);
+ displayLookScreen(_coreVar._purpleRoomObjectId);
}
return;
}
@@ -409,29 +429,29 @@ void MortevielleEngine::fctLook() {
if (_num == 1) {
_crep = 164;
if (_coreVar._atticRodHoleObjectId != 0)
- treg(_coreVar._atticRodHoleObjectId);
+ displayLookScreen(_coreVar._atticRodHoleObjectId);
else if (_coreVar._atticBallHoleObjectId != 0)
- treg(_coreVar._atticBallHoleObjectId);
+ displayLookScreen(_coreVar._atticBallHoleObjectId);
} else {
_crep = 193;
if (_coreVar._atticRodHoleObjectId != 0)
- treg(_coreVar._atticRodHoleObjectId);
+ displayLookScreen(_coreVar._atticRodHoleObjectId);
}
}
if (_coreVar._currPlace == CELLAR) {
_crep = 164;
if (_coreVar._cellarObjectId != 0)
- treg(_coreVar._cellarObjectId);
+ displayLookScreen(_coreVar._cellarObjectId);
}
if (_coreVar._currPlace == SECRET_PASSAGE) {
_crep = 174;
if (_coreVar._secretPassageObjectId != 0)
- treg(_coreVar._secretPassageObjectId);
+ displayLookScreen(_coreVar._secretPassageObjectId);
}
if (_coreVar._currPlace == WELL) {
_crep = 131;
if (_coreVar._wellObjectId != 0)
- treg(_coreVar._wellObjectId);
+ displayLookScreen(_coreVar._wellObjectId);
}
}
return;
@@ -451,15 +471,15 @@ void MortevielleEngine::fctLook() {
if (_crep == 255)
_crep = 131;
if ((_coreVar._currPlace == GREEN_ROOM) && (_num == 1))
- treg(144);
+ displayLookScreen(144);
if ((_coreVar._currPlace == BLUE_ROOM) && (_num == 3))
- treg(147);
+ displayLookScreen(147);
if ((_coreVar._currPlace == GREEN_ROOM2) && (_num == 3))
- treg(149);
+ displayLookScreen(149);
if ((_coreVar._currPlace == JULIA_ROOM) && (_num == 2))
- treg(30);
+ displayLookScreen(30);
if ((_coreVar._currPlace == DINING_ROOM) && (_num == 3))
- treg(31);
+ displayLookScreen(31);
}
/**
@@ -468,7 +488,7 @@ void MortevielleEngine::fctLook() {
*/
void MortevielleEngine::fctSelftLook() {
if (_coreVar._selectedObjectId != 0)
- treg(_coreVar._selectedObjectId);
+ displayLookScreen(_coreVar._selectedObjectId);
else
_crep = 186;
}
@@ -503,9 +523,12 @@ void MortevielleEngine::fctSearch() {
setCoordinates(7);
if (_num != 0) {
int i;
- for (i = 1; (i <= 6) && (_num != _openObjects[i]); i++)
- ;
- if (_num == _openObjects[i]) {
+ for (i = 1; i <= 6; i++) {
+ if (_num == _openObjects[i])
+ break;
+ }
+
+ if (i <= 6) {
if (_currBitIndex > 0)
_coreVar._faithScore += 3;
@@ -529,12 +552,12 @@ void MortevielleEngine::fctSearch() {
if (_coreVar._currPlace == PURPLE_ROOM) {
_crep = 123;
if (_coreVar._purpleRoomObjectId != 0)
- treg(_coreVar._purpleRoomObjectId);
+ displayLookScreen(_coreVar._purpleRoomObjectId);
}
if (_coreVar._currPlace == CRYPT) {
_crep = 123;
if (_coreVar._cryptObjectId != 0)
- treg(_coreVar._cryptObjectId);
+ displayLookScreen(_coreVar._cryptObjectId);
}
}
}
@@ -584,7 +607,7 @@ void MortevielleEngine::fctOpen() {
if (_caff == ROOM26) {
if (_roomDoorId != OWN_ROOM) {
- _currAction = OPCODE_ENTER;
+ _currAction = _menu._opcodeEnter;
_syn = true;
} else
_crep = 997;
@@ -606,9 +629,20 @@ void MortevielleEngine::fctOpen() {
_coreVar._faithScore += 2;
++_openObjCount;
int i;
- for (i = 1; (i <= 6) && (_openObjects[i] != 0) && (_openObjects[i] != _num); i++)
- ;
- if (_openObjects[i] != _num) {
+ for (i = 1; (i <= 6); i++) {
+ if ((_openObjects[i] == 0) || (_openObjects[i] == _num))
+ break;
+ }
+
+ if (i > 6) {
+ warning("Unexpected action: Too many open objects");
+ return;
+ }
+
+ if (_openObjects[i] == _num)
+ // display "Already Opened"
+ _crep = 18;
+ else {
if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM)
|| (_coreVar._currPlace == JULIA_ROOM)
|| (_coreVar._currPlace == BLUE_ROOM)
@@ -633,6 +667,7 @@ void MortevielleEngine::fctOpen() {
}
_openObjects[i] = _num;
displayAnimFrame(1, _num);
+ _soundManager.waitSpeech();
}
int tmpPlace = _coreVar._currPlace;
if (_coreVar._currPlace == CRYPT)
@@ -640,9 +675,7 @@ void MortevielleEngine::fctOpen() {
_crep = _tabdon[kAouvr + (tmpPlace * 7) + _num - 1];
if (_crep == 254)
_crep = 999;
- } else
- // display "Already Opened"
- _crep = 18;
+ }
}
}
@@ -701,14 +734,14 @@ void MortevielleEngine::fctPlace() {
_soundManager.startSpeech(6, -9, 1);
// Do you want to enter the hidden passage?
- int answer = _dialogManager.show(getEngineString(S_YES_NO), 1);
+ int answer = _dialogManager.show(getEngineString(S_YES_NO));
if (answer == 1) {
Common::String alertTxt = getString(582);
- _dialogManager.show(alertTxt, 1);
+ _dialogManager.show(alertTxt);
bool enterPassageFl = _dialogManager.showKnowledgeCheck();
_mouse.hideMouse();
- hirs();
+ clearScreen();
drawRightFrame();
clearDescriptionBar();
clearVerbBar();
@@ -731,7 +764,7 @@ void MortevielleEngine::fctPlace() {
displayAnimFrame(1, 2);
displayAnimFrame(1, 1);
alertTxt = getString(577);
- _dialogManager.show(alertTxt, 1);
+ _dialogManager.show(alertTxt);
displayAnimFrame(2, 1);
_crep = 166;
}
@@ -800,7 +833,7 @@ void MortevielleEngine::fctTurn() {
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), 1);
+ int answer = _dialogManager.show(getEngineString(S_YES_NO));
if (answer == 1)
_endGame = true;
else
@@ -810,7 +843,7 @@ void MortevielleEngine::fctTurn() {
handleDescriptionText(2, 175);
clearVerbBar();
_soundManager.startSpeech(6, -9, 1);
- int answer = _dialogManager.show(getEngineString(S_YES_NO), 1);
+ int answer = _dialogManager.show(getEngineString(S_YES_NO));
if (answer == 1) {
_coreVar._currPlace = CRYPT;
prepareDisplayText();
@@ -883,9 +916,12 @@ void MortevielleEngine::fctClose() {
setCoordinates(7);
if (_num != 0) {
int i;
- for (i = 1; (i <= 6) && (_num != _openObjects[i]); ++i)
- ;
- if (_num == _openObjects[i]) {
+ for (i = 1; i <= 6; ++i) {
+ if (_num == _openObjects[i])
+ break;
+ }
+
+ if (i <= 6) {
displayAnimFrame(2, _num);
_crep = 998;
_openObjects[i] = 0;
@@ -913,7 +949,7 @@ void MortevielleEngine::fctKnock() {
displayTextInVerbBar(getEngineString(S_HIT));
if (_coreVar._currPlace == LANDING) {
- _dialogManager.show(getEngineString(S_BEFORE_USE_DEP_MENU), 1);
+ _dialogManager.show(getEngineString(S_BEFORE_USE_DEP_MENU));
return;
}
@@ -932,14 +968,13 @@ void MortevielleEngine::fctKnock() {
if (_coreVar._currPlace == ROOM26) {
int rand = (getRandomNumber(0, 8)) - 4;
_soundManager.startSpeech(11, rand, 1);
- int p = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId);
- int l = _roomDoorId;
- if (l != OWN_ROOM) {
- if (p != -500) {
- if (rand > p)
+ int pres = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId);
+ if (_roomDoorId != OWN_ROOM) {
+ if (pres != -500) {
+ if (rand > pres)
_crep = 190;
else {
- setPresenceFlags(l);
+ setPresenceFlags(_roomDoorId);
getKnockAnswer();
}
} else
@@ -979,9 +1014,12 @@ void MortevielleEngine::fctSelfPut() {
_crep = 997;
else {
int i;
- for (i = 1; (i <= 6) && (_num != _openObjects[i]); i++)
- ;
- if (_num == _openObjects[i]) {
+ for (i = 1; i <= 6; i++) {
+ if (_num == _openObjects[i])
+ break;
+ }
+
+ if (i <= 6) {
_curSearchObjId = objId;
_crep = 999;
} else
@@ -1002,12 +1040,15 @@ void MortevielleEngine::fctSelfPut() {
if (_num == 1) {
if (_coreVar._atticBallHoleObjectId != 0)
_crep = 188;
- else
+ else {
_coreVar._atticBallHoleObjectId = _coreVar._selectedObjectId;
+ displayAnimFrame(1, 7);
+ }
} else if (_coreVar._atticRodHoleObjectId != 0) {
_crep = 188;
} else {
_coreVar._atticRodHoleObjectId = _coreVar._selectedObjectId;
+ displayAnimFrame(1, 6);
}
}
@@ -1053,18 +1094,17 @@ void MortevielleEngine::fctListen() {
if (_currBitIndex != 0)
++_coreVar._faithScore;
int rand;
- int p = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId);
- int l = _roomDoorId;
- if (l != OWN_ROOM) {
- if (p != -500) {
- if (rand > p)
+ int pres = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId);
+ if (_roomDoorId != OWN_ROOM) {
+ if (pres != -500) {
+ if (rand > pres)
_crep = 101;
else {
- setPresenceFlags(l);
- int j, h, m;
- updateHour(j, h, m);
+ setPresenceFlags(_roomDoorId);
+ int day, hour, minute;
+ updateHour(day, hour, minute);
rand = getRandomNumber(1, 100);
- if ((h >= 0) && (h < 8)) {
+ if ((hour >= 0) && (hour < 8)) {
if (rand > 30)
_crep = 101;
else
@@ -1094,25 +1134,25 @@ void MortevielleEngine::fctEat() {
resetRoomVariables(_coreVar._currPlace);
_menu.setDestinationText(_coreVar._currPlace);
- int j, h, m;
- updateHour(j, h, m);
- if ((h == 12) || (h == 13) || (h == 19)) {
+ int day, hour, minute;
+ updateHour(day, hour, minute);
+ if ((hour == 12) || (hour == 13) || (hour == 19)) {
_coreVar._faithScore -= (_coreVar._faithScore / 7);
- if (h == 12) {
- if (m == 0)
- h = 4;
+ if (hour == 12) {
+ if (minute == 0)
+ hour = 4;
else
- h = 3;
+ hour = 3;
}
- if ((h == 13) || (h == 19)) {
- if (m == 0)
- h = 2;
+ if ((hour == 13) || (hour == 19)) {
+ if (minute == 0)
+ hour = 2;
else
- h = 1;
+ hour = 1;
}
- _currentHourCount += h;
+ _currentHourCount += hour;
_crep = 135;
prepareRoom();
} else {
@@ -1137,18 +1177,19 @@ void MortevielleEngine::fctEnter() {
_crep = 189;
_coreVar._availableQuestion[8] = '*';
} else {
- int z = 0;
+ int pres = 0;
if (!_blo)
- z = getPresence(_roomDoorId);
- if (z != 0) {
+ 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);
displayAnimFrame(1, 1);
+ _soundManager.waitSpeech();
- int charIndex = convertBitIndexToCharacterIndex(z);
+ int charIndex = convertBitIndexToCharacterIndex(pres);
++_coreVar._faithScore;
_coreVar._currPlace = LANDING;
_currMenu = MENU_DISCUSS;
@@ -1168,6 +1209,7 @@ void MortevielleEngine::fctEnter() {
int randVal = (getRandomNumber(0, 10)) - 5;
_soundManager.startSpeech(7, randVal, 1);
displayAnimFrame(1, 1);
+ _soundManager.waitSpeech();
_coreVar._currPlace = _roomDoorId;
prepareDisplayText();
@@ -1185,8 +1227,6 @@ void MortevielleEngine::fctEnter() {
* @remarks Originally called 'tdormir'
*/
void MortevielleEngine::fctSleep() {
- int j, h, m;
-
if ((_coreVar._currPlace > LANDING) && (_coreVar._currPlace < ROOM26)) {
_crep = 148;
return;
@@ -1202,25 +1242,26 @@ void MortevielleEngine::fctSleep() {
clearVerbBar();
clearDescriptionBar();
prepareScreenType2();
- ecr2(getEngineString(S_WANT_TO_WAKE_UP));
- updateHour(j, h, m);
+ displayTextBlock(getEngineString(S_WANT_TO_WAKE_UP));
+ int day, hour, minute;
+ updateHour(day, hour, minute);
int answer;
do {
- if (h < 8) {
+ if (hour < 8) {
_coreVar._faithScore -= (_coreVar._faithScore / 20);
- int z = (7 - h) * 2;
- if (m == 30)
+ int z = (7 - hour) * 2;
+ if (minute == 30)
--z;
_currentHourCount += z;
- h = 7;
+ hour = 7;
}
_currentHourCount += 2;
- ++h;
- if (h > 23)
- h = 0;
+ ++hour;
+ if (hour > 23)
+ hour = 0;
prepareRoom();
- answer = _dialogManager.show(getEngineString(S_YES_NO), 1);
+ answer = _dialogManager.show(getEngineString(S_YES_NO));
_anyone = false;
} while (answer != 1);
_crep = 998;
@@ -1310,7 +1351,7 @@ void MortevielleEngine::fctWait() {
return;
}
handleDescriptionText(2, 102);
- answer = _dialogManager.show(getEngineString(S_YES_NO), 1);
+ answer = _dialogManager.show(getEngineString(S_YES_NO));
} while (answer != 2);
_crep = 998;
if (!_anyone)
@@ -1361,12 +1402,12 @@ void MortevielleEngine::fctDiscuss() {
displId = _caff + 60;
}
testKey(false);
- mennor();
+ menuUp();
_mouse.hideMouse();
- hirs();
- premtet();
+ clearScreen();
+ drawDiscussionBox();
startDialog(displId);
- hirs();
+ clearScreen();
for (int ix = 1; ix <= 46; ++ix)
questionAsked[ix] = false;
for (int ix = 1; ix <= 45; ++ix) {
@@ -1408,7 +1449,7 @@ void MortevielleEngine::fctDiscuss() {
return;
_mouse.getMousePosition(x, y, click);
- x *= (3 - _resolutionScaler);
+ x *= (3 - kResolutionScaler);
if (x > 319)
cx = 41;
else
@@ -1493,8 +1534,8 @@ void MortevielleEngine::fctDiscuss() {
displId = 139;
}
_mouse.hideMouse();
- hirs();
- premtet();
+ clearScreen();
+ drawDiscussionBox();
startDialog(displId);
_mouse.showMouse();
if ((displId == 84) || (displId == 86)) {
@@ -1511,15 +1552,15 @@ void MortevielleEngine::fctDiscuss() {
_coreVar._availableQuestion[32] = '*';
}
_mouse.hideMouse();
- hirs();
+ clearScreen();
_mouse.showMouse();
}
} while ((choice != 46) && (displId != 138));
if (_col) {
_coreVar._faithScore += (3 * (_coreVar._faithScore / 10));
_mouse.hideMouse();
- hirs();
- premtet();
+ clearScreen();
+ drawDiscussionBox();
startDialog(138);
_mouse.showMouse();
_col = false;
@@ -1527,7 +1568,7 @@ void MortevielleEngine::fctDiscuss() {
}
_controlMenu = 0;
_mouse.hideMouse();
- hirs();
+ clearScreen();
drawRightFrame();
_mouse.showMouse();
showPeoplePresent(_currBitIndex);
@@ -1577,7 +1618,7 @@ void MortevielleEngine::fctScratch() {
*/
void MortevielleEngine::endGame() {
_quitGame = true;
- tlu(13, 152);
+ displayNarrativePicture(13, 152);
displayEmptyHand();
clearUpperLeftPart();
clearDescriptionBar();
@@ -1587,8 +1628,8 @@ void MortevielleEngine::endGame() {
_mouse.hideMouse();
_caff = 70;
_text.taffich();
- hirs();
- premtet();
+ clearScreen();
+ drawDiscussionBox();
startDialog(141);
_mouse.showMouse();
clearUpperLeftPart();
@@ -1626,7 +1667,7 @@ void MortevielleEngine::askRestart() {
_day = 0;
handleDescriptionText(2, 180);
- int answer = _dialogManager.show(getEngineString(S_YES_NO), 1);
+ int answer = _dialogManager.show(getEngineString(S_YES_NO));
_quitGame = (answer != 1);
}