From 3f60cd79fed0e245dffe97e8cd33a7990ae90f48 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 14 Oct 2012 21:59:27 +0200 Subject: MORTEVIELLE: More renaming --- engines/mortevielle/actions.cpp | 72 +++++++-------- engines/mortevielle/dialogs.cpp | 16 ++-- engines/mortevielle/graphics.cpp | 6 +- engines/mortevielle/menu.cpp | 38 ++++---- engines/mortevielle/mortevielle.cpp | 173 +++++++++++++++++------------------- engines/mortevielle/mortevielle.h | 33 +++---- engines/mortevielle/mouse.cpp | 22 ++--- engines/mortevielle/outtext.cpp | 32 +++---- engines/mortevielle/saveload.cpp | 4 +- 9 files changed, 193 insertions(+), 203 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 6d8e095a3a..392ea17df1 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -48,7 +48,7 @@ void MortevielleEngine::fctMove() { } if ((_coreVar._currPlace == LANDING) && (_msg[4] == _menu._moveMenu[6])) { if (!_syn) - ecr3(getEngineString(S_GO_TO)); + displayTextInVerbBar(getEngineString(S_GO_TO)); tfleche(); if (_keyPressedEsc) @@ -217,7 +217,7 @@ void MortevielleEngine::fctTake() { return; } if (!_syn) - ecr3(getEngineString(S_TAKE)); + displayTextInVerbBar(getEngineString(S_TAKE)); tfleche(); if ((_anyone) || (_keyPressedEsc)) return; @@ -323,7 +323,7 @@ void MortevielleEngine::fctInventoryTake() { */ void MortevielleEngine::fctLift() { if (!_syn) - ecr3(getEngineString(S_LIFT)); + displayTextInVerbBar(getEngineString(S_LIFT)); tfleche(); if ((_anyone) || (_keyPressedEsc)) return; @@ -360,7 +360,7 @@ void MortevielleEngine::fctRead() { getReadDescription(_caff); else { if (!_syn) - ecr3(getEngineString(S_READ)); + displayTextInVerbBar(getEngineString(S_READ)); tfleche(); if (!(_anyone) && !(_keyPressedEsc)) { setCoordinates(4); @@ -393,7 +393,7 @@ void MortevielleEngine::fctLook() { return; } if (!_syn) - ecr3(getEngineString(S_LOOK)); + displayTextInVerbBar(getEngineString(S_LOOK)); tfleche(); if ((_anyone) || (_keyPressedEsc)) return; @@ -483,7 +483,7 @@ void MortevielleEngine::fctSearch() { } if (!_syn) - ecr3(getEngineString(S_SEARCH)); + displayTextInVerbBar(getEngineString(S_SEARCH)); tfleche(); if (_anyone || _keyPressedEsc) @@ -579,7 +579,7 @@ void MortevielleEngine::fctSelfSearch() { */ void MortevielleEngine::fctOpen() { if (!_syn) - ecr3(getEngineString(S_OPEN)); + displayTextInVerbBar(getEngineString(S_OPEN)); if (_caff == ROOM26) { if (_roomDoorId != OWN_ROOM) { @@ -657,7 +657,7 @@ void MortevielleEngine::fctPlace() { } if (!_syn) - ecr3(getEngineString(S_PUT)); + displayTextInVerbBar(getEngineString(S_PUT)); tfleche(); if (_keyPressedEsc) @@ -669,7 +669,7 @@ void MortevielleEngine::fctPlace() { setCoordinates(8); if (_num != 0) { _crep = 999; - if (_caff == 13) { + if (_caff == ATTIC) { if (_num == 1) { if (_coreVar._atticBallHoleObjectId != 0) { _crep = 188; @@ -687,7 +687,7 @@ void MortevielleEngine::fctPlace() { } } - if (_caff == 14) { + if (_caff == CELLAR) { if (_coreVar._cellarObjectId != 0) { _crep = 188; } else { @@ -745,14 +745,14 @@ void MortevielleEngine::fctPlace() { } } - if (_caff == 16) { + if (_caff == CRYPT) { if (_coreVar._cryptObjectId == 0) _coreVar._cryptObjectId = _coreVar._selectedObjectId; else _crep = 188; } - if (_caff == 17) { + if (_caff == SECRET_PASSAGE) { if (_coreVar._secretPassageObjectId != 0) { _crep = 188; } else if (_coreVar._selectedObjectId == 143) { @@ -764,7 +764,7 @@ void MortevielleEngine::fctPlace() { } } - if (_caff == 24) { + if (_caff == WELL) { if (_coreVar._wellObjectId != 0) { _crep = 188; } else if ((_coreVar._selectedObjectId == 140) || (_coreVar._selectedObjectId == 120)) { @@ -790,7 +790,7 @@ void MortevielleEngine::fctTurn() { return; } if (!_syn) - ecr3(getEngineString(S_TURN)); + displayTextInVerbBar(getEngineString(S_TURN)); tfleche(); if ((_anyone) || (_keyPressedEsc)) return; @@ -826,7 +826,7 @@ void MortevielleEngine::fctTurn() { */ void MortevielleEngine::fctSelfHide() { if (!_syn) - ecr3(getEngineString(S_HIDE_SELF)); + displayTextInVerbBar(getEngineString(S_HIDE_SELF)); tfleche(); if (!(_anyone) && !(_keyPressedEsc)) { setCoordinates(10); @@ -848,7 +848,7 @@ void MortevielleEngine::fctAttach() { _crep = 186; else { if (!_syn) - ecr3(getEngineString(S_TIE)); + displayTextInVerbBar(getEngineString(S_TIE)); tfleche(); if (!(_anyone) && !(_keyPressedEsc)) { setCoordinates(8); @@ -872,7 +872,7 @@ void MortevielleEngine::fctAttach() { */ void MortevielleEngine::fctClose() { if (!_syn) - ecr3(getEngineString(S_CLOSE)); + displayTextInVerbBar(getEngineString(S_CLOSE)); if (_caff < ROOM26) { tfleche(); @@ -912,7 +912,7 @@ void MortevielleEngine::fctClose() { */ void MortevielleEngine::fctKnock() { if (!_syn) - ecr3(getEngineString(S_HIT)); + displayTextInVerbBar(getEngineString(S_HIT)); if (_coreVar._currPlace == LANDING) { Alert::show(getEngineString(S_BEFORE_USE_DEP_MENU), 1); @@ -959,7 +959,7 @@ void MortevielleEngine::fctKnock() { */ void MortevielleEngine::fctSelfPut() { if (!_syn) - ecr3(getEngineString(S_POSE)); + displayTextInVerbBar(getEngineString(S_POSE)); if (_coreVar._selectedObjectId == 0) _crep = 186; else { @@ -1095,7 +1095,7 @@ void MortevielleEngine::fctEat() { } else { exitRoom(); _coreVar._currPlace = DINING_ROOM; - _caff = 10; + _caff = DINING_ROOM; resetRoomVariables(_coreVar._currPlace); _menu.setDestinationText(_coreVar._currPlace); @@ -1140,7 +1140,7 @@ void MortevielleEngine::fctEnter() { _crep = 997; else if ((_roomDoorId == ROOM9) && (_coreVar._selectedObjectId != 136)) { _crep = 189; - _coreVar._teauto[8] = '*'; + _coreVar._availableQuestion[8] = '*'; } else { int z = 0; if (!_blo) @@ -1238,8 +1238,8 @@ void MortevielleEngine::fctSleep() { */ void MortevielleEngine::fctForce() { if (!_syn) - ecr3(getEngineString(S_SMASH)); - if (_caff < 25) + displayTextInVerbBar(getEngineString(S_SMASH)); + if (_caff < DOOR) tfleche(); if ((!_anyone) && (!_keyPressedEsc)) { @@ -1328,7 +1328,7 @@ void MortevielleEngine::fctWait() { */ void MortevielleEngine::fctSound() { if (!_syn) - ecr3(getEngineString(S_PROBE2)); + displayTextInVerbBar(getEngineString(S_PROBE2)); if (_caff < 27) { tfleche(); if (!(_anyone) && (!_keyPressedEsc)) @@ -1387,7 +1387,7 @@ void MortevielleEngine::fctDiscuss() { int posY = 0; for (int icm = 1; icm < 43; icm++) { _screenSurface.putxy(posX, posY); - if (_coreVar._teauto[icm] == '*') { + if (_coreVar._availableQuestion[icm] == '*') { // If question already asked, write it in reverse video if (questionAsked[icm]) writetp(lib[icm], 1); @@ -1411,7 +1411,7 @@ void MortevielleEngine::fctDiscuss() { CHECK_QUIT; _mouse.getMousePosition(x, y, click); - x *= (3 - _res); + x *= (3 - _resolutionScaler); if (x > 319) cx = 41; else @@ -1450,7 +1450,7 @@ void MortevielleEngine::fctDiscuss() { writetp(lib[choice], 1); questionAsked[choice] = ! questionAsked[choice]; } - if ((_coreVar._teauto[ix] == '*') || (ix == 46)) { + if ((_coreVar._availableQuestion[ix] == '*') || (ix == 46)) { posY = ((ix - 1) % 23) << 3; if (ix > 23) posX = 320; @@ -1501,17 +1501,17 @@ void MortevielleEngine::fctDiscuss() { startDialog(displId); _mouse.showMouse(); if ((displId == 84) || (displId == 86)) { - _coreVar._pourc[5] = '*'; - _coreVar._teauto[7] = '*'; + _coreVar._pctHintFound[5] = '*'; + _coreVar._availableQuestion[7] = '*'; } if ((displId == 106) || (displId == 108) || (displId == 94)) { for (int indx = 29; indx <= 31; ++indx) - _coreVar._teauto[indx] = '*'; - _coreVar._pourc[7] = '*'; + _coreVar._availableQuestion[indx] = '*'; + _coreVar._pctHintFound[7] = '*'; } if (displId == 70) { - _coreVar._pourc[8] = '*'; - _coreVar._teauto[32] = '*'; + _coreVar._pctHintFound[8] = '*'; + _coreVar._availableQuestion[32] = '*'; } _mouse.hideMouse(); hirs(); @@ -1550,10 +1550,10 @@ void MortevielleEngine::fctSmell() { _crep = 119; if (_caff < ROOM26) { if (!_syn) - ecr3(getEngineString(S_SMELL)); + displayTextInVerbBar(getEngineString(S_SMELL)); tfleche(); if (!(_anyone) && !(_keyPressedEsc)) - if (_caff == 16) + if (_caff == CRYPT) _crep = 153; } else if (_caff == 123) _crep = 110; @@ -1568,7 +1568,7 @@ void MortevielleEngine::fctScratch() { _crep = 155; if (_caff < 27) { if (!_syn) - ecr3(getEngineString(S_SCRATCH)); + displayTextInVerbBar(getEngineString(S_SCRATCH)); tfleche(); } _num = 0; diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index f0f4452899..ee6eb697fb 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -71,7 +71,7 @@ int Alert::show(const Common::String &msg, int n) { while ((alertStr[i + 1] != '\174') && (alertStr[i + 1] != '\135')) { ++i; displayStr += alertStr[i]; - if (g_vm->_res == 2) + if (g_vm->_resolutionScaler == 2) curPos.x -= 3; else curPos.x -= 5; @@ -95,12 +95,12 @@ int Alert::show(const Common::String &msg, int n) { int limit[3][3]; memset(&limit[0][0], 0, sizeof(int) * 3 * 3); - limit[1][1] = ((uint)(coldep) / 2) * g_vm->_res; + limit[1][1] = ((uint)(coldep) / 2) * g_vm->_resolutionScaler; limit[1][2] = limit[1][1] + 40; if (caseNumb == 1) { limit[2][1] = limit[2][2]; } else { - limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) / 2) * g_vm->_res; + limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) / 2) * g_vm->_resolutionScaler; limit[2][2] = (limit[2][1]) + 40; } g_vm->_mouse.showMouse(); @@ -221,7 +221,7 @@ void Alert::decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &li } ++i; choiceListStr = g_vm->copy(inputStr, i, 30); - if (g_vm->_res == 2) + if (g_vm->_resolutionScaler == 2) col *= 6; else col *= 10; @@ -303,7 +303,7 @@ bool KnowledgeCheck::show() { g_vm->hirs(); g_vm->_mouse.showMouse(); int dialogHeight; - if (g_vm->_res == 1) + if (g_vm->_resolutionScaler == 1) dialogHeight = 29; else dialogHeight = 23; @@ -335,7 +335,7 @@ bool KnowledgeCheck::show() { } for (int j = 1; j <= lastOption - firstOption + 1; ++j) { - coor[j]._rect = Common::Rect(45 * g_vm->_res, 27 + j * 8, (maxLength * 3 + 55) * g_vm->_res, 34 + j * 8); + coor[j]._rect = Common::Rect(45 * g_vm->_resolutionScaler, 27 + j * 8, (maxLength * 3 + 55) * g_vm->_resolutionScaler, 34 + j * 8); coor[j]._enabled = true; while ((int)choiceArray[j].size() < maxLength) { @@ -344,7 +344,7 @@ bool KnowledgeCheck::show() { } coor[lastOption - firstOption + 2]._enabled = false; int rep; - if (g_vm->_res == 1) + if (g_vm->_resolutionScaler == 1) rep = 10; else rep = 6; @@ -473,7 +473,7 @@ void f3f8::ani50() { g_vm->pictout(kAdrAni, g_vm->_crep, 63, 12); g_vm->_crep = g_vm->animof(2, 1); g_vm->pictout(kAdrAni, g_vm->_crep, 63, 12); - g_vm->_largestClearScreen = (g_vm->_res == 1); + g_vm->_largestClearScreen = (g_vm->_resolutionScaler == 1); g_vm->handleDescriptionText(2, kDialogStringIndex + 143); } diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index fec2cfbf6b..5bf3aedc99 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -996,7 +996,7 @@ void ScreenSurface::writeCharacter(const Common::Point &pt, unsigned char ch, in * simulate the original 640x400 surface, all Y values have to be doubled */ void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { - if (g_vm->_res == 1) { + if (g_vm->_resolutionScaler == 1) { x = (uint)x >> 1; dx = (uint)dx >> 1; } @@ -1063,7 +1063,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { g_vm->_mouse.hideMouse(); pt = _textPos; - if (g_vm->_res == 2) + if (g_vm->_resolutionScaler == 2) i = 6; else i = 10; @@ -1105,7 +1105,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { * Gets the width in pixels of the specified string */ int ScreenSurface::getStringWidth(const Common::String &s) { - int charWidth = (g_vm->_res == 2) ? 6 : 10; + int charWidth = (g_vm->_resolutionScaler == 2) ? 6 : 10; return s.size() * charWidth; } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index f03d6661e4..8e6d94c449 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -93,8 +93,8 @@ void Menu::setDestinationText(int roomId) { roomId = LANDING; int destinationId = 0; - for (; (destinationId < 7) && (g_vm->_v_lieu[destinationId][roomId]); ++destinationId) { - nomp = g_vm->getString(g_vm->_v_lieu[destinationId][roomId] + kMenuPlaceStringIndex); + for (; (destinationId < 7) && (g_vm->_destinationArray[destinationId][roomId]); ++destinationId) { + nomp = g_vm->getString(g_vm->_destinationArray[destinationId][roomId] + kMenuPlaceStringIndex); while (nomp.size() < 20) nomp += ' '; setText(_moveMenu[destinationId + 1], nomp); @@ -178,7 +178,7 @@ void Menu::displayMenu() { g_vm->_mouse.hideMouse(); g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); - col = 28 * g_vm->_res; + col = 28 * g_vm->_resolutionScaler; if (g_vm->_currGraphicalDevice == MODE_CGA) color = 1; else @@ -207,7 +207,7 @@ void Menu::displayMenu() { } while (k != 3); ++y; } while (y != 9); - col += 48 * g_vm->_res; + col += 48 * g_vm->_resolutionScaler; } while (num_letr != 6); g_vm->_mouse.showMouse(); } @@ -284,14 +284,14 @@ void Menu::util(Common::Point pos) { int ymx = (_menuConstants[_msg3 - 1][3] << 3) + 16; int dxcar = _menuConstants[_msg3 - 1][2]; - int xmn = (_menuConstants[_msg3 - 1][0] << 2) * g_vm->_res; + int xmn = (_menuConstants[_msg3 - 1][0] << 2) * g_vm->_resolutionScaler; int ix; - if (g_vm->_res == 1) + if (g_vm->_resolutionScaler == 1) ix = 5; else ix = 3; - int xmx = dxcar * ix * g_vm->_res + xmn + 2; + int xmx = dxcar * ix * g_vm->_resolutionScaler + xmn + 2; if ((pos.x > xmn) && (pos.x < xmx) && (pos.y < ymx) && (pos.y > 15)) { ix = (((uint)pos.y >> 3) - 1) + (_msg3 << 8); if (ix != _msg4) { @@ -321,7 +321,7 @@ void Menu::menuDown(int ii) { g_vm->_mouse.hideMouse(); g_vm->sauvecr(10, (_menuConstants[ii - 1][1] + 1) << 1); xco = xco << 3; - if (g_vm->_res == 1) + if (g_vm->_resolutionScaler == 1) cx = 10; else cx = 6; @@ -433,24 +433,24 @@ void Menu::mdn() { g_vm->_prevPos = curPos; bool tes = (curPos.y < 11) - && ((curPos.x >= (28 * g_vm->_res) && curPos.x <= (28 * g_vm->_res + 24)) - || (curPos.x >= (76 * g_vm->_res) && curPos.x <= (76 * g_vm->_res + 24)) - || ((curPos.x > 124 * g_vm->_res) && (curPos.x < 124 * g_vm->_res + 24)) - || ((curPos.x > 172 * g_vm->_res) && (curPos.x < 172 * g_vm->_res + 24)) - || ((curPos.x > 220 * g_vm->_res) && (curPos.x < 220 * g_vm->_res + 24)) - || ((curPos.x > 268 * g_vm->_res) && (curPos.x < 268 * g_vm->_res + 24))); + && ((curPos.x >= (28 * g_vm->_resolutionScaler) && curPos.x <= (28 * g_vm->_resolutionScaler + 24)) + || (curPos.x >= (76 * g_vm->_resolutionScaler) && curPos.x <= (76 * g_vm->_resolutionScaler + 24)) + || ((curPos.x > 124 * g_vm->_resolutionScaler) && (curPos.x < 124 * g_vm->_resolutionScaler + 24)) + || ((curPos.x > 172 * g_vm->_resolutionScaler) && (curPos.x < 172 * g_vm->_resolutionScaler + 24)) + || ((curPos.x > 220 * g_vm->_resolutionScaler) && (curPos.x < 220 * g_vm->_resolutionScaler + 24)) + || ((curPos.x > 268 * g_vm->_resolutionScaler) && (curPos.x < 268 * g_vm->_resolutionScaler + 24))); if (tes) { int ix; - if (curPos.x < 76 * g_vm->_res) + if (curPos.x < 76 * g_vm->_resolutionScaler) ix = MENU_INVENTORY; - else if (curPos.x < 124 * g_vm->_res) + else if (curPos.x < 124 * g_vm->_resolutionScaler) ix = MENU_MOVE; - else if (curPos.x < 172 * g_vm->_res) + else if (curPos.x < 172 * g_vm->_resolutionScaler) ix = MENU_ACTION; - else if (curPos.x < 220 * g_vm->_res) + else if (curPos.x < 220 * g_vm->_resolutionScaler) ix = MENU_SELF; - else if (curPos.x < 268 * g_vm->_res) + else if (curPos.x < 268 * g_vm->_resolutionScaler) ix = MENU_DISCUSS; else ix = MENU_FILE; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 782c811b1f..2b95bcea0e 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -180,7 +180,7 @@ Common::ErrorCode MortevielleEngine::initialise() { // Set the screen mode _currGraphicalDevice = MODE_EGA; - _res = 2; + _resolutionScaler = 2; _txxFileFl = false; // Load texts from TXX files @@ -673,7 +673,7 @@ void MortevielleEngine::handleAction() { } else if (inkey == '\77') { if ((_menuOpcode != OPCODE_NONE) && ((_msg[3] == MENU_ACTION) || (_msg[3] == MENU_SELF))) { _msg[4] = _menuOpcode; - ecr3(getEngineString(S_IDEM)); + displayTextInVerbBar(getEngineString(S_IDEM)); } else return; } else if (inkey == '\104') { @@ -746,7 +746,7 @@ void MortevielleEngine::loadPlaces() { for (int i = 0; i < 7; ++i) { for (int j = 0; j < 25; ++j) - _v_lieu[i][j] = f.readByte(); + _destinationArray[i][j] = f.readByte(); } f.close(); @@ -2004,8 +2004,8 @@ void MortevielleEngine::handleOpcode() { } int hour, day, minute; updateHour(day, hour, minute); - if ((((hour == 12) || (hour == 13) || (hour == 19)) && (_coreVar._currPlace != 10)) || - ((hour > 0) && (hour < 6) && (_coreVar._currPlace != 0))) + if ((((hour == 12) || (hour == 13) || (hour == 19)) && (_coreVar._currPlace != DINING_ROOM)) || + ((hour > 0) && (hour < 6) && (_coreVar._currPlace != OWN_ROOM))) ++_coreVar._faithScore; if (((_coreVar._currPlace < CRYPT) || (_coreVar._currPlace > MOUNTAIN)) && (_coreVar._currPlace != INSIDE_WELL) && (_coreVar._currPlace != OWN_ROOM) && (_coreVar._selectedObjectId != 152) && (!_loseGame)) { @@ -2104,7 +2104,7 @@ void MortevielleEngine::clearUpperRightPart() { Common::String st; _mouse.hideMouse(); - if (_res == 1) { + if (_resolutionScaler == 1) { x2 = 634; x1 = 534; } else { @@ -2293,21 +2293,21 @@ void MortevielleEngine::resetVariables() { _coreVar._fullHour = chr(20); for (int i = 1; i <= 10; ++i) - _coreVar._pourc[i] = ' '; + _coreVar._pctHintFound[i] = ' '; for (int i = 1; i <= 6; ++i) - _coreVar._teauto[i] = '*'; + _coreVar._availableQuestion[i] = '*'; for (int i = 7; i <= 9; ++i) - _coreVar._teauto[i] = ' '; + _coreVar._availableQuestion[i] = ' '; for (int i = 10; i <= 28; ++i) - _coreVar._teauto[i] = '*'; + _coreVar._availableQuestion[i] = '*'; for (int i = 29; i <= 42; ++i) - _coreVar._teauto[i] = ' '; + _coreVar._availableQuestion[i] = ' '; - _coreVar._teauto[33] = '*'; + _coreVar._availableQuestion[33] = '*'; for (int i = 1; i <= 8; ++i) _nbrep[i] = 0; @@ -2563,7 +2563,7 @@ void MortevielleEngine::showTitleScreen() { draw(kAdrDes, 0, 0); Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; - _screenSurface.putxy(104 + 72 * _res, 185); + _screenSurface.putxy(104 + 72 * _resolutionScaler, 185); _screenSurface.drawString(cpr, 0); } @@ -2609,14 +2609,7 @@ int MortevielleEngine::readclock() { * @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; + int day, hour, minute; _anyone = false; updateHour(day, hour, minute); @@ -2634,29 +2627,26 @@ void MortevielleEngine::prepareRoom() { _hour = hour; _minute = 0; drawClock(); - cf = 0; + int hintCount = 0; for (int i = 1; i <= 10; ++i) { - if (_coreVar._pourc[i] == '*') - ++cf; + if (_coreVar._pctHintFound[i] == '*') + ++hintCount; } - if (cf == 10) - stpo = "10"; + Common::String pctStr; + if (hintCount == 10) + pctStr = "10"; else - stpo = chr(cf + 48); - - _hintPctMessage = Common::String(d3); - _hintPctMessage += d5; - _hintPctMessage += d4; - _hintPctMessage += d3; - _hintPctMessage += d1; - _hintPctMessage += stpo; + pctStr = chr(hintCount + 48); + + _hintPctMessage = "[1]["; + _hintPctMessage += getEngineString(S_SHOULD_HAVE_NOTICED); + _hintPctMessage += pctStr; _hintPctMessage += '0'; - _hintPctMessage += d2; - _hintPctMessage += d4; - _hintPctMessage += d3; - _hintPctMessage += d6; - _hintPctMessage += d4; + _hintPctMessage += getEngineString(S_NUMBER_OF_HINTS); + _hintPctMessage += "]["; + _hintPctMessage += getEngineString(S_OK); + _hintPctMessage += ']'; } if (minute > _minute) { _minute = 30; @@ -2670,11 +2660,10 @@ void MortevielleEngine::prepareRoom() { _inGameHourDuration = kTime2; else _inGameHourDuration = kTime1; - cf = _coreVar._faithScore; - if ((cf > 33) && (cf < 66)) + if ((_coreVar._faithScore > 33) && (_coreVar._faithScore < 66)) _inGameHourDuration -= (_inGameHourDuration / 3); - if (cf > 65) + if (_coreVar._faithScore > 65) _inGameHourDuration -= ((_inGameHourDuration / 3) * 2); int newHour = readclock(); @@ -2686,40 +2675,40 @@ void MortevielleEngine::prepareRoom() { switch (_place) { case GREEN_ROOM: case DARKBLUE_ROOM: - setRandomPresenceGreenRoom(cf); + setRandomPresenceGreenRoom(_coreVar._faithScore); break; case PURPLE_ROOM: - setRandomPresencePurpleRoom(cf); + setRandomPresencePurpleRoom(_coreVar._faithScore); break; case BLUE_ROOM: - setRandomPresenceBlueRoom(cf); + setRandomPresenceBlueRoom(_coreVar._faithScore); break; case RED_ROOM: case GREEN_ROOM2: - setRandomPresenceRedRoom(cf); + setRandomPresenceRedRoom(_coreVar._faithScore); break; case ROOM9: - setRandomPresenceRoom9(cf); + setRandomPresenceRoom9(_coreVar._faithScore); break; case DINING_ROOM: - setRandomPresenceDiningRoom(cf); + setRandomPresenceDiningRoom(_coreVar._faithScore); break; case BUREAU: - setRandomPresenceBureau(cf); + setRandomPresenceBureau(_coreVar._faithScore); break; case KITCHEN: - setRandomPresenceKitchen(cf); + setRandomPresenceKitchen(_coreVar._faithScore); break; case ATTIC: case CELLAR: - setRandomPresenceAttic(cf); + setRandomPresenceAttic(_coreVar._faithScore); break; case LANDING: case ROOM26: - setRandomPresenceLanding(cf); + setRandomPresenceLanding(_coreVar._faithScore); break; case CHAPEL: - setRandomPresenceChapel(cf); + setRandomPresenceChapel(_coreVar._faithScore); break; } if ((_savedBitIndex != 0) && (_currBitIndex != 10)) @@ -2736,7 +2725,7 @@ void MortevielleEngine::prepareRoom() { if (getRandomNumber(1, 5) < 5) { clearVerbBar(); prepareScreenType2(); - ecr3(getEngineString(S_HEAR_NOISE)); + displayTextInVerbBar(getEngineString(S_HEAR_NOISE)); int rand = (getRandomNumber(0, 4)) - 2; _speechManager.startSpeech(1, rand, 1); clearVerbBar(); @@ -2771,29 +2760,29 @@ void MortevielleEngine::drawClock() { const int x = 580; const int y = 123; const int rg = 9; - int h, co; + int hourColor; _mouse.hideMouse(); _screenSurface.drawRectangle(570, 118, 20, 10); _screenSurface.drawRectangle(578, 114, 6, 18); if ((_currGraphicalDevice == MODE_CGA) || (_currGraphicalDevice == MODE_HERCULES)) - co = 0; + hourColor = 0; else - co = 1; + hourColor = 1; if (_minute == 0) - _screenSurface.drawLine(((uint)x >> 1) * _res, y, ((uint)x >> 1) * _res, (y - rg), co); + _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)x >> 1) * _resolutionScaler, (y - rg), hourColor); else - _screenSurface.drawLine(((uint)x >> 1) * _res, y, ((uint)x >> 1) * _res, (y + rg), co); + _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)x >> 1) * _resolutionScaler, (y + rg), hourColor); - h = _hour; - if (h > 12) - h -= 12; - if (h == 0) - h = 12; + int hour12 = _hour; + if (hour12 > 12) + hour12 -= 12; + if (hour12 == 0) + hour12 = 12; - _screenSurface.drawLine(((uint)x >> 1) * _res, y, ((uint)(x + cv[0][h - 1]) >> 1) * _res, y + cv[1][h - 1], co); + _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)(x + cv[0][hour12 - 1]) >> 1) * _resolutionScaler, y + cv[1][hour12 - 1], hourColor); _mouse.showMouse(); _screenSurface.putxy(568, 154); @@ -2840,12 +2829,12 @@ void MortevielleEngine::hirs() { if (_currGraphicalDevice == MODE_TANDY) { _screenSurface.fillRect(0, Common::Rect(0, 0, 639, 200)); - _res = 1; + _resolutionScaler = 1; } else if (_currGraphicalDevice == MODE_CGA) { palette(1); - _res = 1; + _resolutionScaler = 1; } else - _res = 2; + _resolutionScaler = 2; _screenSurface.clearScreen(); } @@ -2860,7 +2849,7 @@ void MortevielleEngine::initCaveOrCellar() { _coreVar._faithScore += (_coreVar._faithScore / 10); clearVerbBar(); prepareScreenType2(); - ecr3(getEngineString(S_SOMEONE_ENTERS)); + displayTextInVerbBar(getEngineString(S_SOMEONE_ENTERS)); int rand = (getRandomNumber(0, 4)) - 2; _speechManager.startSpeech(2, rand, 1); @@ -2938,7 +2927,7 @@ int MortevielleEngine::animof(int ouf, int num) { void MortevielleEngine::displayTextInDescriptionBar(int x, int y, int nb, int mesgId) { int co; - if (_res == 1) + if (_resolutionScaler == 1) co = 10; else co = 6; @@ -2956,7 +2945,7 @@ void MortevielleEngine::handleDescriptionText(int f, int mesgId) { if ((mesgId > 499) && (mesgId < 563)) { Common::String tmpStr = getString(mesgId - 501 + kInventoryStringIndex); - if ((int) tmpStr.size() > ((58 + (_res - 1) * 37) << 1)) + if ((int) tmpStr.size() > ((58 + (_resolutionScaler - 1) * 37) << 1)) _largestClearScreen = true; else _largestClearScreen = false; @@ -2972,12 +2961,12 @@ void MortevielleEngine::handleDescriptionText(int f, int mesgId) { prepareScreenType2(); displayTextInDescriptionBar(8, 182, 103, mesgId); if ((mesgId == 68) || (mesgId == 69)) - _coreVar._teauto[40] = '*'; - if ((mesgId == 104) && (_caff == 14)) { - _coreVar._teauto[36] = '*'; - if (_coreVar._teauto[39] == '*') { - _coreVar._pourc[3] = '*'; - _coreVar._teauto[38] = '*'; + _coreVar._availableQuestion[40] = '*'; + if ((mesgId == 104) && (_caff == CELLAR)) { + _coreVar._availableQuestion[36] = '*'; + if (_coreVar._availableQuestion[39] == '*') { + _coreVar._pctHintFound[3] = '*'; + _coreVar._availableQuestion[38] = '*'; } } break; @@ -2994,9 +2983,9 @@ void MortevielleEngine::handleDescriptionText(int f, int mesgId) { _text.displayStr(tmpStr, 80, 40, 60, 25, i); if (mesgId == 180) - _coreVar._pourc[6] = '*'; + _coreVar._pctHintFound[6] = '*'; else if (mesgId == 179) - _coreVar._pourc[10] = '*'; + _coreVar._pctHintFound[10] = '*'; } break; default: @@ -3061,7 +3050,7 @@ void MortevielleEngine::resetOpenObjects() { void MortevielleEngine::ecr2(Common::String text) { // Some dead code was present in the original: removed _screenSurface.putxy(8, 177); - int tlig = 59 + (_res - 1) * 36; + int tlig = 59 + (_resolutionScaler - 1) * 36; if ((int)text.size() < tlig) _screenSurface.drawString(text, 5); @@ -3082,7 +3071,7 @@ void MortevielleEngine::ecr2(Common::String text) { } } -void MortevielleEngine::ecr3(Common::String text) { +void MortevielleEngine::displayTextInVerbBar(Common::String text) { clearVerbBar(); _screenSurface.putxy(8, 192); _screenSurface.drawString(text, 5); @@ -3282,19 +3271,19 @@ int MortevielleEngine::getPresence(int roomId) { } void MortevielleEngine::writetp(Common::String s, int t) { - if (_res == 2) + if (_resolutionScaler == 2) _screenSurface.drawString(s, t); else _screenSurface.drawString(copy(s, 1, 25), t); } void MortevielleEngine::aniof(int ouf, int num) { - if ((_caff == 7) && ((num == 4) || (num == 5))) + if ((_caff == BATHROOM) && ((num == 4) || (num == 5))) return; - if ((_caff == 10) && (num == 7)) + if ((_caff == DINING_ROOM) && (num == 7)) num = 6; - else if (_caff == 12) { + else if (_caff == KITCHEN) { if (num == 3) num = 4; else if (num == 4) @@ -3332,17 +3321,17 @@ void MortevielleEngine::drawPicture() { aniof(1, _openObjects[cx]); } - if (_caff == 13) { + if (_caff == ATTIC) { if (_coreVar._atticBallHoleObjectId == 141) aniof(1, 7); if (_coreVar._atticRodHoleObjectId == 159) aniof(1, 6); - } else if ((_caff == 14) && (_coreVar._cellarObjectId == 151)) + } else if ((_caff == CELLAR) && (_coreVar._cellarObjectId == 151)) aniof(1, 2); - else if ((_caff == 17) && (_coreVar._secretPassageObjectId == 143)) + else if ((_caff == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) aniof(1, 1); - else if ((_caff == 24) && (_coreVar._wellObjectId != 0)) + else if ((_caff == WELL) && (_coreVar._wellObjectId != 0)) aniof(1, 1); } @@ -3622,7 +3611,7 @@ void MortevielleEngine::tfleche() { CHECK_QUIT; if (getMouseClick()) - inRect = (_mouse._pos.x < 256 * _res) && (_mouse._pos.y < 176) && (_mouse._pos.y > 12); + inRect = (_mouse._pos.x < 256 * _resolutionScaler) && (_mouse._pos.y < 176) && (_mouse._pos.y > 12); prepareRoom(); } while (!(qust || inRect || _anyone)); @@ -3679,10 +3668,10 @@ void MortevielleEngine::setCoordinates(int sx) { cy = 1; do { cb += 2; - sx = _tabdon[a + cb] * _res; + sx = _tabdon[a + cb] * _resolutionScaler; sy = _tabdon[(a + cb + 1)]; cb += 2; - ix = _tabdon[a + cb] * _res; + ix = _tabdon[a + cb] * _resolutionScaler; iy = _tabdon[(a + cb + 1)]; ++cy; } while (!(((_x >= sx) && (_x <= ix) && (_y >= sy) && (_y <= iy)) || (cy > ib))); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 1141f70026..81baab91b4 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -154,8 +154,7 @@ static const int _actionMenu[12] = { OPCODE_NONE, /* 9 "A glance at the forbidden$", 18 "It's already open$", -26 "A photograph$", -27 "The coat of arms$", +26 "A photograph$" */ enum Places { OWN_ROOM = 0, GREEN_ROOM = 1, PURPLE_ROOM = 2, TOILETS = 3, DARKBLUE_ROOM = 4, @@ -163,7 +162,7 @@ enum Places { DINING_ROOM = 10, BUREAU = 11, KITCHEN = 12, ATTIC = 13, CELLAR = 14, LANDING = 15, CRYPT = 16, SECRET_PASSAGE = 17, ROOM18 = 18, MOUNTAIN = 19, CHAPEL = 20, MANOR_FRONT = 21, MANOR_BACK = 22, INSIDE_WELL = 23, WELL = 24, - DOOR = 25, ROOM26 = 26, ROOM27 = 27 + DOOR = 25, ROOM26 = 26, COAT_ARMS = 27 }; enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCULES = 3, MODE_TANDY = 4 }; @@ -185,8 +184,8 @@ struct Pattern { struct SaveStruct { int _faithScore; - byte _pourc[11]; - byte _teauto[43]; + byte _pctHintFound[11]; + byte _availableQuestion[43]; byte _inventory[31]; int _currPlace; int _atticBallHoleObjectId; @@ -420,31 +419,32 @@ private: void delay(int amount); void handleOpcode(); - void cinq_huit(char &c, int &idx, byte &pt, bool &the_end); - void copcha(); - void adzon(); void displayTextInDescriptionBar(int x, int y, int nb, int mesgId); void mapMessageId(int &mesgId); void resetOpenObjects(); + void setCoordinates(int sx); + void displayTextInVerbBar(Common::String text); + void drawPicture(); + void drawPictureWithText(); + void addObjectToInventory(int objectId); + void putInHand(int &objId); + + void cinq_huit(char &c, int &idx, byte &pt, bool &the_end); + void copcha(); + void adzon(); void phaz(int &rand, int &p, int cf); void writetp(Common::String s, int t); void premtet(); void ajchai(); void tfleche(); - void setCoordinates(int sx); void ecr2(Common::String text); - void ecr3(Common::String text); void init_nbrepm(); void aniof(int ouf, int num); - void drawPicture(); - void drawPictureWithText(); void tlu(int af, int ob); void affrep(); void mennor(); - void addObjectToInventory(int objectId); void tsuiv(); void treg(int objId); - void putInHand(int &objId); void rechai(int &ch); void fenat(char ans); @@ -466,10 +466,11 @@ public: SaveStruct _coreVar, _saveStruct; int _maff; - int _res; int _caff; int _crep; - byte _v_lieu[7][25]; + + int _resolutionScaler; + byte _destinationArray[7][25]; // TODO: Replace the following with proper implementations, or refactor out the code using them byte _mem[65536 * 16]; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 96b40d8114..bc0f5fe7d3 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -219,8 +219,8 @@ void MouseHandler::showMouse() { * @remarks Originally called 'pos_mouse' */ void MouseHandler::setMousePosition(Common::Point newPos) { - if (newPos.x > 314 * g_vm->_res) - newPos.x = 314 * g_vm->_res; + if (newPos.x > 314 * g_vm->_resolutionScaler) + newPos.x = 314 * g_vm->_resolutionScaler; else if (newPos.x < 0) newPos.x = 0; if (newPos.y > 199) @@ -291,16 +291,16 @@ void MouseHandler::moveMouse(bool &funct, char &key) { cy = 190; break; case '9': - cx = 315 * g_vm->_res; + cx = 315 * g_vm->_resolutionScaler; cy = 1; break; case '3': cy = 190; - cx = 315 * g_vm->_res; + cx = 315 * g_vm->_resolutionScaler; break; case '5': cy = 100; - cx = 155 * g_vm->_res; + cx = 155 * g_vm->_resolutionScaler; break; case ' ': case '\15': @@ -354,27 +354,27 @@ void MouseHandler::moveMouse(bool &funct, char &key) { } break; case 'I': - cx = g_vm->_res * 32; + cx = g_vm->_resolutionScaler * 32; cy = 8; break; case 'D': - cx = 80 * g_vm->_res; + cx = 80 * g_vm->_resolutionScaler; cy = 8; break; case 'A': - cx = 126 * g_vm->_res; + cx = 126 * g_vm->_resolutionScaler; cy = 8; break; case 'S': - cx = 174 * g_vm->_res; + cx = 174 * g_vm->_resolutionScaler; cy = 8; break; case 'P': - cx = 222 * g_vm->_res; + cx = 222 * g_vm->_resolutionScaler; cy = 8; break; case 'F': - cx = g_vm->_res * 270; + cx = g_vm->_resolutionScaler * 270; cy = 8; break; case '\23': diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index e18c5c1692..4bdfcb4699 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -60,7 +60,7 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int inputStr += '$'; g_vm->_screenSurface.putxy(x, y); - if (g_vm->_res == 1) + if (g_vm->_resolutionScaler == 1) tab = 10; else tab = 6; @@ -206,37 +206,37 @@ void TextHandler::taffich() { switch (a) { case 16: - g_vm->_coreVar._pourc[9] = '*'; - g_vm->_coreVar._teauto[42] = '*'; + g_vm->_coreVar._pctHintFound[9] = '*'; + g_vm->_coreVar._availableQuestion[42] = '*'; break; case 20: - g_vm->_coreVar._teauto[39] = '*'; - if (g_vm->_coreVar._teauto[36] == '*') { - g_vm->_coreVar._pourc[3] = '*'; - g_vm->_coreVar._teauto[38] = '*'; + g_vm->_coreVar._availableQuestion[39] = '*'; + if (g_vm->_coreVar._availableQuestion[36] == '*') { + g_vm->_coreVar._pctHintFound[3] = '*'; + g_vm->_coreVar._availableQuestion[38] = '*'; } break; case 24: - g_vm->_coreVar._teauto[37] = '*'; + g_vm->_coreVar._availableQuestion[37] = '*'; break; case 30: - g_vm->_coreVar._teauto[9] = '*'; + g_vm->_coreVar._availableQuestion[9] = '*'; break; - case 31: - g_vm->_coreVar._pourc[4] = '*'; - g_vm->_coreVar._teauto[35] = '*'; + case 31: // Coat of arms + g_vm->_coreVar._pctHintFound[4] = '*'; + g_vm->_coreVar._availableQuestion[35] = '*'; break; case 118: - g_vm->_coreVar._teauto[41] = '*'; + g_vm->_coreVar._availableQuestion[41] = '*'; break; case 143: - g_vm->_coreVar._pourc[1] = '*'; + g_vm->_coreVar._pctHintFound[1] = '*'; break; case 150: - g_vm->_coreVar._teauto[34] = '*'; + g_vm->_coreVar._availableQuestion[34] = '*'; break; case 151: - g_vm->_coreVar._pourc[2] = '*'; + g_vm->_coreVar._pctHintFound[2] = '*'; break; default: break; diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index e4fb38c20a..093f22e9cf 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -46,9 +46,9 @@ Common::String SavegameManager::generateSaveName(int slotNumber) { void SavegameManager::sync_save(Common::Serializer &sz) { sz.syncAsSint16LE(g_vm->_saveStruct._faithScore); for (int i = 0; i < 11; ++i) - sz.syncAsByte(g_vm->_saveStruct._pourc[i]); + sz.syncAsByte(g_vm->_saveStruct._pctHintFound[i]); for (int i = 0; i < 43; ++i) - sz.syncAsByte(g_vm->_saveStruct._teauto[i]); + sz.syncAsByte(g_vm->_saveStruct._availableQuestion[i]); for (int i = 0; i < 31; ++i) sz.syncAsByte(g_vm->_saveStruct._inventory[i]); -- cgit v1.2.3