From 1a9183e0ba06e13ed1385e893ea7287412645fba Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Mar 2012 08:36:59 +0100 Subject: MORTEVIELLE: More renaming --- engines/mortevielle/actions.cpp | 506 ++++++++++++++++++------------------ engines/mortevielle/menu.cpp | 6 +- engines/mortevielle/menu.h | 2 + engines/mortevielle/mor.cpp | 300 +++------------------ engines/mortevielle/mor.h | 4 - engines/mortevielle/mortevielle.cpp | 346 +++++++++++++++++++----- engines/mortevielle/mortevielle.h | 28 +- engines/mortevielle/outtext.cpp | 34 +-- engines/mortevielle/saveload.cpp | 40 +-- engines/mortevielle/speech.h | 8 + engines/mortevielle/var_mor.cpp | 1 - engines/mortevielle/var_mor.h | 34 --- 12 files changed, 655 insertions(+), 654 deletions(-) (limited to 'engines/mortevielle') diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 9479ad5445..3d92db84be 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -42,13 +42,13 @@ namespace Mortevielle { * @remarks Originally called 'taller' */ void MortevielleEngine::fctMove() { - if ((g_s._currPlace == ROOM26) && (g_msg[4] == _menu._moveMenu[6])) { - g_s._currPlace = LANDING; - g_caff = g_s._currPlace; + if ((_coreVar._currPlace == ROOM26) && (g_msg[4] == _menu._moveMenu[6])) { + _coreVar._currPlace = LANDING; + g_caff = _coreVar._currPlace; afdes(); - repon(2, g_s._currPlace); + repon(2, _coreVar._currPlace); } - if ((g_s._currPlace == LANDING) && (g_msg[4] == _menu._moveMenu[6])) { + if ((_coreVar._currPlace == LANDING) && (g_msg[4] == _menu._moveMenu[6])) { if (!_syn) ecr3(getEngineString(S_GO_TO)); tfleche(); @@ -65,15 +65,15 @@ void MortevielleEngine::fctMove() { return; if (g_num == 1) { - g_s._currPlace = OWN_ROOM; + _coreVar._currPlace = OWN_ROOM; _menu.setDestinationMenuText(OWN_ROOM); } else if (g_num == 7) { - g_s._currPlace = ATTIC; + _coreVar._currPlace = ATTIC; _menu.setDestinationMenuText(ATTIC); } if (g_num != 6) - g_s._currPlace = ROOM26; + _coreVar._currPlace = ROOM26; if ((g_num > 1) && (g_num < 6)) g_ment = g_num - 1; @@ -92,55 +92,55 @@ void MortevielleEngine::fctMove() { while (_menu._moveMenu[menuChoice] != g_msg[4]) ++menuChoice; - if (g_s._currPlace == MOUNTAIN) { + if (_coreVar._currPlace == MOUNTAIN) { if (menuChoice == 1) gotoManorFront(); else if (menuChoice == 2) checkManorDistance(); - _menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); return; - } else if (g_s._currPlace == INSIDE_WELL) { + } else if (_coreVar._currPlace == INSIDE_WELL) { if (menuChoice == 1) floodedInWell(); else if (menuChoice == 2) gotoManorBack(); - _menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); return; - } else if ((g_s._currPlace == BUREAU) && (menuChoice == 1)) + } else if ((_coreVar._currPlace == BUREAU) && (menuChoice == 1)) menuChoice = 6; - else if (g_s._currPlace == KITCHEN) { + else if (_coreVar._currPlace == KITCHEN) { if (menuChoice == 2) menuChoice = 6; else if (menuChoice == 5) menuChoice = 16; - } else if ((g_s._currPlace == CELLAR) && (menuChoice == 3)) + } else if ((_coreVar._currPlace == CELLAR) && (menuChoice == 3)) menuChoice = 6; - else if (((g_s._currPlace == LANDING) || (g_s._currPlace == ROOM26)) && (menuChoice == 4)) + else if (((_coreVar._currPlace == LANDING) || (_coreVar._currPlace == ROOM26)) && (menuChoice == 4)) menuChoice = 6; - if ((g_s._currPlace > MOUNTAIN) && (g_s._currPlace != ROOM26)) + if ((_coreVar._currPlace > MOUNTAIN) && (_coreVar._currPlace != ROOM26)) menuChoice += 10; - if ((g_s._currPlace == CHAPEL) && (menuChoice == 13)) + if ((_coreVar._currPlace == CHAPEL) && (menuChoice == 13)) menuChoice = 16; - else if (g_s._currPlace == MANOR_FRONT) { + else if (_coreVar._currPlace == MANOR_FRONT) { if (menuChoice == 12) menuChoice = 16; else if (menuChoice > 13) menuChoice = 15; - } else if ((g_s._currPlace == MANOR_BACK) && (menuChoice > 14)) + } else if ((_coreVar._currPlace == MANOR_BACK) && (menuChoice > 14)) menuChoice = 15; - else if ((g_s._currPlace == WELL) && (menuChoice > 13) && (menuChoice != 17)) + else if ((_coreVar._currPlace == WELL) && (menuChoice > 13) && (menuChoice != 17)) menuChoice = 15; if (menuChoice == 1) - g_s._currPlace = BUREAU; + _coreVar._currPlace = BUREAU; else if (menuChoice == 2) - g_s._currPlace = KITCHEN; + _coreVar._currPlace = KITCHEN; else if (menuChoice == 3) - g_s._currPlace = CELLAR; + _coreVar._currPlace = CELLAR; else if (menuChoice == 4) - g_s._currPlace = LANDING; + _coreVar._currPlace = LANDING; else if (menuChoice == 5) menuChoice = 12; else if (menuChoice == 6) @@ -151,30 +151,30 @@ void MortevielleEngine::fctMove() { else if (menuChoice == 12) gotoManorFront(); else if (menuChoice == 13) - g_s._currPlace = CHAPEL; + _coreVar._currPlace = CHAPEL; else if (menuChoice == 14) - g_s._currPlace = WELL; + _coreVar._currPlace = WELL; else if (menuChoice == 15) checkManorDistance(); else if (menuChoice == 16) gotoManorBack(); else if (menuChoice == 17) { - if ((g_s._wellObjectId != 120) && (g_s._wellObjectId != 140)) + if ((_coreVar._wellObjectId != 120) && (_coreVar._wellObjectId != 140)) g_crep = 997; - else if (g_s._wellObjectId == 120) + else if (_coreVar._wellObjectId == 120) g_crep = 181; - else if (g_s._faithScore > 80) { + else if (_coreVar._faithScore > 80) { g_crep = 1505; loseGame(); } else { - g_s._currPlace = INSIDE_WELL; + _coreVar._currPlace = INSIDE_WELL; affrep(); } } if ((menuChoice < 5) || (menuChoice == 13) || (menuChoice == 14)) affrep(); - debloc(g_s._currPlace); - _menu.setDestinationMenuText(g_s._currPlace); + debloc(_coreVar._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); } /** @@ -187,24 +187,24 @@ void MortevielleEngine::fctTake() { avpoing(cx); if (g_crep != 139) { if (_currBitIndex > 0) - g_s._faithScore += 3; + _coreVar._faithScore += 3; if (_obpart) { - if (g_s._currPlace == PURPLE_ROOM) - g_s._purpleRoomObjectId = 0; - if (g_s._currPlace == ATTIC) { - if (g_s._atticBallHoleObjectId == g_caff) - g_s._atticBallHoleObjectId = 0; - if (g_s._atticRodHoleObjectId == g_caff) - g_s._atticRodHoleObjectId = 0; + if (_coreVar._currPlace == PURPLE_ROOM) + _coreVar._purpleRoomObjectId = 0; + if (_coreVar._currPlace == ATTIC) { + if (_coreVar._atticBallHoleObjectId == g_caff) + _coreVar._atticBallHoleObjectId = 0; + if (_coreVar._atticRodHoleObjectId == g_caff) + _coreVar._atticRodHoleObjectId = 0; } - if (g_s._currPlace == CELLAR) - g_s._cellarObjectId = 0; - if (g_s._currPlace == CRYPT) - g_s._cryptObjectId = 0; - if (g_s._currPlace == SECRET_PASSAGE) - g_s._secretPassageObjectId = 0; - if (g_s._currPlace == WELL) - g_s._wellObjectId = 0; + if (_coreVar._currPlace == CELLAR) + _coreVar._cellarObjectId = 0; + if (_coreVar._currPlace == CRYPT) + _coreVar._cryptObjectId = 0; + if (_coreVar._currPlace == SECRET_PASSAGE) + _coreVar._secretPassageObjectId = 0; + if (_coreVar._currPlace == WELL) + _coreVar._wellObjectId = 0; _menu.unsetSearchMenu(); _obpart = false; affrep(); @@ -213,7 +213,7 @@ void MortevielleEngine::fctTake() { tsuiv(); ++g_dobj; if (g_dobj > 6) { - g_s._faithScore += 2; + _coreVar._faithScore += 2; g_dobj = 0; } } @@ -233,41 +233,41 @@ void MortevielleEngine::fctTake() { } } tcoord(5); - if ((g_num == 0) || ((g_num == 1) && (g_s._currPlace == CRYPT))) { + if ((g_num == 0) || ((g_num == 1) && (_coreVar._currPlace == CRYPT))) { tcoord(8); if (g_num != 0) { if (_currBitIndex > 0) - g_s._faithScore += 3; + _coreVar._faithScore += 3; g_crep = 997; - if ((g_s._currPlace == PURPLE_ROOM) && (g_s._purpleRoomObjectId != 0)) - avpoing(g_s._purpleRoomObjectId); - if ((g_s._currPlace == ATTIC) && (g_num == 1) && (g_s._atticBallHoleObjectId != 0)) { - avpoing(g_s._atticBallHoleObjectId); + if ((_coreVar._currPlace == PURPLE_ROOM) && (_coreVar._purpleRoomObjectId != 0)) + avpoing(_coreVar._purpleRoomObjectId); + if ((_coreVar._currPlace == ATTIC) && (g_num == 1) && (_coreVar._atticBallHoleObjectId != 0)) { + avpoing(_coreVar._atticBallHoleObjectId); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 7); } - if ((g_s._currPlace == ATTIC) && (g_num == 2) && (g_s._atticRodHoleObjectId != 0)) { - avpoing(g_s._atticRodHoleObjectId); + if ((_coreVar._currPlace == ATTIC) && (g_num == 2) && (_coreVar._atticRodHoleObjectId != 0)) { + avpoing(_coreVar._atticRodHoleObjectId); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 6); } - if ((g_s._currPlace == CELLAR) && (g_s._cellarObjectId != 0)) { - avpoing(g_s._cellarObjectId); + if ((_coreVar._currPlace == CELLAR) && (_coreVar._cellarObjectId != 0)) { + avpoing(_coreVar._cellarObjectId); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 2); } - if ((g_s._currPlace == CRYPT) && (g_s._cryptObjectId != 0)) - avpoing(g_s._cryptObjectId); + if ((_coreVar._currPlace == CRYPT) && (_coreVar._cryptObjectId != 0)) + avpoing(_coreVar._cryptObjectId); - if ((g_s._currPlace == SECRET_PASSAGE) && (g_s._secretPassageObjectId != 0)) { - avpoing(g_s._secretPassageObjectId); + if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId != 0)) { + avpoing(_coreVar._secretPassageObjectId); if ((g_crep != 997) && (g_crep != 139)) { g_crep = 182; aniof(2, 1); } } - if ((g_s._currPlace == WELL) && (g_s._wellObjectId != 0)) { - avpoing(g_s._wellObjectId); + if ((_coreVar._currPlace == WELL) && (_coreVar._wellObjectId != 0)) { + avpoing(_coreVar._wellObjectId); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 1); } @@ -275,22 +275,22 @@ void MortevielleEngine::fctTake() { g_crep = 999; } } else { - if ( ((g_s._currPlace == OWN_ROOM) && (g_num == 3)) - || ((g_s._currPlace == GREEN_ROOM) && (g_num == 4)) - || ((g_s._currPlace == PURPLE_ROOM) && (g_num == 1)) - || ((g_s._currPlace == DARKBLUE_ROOM) && (g_num == 3)) - || ((g_s._currPlace == BLUE_ROOM) && (g_num == 6)) - || ((g_s._currPlace == RED_ROOM) && (g_num == 2)) - || ((g_s._currPlace == BATHROOM) && (g_num == 6)) - || ((g_s._currPlace == GREEN_ROOM2) && (g_num == 4)) - || ((g_s._currPlace == ROOM9) && (g_num == 4)) - || ((g_s._currPlace == DINING_ROOM) && (g_num > 2)) - || ((g_s._currPlace == BUREAU) && (g_num == 7)) - || ((g_s._currPlace == KITCHEN) && (g_num == 6)) - || ((g_s._currPlace == ATTIC) && (g_num > 4)) - || ((g_s._currPlace > ATTIC) && (g_s._currPlace != INSIDE_WELL)) ) + if ( ((_coreVar._currPlace == OWN_ROOM) && (g_num == 3)) + || ((_coreVar._currPlace == GREEN_ROOM) && (g_num == 4)) + || ((_coreVar._currPlace == PURPLE_ROOM) && (g_num == 1)) + || ((_coreVar._currPlace == DARKBLUE_ROOM) && (g_num == 3)) + || ((_coreVar._currPlace == BLUE_ROOM) && (g_num == 6)) + || ((_coreVar._currPlace == RED_ROOM) && (g_num == 2)) + || ((_coreVar._currPlace == BATHROOM) && (g_num == 6)) + || ((_coreVar._currPlace == GREEN_ROOM2) && (g_num == 4)) + || ((_coreVar._currPlace == ROOM9) && (g_num == 4)) + || ((_coreVar._currPlace == DINING_ROOM) && (g_num > 2)) + || ((_coreVar._currPlace == BUREAU) && (g_num == 7)) + || ((_coreVar._currPlace == KITCHEN) && (g_num == 6)) + || ((_coreVar._currPlace == ATTIC) && (g_num > 4)) + || ((_coreVar._currPlace > ATTIC) && (_coreVar._currPlace != INSIDE_WELL)) ) g_crep = 997; - else if (g_s._currPlace == INSIDE_WELL) { + else if (_coreVar._currPlace == INSIDE_WELL) { g_crep = 1504; loseGame(); } else @@ -312,11 +312,11 @@ void MortevielleEngine::fctInventoryTake() { cy = 0; do { ++cy; - if (ord(g_s._sjer[cy]) != 0) + if (ord(_coreVar._sjer[cy]) != 0) ++cz; } while (cz != cx); - cz = ord(g_s._sjer[cy]); - g_s._sjer[cy] = chr(0); + cz = ord(_coreVar._sjer[cy]); + _coreVar._sjer[cy] = chr(0); modinv(); avpoing(cz); g_crep = 998; @@ -338,19 +338,19 @@ void MortevielleEngine::fctLift() { tcoord(8); if (g_num != 0) { if (_currBitIndex > 0) - ++g_s._faithScore; + ++_coreVar._faithScore; g_crep = 997; - if ((g_s._currPlace == PURPLE_ROOM) && (g_s._purpleRoomObjectId != 0)) - treg(g_s._purpleRoomObjectId); + if ((_coreVar._currPlace == PURPLE_ROOM) && (_coreVar._purpleRoomObjectId != 0)) + treg(_coreVar._purpleRoomObjectId); } return; } if (_currBitIndex > 0) - ++g_s._faithScore; - int tmpPlace = g_s._currPlace; - if (g_s._currPlace == CRYPT) + ++_coreVar._faithScore; + int tmpPlace = _coreVar._currPlace; + if (_coreVar._currPlace == CRYPT) tmpPlace = 14; - else if (g_s._currPlace == MOUNTAIN) + else if (_coreVar._currPlace == MOUNTAIN) tmpPlace = 15; g_crep = g_tabdon[asoul + (tmpPlace << 3) + (g_num - 1)]; if (g_crep == 255) @@ -381,10 +381,10 @@ void MortevielleEngine::fctRead() { * @remarks Originally called 'tslire' */ void MortevielleEngine::fctSelfRead() { - if (g_s._selectedObjectId == 0) + if (_coreVar._selectedObjectId == 0) g_crep = 186; else - st4(g_s._selectedObjectId); + st4(_coreVar._selectedObjectId); } /** @@ -408,60 +408,60 @@ void MortevielleEngine::fctLook() { tcoord(8); g_crep = 131; if (g_num != 0) { - if (g_s._currPlace == ATTIC) { + if (_coreVar._currPlace == ATTIC) { if (g_num == 1) { g_crep = 164; - if (g_s._atticRodHoleObjectId != 0) - treg(g_s._atticRodHoleObjectId); - else if (g_s._atticBallHoleObjectId != 0) - treg(g_s._atticBallHoleObjectId); + if (_coreVar._atticRodHoleObjectId != 0) + treg(_coreVar._atticRodHoleObjectId); + else if (_coreVar._atticBallHoleObjectId != 0) + treg(_coreVar._atticBallHoleObjectId); } else { g_crep = 193; - if (g_s._atticRodHoleObjectId != 0) - treg(g_s._atticRodHoleObjectId); + if (_coreVar._atticRodHoleObjectId != 0) + treg(_coreVar._atticRodHoleObjectId); } } - if (g_s._currPlace == CELLAR) { + if (_coreVar._currPlace == CELLAR) { g_crep = 164; - if (g_s._cellarObjectId != 0) - treg(g_s._cellarObjectId); + if (_coreVar._cellarObjectId != 0) + treg(_coreVar._cellarObjectId); } - if (g_s._currPlace == SECRET_PASSAGE) { + if (_coreVar._currPlace == SECRET_PASSAGE) { g_crep = 174; - if (g_s._secretPassageObjectId != 0) - treg(g_s._secretPassageObjectId); + if (_coreVar._secretPassageObjectId != 0) + treg(_coreVar._secretPassageObjectId); } - if (g_s._currPlace == WELL) { + if (_coreVar._currPlace == WELL) { g_crep = 131; - if (g_s._wellObjectId != 0) - treg(g_s._wellObjectId); + if (_coreVar._wellObjectId != 0) + treg(_coreVar._wellObjectId); } } return; } - cx = g_s._currPlace; - if (g_s._currPlace == CHAPEL) + cx = _coreVar._currPlace; + if (_coreVar._currPlace == CHAPEL) cx = 17; - if ((g_s._currPlace > MANOR_FRONT) && (g_s._currPlace < DOOR)) + if ((_coreVar._currPlace > MANOR_FRONT) && (_coreVar._currPlace < DOOR)) cx -= 4; - if (g_s._currPlace == ROOM26) + if (_coreVar._currPlace == ROOM26) cx = 21; g_crep = g_tabdon[arega + (cx * 7) + g_num - 1]; - if ((g_s._currPlace == ATTIC) && (g_num == 8)) + if ((_coreVar._currPlace == ATTIC) && (g_num == 8)) g_crep = 126; - if (g_s._currPlace == MOUNTAIN) + if (_coreVar._currPlace == MOUNTAIN) g_crep = 103; if (g_crep == 255) g_crep = 131; - if ((g_s._currPlace == GREEN_ROOM) && (g_num == 1)) + if ((_coreVar._currPlace == GREEN_ROOM) && (g_num == 1)) treg(144); - if ((g_s._currPlace == BLUE_ROOM) && (g_num == 3)) + if ((_coreVar._currPlace == BLUE_ROOM) && (g_num == 3)) treg(147); - if ((g_s._currPlace == GREEN_ROOM2) && (g_num == 3)) + if ((_coreVar._currPlace == GREEN_ROOM2) && (g_num == 3)) treg(149); - if ((g_s._currPlace == 9) && (g_num == 2)) + if ((_coreVar._currPlace == 9) && (g_num == 2)) treg(30); - if ((g_s._currPlace == DINING_ROOM) && (g_num == 3)) + if ((_coreVar._currPlace == DINING_ROOM) && (g_num == 3)) treg(31); } @@ -470,8 +470,8 @@ void MortevielleEngine::fctLook() { * @remarks Originally called 'tsregarder' */ void MortevielleEngine::fctSelftLook() { - if (g_s._selectedObjectId != 0) - treg(g_s._selectedObjectId); + if (_coreVar._selectedObjectId != 0) + treg(_coreVar._selectedObjectId); else g_crep = 186; } @@ -495,7 +495,7 @@ void MortevielleEngine::fctSearch() { if (_anyone || _keyPressedEsc) return; - if (g_s._currPlace == INSIDE_WELL) { + if (_coreVar._currPlace == INSIDE_WELL) { g_crep = 1504; loseGame(); return; @@ -513,7 +513,7 @@ void MortevielleEngine::fctSearch() { g_crep = 187; else { if (_currBitIndex > 0) - g_s._faithScore += 3; + _coreVar._faithScore += 3; rechai(g_mchai); if (g_mchai != 0) { @@ -530,41 +530,41 @@ void MortevielleEngine::fctSearch() { g_crep = 997; if (g_num != 0) { if (_currBitIndex > 0) - g_s._faithScore += 3; - if ((g_s._currPlace != WELL) && (g_s._currPlace != SECRET_PASSAGE) && (g_s._currPlace != ATTIC)) { - if (g_s._currPlace == PURPLE_ROOM) { + _coreVar._faithScore += 3; + if ((_coreVar._currPlace != WELL) && (_coreVar._currPlace != SECRET_PASSAGE) && (_coreVar._currPlace != ATTIC)) { + if (_coreVar._currPlace == PURPLE_ROOM) { g_crep = 123; - if (g_s._purpleRoomObjectId != 0) - treg(g_s._purpleRoomObjectId); + if (_coreVar._purpleRoomObjectId != 0) + treg(_coreVar._purpleRoomObjectId); } - if (g_s._currPlace == CRYPT) { + if (_coreVar._currPlace == CRYPT) { g_crep = 123; - if (g_s._cryptObjectId != 0) - treg(g_s._cryptObjectId); + if (_coreVar._cryptObjectId != 0) + treg(_coreVar._cryptObjectId); } } } } } else { if (_currBitIndex > 0) - g_s._faithScore += 3; + _coreVar._faithScore += 3; g_crep = 997; - if (g_s._currPlace < CELLAR) - g_crep = r[g_s._currPlace]; + if (_coreVar._currPlace < CELLAR) + g_crep = r[_coreVar._currPlace]; - if ((g_s._currPlace == TOILETS) && (g_num == 2)) + if ((_coreVar._currPlace == TOILETS) && (g_num == 2)) g_crep = 162; - if (g_s._currPlace == KITCHEN) { + if (_coreVar._currPlace == KITCHEN) { if ((g_num == 3) || (g_num == 4)) g_crep = 162; else if (g_num == 5) g_crep = 159; } - if (g_s._currPlace == MOUNTAIN) + if (_coreVar._currPlace == MOUNTAIN) g_crep = 104; - else if (g_s._currPlace == CRYPT) + else if (_coreVar._currPlace == CRYPT) g_crep = 155; } } @@ -574,8 +574,8 @@ void MortevielleEngine::fctSearch() { * @remarks Originally called 'tsfouiller' */ void MortevielleEngine::fctSelfSearch() { - if (g_s._selectedObjectId != 0) - st7(g_s._selectedObjectId); + if (_coreVar._selectedObjectId != 0) + st7(_coreVar._selectedObjectId); else g_crep = 186; } @@ -609,30 +609,30 @@ void MortevielleEngine::fctOpen() { tcoord(7); if (g_num != 0) { if (_currBitIndex > 0) - g_s._faithScore += 2; + _coreVar._faithScore += 2; ++g_iouv; int tmpPlace = 0; do { ++tmpPlace; } while (!((tmpPlace > 6) || (ord(g_touv[tmpPlace]) == 0) || (ord(g_touv[tmpPlace]) == g_num))); if (ord(g_touv[tmpPlace]) != g_num) { - if (!( ((g_num == 3) && ((g_s._currPlace == OWN_ROOM) || (g_s._currPlace == 9) || (g_s._currPlace == BLUE_ROOM) || (g_s._currPlace == BATHROOM))) - || ((g_num == 4) && ((g_s._currPlace == GREEN_ROOM) || (g_s._currPlace == PURPLE_ROOM) || (g_s._currPlace == RED_ROOM))) - || ((g_s._currPlace == DARKBLUE_ROOM) && (g_num == 5)) - || ((g_num == 6) && ((g_s._currPlace == BATHROOM) || (g_s._currPlace == DINING_ROOM) || (g_s._currPlace == GREEN_ROOM2) || (g_s._currPlace == ATTIC))) - || ((g_s._currPlace == GREEN_ROOM2) && (g_num == 2)) - || ((g_s._currPlace == KITCHEN) && (g_num == 7))) ) { - if ( ((g_s._currPlace > DINING_ROOM) && (g_s._currPlace < CELLAR)) - || ((g_s._currPlace > RED_ROOM) && (g_s._currPlace < DINING_ROOM)) - || (g_s._currPlace == OWN_ROOM) || (g_s._currPlace == PURPLE_ROOM) || (g_s._currPlace == BLUE_ROOM)) { + if (!( ((g_num == 3) && ((_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == 9) || (_coreVar._currPlace == BLUE_ROOM) || (_coreVar._currPlace == BATHROOM))) + || ((g_num == 4) && ((_coreVar._currPlace == GREEN_ROOM) || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == RED_ROOM))) + || ((_coreVar._currPlace == DARKBLUE_ROOM) && (g_num == 5)) + || ((g_num == 6) && ((_coreVar._currPlace == BATHROOM) || (_coreVar._currPlace == DINING_ROOM) || (_coreVar._currPlace == GREEN_ROOM2) || (_coreVar._currPlace == ATTIC))) + || ((_coreVar._currPlace == GREEN_ROOM2) && (g_num == 2)) + || ((_coreVar._currPlace == KITCHEN) && (g_num == 7))) ) { + if ( ((_coreVar._currPlace > DINING_ROOM) && (_coreVar._currPlace < CELLAR)) + || ((_coreVar._currPlace > RED_ROOM) && (_coreVar._currPlace < DINING_ROOM)) + || (_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == BLUE_ROOM)) { if (getRandomNumber(1, 4) == 3) _speechManager.startSpeech(7, 9, 1); } g_touv[tmpPlace] = chr(g_num); aniof(1, g_num); } - tmpPlace = g_s._currPlace; - if (g_s._currPlace == CRYPT) + tmpPlace = _coreVar._currPlace; + if (_coreVar._currPlace == CRYPT) tmpPlace = CELLAR; g_crep = g_tabdon[aouvr + (tmpPlace * 7) + g_num - 1]; if (g_crep == 254) @@ -647,7 +647,7 @@ void MortevielleEngine::fctOpen() { * @remarks Originally called 'tmettre' */ void MortevielleEngine::fctPlace() { - if (g_s._selectedObjectId == 0) { + if (_coreVar._selectedObjectId == 0) { g_crep = 186; return; } @@ -667,28 +667,28 @@ void MortevielleEngine::fctPlace() { g_crep = 999; if (g_caff == 13) { if (g_num == 1) { - if (g_s._atticBallHoleObjectId != 0) { + if (_coreVar._atticBallHoleObjectId != 0) { g_crep = 188; } else { - g_s._atticBallHoleObjectId = g_s._selectedObjectId; - if (g_s._selectedObjectId == 141) + _coreVar._atticBallHoleObjectId = _coreVar._selectedObjectId; + if (_coreVar._selectedObjectId == 141) aniof(1, 7); } - } else if (g_s._atticRodHoleObjectId != 0) { + } else if (_coreVar._atticRodHoleObjectId != 0) { g_crep = 188; } else { - g_s._atticRodHoleObjectId = g_s._selectedObjectId; - if (g_s._selectedObjectId == 159) + _coreVar._atticRodHoleObjectId = _coreVar._selectedObjectId; + if (_coreVar._selectedObjectId == 159) aniof(1, 6); } } if (g_caff == 14) { - if (g_s._cellarObjectId != 0) { + if (_coreVar._cellarObjectId != 0) { g_crep = 188; } else { - g_s._cellarObjectId = g_s._selectedObjectId; - if (g_s._selectedObjectId == 151) { + _coreVar._cellarObjectId = _coreVar._selectedObjectId; + if (_coreVar._selectedObjectId == 151) { // Open hidden passage aniof(1, 2); aniof(1, 1); @@ -709,7 +709,7 @@ void MortevielleEngine::fctPlace() { clearScreenType2(); clearScreenType3(); _mouse.showMouse(); - tinke(); + prepareRoom(); drawClock(); if (_currBitIndex != 0) showPeoplePresent(_currBitIndex); @@ -718,10 +718,10 @@ void MortevielleEngine::fctPlace() { _menu.displayMenu(); if (enterPassageFl) { - g_s._currPlace = SECRET_PASSAGE; + _coreVar._currPlace = SECRET_PASSAGE; _menu.setDestinationMenuText(SECRET_PASSAGE); } else { - _menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); setPal(14); dessin(0); aniof(1, 2); @@ -742,17 +742,17 @@ void MortevielleEngine::fctPlace() { } if (g_caff == 16) { - if (g_s._cryptObjectId == 0) - g_s._cryptObjectId = g_s._selectedObjectId; + if (_coreVar._cryptObjectId == 0) + _coreVar._cryptObjectId = _coreVar._selectedObjectId; else g_crep = 188; } if (g_caff == 17) { - if (g_s._secretPassageObjectId != 0) { + if (_coreVar._secretPassageObjectId != 0) { g_crep = 188; - } else if (g_s._selectedObjectId == 143) { - g_s._secretPassageObjectId = 143; + } else if (_coreVar._selectedObjectId == 143) { + _coreVar._secretPassageObjectId = 143; aniof(1, 1); } else { g_crep = 1512; @@ -761,10 +761,10 @@ void MortevielleEngine::fctPlace() { } if (g_caff == 24) { - if (g_s._wellObjectId != 0) { + if (_coreVar._wellObjectId != 0) { g_crep = 188; - } else if ((g_s._selectedObjectId == 140) || (g_s._selectedObjectId == 120)) { - g_s._wellObjectId = g_s._selectedObjectId; + } else if ((_coreVar._selectedObjectId == 140) || (_coreVar._selectedObjectId == 120)) { + _coreVar._wellObjectId = _coreVar._selectedObjectId; aniof(1, 1); } else { g_crep = 185; @@ -793,7 +793,7 @@ void MortevielleEngine::fctTurn() { tcoord(9); if (g_num != 0) { g_crep = 997; - if ((g_s._currPlace == ATTIC) && (g_s._atticRodHoleObjectId == 159) && (g_s._atticBallHoleObjectId == 141)) { + if ((_coreVar._currPlace == ATTIC) && (_coreVar._atticRodHoleObjectId == 159) && (_coreVar._atticBallHoleObjectId == 141)) { repon(2, 167); _speechManager.startSpeech(7, 9, 1); int answer = Alert::show(getEngineString(S_YES_NO), 1); @@ -802,13 +802,13 @@ void MortevielleEngine::fctTurn() { else g_crep = 168; } - if ((g_s._currPlace == SECRET_PASSAGE) && (g_s._secretPassageObjectId == 143)) { + if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) { repon(2, 175); clearScreenType3(); _speechManager.startSpeech(6, -9, 1); int answer = Alert::show(getEngineString(S_YES_NO), 1); if (answer == 1) { - g_s._currPlace = CRYPT; + _coreVar._currPlace = CRYPT; affrep(); } else g_crep = 176; @@ -840,7 +840,7 @@ void MortevielleEngine::fctSelfHide() { * @remarks Originally called 'tattacher' */ void MortevielleEngine::fctAttach() { - if (g_s._selectedObjectId == 0) + if (_coreVar._selectedObjectId == 0) g_crep = 186; else { if (!_syn) @@ -849,10 +849,10 @@ void MortevielleEngine::fctAttach() { if (!(_anyone) && !(_keyPressedEsc)) { tcoord(8); g_crep = 997; - if ((g_num != 0) && (g_s._currPlace == WELL)) { + if ((g_num != 0) && (_coreVar._currPlace == WELL)) { g_crep = 999; - if ((g_s._selectedObjectId == 120) || (g_s._selectedObjectId == 140)) { - g_s._wellObjectId = g_s._selectedObjectId; + if ((_coreVar._selectedObjectId == 120) || (_coreVar._selectedObjectId == 140)) { + _coreVar._wellObjectId = _coreVar._selectedObjectId; aniof(1, 1); } else g_crep = 185; @@ -910,15 +910,15 @@ void MortevielleEngine::fctKnock() { if (!_syn) ecr3(getEngineString(S_HIT)); - if (g_s._currPlace == LANDING) { + if (_coreVar._currPlace == LANDING) { Alert::show(getEngineString(S_BEFORE_USE_DEP_MENU), 1); return; } - if (g_s._currPlace < DOOR) { + if (_coreVar._currPlace < DOOR) { tfleche(); if (!(_anyone) && !(_keyPressedEsc)) { - if ((g_s._currPlace < MOUNTAIN) && (g_s._currPlace != LANDING)) + if ((_coreVar._currPlace < MOUNTAIN) && (_coreVar._currPlace != LANDING)) g_crep = 133; else g_crep = 997; @@ -927,11 +927,11 @@ void MortevielleEngine::fctKnock() { return; } - if (g_s._currPlace == ROOM26) { + if (_coreVar._currPlace == ROOM26) { int rand = (getRandomNumber(0, 8)) - 4; _speechManager.startSpeech(11, rand, 1); int p; - ecfren(p, rand, g_s._faithScore, g_ment); + ecfren(p, rand, _coreVar._faithScore, g_ment); int l = g_ment; if (l != 0) { if (p != -500) { @@ -957,7 +957,7 @@ void MortevielleEngine::fctKnock() { void MortevielleEngine::fctSelfPut() { if (!_syn) ecr3(getEngineString(S_POSE)); - if (g_s._selectedObjectId == 0) + if (_coreVar._selectedObjectId == 0) g_crep = 186; else { if (g_caff > 99) { @@ -994,30 +994,30 @@ void MortevielleEngine::fctSelfPut() { if (g_num != 0) { g_crep = 998; if (g_caff == PURPLE_ROOM) { - if (g_s._purpleRoomObjectId != 0) + if (_coreVar._purpleRoomObjectId != 0) g_crep = 188; else - g_s._purpleRoomObjectId = g_s._selectedObjectId; + _coreVar._purpleRoomObjectId = _coreVar._selectedObjectId; } if (g_caff == ATTIC) { if (g_num == 1) { - if (g_s._atticBallHoleObjectId != 0) + if (_coreVar._atticBallHoleObjectId != 0) g_crep = 188; else - g_s._atticBallHoleObjectId = g_s._selectedObjectId; - } else if (g_s._atticRodHoleObjectId != 0) { + _coreVar._atticBallHoleObjectId = _coreVar._selectedObjectId; + } else if (_coreVar._atticRodHoleObjectId != 0) { g_crep = 188; } else { - g_s._atticRodHoleObjectId = g_s._selectedObjectId; + _coreVar._atticRodHoleObjectId = _coreVar._selectedObjectId; } } if (g_caff == CRYPT) { - if (g_s._cryptObjectId != 0) + if (_coreVar._cryptObjectId != 0) g_crep = 188; else - g_s._cryptObjectId = g_s._selectedObjectId; + _coreVar._cryptObjectId = _coreVar._selectedObjectId; } if (g_caff == WELL) @@ -1049,13 +1049,13 @@ void MortevielleEngine::fctSelfPut() { * @remarks Originally called 'tecouter' */ void MortevielleEngine::fctListen() { - if (g_s._currPlace != ROOM26) + if (_coreVar._currPlace != ROOM26) g_crep = 101; else { if (_currBitIndex != 0) - ++g_s._faithScore; + ++_coreVar._faithScore; int p, rand; - ecfren(p, rand, g_s._faithScore, g_ment); + ecfren(p, rand, _coreVar._faithScore, g_ment); int l = g_ment; if (l != 0) { if (p != -500) { @@ -1087,19 +1087,19 @@ void MortevielleEngine::fctListen() { * @remarks Originally called 'tmanger' */ void MortevielleEngine::fctEat() { - if ((g_s._currPlace > LANDING) && (g_s._currPlace < ROOM26)) { + if ((_coreVar._currPlace > LANDING) && (_coreVar._currPlace < ROOM26)) { g_crep = 148; } else { tsort(); - g_s._currPlace = DINING_ROOM; + _coreVar._currPlace = DINING_ROOM; g_caff = 10; - debloc(g_s._currPlace); - _menu.setDestinationMenuText(g_s._currPlace); + debloc(_coreVar._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); int j, h, m; updateHour(j, h, m); if ((h == 12) || (h == 13) || (h == 19)) { - g_s._faithScore -= (g_s._faithScore / 7); + _coreVar._faithScore -= (_coreVar._faithScore / 7); if (h == 12) { if (m == 0) h = 4; @@ -1116,7 +1116,7 @@ void MortevielleEngine::fctEat() { g_jh += h; g_crep = 135; - tinke(); + prepareRoom(); } else { g_crep = 134; } @@ -1128,16 +1128,16 @@ void MortevielleEngine::fctEat() { * @remarks Originally called 'tentrer' */ void MortevielleEngine::fctEnter() { - if ((g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) { + if ((_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) { gotoDiningRoom(); - _menu.setDestinationMenuText(g_s._currPlace); - } else if (g_s._currPlace == LANDING) + _menu.setDestinationMenuText(_coreVar._currPlace); + } else if (_coreVar._currPlace == LANDING) showMoveMenuAlert(); else if (g_ment == 0) g_crep = 997; - else if ((g_ment == 9) && (g_s._selectedObjectId != 136)) { + else if ((g_ment == 9) && (_coreVar._selectedObjectId != 136)) { g_crep = 189; - g_s._teauto[8] = '*'; + _coreVar._teauto[8] = '*'; } else { int z = 0; if (!_blo) @@ -1151,8 +1151,8 @@ void MortevielleEngine::fctEnter() { aniof(1, 1); g_x = convertBitIndexToCharacterIndex(z); - ++g_s._faithScore; - g_s._currPlace = LANDING; + ++_coreVar._faithScore; + _coreVar._currPlace = LANDING; g_msg[3] = MENU_DISCUSS; g_msg[4] = _menu._discussMenu[g_x]; _syn = true; @@ -1171,10 +1171,10 @@ void MortevielleEngine::fctEnter() { _speechManager.startSpeech(7, g_x, 1); aniof(1, 1); - g_s._currPlace = g_ment; + _coreVar._currPlace = g_ment; affrep(); - debloc(g_s._currPlace); - _menu.setDestinationMenuText(g_s._currPlace); + debloc(_coreVar._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); g_ment = 0; g_mpers = 0; _currBitIndex = 0; @@ -1189,17 +1189,17 @@ void MortevielleEngine::fctEnter() { void MortevielleEngine::fctSleep() { int z, j, h, m; - if ((g_s._currPlace > LANDING) && (g_s._currPlace < ROOM26)) { + if ((_coreVar._currPlace > LANDING) && (_coreVar._currPlace < ROOM26)) { g_crep = 148; return; } - if (g_s._currPlace != OWN_ROOM) { + if (_coreVar._currPlace != OWN_ROOM) { tsort(); - g_s._currPlace = OWN_ROOM; + _coreVar._currPlace = OWN_ROOM; affrep(); afdes(); - debloc(g_s._currPlace); - _menu.setDestinationMenuText(g_s._currPlace); + debloc(_coreVar._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); } clearScreenType3(); clearScreenType2(); @@ -1210,7 +1210,7 @@ void MortevielleEngine::fctSleep() { int answer; do { if (h < 8) { - g_s._faithScore -= (g_s._faithScore / 20); + _coreVar._faithScore -= (_coreVar._faithScore / 20); z = (7 - h) * 2; if (m == 30) --z; @@ -1221,7 +1221,7 @@ void MortevielleEngine::fctSleep() { ++h; if (h > 23) h = 0; - tinke(); + prepareRoom(); answer = Alert::show(getEngineString(S_YES_NO), 1); _anyone = false; } while (answer != 1); @@ -1240,11 +1240,11 @@ void MortevielleEngine::fctForce() { tfleche(); if ((!_anyone) && (!_keyPressedEsc)) { - if (g_s._currPlace != ROOM26) + if (_coreVar._currPlace != ROOM26) g_crep = 997; else { g_crep = 143; - g_s._faithScore += 2; + _coreVar._faithScore += 2; } } } @@ -1256,27 +1256,27 @@ void MortevielleEngine::fctForce() { void MortevielleEngine::fctLeave() { tsort(); g_crep = 0; - if ((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK) || (g_s._currPlace == WELL)) + if ((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK) || (_coreVar._currPlace == WELL)) g_crep = 997; else { int nextPlace = OWN_ROOM; - if ((g_s._currPlace < CRYPT) || (g_s._currPlace == ROOM26)) + if ((_coreVar._currPlace < CRYPT) || (_coreVar._currPlace == ROOM26)) nextPlace = DINING_ROOM; - else if ((g_s._currPlace == DINING_ROOM) || (g_s._currPlace == CHAPEL)) + else if ((_coreVar._currPlace == DINING_ROOM) || (_coreVar._currPlace == CHAPEL)) nextPlace = MANOR_FRONT; - else if ((g_s._currPlace < DINING_ROOM) || (g_s._currPlace == ATTIC)) + else if ((_coreVar._currPlace < DINING_ROOM) || (_coreVar._currPlace == ATTIC)) nextPlace = LANDING; - else if (g_s._currPlace == CRYPT) { + else if (_coreVar._currPlace == CRYPT) { nextPlace = SECRET_PASSAGE; g_crep = 176; - } else if (g_s._currPlace == SECRET_PASSAGE) + } else if (_coreVar._currPlace == SECRET_PASSAGE) nextPlace = t23coul(); - else if (g_s._currPlace == INSIDE_WELL) + else if (_coreVar._currPlace == INSIDE_WELL) nextPlace = WELL; if (g_crep != 997) - g_s._currPlace = nextPlace; + _coreVar._currPlace = nextPlace; g_caff = nextPlace; if (g_crep == 0) @@ -1297,18 +1297,18 @@ void MortevielleEngine::fctWait() { int answer; do { ++g_jh; - tinke(); + prepareRoom(); if (!_blo) - t11(g_s._currPlace); + t11(_coreVar._currPlace); if ((_currBitIndex != 0) && (g_mpers == 0)) { g_crep = 998; - if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) + if ((_coreVar._currPlace == ATTIC) || (_coreVar._currPlace == CELLAR)) cavegre(); - if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) + if ((_coreVar._currPlace > OWN_ROOM) && (_coreVar._currPlace < DINING_ROOM)) _anyone = true; g_mpers = _currBitIndex; if (!_anyone) - tinke(); + prepareRoom(); return; } repon(2, 102); @@ -1316,7 +1316,7 @@ void MortevielleEngine::fctWait() { } while (answer != 2); g_crep = 998; if (!_anyone) - tinke(); + prepareRoom(); } /** @@ -1383,7 +1383,7 @@ void MortevielleEngine::fctDiscuss() { do { ++icm; _screenSurface.putxy(co, lig); - if (g_s._teauto[icm] == '*') { + if (_coreVar._teauto[icm] == '*') { if (te[icm]) writetp(lib[icm], 1); else @@ -1443,7 +1443,7 @@ void MortevielleEngine::fctDiscuss() { writetp(lib[choi], 1); te[choi] = ! te[choi]; } - if ((g_s._teauto[ix] == '*') || (ix == 46)) { + if ((_coreVar._teauto[ix] == '*') || (ix == 46)) { lig = ((ix - 1) % 23) << 3; if (ix > 23) co = 320; @@ -1466,7 +1466,7 @@ void MortevielleEngine::fctDiscuss() { int ix = choi - 1; if (_col) { _col = false; - g_s._currPlace = 15; + _coreVar._currPlace = 15; if (g_iouv > 0) max = 8; else @@ -1475,14 +1475,14 @@ void MortevielleEngine::fctDiscuss() { suj = 129; else { suj = 138; - g_s._faithScore += (3 * (g_s._faithScore / 10)); + _coreVar._faithScore += (3 * (_coreVar._faithScore / 10)); } } else if (g_nbrep[g_caff - 69] < g_nbrepm[g_caff - 69]) { suj = g_tabdon[arep + (ix << 3) + (g_caff - 70)]; - g_s._faithScore += g_tabdon[arcf + ix]; + _coreVar._faithScore += g_tabdon[arcf + ix]; ++g_nbrep[g_caff - 69]; } else { - g_s._faithScore += 3; + _coreVar._faithScore += 3; suj = 139; } _mouse.hideMouse(); @@ -1491,17 +1491,17 @@ void MortevielleEngine::fctDiscuss() { startDialog(suj); _mouse.showMouse(); if ((suj == 84) || (suj == 86)) { - g_s._pourc[5] = '*'; - g_s._teauto[7] = '*'; + _coreVar._pourc[5] = '*'; + _coreVar._teauto[7] = '*'; } if ((suj == 106) || (suj == 108) || (suj == 94)) { for (int indx = 29; indx <= 31; ++indx) - g_s._teauto[indx] = '*'; - g_s._pourc[7] = '*'; + _coreVar._teauto[indx] = '*'; + _coreVar._pourc[7] = '*'; } if (suj == 70) { - g_s._pourc[8] = '*'; - g_s._teauto[32] = '*'; + _coreVar._pourc[8] = '*'; + _coreVar._teauto[32] = '*'; } _mouse.hideMouse(); hirs(); @@ -1509,14 +1509,14 @@ void MortevielleEngine::fctDiscuss() { } } while ((choi != 46) && (suj != 138)); if (_col) { - g_s._faithScore += (3 * (g_s._faithScore / 10)); + _coreVar._faithScore += (3 * (_coreVar._faithScore / 10)); _mouse.hideMouse(); hirs(); premtet(); startDialog(138); _mouse.showMouse(); _col = false; - g_s._currPlace = LANDING; + _coreVar._currPlace = LANDING; } g_ctrm = 0; _mouse.hideMouse(); @@ -1524,11 +1524,11 @@ void MortevielleEngine::fctDiscuss() { drawRightFrame(); _mouse.showMouse(); showPeoplePresent(_currBitIndex); - tinke(); + prepareRoom(); drawClock(); affrep(); /* chech;*/ - _menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); clearScreenType3(); } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 137ff468a2..1d8a10526b 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -196,7 +196,7 @@ void Menu::displayMenu() { do { // One line after the other msk = 0x80; for (pt = 0; pt <= 7; ++pt) { - if ((g_lettres[num_letr - 1][ind_tabl] & msk) != 0) { + if ((_charArr[num_letr - 1][ind_tabl] & msk) != 0) { g_vm->_screenSurface.setPixel(Common::Point(x + 1, y + 1), 0); g_vm->_screenSurface.setPixel(Common::Point(x, y + 1), 0); g_vm->_screenSurface.setPixel(Common::Point(x, y), color); @@ -505,7 +505,7 @@ void Menu::initMenu() { if (!f.open("menu.mor")) error("Missing file - menufr.mor or menual.mor or menu.mor"); - f.read(g_lettres, 7 * 24); + f.read(_charArr, 7 * 24); f.close(); // Skipped: dialog asking to swap floppy @@ -567,7 +567,7 @@ void Menu::setSearchMenu() { * @remarks Originally called 'mfouen' */ void Menu::unsetSearchMenu() { - setDestinationMenuText(g_vm->g_s._currPlace); + setDestinationMenuText(g_vm->_coreVar._currPlace); for (int i = 1; i <= 11; ++i) enableMenuItem(_actionMenu[i]); diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 7f224a3ee5..b600d4e3af 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -40,6 +40,8 @@ enum { class Menu { private: + byte _charArr[7][24]; + void util(Common::Point pos); void invert(int indx); void menuDown(int ii); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index e1206be2c2..ca01e01fcf 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -95,18 +95,6 @@ int animof(int ouf, int num) { return animof_result; } -/** - * Read the current system time - */ -int readclock() { - TimeDate dateTime; - g_system->getTimeAndDate(dateTime); - - int m = dateTime.tm_min * 60; - int h = dateTime.tm_hour * 3600; - return h + m + dateTime.tm_sec; -} - void modif(int &nu) { if (nu == 26) nu = 25; @@ -245,12 +233,12 @@ void repon(int f, int m) { g_vm->prepareScreenType2(); text1(8, 182, 103, m); if ((m == 68) || (m == 69)) - g_vm->g_s._teauto[40] = '*'; + g_vm->_coreVar._teauto[40] = '*'; if ((m == 104) && (g_caff == 14)) { - g_vm->g_s._teauto[36] = '*'; - if (g_vm->g_s._teauto[39] == '*') { - g_vm->g_s._pourc[3] = '*'; - g_vm->g_s._teauto[38] = '*'; + g_vm->_coreVar._teauto[36] = '*'; + if (g_vm->_coreVar._teauto[39] == '*') { + g_vm->_coreVar._pourc[3] = '*'; + g_vm->_coreVar._teauto[38] = '*'; } } break; @@ -267,9 +255,9 @@ void repon(int f, int m) { displayStr(tmpStr, 80, 40, 60, 25, i); if (m == 180) - g_vm->g_s._pourc[6] = '*'; + g_vm->_coreVar._pourc[6] = '*'; else if (m == 179) - g_vm->g_s._pourc[10] = '*'; + g_vm->_coreVar._pourc[10] = '*'; } break; default: @@ -286,57 +274,6 @@ int chlm() { return retval; } -/** - * Engine function - Draw Clock - * @remarks Originally called 'pendule' - */ -void drawClock() { - const int cv[2][12] = { - { 5, 8, 10, 8, 5, 0, -5, -8, -10, -8, -5, 0 }, - { -5, -3, 0, 3, 5, 6, 5, 3, 0, -3, -5, -6 } - }; - const int x = 580; - const int y = 123; - const int rg = 9; - int h, co; - - g_vm->_mouse.hideMouse(); - - paint_rect(570, 118, 20, 10); - paint_rect(578, 114, 6, 18); - if ((g_vm->_currGraphicalDevice == MODE_CGA) || (g_vm->_currGraphicalDevice == MODE_HERCULES)) - co = 0; - else - co = 1; - - if (g_vm->_minute == 0) - g_vm->_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y - rg), co); - else - g_vm->_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y + rg), co); - - h = g_vm->_hour; - if (h > 12) - h -= 12; - if (h == 0) - h = 12; - - g_vm->_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)(x + cv[0][h - 1]) >> 1) * g_res, y + cv[1][h - 1], co); - g_vm->_mouse.showMouse(); - g_vm->_screenSurface.putxy(568, 154); - - if (g_vm->_hour > 11) - g_vm->_screenSurface.drawString("PM ", 1); - else - g_vm->_screenSurface.drawString("AM ", 1); - - g_vm->_screenSurface.putxy(550, 160); - if ((g_vm->_day >= 0) && (g_vm->_day <= 8)) { - Common::String tmp = g_vm->getEngineString(S_DAY); - tmp.insertChar((char)(g_vm->_day + 49), 0); - g_vm->_screenSurface.drawString(tmp, 1); - } -} - /************* * NIVEAU 11 * *************/ @@ -426,7 +363,7 @@ int t11(int roomId) { int retVal = 0; int p, rand; - ecfren(p, rand, g_vm->g_s._faithScore, roomId); + ecfren(p, rand, g_vm->_coreVar._faithScore, roomId); g_vm->_place = roomId; if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) { if (p != -500) { @@ -458,7 +395,7 @@ int t11(int roomId) { p = g_vm->getPresenceStatsLanding(); else if (roomId == CHAPEL) p = g_vm->getPresenceStatsChapel(h); - p += g_vm->g_s._faithScore; + p += g_vm->_coreVar._faithScore; rand = g_vm->getRandomNumber(1, 100); if (rand > p) { g_vm->displayAloneText(); @@ -483,9 +420,9 @@ int t11(int roomId) { } void cavegre() { - g_vm->g_s._faithScore += 2; - if (g_vm->g_s._faithScore > 69) - g_vm->g_s._faithScore += (g_vm->g_s._faithScore / 10); + g_vm->_coreVar._faithScore += 2; + if (g_vm->_coreVar._faithScore > 69) + g_vm->_coreVar._faithScore += (g_vm->_coreVar._faithScore / 10); g_vm->clearScreenType3(); g_vm->prepareScreenType2(); ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS)); @@ -551,16 +488,16 @@ void dessin(int ad) { } if (g_caff == 13) { - if (g_vm->g_s._atticBallHoleObjectId == 141) + if (g_vm->_coreVar._atticBallHoleObjectId == 141) aniof(1, 7); - if (g_vm->g_s._atticRodHoleObjectId == 159) + if (g_vm->_coreVar._atticRodHoleObjectId == 159) aniof(1, 6); - } else if ((g_caff == 14) && (g_vm->g_s._cellarObjectId == 151)) + } else if ((g_caff == 14) && (g_vm->_coreVar._cellarObjectId == 151)) aniof(1, 2); - else if ((g_caff == 17) && (g_vm->g_s._secretPassageObjectId == 143)) + else if ((g_caff == 17) && (g_vm->_coreVar._secretPassageObjectId == 143)) aniof(1, 1); - else if ((g_caff == 24) && (g_vm->g_s._wellObjectId != 0)) + else if ((g_caff == 24) && (g_vm->_coreVar._wellObjectId != 0)) aniof(1, 1); } @@ -570,157 +507,6 @@ void dessin(int ad) { } } -void tinke() { - Common::String d1 = g_vm->getEngineString(S_SHOULD_HAVE_NOTICED); - Common::String d2 = g_vm->getEngineString(S_NUMBER_OF_HINTS); - const char d3 = '['; - const char d4 = ']'; - const char d5 = '1'; - Common::String d6 = g_vm->getEngineString(S_OK); - int cf, day, hour, minute; - Common::String stpo; - - g_vm->_anyone = false; - g_vm->updateHour(day, hour, minute); - if (day != g_vm->_day) { - g_vm->_day = day; - int i = 0; - do { - ++i; - if (g_nbrepm[i] != 0) - --g_nbrepm[i]; - g_nbrep[i] = 0; - } while (i != 8); - } - if ((hour > g_vm->_hour) || ((hour == 0) && (g_vm->_hour == 23))) { - g_vm->_hour = hour; - g_vm->_minute = 0; - drawClock(); - cf = 0; - for (int i = 1; i <= 10; ++i) { - if (g_vm->g_s._pourc[i] == '*') - ++cf; - } - - if (cf == 10) - stpo = "10"; - else - stpo = chr(cf + 48); - - g_vm->_hintPctMessage = Common::String(d3); - g_vm->_hintPctMessage += d5; - g_vm->_hintPctMessage += d4; - g_vm->_hintPctMessage += d3; - g_vm->_hintPctMessage += d1; - g_vm->_hintPctMessage += stpo; - g_vm->_hintPctMessage += '0'; - g_vm->_hintPctMessage += d2; - g_vm->_hintPctMessage += d4; - g_vm->_hintPctMessage += d3; - g_vm->_hintPctMessage += d6; - g_vm->_hintPctMessage += d4; - } - if (minute > g_vm->_minute) { - g_vm->_minute = 30; - drawClock(); - } - if (g_vm->_mouse._pos.y < 12) - return; - - if (!g_vm->_blo) { - if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) - g_t = kTime2; - else - g_t = kTime1; - cf = g_vm->g_s._faithScore; - if ((cf > 33) && (cf < 66)) - g_t -= (g_t / 3); - - if (cf > 65) - g_t -= ((g_t / 3) * 2); - - int nh = readclock(); - if ((nh - g_mh) > g_t) { - bool activeMenu = g_vm->_menu._menuActive; - g_vm->_menu.eraseMenu(); - g_jh += ((nh - g_mh) / g_t); - g_mh = nh; - switch (g_vm->_place) { - case GREEN_ROOM: - case DARKBLUE_ROOM: - g_vm->setRandomPresenceGreenRoom(cf); - break; - case PURPLE_ROOM: - g_vm->setRandomPresencePurpleRoom(cf); - break; - case BLUE_ROOM: - g_vm->setRandomPresenceBlueRoom(cf); - break; - case RED_ROOM: - case GREEN_ROOM2: - g_vm->setRandomPresenceRedRoom(cf); - break; - case ROOM9: - g_vm->setRandomPresenceRoom9(cf); - break; - case DINING_ROOM: - g_vm->setRandomPresenceDiningRoom(cf); - break; - case BUREAU: - g_vm->setRandomPresenceBureau(cf); - break; - case KITCHEN: - g_vm->setRandomPresenceKitchen(cf); - break; - case ATTIC: - case CELLAR: - g_vm->setRandomPresenceAttic(cf); - break; - case LANDING: - case ROOM26: - g_vm->setRandomPresenceLanding(cf); - break; - case CHAPEL: - g_vm->setRandomPresenceChapel(cf); - break; - } - if ((g_mpers != 0) && (g_vm->_currBitIndex != 10)) - g_mpers = g_vm->_currBitIndex; - - if ((g_mpers == 0) && (g_vm->_currBitIndex > 0)) { - if ((g_vm->g_s._currPlace == ATTIC) || (g_vm->g_s._currPlace == CELLAR)) { - cavegre(); - } else if (g_vm->_currBitIndex == 10) { - g_vm->_currBitIndex = 0; - if (!g_vm->_brt) { - g_vm->_brt = true; - g_hdb = readclock(); - if (g_vm->getRandomNumber(1, 5) < 5) { - g_vm->clearScreenType3(); - g_vm->prepareScreenType2(); - ecr3(g_vm->getEngineString(S_HEAR_NOISE)); - int rand = (g_vm->getRandomNumber(0, 4)) - 2; - g_vm->_speechManager.startSpeech(1, rand, 1); - g_vm->clearScreenType3(); - } - } - } - } - - if (activeMenu) - g_vm->_menu.drawMenu(); - } - } - g_hfb = readclock(); - if ((g_vm->_brt) && ((g_hfb - g_hdb) > 17)) { - g_vm->getPresenceBitIndex(g_vm->_place); - g_vm->_brt = false; - g_hdb = 0; - if ((g_vm->g_s._currPlace > OWN_ROOM) && (g_vm->g_s._currPlace < DINING_ROOM)) - g_vm->_anyone = true; - } -} - void fenat(char ans) { int coul; @@ -763,7 +549,7 @@ void tkey1(bool d) { // Event loop do { if (d) - tinke(); + g_vm->prepareRoom(); quest = g_vm->keyPressed(); g_vm->_mouse.getMousePosition(x, y, c); CHECK_QUIT; @@ -787,17 +573,17 @@ void tlu(int af, int ob) { } void affrep() { - g_caff = g_vm->g_s._currPlace; - g_crep = g_vm->g_s._currPlace; + g_caff = g_vm->_coreVar._currPlace; + g_crep = g_vm->_coreVar._currPlace; } void tsort() { - if ((g_iouv > 0) && (g_vm->g_s._currPlace != 0)) { - if (g_vm->g_s._faithScore < 50) - g_vm->g_s._faithScore += 2; + if ((g_iouv > 0) && (g_vm->_coreVar._currPlace != 0)) { + if (g_vm->_coreVar._faithScore < 50) + g_vm->_coreVar._faithScore += 2; else - g_vm->g_s._faithScore += (g_vm->g_s._faithScore / 10); + g_vm->_coreVar._faithScore += (g_vm->_coreVar._faithScore / 10); } for (int cx = 1; cx <= 7; ++cx) @@ -805,7 +591,7 @@ void tsort() { g_ment = 0; g_iouv = 0; g_mchai = 0; - debloc(g_vm->g_s._currPlace); + debloc(g_vm->_coreVar._currPlace); } void st4(int ob) { @@ -844,9 +630,9 @@ void modinv() { int cy = 0; for (int i = 1; i <= 6; ++i) { - if (g_vm->g_s._sjer[i] != chr(0)) { + if (g_vm->_coreVar._sjer[i] != chr(0)) { ++cy; - r = (ord(g_vm->g_s._sjer[i]) + 400); + r = (ord(g_vm->_coreVar._sjer[i]) + 400); nomp = g_vm->getString(r - 501 + kInventoryStringIndex); g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cy], nomp); g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[i]); @@ -879,7 +665,7 @@ void ajchai() { } while ((cx <= 9) && (g_tabdon[cy + cx] != 0)); if (g_tabdon[cy + cx] == 0) - g_tabdon[cy + cx] = g_vm->g_s._selectedObjectId; + g_tabdon[cy + cx] = g_vm->_coreVar._selectedObjectId; else g_crep = 192; } @@ -888,10 +674,10 @@ void ajjer(int ob) { int cx = 0; do { ++cx; - } while ((cx <= 5) && (ord(g_vm->g_s._sjer[cx]) != 0)); + } while ((cx <= 5) && (ord(g_vm->_coreVar._sjer[cx]) != 0)); - if (ord(g_vm->g_s._sjer[cx]) == 0) { - g_vm->g_s._sjer[(cx)] = chr(ob); + if (ord(g_vm->_coreVar._sjer[cx]) == 0) { + g_vm->_coreVar._sjer[(cx)] = chr(ob); modinv(); } else g_crep = 139; @@ -920,11 +706,11 @@ L1: g_vm->_speechManager.startSpeech(4, 4, 1); if (g_iouv == 0) - g_vm->g_s._faithScore += 2; - else if (g_vm->g_s._faithScore < 50) - g_vm->g_s._faithScore += 4; + g_vm->_coreVar._faithScore += 2; + else if (g_vm->_coreVar._faithScore < 50) + g_vm->_coreVar._faithScore += 4; else - g_vm->g_s._faithScore += 3 * (g_vm->g_s._faithScore / 10); + g_vm->_coreVar._faithScore += 3 * (g_vm->_coreVar._faithScore / 10); tsort(); g_vm->_menu.setDestinationMenuText(LANDING); int cx = g_vm->convertBitIndexToCharacterIndex(g_vm->_currBitIndex); @@ -971,7 +757,7 @@ void tsuiv() { g_caff = tbcl; g_crep = g_caff + 400; if (g_vm->_currBitIndex != 0) - g_vm->g_s._faithScore += 2; + g_vm->_coreVar._faithScore += 2; } else { affrep(); g_vm->endSearch(); @@ -998,7 +784,7 @@ void tfleche() { if (g_vm->getMouseClick()) inRect = (g_vm->_mouse._pos.x < 256 * g_res) && (g_vm->_mouse._pos.y < 176) && (g_vm->_mouse._pos.y > 12); - tinke(); + g_vm->prepareRoom(); } while (!(qust || inRect || g_vm->_anyone)); if (qust && (touch == '\103')) @@ -1112,20 +898,20 @@ void treg(int ob) { void avpoing(int &ob) { g_crep = 999; - if (g_vm->g_s._selectedObjectId != 0) - ajjer(g_vm->g_s._selectedObjectId); + if (g_vm->_coreVar._selectedObjectId != 0) + ajjer(g_vm->_coreVar._selectedObjectId); if (g_crep != 139) { modobj(ob + 400); - g_vm->g_s._selectedObjectId = ob; + g_vm->_coreVar._selectedObjectId = ob; ob = 0; } } void rechai(int &ch) { - int tmpPlace = g_vm->g_s._currPlace; + int tmpPlace = g_vm->_coreVar._currPlace; - if (g_vm->g_s._currPlace == CRYPT) + if (g_vm->_coreVar._currPlace == CRYPT) tmpPlace = CELLAR; ch = g_tabdon[achai + (tmpPlace * 7) + g_num - 1]; } @@ -1140,7 +926,7 @@ int t23coul() { } void maivid() { - g_vm->g_s._selectedObjectId = 0; + g_vm->_coreVar._selectedObjectId = 0; modobj(500); } diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index de1b0b4a7d..03a4c0f757 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -48,7 +48,6 @@ extern void charecr(int y, int dy); extern void adzon(); extern int animof(int ouf, int num); /* Niveau 14 suite */ -extern int readclock(); extern void modif(int &nu); /* NIVEAU 13 */ extern void text1(int x, int y, int nb, int m); @@ -77,8 +76,6 @@ extern void writetp(Common::String s, int t); extern void aniof(int ouf, int num); /* NIVEAU 9 */ extern void dessin(int ad); - -extern void tinke(); extern void fenat(char ans); /* NIVEAU 8 */ extern void afdes(); @@ -89,7 +86,6 @@ extern void affrep(); /* NIVEAU 6 */ extern void tsort(); extern void st4(int ob); -extern void displayDiningRoom(); extern void modinv(); extern void mennor(); extern void premtet(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 866c8e42c9..907e305be8 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -625,10 +625,10 @@ void MortevielleEngine::handleAction() { _inMainGameLoop = true; do { _menu.mdn(); - tinke(); + prepareRoom(); _mouse.moveMouse(funct, inkey); CHECK_QUIT; - temps = temps + 1; + ++temps; } while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); _inMainGameLoop = false; @@ -682,7 +682,7 @@ void MortevielleEngine::handleAction() { oo = true; if ((g_msg[4] == OPCODE_LIFT) || (_obpart)) { endSearch(); - g_caff = g_s._currPlace; + g_caff = _coreVar._currPlace; g_crep = 998; } else tsuiv(); @@ -1432,7 +1432,7 @@ int MortevielleEngine::getPresenceBitIndex(int roomId) { void MortevielleEngine::initGame() { _place = MANOR_FRONT; g_jh = 0; - if (!g_s._alreadyEnteredManor) + if (!_coreVar._alreadyEnteredManor) _blo = true; g_t = kTime1; g_mh = readclock(); @@ -1625,21 +1625,21 @@ void MortevielleEngine::startMusicOrSpeech(int so) { if (so == 0) { /* musik(0) */ ; - } else if ((g_prebru == 0) && (!g_s._alreadyEnteredManor)) { + } else if ((g_prebru == 0) && (!_coreVar._alreadyEnteredManor)) { // Type 1: Speech _speechManager.startSpeech(10, 1, 1); ++g_prebru; } else { - if (((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) + if (((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) // Type 1: Speech _speechManager.startSpeech(9, getRandomNumber(2, 4), 1); - else if ((g_s._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1)) + else if ((_coreVar._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1)) // Type 1: Speech _speechManager.startSpeech(8, 1, 1); - else if ((g_s._currPlace == WELL) && (getRandomNumber(1, 2) == 2)) + else if ((_coreVar._currPlace == WELL) && (getRandomNumber(1, 2) == 2)) // Type 1: Speech _speechManager.startSpeech(12, 1, 1); - else if (g_s._currPlace == INSIDE_WELL) + else if (_coreVar._currPlace == INSIDE_WELL) // Type 1: Speech _speechManager.startSpeech(13, 1, 1); else @@ -1679,9 +1679,9 @@ void MortevielleEngine::loseGame() { bool MortevielleEngine::checkInventory(int objectId) { bool retVal = false; for (int i = 1; i <= 6; ++i) - retVal = (retVal || (ord(g_s._sjer[i]) == objectId)); + retVal = (retVal || (ord(_coreVar._sjer[i]) == objectId)); - if (g_s._selectedObjectId == objectId) + if (_coreVar._selectedObjectId == objectId) retVal = true; return retVal; @@ -1692,7 +1692,7 @@ bool MortevielleEngine::checkInventory(int objectId) { * @remarks Originally called 'st1sama' */ void MortevielleEngine::displayDiningRoom() { - g_s._currPlace = DINING_ROOM; + _coreVar._currPlace = DINING_ROOM; affrep(); } @@ -1741,13 +1741,13 @@ void MortevielleEngine::gotoDiningRoom() { int day, hour, minute; updateHour(day, hour, minute); - if ((hour < 5) && (g_s._currPlace > ROOM18)) { + if ((hour < 5) && (_coreVar._currPlace > ROOM18)) { if (!checkInventory(137)) { //You don't have the keys, and it's late g_crep = 1511; loseGame(); } else displayDiningRoom(); - } else if (!g_s._alreadyEnteredManor) { //Is it your first time? + } else if (!_coreVar._alreadyEnteredManor) { //Is it your first time? _currBitIndex = 255; // Everybody is present showPeoplePresent(_currBitIndex); g_caff = 77; @@ -1763,14 +1763,14 @@ void MortevielleEngine::gotoDiningRoom() { drawRightFrame(); drawClock(); _mouse.showMouse(); - g_s._currPlace = OWN_ROOM; + _coreVar._currPlace = OWN_ROOM; affrep(); resetPresenceInRooms(DINING_ROOM); if (!_blo) minute = t11(OWN_ROOM); _currBitIndex = 0; g_mpers = 0; - g_s._alreadyEnteredManor = true; + _coreVar._alreadyEnteredManor = true; } else displayDiningRoom(); } @@ -1786,7 +1786,7 @@ void MortevielleEngine::checkManorDistance() { loseGame(); } else { _okdes = true; - g_s._currPlace = MOUNTAIN; + _coreVar._currPlace = MOUNTAIN; affrep(); } } @@ -1797,7 +1797,7 @@ void MortevielleEngine::checkManorDistance() { */ void MortevielleEngine::gotoManorFront() { _manorDistance = 0; - g_s._currPlace = MANOR_FRONT; + _coreVar._currPlace = MANOR_FRONT; affrep(); } @@ -1806,7 +1806,7 @@ void MortevielleEngine::gotoManorFront() { * @remarks Originally called 't1derr' */ void MortevielleEngine::gotoManorBack() { - g_s._currPlace = MANOR_BACK; + _coreVar._currPlace = MANOR_BACK; affrep(); } @@ -1830,7 +1830,7 @@ void MortevielleEngine::changeGraphicalDevice(int newDevice) { _mouse.initMouse(); _mouse.showMouse(); drawRightFrame(); - tinke(); + prepareRoom(); drawClock(); if (_currBitIndex != 0) showPeoplePresent(_currBitIndex); @@ -1884,16 +1884,16 @@ void MortevielleEngine::gameLoaded() { _heroSearching = false; displayAloneText(); - tinke(); + prepareRoom(); drawClock(); afdes(); repon(2, g_crep); clearScreenType3(); _endGame = false; - _menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); modinv(); - if (g_s._selectedObjectId != 0) - modobj(g_s._selectedObjectId + 400); + if (_coreVar._selectedObjectId != 0) + modobj(_coreVar._selectedObjectId + 400); _mouse.showMouse(); } @@ -1984,16 +1984,16 @@ void MortevielleEngine::handleOpcode() { } int hour, day, minute; updateHour(day, hour, minute); - if ((((hour == 12) || (hour == 13) || (hour == 19)) && (g_s._currPlace != 10)) || - ((hour > 0) && (hour < 6) && (g_s._currPlace != 0))) - ++g_s._faithScore; - if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != INSIDE_WELL) - && (g_s._currPlace != OWN_ROOM) && (g_s._selectedObjectId != 152) && (!_loseGame)) { - if ((g_s._faithScore > 99) && (hour > 8) && (hour < 16)) { + if ((((hour == 12) || (hour == 13) || (hour == 19)) && (_coreVar._currPlace != 10)) || + ((hour > 0) && (hour < 6) && (_coreVar._currPlace != 0))) + ++_coreVar._faithScore; + if (((_coreVar._currPlace < CRYPT) || (_coreVar._currPlace > MOUNTAIN)) && (_coreVar._currPlace != INSIDE_WELL) + && (_coreVar._currPlace != OWN_ROOM) && (_coreVar._selectedObjectId != 152) && (!_loseGame)) { + if ((_coreVar._faithScore > 99) && (hour > 8) && (hour < 16)) { g_crep = 1501; loseGame(); } - if ((g_s._faithScore > 99) && (hour > 0) && (hour < 9)) { + if ((_coreVar._faithScore > 99) && (hour > 0) && (hour < 9)) { g_crep = 1508; loseGame(); } @@ -2017,7 +2017,7 @@ void MortevielleEngine::hourToChar() { minute = 1; hour += day * 24; minute += hour * 2; - g_s._fullHour = chr(minute); + _coreVar._fullHour = chr(minute); } /** @@ -2025,7 +2025,7 @@ void MortevielleEngine::hourToChar() { * @remarks Originally called 'theure' */ void MortevielleEngine::charToHour() { - int fullHour = ord(g_s._fullHour); + int fullHour = ord(_coreVar._fullHour); int tmpHour = fullHour % 48; _currDay = fullHour / 48; _currHalfHour = tmpHour % 2; @@ -2092,11 +2092,11 @@ void MortevielleEngine::clearScreenType10() { cod = 544; } _screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98)); - if (g_s._faithScore < 33) + if (_coreVar._faithScore < 33) st = getEngineString(S_COOL); - else if (g_s._faithScore < 66) + else if (_coreVar._faithScore < 66) st = getEngineString(S_LOURDE); - else if (g_s._faithScore > 65) + else if (_coreVar._faithScore > 65) st = getEngineString(S_MALSAINE); co = 580 - (_screenSurface.getStringWidth(st) / 2); @@ -2252,40 +2252,40 @@ void MortevielleEngine::copcha() { void MortevielleEngine::resetVariables() { copcha(); - g_s._alreadyEnteredManor = false; - g_s._selectedObjectId = 0; - g_s._cellarObjectId = 0; - g_s._atticBallHoleObjectId = 0; - g_s._atticRodHoleObjectId = 0; - g_s._wellObjectId = 0; - g_s._secretPassageObjectId = 0; - g_s._purpleRoomObjectId = 136; - g_s._cryptObjectId = 141; - g_s._faithScore = getRandomNumber(4, 10); - g_s._currPlace = MANOR_FRONT; + _coreVar._alreadyEnteredManor = false; + _coreVar._selectedObjectId = 0; + _coreVar._cellarObjectId = 0; + _coreVar._atticBallHoleObjectId = 0; + _coreVar._atticRodHoleObjectId = 0; + _coreVar._wellObjectId = 0; + _coreVar._secretPassageObjectId = 0; + _coreVar._purpleRoomObjectId = 136; + _coreVar._cryptObjectId = 141; + _coreVar._faithScore = getRandomNumber(4, 10); + _coreVar._currPlace = MANOR_FRONT; for (int i = 2; i <= 6; ++i) - g_s._sjer[i] = chr(0); + _coreVar._sjer[i] = chr(0); - g_s._sjer[1] = chr(113); - g_s._fullHour = chr(20); + _coreVar._sjer[1] = chr(113); + _coreVar._fullHour = chr(20); for (int i = 1; i <= 10; ++i) - g_s._pourc[i] = ' '; + _coreVar._pourc[i] = ' '; for (int i = 1; i <= 6; ++i) - g_s._teauto[i] = '*'; + _coreVar._teauto[i] = '*'; for (int i = 7; i <= 9; ++i) - g_s._teauto[i] = ' '; + _coreVar._teauto[i] = ' '; for (int i = 10; i <= 28; ++i) - g_s._teauto[i] = '*'; + _coreVar._teauto[i] = '*'; for (int i = 29; i <= 42; ++i) - g_s._teauto[i] = ' '; + _coreVar._teauto[i] = ' '; - g_s._teauto[33] = '*'; + _coreVar._teauto[33] = '*'; for (int i = 1; i <= 8; ++i) g_nbrep[i] = 0; @@ -2519,7 +2519,7 @@ void MortevielleEngine::showTitleScreen() { if (_newGraphicalDevice != _currGraphicalDevice) _currGraphicalDevice = _newGraphicalDevice; hirs(); - g_vm->draw(g_ades, 0, 0); + draw(g_ades, 0, 0); Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; _screenSurface.putxy(104 + 72 * g_res, 185); @@ -2531,10 +2531,10 @@ void MortevielleEngine::showTitleScreen() { * @remarks Originally called 'dessine' */ void MortevielleEngine::draw(int ad, int x, int y) { - g_vm->_mouse.hideMouse(); - g_vm->setPal(g_numpal); + _mouse.hideMouse(); + setPal(g_numpal); pictout(ad, 0, x, y); - g_vm->_mouse.showMouse(); + _mouse.showMouse(); } /** @@ -2542,13 +2542,231 @@ void MortevielleEngine::draw(int ad, int x, int y) { * @remarks Originally called 'dessine_rouleau' */ void MortevielleEngine::drawRightFrame() { - g_vm->setPal(89); - if (g_vm->_currGraphicalDevice == MODE_HERCULES) { + setPal(89); + if (_currGraphicalDevice == MODE_HERCULES) { g_mem[0x7000 * 16 + 14] = 15; } - g_vm->_mouse.hideMouse(); + _mouse.hideMouse(); pictout(0x73a2, 0, 0, 0); - g_vm->_mouse.showMouse(); + _mouse.showMouse(); +} + +/** + * Read the current system time + */ +int MortevielleEngine::readclock() { + TimeDate dateTime; + g_system->getTimeAndDate(dateTime); + + int m = dateTime.tm_min * 60; + int h = dateTime.tm_hour * 3600; + return h + m + dateTime.tm_sec; +} + +/** + * Engine function - Prepare room and hint string + * @remarks Originally called 'tinke' + */ +void MortevielleEngine::prepareRoom() { + Common::String d1 = getEngineString(S_SHOULD_HAVE_NOTICED); + Common::String d2 = getEngineString(S_NUMBER_OF_HINTS); + const char d3 = '['; + const char d4 = ']'; + const char d5 = '1'; + Common::String d6 = getEngineString(S_OK); + int cf, day, hour, minute; + Common::String stpo; + + _anyone = false; + updateHour(day, hour, minute); + if (day != _day) { + _day = day; + int i = 0; + do { + ++i; + if (g_nbrepm[i] != 0) + --g_nbrepm[i]; + g_nbrep[i] = 0; + } while (i != 8); + } + if ((hour > _hour) || ((hour == 0) && (_hour == 23))) { + _hour = hour; + _minute = 0; + drawClock(); + cf = 0; + for (int i = 1; i <= 10; ++i) { + if (_coreVar._pourc[i] == '*') + ++cf; + } + + if (cf == 10) + stpo = "10"; + else + stpo = chr(cf + 48); + + _hintPctMessage = Common::String(d3); + _hintPctMessage += d5; + _hintPctMessage += d4; + _hintPctMessage += d3; + _hintPctMessage += d1; + _hintPctMessage += stpo; + _hintPctMessage += '0'; + _hintPctMessage += d2; + _hintPctMessage += d4; + _hintPctMessage += d3; + _hintPctMessage += d6; + _hintPctMessage += d4; + } + if (minute > _minute) { + _minute = 30; + drawClock(); + } + if (_mouse._pos.y < 12) + return; + + if (!_blo) { + if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) + g_t = kTime2; + else + g_t = kTime1; + cf = _coreVar._faithScore; + if ((cf > 33) && (cf < 66)) + g_t -= (g_t / 3); + + if (cf > 65) + g_t -= ((g_t / 3) * 2); + + int nh = readclock(); + if ((nh - g_mh) > g_t) { + bool activeMenu = _menu._menuActive; + _menu.eraseMenu(); + g_jh += ((nh - g_mh) / g_t); + g_mh = nh; + switch (_place) { + case GREEN_ROOM: + case DARKBLUE_ROOM: + setRandomPresenceGreenRoom(cf); + break; + case PURPLE_ROOM: + setRandomPresencePurpleRoom(cf); + break; + case BLUE_ROOM: + setRandomPresenceBlueRoom(cf); + break; + case RED_ROOM: + case GREEN_ROOM2: + setRandomPresenceRedRoom(cf); + break; + case ROOM9: + setRandomPresenceRoom9(cf); + break; + case DINING_ROOM: + setRandomPresenceDiningRoom(cf); + break; + case BUREAU: + setRandomPresenceBureau(cf); + break; + case KITCHEN: + setRandomPresenceKitchen(cf); + break; + case ATTIC: + case CELLAR: + setRandomPresenceAttic(cf); + break; + case LANDING: + case ROOM26: + setRandomPresenceLanding(cf); + break; + case CHAPEL: + setRandomPresenceChapel(cf); + break; + } + if ((g_mpers != 0) && (_currBitIndex != 10)) + g_mpers = _currBitIndex; + + if ((g_mpers == 0) && (_currBitIndex > 0)) { + if ((_coreVar._currPlace == ATTIC) || (_coreVar._currPlace == CELLAR)) { + cavegre(); + } else if (_currBitIndex == 10) { + _currBitIndex = 0; + if (!_brt) { + _brt = true; + g_hdb = readclock(); + if (getRandomNumber(1, 5) < 5) { + clearScreenType3(); + prepareScreenType2(); + ecr3(getEngineString(S_HEAR_NOISE)); + int rand = (getRandomNumber(0, 4)) - 2; + _speechManager.startSpeech(1, rand, 1); + clearScreenType3(); + } + } + } + } + + if (activeMenu) + _menu.drawMenu(); + } + } + g_hfb = readclock(); + if ((_brt) && ((g_hfb - g_hdb) > 17)) { + getPresenceBitIndex(_place); + _brt = false; + g_hdb = 0; + if ((_coreVar._currPlace > OWN_ROOM) && (_coreVar._currPlace < DINING_ROOM)) + _anyone = true; + } +} + +/** + * Engine function - Draw Clock + * @remarks Originally called 'pendule' + */ +void MortevielleEngine::drawClock() { + const int cv[2][12] = { + { 5, 8, 10, 8, 5, 0, -5, -8, -10, -8, -5, 0 }, + { -5, -3, 0, 3, 5, 6, 5, 3, 0, -3, -5, -6 } + }; + const int x = 580; + const int y = 123; + const int rg = 9; + int h, co; + + _mouse.hideMouse(); + + paint_rect(570, 118, 20, 10); + paint_rect(578, 114, 6, 18); + if ((_currGraphicalDevice == MODE_CGA) || (_currGraphicalDevice == MODE_HERCULES)) + co = 0; + else + co = 1; + + if (_minute == 0) + _screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y - rg), co); + else + _screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y + rg), co); + + h = _hour; + if (h > 12) + h -= 12; + if (h == 0) + h = 12; + + _screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)(x + cv[0][h - 1]) >> 1) * g_res, y + cv[1][h - 1], co); + _mouse.showMouse(); + _screenSurface.putxy(568, 154); + + if (_hour > 11) + _screenSurface.drawString("PM ", 1); + else + _screenSurface.drawString("AM ", 1); + + _screenSurface.putxy(550, 160); + if ((_day >= 0) && (_day <= 8)) { + Common::String tmp = getEngineString(S_DAY); + tmp.insertChar((char)(_day + 49), 0); + _screenSurface.drawString(tmp, 1); + } } } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index b17d729296..c0230cf5cc 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -100,6 +100,29 @@ struct t_pcga { nhom _a[16]; }; +struct Pattern { + byte _tay, _tax; + byte _des[kMaxPatt + 1][kMaxPatt + 1]; +}; + +struct SaveStruct { + int _faithScore; + byte _pourc[11]; + byte _teauto[43]; + byte _sjer[31]; + int _currPlace; + int _atticBallHoleObjectId; + int _atticRodHoleObjectId; + int _cellarObjectId; + int _secretPassageObjectId; + int _wellObjectId; + int _selectedObjectId; + int _purpleRoomObjectId; + int _cryptObjectId; + bool _alreadyEnteredManor; + byte _fullHour; +}; + class MortevielleEngine : public Engine { private: const ADGameDescription *_gameDescription; @@ -133,6 +156,7 @@ private: void loadCFIEC(); void loadCFIPH(); void showTitleScreen(); + int readclock(); public: Common::String _hintPctMessage; @@ -183,7 +207,7 @@ public: int _c_zzz; int ptr_word; byte _v_lieu[7][25]; - SaveStruct g_s, g_s1; + SaveStruct _coreVar, _saveStruct; byte g_is; ScreenSurface _screenSurface; @@ -334,6 +358,8 @@ public: void music(); void draw(int ad, int x, int y); void drawRightFrame(); + void prepareRoom(); + void drawClock(); }; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 6a8aaff048..22385ed0fe 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -196,37 +196,37 @@ void taffich() { switch (a) { case 16: - g_vm->g_s._pourc[9] = '*'; - g_vm->g_s._teauto[42] = '*'; + g_vm->_coreVar._pourc[9] = '*'; + g_vm->_coreVar._teauto[42] = '*'; break; case 20: - g_vm->g_s._teauto[39] = '*'; - if (g_vm->g_s._teauto[36] == '*') { - g_vm->g_s._pourc[3] = '*'; - g_vm->g_s._teauto[38] = '*'; + g_vm->_coreVar._teauto[39] = '*'; + if (g_vm->_coreVar._teauto[36] == '*') { + g_vm->_coreVar._pourc[3] = '*'; + g_vm->_coreVar._teauto[38] = '*'; } break; case 24: - g_vm->g_s._teauto[37] = '*'; + g_vm->_coreVar._teauto[37] = '*'; break; case 30: - g_vm->g_s._teauto[9] = '*'; + g_vm->_coreVar._teauto[9] = '*'; break; case 31: - g_vm->g_s._pourc[4] = '*'; - g_vm->g_s._teauto[35] = '*'; + g_vm->_coreVar._pourc[4] = '*'; + g_vm->_coreVar._teauto[35] = '*'; break; case 118: - g_vm->g_s._teauto[41] = '*'; + g_vm->_coreVar._teauto[41] = '*'; break; case 143: - g_vm->g_s._pourc[1] = '*'; + g_vm->_coreVar._pourc[1] = '*'; break; case 150: - g_vm->g_s._teauto[34] = '*'; + g_vm->_coreVar._teauto[34] = '*'; break; case 151: - g_vm->g_s._pourc[2] = '*'; + g_vm->_coreVar._pourc[2] = '*'; break; default: break; @@ -258,7 +258,7 @@ void taffich() { if (((a > 69) && (a < 80)) || (a == 30) || (a == 31) || (a == 144) || (a == 147) || (a == 149)) m = 2030; - if (((a < 27) && (((g_maff > 69) && (!g_vm->g_s._alreadyEnteredManor)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) + if (((a < 27) && (((g_maff > 69) && (!g_vm->_coreVar._alreadyEnteredManor)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) m = 2033; g_maff = a; @@ -333,11 +333,11 @@ void taffich() { charani(filename, lgt, handle); } g_vm->_mouse.showMouse(); - if ((a < 27) && ((g_maff < 27) || (g_vm->g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { + if ((a < 27) && ((g_maff < 27) || (g_vm->_coreVar._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) g_vm->displayAloneText(); else if (!g_vm->_blo) - cx = t11(g_vm->g_s._currPlace); + cx = t11(g_vm->_coreVar._currPlace); g_mpers = 0; } } diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index c99804f34c..fa26132e9b 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -46,25 +46,25 @@ Common::String SavegameManager::generateSaveName(int slotNumber) { * Handle saving or loading savegame data */ void SavegameManager::sync_save(Common::Serializer &sz) { - sz.syncAsSint16LE(g_vm->g_s1._faithScore); + sz.syncAsSint16LE(g_vm->_saveStruct._faithScore); for (int i = 0; i < 11; ++i) - sz.syncAsByte(g_vm->g_s1._pourc[i]); + sz.syncAsByte(g_vm->_saveStruct._pourc[i]); for (int i = 0; i < 43; ++i) - sz.syncAsByte(g_vm->g_s1._teauto[i]); + sz.syncAsByte(g_vm->_saveStruct._teauto[i]); for (int i = 0; i < 31; ++i) - sz.syncAsByte(g_vm->g_s1._sjer[i]); - - sz.syncAsSint16LE(g_vm->g_s1._currPlace); - sz.syncAsSint16LE(g_vm->g_s1._atticBallHoleObjectId); - sz.syncAsSint16LE(g_vm->g_s1._atticRodHoleObjectId); - sz.syncAsSint16LE(g_vm->g_s1._cellarObjectId); - sz.syncAsSint16LE(g_vm->g_s1._secretPassageObjectId); - sz.syncAsSint16LE(g_vm->g_s1._wellObjectId); - sz.syncAsSint16LE(g_vm->g_s1._selectedObjectId); - sz.syncAsSint16LE(g_vm->g_s1._purpleRoomObjectId); - sz.syncAsSint16LE(g_vm->g_s1._cryptObjectId); - sz.syncAsByte(g_vm->g_s1._alreadyEnteredManor); - sz.syncAsByte(g_vm->g_s1._fullHour); + sz.syncAsByte(g_vm->_saveStruct._sjer[i]); + + sz.syncAsSint16LE(g_vm->_saveStruct._currPlace); + sz.syncAsSint16LE(g_vm->_saveStruct._atticBallHoleObjectId); + sz.syncAsSint16LE(g_vm->_saveStruct._atticRodHoleObjectId); + sz.syncAsSint16LE(g_vm->_saveStruct._cellarObjectId); + sz.syncAsSint16LE(g_vm->_saveStruct._secretPassageObjectId); + sz.syncAsSint16LE(g_vm->_saveStruct._wellObjectId); + sz.syncAsSint16LE(g_vm->_saveStruct._selectedObjectId); + sz.syncAsSint16LE(g_vm->_saveStruct._purpleRoomObjectId); + sz.syncAsSint16LE(g_vm->_saveStruct._cryptObjectId); + sz.syncAsByte(g_vm->_saveStruct._alreadyEnteredManor); + sz.syncAsByte(g_vm->_saveStruct._fullHour); sz.syncBytes(g_bufcha, 391); } @@ -106,7 +106,7 @@ void SavegameManager::loadSavegame(int n) { Common::Serializer sz(stream, NULL); sync_save(sz); - g_vm->g_s = g_vm->g_s1; + g_vm->_coreVar = g_vm->_saveStruct; for (int i = 0; i <= 389; ++i) g_tabdon[i + kAcha] = g_bufcha[i]; @@ -142,9 +142,9 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { for (i = 0; i <= 389; ++i) g_bufcha[i] = g_tabdon[i + kAcha]; - g_vm->g_s1 = g_vm->g_s; - if (g_vm->g_s1._currPlace == 26) - g_vm->g_s1._currPlace = 15; + g_vm->_saveStruct = g_vm->_coreVar; + if (g_vm->_saveStruct._currPlace == 26) + g_vm->_saveStruct._currPlace = 15; Common::String filename = generateSaveName(n); f = g_system->getSavefileManager()->openForSaving(filename); diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index eabffb9bba..0c12a43acb 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -56,6 +56,14 @@ const int kTempoM = 89; //const int seg_syst = 0x6fed; //const int offsetb2 = 4; +struct SpeechQueue { + int _val; + int _code; + int _acc; + int _freq; + int _rep; +}; + class SpeechManager { private: int _typlec; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index a601c45a94..8b82aaccdf 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -106,7 +106,6 @@ int g_nbrep[9]; int g_nbrepm[9]; int g_msg[5]; byte g_touv[8]; -SaveStruct g_s, g_s1; byte g_bufcha[391]; byte g_lettres[7][24]; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 178ca2d989..a6fccb6010 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -114,44 +114,12 @@ struct Hint { byte _point; }; -struct SaveStruct { - int _faithScore; - byte _pourc[11]; - byte _teauto[43]; - byte _sjer[31]; - int _currPlace; - int _atticBallHoleObjectId; - int _atticRodHoleObjectId; - int _cellarObjectId; - int _secretPassageObjectId; - int _wellObjectId; - int _selectedObjectId; - int _purpleRoomObjectId; - int _cryptObjectId; - bool _alreadyEnteredManor; - byte _fullHour; -}; - -struct SpeechQueue { - int _val; - int _code; - int _acc; - int _freq; - int _rep; -}; - struct Rect { int _x1, _x2, _y1, _y2; bool _enabled; }; -struct Pattern { - byte _tay, _tax; - byte _des[kMaxPatt + 1][kMaxPatt + 1]; -}; - typedef int tablint[256]; -//typedef Common::Point tabdb[17]; typedef int tfxx[108]; /*---------------------------------------------------------------------------*/ @@ -206,8 +174,6 @@ extern int g_msg[5]; extern byte g_touv[8]; extern byte g_bufcha[391]; -extern byte g_lettres[7][24]; - extern uint16 g_t_mot[kMaxTi + 1]; extern int g_tay_tchar; extern Hint g_t_rec[kMaxTd + 1]; -- cgit v1.2.3