diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 22c1f5332ea..6f57019cf2a 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -734,12 +734,12 @@ void MortevielleEngine::fctPlace() { _soundManager->startSpeech(6, -9, 1); // Do you want to enter the hidden passage? - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); if (answer == 1) { Common::String alertTxt = getString(582); - _dialogManager.show(alertTxt); + _dialogManager->show(alertTxt); - bool enterPassageFl = _dialogManager.showKnowledgeCheck(); + bool enterPassageFl = _dialogManager->showKnowledgeCheck(); _mouse->hideMouse(); clearScreen(); drawRightFrame(); @@ -764,7 +764,7 @@ void MortevielleEngine::fctPlace() { displayAnimFrame(1, 2); displayAnimFrame(1, 1); alertTxt = getString(577); - _dialogManager.show(alertTxt); + _dialogManager->show(alertTxt); displayAnimFrame(2, 1); _crep = 166; } @@ -833,7 +833,7 @@ void MortevielleEngine::fctTurn() { if ((_coreVar._currPlace == ATTIC) && (_coreVar._atticRodHoleObjectId == 159) && (_coreVar._atticBallHoleObjectId == 141)) { handleDescriptionText(2, 167); _soundManager->startSpeech(7, 9, 1); - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); if (answer == 1) _endGame = true; else @@ -843,7 +843,7 @@ void MortevielleEngine::fctTurn() { handleDescriptionText(2, 175); clearVerbBar(); _soundManager->startSpeech(6, -9, 1); - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); if (answer == 1) { _coreVar._currPlace = CRYPT; prepareDisplayText(); @@ -949,7 +949,7 @@ void MortevielleEngine::fctKnock() { displayTextInVerbBar(getEngineString(S_HIT)); if (_coreVar._currPlace == LANDING) { - _dialogManager.show(getEngineString(S_BEFORE_USE_DEP_MENU)); + _dialogManager->show(getEngineString(S_BEFORE_USE_DEP_MENU)); return; } @@ -1261,7 +1261,7 @@ void MortevielleEngine::fctSleep() { if (hour > 23) hour = 0; prepareRoom(); - answer = _dialogManager.show(getEngineString(S_YES_NO)); + answer = _dialogManager->show(getEngineString(S_YES_NO)); _anyone = false; } while (answer != 1); _crep = 998; @@ -1351,7 +1351,7 @@ void MortevielleEngine::fctWait() { return; } handleDescriptionText(2, 102); - answer = _dialogManager.show(getEngineString(S_YES_NO)); + answer = _dialogManager->show(getEngineString(S_YES_NO)); } while (answer != 2); _crep = 998; if (!_anyone) @@ -1423,7 +1423,7 @@ void MortevielleEngine::fctDiscuss() { int posX = 0; int posY = 0; for (int icm = 1; icm < 43; icm++) { - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (_coreVar._availableQuestion[icm] == '*') { // If question already asked, write it in reverse video if (questionAsked[icm]) @@ -1438,7 +1438,7 @@ void MortevielleEngine::fctDiscuss() { } else posY += 8; } - _screenSurface.putxy(320, 176); + _screenSurface->putxy(320, 176); displayQuestionText(lib[46], 0); char retKey = '\0'; bool click; @@ -1462,7 +1462,7 @@ void MortevielleEngine::fctDiscuss() { posX = 320; else posX = 0; - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (questionAsked[choice]) displayQuestionText(lib[choice], 0); else @@ -1481,7 +1481,7 @@ void MortevielleEngine::fctDiscuss() { posX = 320; else posX = 0; - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (questionAsked[choice]) displayQuestionText(lib[choice], 0); else @@ -1494,7 +1494,7 @@ void MortevielleEngine::fctDiscuss() { posX = 320; else posX = 0; - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (questionAsked[ix]) displayQuestionText(lib[ix], 0); else @@ -1667,7 +1667,7 @@ void MortevielleEngine::askRestart() { _day = 0; handleDescriptionText(2, 180); - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); _quitGame = (answer != 1); } diff --git a/engines/mortevielle/debugger.cpp b/engines/mortevielle/debugger.cpp index 4ef5151c818..4b39462cde0 100644 --- a/engines/mortevielle/debugger.cpp +++ b/engines/mortevielle/debugger.cpp @@ -25,7 +25,8 @@ namespace Mortevielle { -Debugger::Debugger() : GUI::Debugger() { +Debugger::Debugger(MortevielleEngine *vm) : GUI::Debugger() { + _vm = vm; DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); DCmd_Register("show_questions", WRAP_METHOD(Debugger, Cmd_showAllQuestions)); DCmd_Register("reset_parano", WRAP_METHOD(Debugger, Cmd_resetParano)); @@ -52,8 +53,4 @@ bool Debugger::Cmd_resetParano(int argc, const char **argv) { return true; } -void Debugger::setParent(MortevielleEngine *vm) { - _vm = vm; -} - } // End of namespace Mortevielle diff --git a/engines/mortevielle/debugger.h b/engines/mortevielle/debugger.h index 9041d901101..6e1006681ca 100644 --- a/engines/mortevielle/debugger.h +++ b/engines/mortevielle/debugger.h @@ -39,9 +39,8 @@ protected: bool Cmd_resetParano(int argc, const char **argv); public: - Debugger(); + Debugger(MortevielleEngine *vm); virtual ~Debugger() {} - void setParent(MortevielleEngine *vm); }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 2aa2757dfa0..09a4227cc03 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -35,13 +35,17 @@ namespace Mortevielle { +DialogManager::DialogManager(MortevielleEngine *vm) { + _vm = vm; +} + /** * Alert function - Show * @remarks Originally called 'do_alert' */ int DialogManager::show(const Common::String &msg) { // Make a copy of the current screen surface for later restore - _vm->_backgroundSurface.copyFrom(_vm->_screenSurface); + _vm->_backgroundSurface.copyFrom(*_vm->_screenSurface); _vm->_mouse->hideMouse(); while (_vm->keyPressed()) @@ -63,7 +67,7 @@ int DialogManager::show(const Common::String &msg) { } else { drawAlertBox(8, 7, colNumb); int i = 0; - _vm->_screenSurface._textPos.y = 70; + _vm->_screenSurface->_textPos.y = 70; do { curPos.x = 320; Common::String displayStr = ""; @@ -72,9 +76,9 @@ int DialogManager::show(const Common::String &msg) { displayStr += alertStr[i]; curPos.x -= 3; } - _vm->_screenSurface.putxy(curPos.x, _vm->_screenSurface._textPos.y); - _vm->_screenSurface._textPos.y += 6; - _vm->_screenSurface.drawString(displayStr, 4); + _vm->_screenSurface->putxy(curPos.x, _vm->_screenSurface->_textPos.y); + _vm->_screenSurface->_textPos.y += 6; + _vm->_screenSurface->drawString(displayStr, 4); ++i; } while (alertStr[i] != ']'); } @@ -132,14 +136,14 @@ int DialogManager::show(const Common::String &msg) { Common::String tmpStr(" "); tmpStr += buttonStr[id]; tmpStr += " "; - _vm->_screenSurface.drawString(tmpStr, 0); + _vm->_screenSurface->drawString(tmpStr, 0); } setPosition(ix, coldep, esp); Common::String tmp2 = " "; tmp2 += buttonStr[ix]; tmp2 += " "; - _vm->_screenSurface.drawString(tmp2, 1); + _vm->_screenSurface->drawString(tmp2, 1); id = ix; _vm->_mouse->showMouse(); @@ -153,7 +157,7 @@ int DialogManager::show(const Common::String &msg) { Common::String tmp3(" "); tmp3 += buttonStr[id]; tmp3 += " "; - _vm->_screenSurface.drawString(tmp3, 0); + _vm->_screenSurface->drawString(tmp3, 0); id = 0; _vm->_mouse->showMouse(); @@ -169,12 +173,12 @@ int DialogManager::show(const Common::String &msg) { Common::String tmp4(" "); tmp4 += buttonStr[1]; tmp4 += " "; - _vm->_screenSurface.drawString(tmp4, 1); + _vm->_screenSurface->drawString(tmp4, 1); } _vm->_mouse->showMouse(); /* Restore the background area */ - _vm->_screenSurface.copyFrom(_vm->_backgroundSurface, 0, 0); + _vm->_screenSurface->copyFrom(_vm->_backgroundSurface, 0, 0); return id; } @@ -221,7 +225,7 @@ void DialogManager::decodeAlertDetails(Common::String inputStr, int &choiceNumb, } void DialogManager::setPosition(int ji, int coldep, int esp) { - _vm->_screenSurface.putxy(coldep + (40 + esp) * (ji - 1), 98); + _vm->_screenSurface->putxy(coldep + (40 + esp) * (ji - 1), 98); } /** @@ -235,9 +239,9 @@ void DialogManager::drawAlertBox(int firstLine, int lineNum, int width) { int y = (firstLine - 1) * 8; int xx = x + width; int yy = y + (lineNum * 8); - _vm->_screenSurface.fillRect(15, Common::Rect(x, y, xx, yy)); - _vm->_screenSurface.fillRect(0, Common::Rect(x, y + 2, xx, y + 4)); - _vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); + _vm->_screenSurface->fillRect(15, Common::Rect(x, y, xx, yy)); + _vm->_screenSurface->fillRect(0, Common::Rect(x, y + 2, xx, y + 4)); + _vm->_screenSurface->fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); } /** @@ -259,13 +263,13 @@ void DialogManager::setButtonText(Common::String c, int coldep, int nbcase, Comm while (str[l].size() < 3) str[l] += ' '; - _vm->_screenSurface.putxy(x, 98); + _vm->_screenSurface->putxy(x, 98); Common::String tmp(" "); tmp += str[l]; tmp += " "; - _vm->_screenSurface.drawString(tmp, 0); + _vm->_screenSurface->drawString(tmp, 0); x += esp + 40; } } @@ -296,7 +300,7 @@ bool DialogManager::showKnowledgeCheck() { _vm->clearScreen(); _vm->_mouse->showMouse(); int dialogHeight = 23; - _vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, dialogHeight)); + _vm->_screenSurface->fillRect(15, Common::Rect(0, 14, 630, dialogHeight)); Common::String tmpStr = _vm->getString(textIndexArr[indx]); _vm->_text->displayStr(tmpStr, 20, 15, 100, 2, 0); @@ -333,7 +337,7 @@ bool DialogManager::showKnowledgeCheck() { } coor[lastOption - firstOption + 2]._enabled = false; int rep = 6; - _vm->_screenSurface.drawBox(80, 33, 40 + (maxLength * rep), (lastOption - firstOption) * 8 + 16, 15); + _vm->_screenSurface->drawBox(80, 33, 40 + (maxLength * rep), (lastOption - firstOption) * 8 + 16, 15); rep = 0; prevChoice = 0; @@ -391,17 +395,17 @@ void DialogManager::drawF3F8() { Common::String f8 = _vm->getEngineString(S_F8); // Write the F3 and F8 text strings - _vm->_screenSurface.putxy(3, 44); - _vm->_screenSurface.drawString(f3, 5); - _vm->_screenSurface._textPos.y = 51; - _vm->_screenSurface.drawString(f8, 5); + _vm->_screenSurface->putxy(3, 44); + _vm->_screenSurface->drawString(f3, 5); + _vm->_screenSurface->_textPos.y = 51; + _vm->_screenSurface->drawString(f8, 5); // Get the width of the written text strings - int f3Width = _vm->_screenSurface.getStringWidth(f3); - int f8Width = _vm->_screenSurface.getStringWidth(f8); + int f3Width = _vm->_screenSurface->getStringWidth(f3); + int f8Width = _vm->_screenSurface->getStringWidth(f8); // Write out the bounding box - _vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 18, 7); + _vm->_screenSurface->drawBox(0, 42, MAX(f3Width, f8Width) + 6, 18, 7); } /** @@ -466,7 +470,4 @@ void DialogManager::displayIntroFrame2() { _vm->handleDescriptionText(2, kDialogStringIndex + 143); } -void DialogManager::setParent(MortevielleEngine *vm) { - _vm = vm; -} } // End of namespace Mortevielle diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index 3f308519609..03dfc780231 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -51,7 +51,8 @@ private: void drawAlertBox(int firstLine, int lineNum, int width); void setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp); public: - void setParent(MortevielleEngine *vm); + DialogManager(MortevielleEngine *vm); + int show(const Common::String &msg); void drawF3F8(); void checkForF8(int SpeechNum, bool drawFrame2Fl); diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 7a7e9265c56..18b0e7f1c12 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -881,6 +881,10 @@ GfxSurface::~GfxSurface() { * Screen surface *-------------------------------------------------------------------------*/ +ScreenSurface::ScreenSurface(MortevielleEngine *vm) { + _vm = vm; +} + /** * Called to populate the font data from the passed file */ @@ -1082,11 +1086,11 @@ void ScreenSurface::drawString(const Common::String &l, int command) { case 0: case 2: color = 15; - _vm->_screenSurface.fillRect(0, Common::Rect(pt.x, pt.y, x, pt.y + 7)); + _vm->_screenSurface->fillRect(0, Common::Rect(pt.x, pt.y, x, pt.y + 7)); break; case 1: case 3: - _vm->_screenSurface.fillRect(15, Common::Rect(pt.x, pt.y, x, pt.y + 7)); + _vm->_screenSurface->fillRect(15, Common::Rect(pt.x, pt.y, x, pt.y + 7)); break; case 5: color = 15; @@ -1099,7 +1103,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { pt.x += 1; pt.y += 1; for (x = 1; (x <= (int)l.size()) && (l[x - 1] != 0); ++x) { - _vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), l[x - 1], color); + _vm->_screenSurface->writeCharacter(Common::Point(pt.x, pt.y), l[x - 1], color); pt.x += charWidth; } _vm->_mouse->showMouse(); @@ -1133,7 +1137,7 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { else step = 1; do { - _vm->_screenSurface.setPixel(Common::Point(abs((int)(a * i + b)), i), coul); + _vm->_screenSurface->setPixel(Common::Point(abs((int)(a * i + b)), i), coul); i += step; } while (i != yy); } else { @@ -1145,7 +1149,7 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { else step = 1; do { - _vm->_screenSurface.setPixel(Common::Point(i, abs((int)(a * i + b))), coul); + _vm->_screenSurface->setPixel(Common::Point(i, abs((int)(a * i + b))), coul); i = i + step; } while (i != xx); } @@ -1156,12 +1160,7 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { * @remarks Originally called 'paint_rect' */ void ScreenSurface::drawRectangle(int x, int y, int dx, int dy) { - _vm->_screenSurface.fillRect(11, Common::Rect(x, y, x + dx, y + dy)); + _vm->_screenSurface->fillRect(11, Common::Rect(x, y, x + dx, y + dy)); } -void ScreenSurface::setParent(MortevielleEngine *vm) { - _vm = vm; -} - - } // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index e31f5da29ae..7f0d4823cba 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -91,6 +91,8 @@ private: byte _fontData[FONT_NUM_CHARS * FONT_HEIGHT]; public: + ScreenSurface(MortevielleEngine *vm); + Common::Point _textPos; // Original called xwhere/ywhere void readFontData(Common::File &f, int dataSize); Graphics::Surface lockArea(const Common::Rect &bounds); @@ -106,7 +108,6 @@ public: int getStringWidth(const Common::String &s); void drawLine(int x, int y, int xx, int yy, int coul); void drawRectangle(int x, int y, int dx, int dy); - void setParent(MortevielleEngine *vm); // TODO: Refactor code to remove this method, for increased performance void setPixel(const Common::Point &pt, int palIndex); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 32e4dd25b62..14fc8d40849 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -297,7 +297,7 @@ void Menu::enableMenuItem(MenuItem item) { void Menu::displayMenu() { _vm->_mouse->hideMouse(); - _vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); + _vm->_screenSurface->fillRect(7, Common::Rect(0, 0, 639, 10)); int col = 28 * kResolutionScaler; for (int charNum = 0; charNum < 6; charNum++) { @@ -311,9 +311,9 @@ void Menu::displayMenu() { uint msk = 0x80; for (int pt = 0; pt <= 7; ++pt) { if ((_charArr[charNum][idx] & msk) != 0) { - _vm->_screenSurface.setPixel(Common::Point(x + 1, y + 1), 0); - _vm->_screenSurface.setPixel(Common::Point(x, y + 1), 0); - _vm->_screenSurface.setPixel(Common::Point(x, y), 9); + _vm->_screenSurface->setPixel(Common::Point(x + 1, y + 1), 0); + _vm->_screenSurface->setPixel(Common::Point(x, y + 1), 0); + _vm->_screenSurface->setPixel(Common::Point(x, y), 9); } msk >>= 1; ++x; @@ -349,7 +349,7 @@ void Menu::invert(int indx) { int menuIndex = _msg4 & 0xFF; - _vm->_screenSurface.putxy(menuConstants[_msg3 - 1][0] << 3, (menuIndex + 1) << 3); + _vm->_screenSurface->putxy(menuConstants[_msg3 - 1][0] << 3, (menuIndex + 1) << 3); Common::String str; switch (_msg3) { @@ -389,7 +389,7 @@ void Menu::invert(int indx) { break; } if ((str[0] != '*') && (str[0] != '<')) - _vm->_screenSurface.drawString(str, indx); + _vm->_screenSurface->drawString(str, indx); else _msg4 = OPCODE_NONE; } @@ -420,7 +420,7 @@ void Menu::util(Common::Point pos) { */ void Menu::menuDown(int ii) { // Make a copy of the current screen surface for later restore - _vm->_backgroundSurface.copyFrom(_vm->_screenSurface); + _vm->_backgroundSurface.copyFrom(*_vm->_screenSurface); // Draw the menu int minX = menuConstants[ii - 1][0] << 3; @@ -432,56 +432,56 @@ void Menu::menuDown(int ii) { // Extra width needed for Self menu in English version maxX = 435; - _vm->_screenSurface.fillRect(15, Common::Rect(minX, 12, maxX, 10 + (menuConstants[ii - 1][1] << 1))); - _vm->_screenSurface.fillRect(0, Common::Rect(maxX, 12, maxX + 4, 10 + (menuConstants[ii - 1][1] << 1))); - _vm->_screenSurface.fillRect(0, Common::Rect(minX, 8 + (menuConstants[ii - 1][1] << 1), maxX + 4, 12 + (menuConstants[ii - 1][1] << 1))); - _vm->_screenSurface.putxy(minX, 16); + _vm->_screenSurface->fillRect(15, Common::Rect(minX, 12, maxX, 10 + (menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface->fillRect(0, Common::Rect(maxX, 12, maxX + 4, 10 + (menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface->fillRect(0, Common::Rect(minX, 8 + (menuConstants[ii - 1][1] << 1), maxX + 4, 12 + (menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface->putxy(minX, 16); for (int i = 1; i <= lineNum; i++) { switch (ii) { case 1: if (_inventoryStringArray[i][0] != '*') - _vm->_screenSurface.drawString(_inventoryStringArray[i], 4); + _vm->_screenSurface->drawString(_inventoryStringArray[i], 4); break; case 2: if (_moveStringArray[i][0] != '*') - _vm->_screenSurface.drawString(_moveStringArray[i], 4); + _vm->_screenSurface->drawString(_moveStringArray[i], 4); break; case 3: if (_actionStringArray[i][0] != '*') - _vm->_screenSurface.drawString(_actionStringArray[i], 4); + _vm->_screenSurface->drawString(_actionStringArray[i], 4); break; case 4: if (_selfStringArray[i][0] != '*') - _vm->_screenSurface.drawString(_selfStringArray[i], 4); + _vm->_screenSurface->drawString(_selfStringArray[i], 4); break; case 5: if (_discussStringArray[i][0] != '*') - _vm->_screenSurface.drawString(_discussStringArray[i], 4); + _vm->_screenSurface->drawString(_discussStringArray[i], 4); break; case 6: - _vm->_screenSurface.drawString(_vm->getEngineString(S_SAVE_LOAD + i), 4); + _vm->_screenSurface->drawString(_vm->getEngineString(S_SAVE_LOAD + i), 4); break; case 7: { Common::String s = _vm->getEngineString(S_SAVE_LOAD + 1); s += ' '; s += (char)(48 + i); - _vm->_screenSurface.drawString(s, 4); + _vm->_screenSurface->drawString(s, 4); } break; case 8: if (i == 1) - _vm->_screenSurface.drawString(_vm->getEngineString(S_RESTART), 4); + _vm->_screenSurface->drawString(_vm->getEngineString(S_RESTART), 4); else { Common::String s = _vm->getEngineString(S_SAVE_LOAD + 2); s += ' '; s += (char)(47 + i); - _vm->_screenSurface.drawString(s, 4); + _vm->_screenSurface->drawString(s, 4); } break; default: break; } - _vm->_screenSurface.putxy(minX, _vm->_screenSurface._textPos.y + 8); + _vm->_screenSurface->putxy(minX, _vm->_screenSurface->_textPos.y + 8); } _multiTitle = true; _vm->_mouse->showMouse(); @@ -493,11 +493,11 @@ void Menu::menuDown(int ii) { void Menu::menuUp(int msgId) { if (_multiTitle) { /* Restore the background area */ - assert(_vm->_screenSurface.pitch == _vm->_backgroundSurface.pitch); + assert(_vm->_screenSurface->pitch == _vm->_backgroundSurface.pitch); // Get a pointer to the source and destination of the area to restore const byte *pSrc = (const byte *)_vm->_backgroundSurface.getBasePtr(0, 10); - Graphics::Surface destArea = _vm->_screenSurface.lockArea(Common::Rect(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT)); + Graphics::Surface destArea = _vm->_screenSurface->lockArea(Common::Rect(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT)); byte *pDest = (byte *)destArea.getPixels(); // Copy the data diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 01e0492d4ae..34372ba32a8 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -49,13 +49,13 @@ MortevielleEngine *g_vm; MortevielleEngine::MortevielleEngine(OSystem *system, const MortevielleGameDescription *gameDesc): Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle") { g_vm = this; - _debugger.setParent(this); - _dialogManager.setParent(this); - _screenSurface.setParent(this); + _debugger = new Debugger(this); + _dialogManager = new DialogManager(this); + _screenSurface = new ScreenSurface(this); _mouse = new MouseHandler(this); _text = new TextHandler(this); _soundManager = new SoundManager(this, _mixer); - _savegameManager.setParent(this); + _savegameManager = new SavegameManager(this); _menu = new Menu(this); _lastGameFrame = 0; @@ -105,9 +105,13 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const MortevielleGameDescr MortevielleEngine::~MortevielleEngine() { delete _menu; + delete _savegameManager; delete _soundManager; delete _text; delete _mouse; + delete _screenSurface; + delete _dialogManager; + delete _debugger; free(_curPict); free(_curAnim); @@ -144,7 +148,7 @@ bool MortevielleEngine::canSaveGameStateCurrently() { * Load in a savegame at the specified slot number */ Common::Error MortevielleEngine::loadGameState(int slot) { - return _savegameManager.loadGame(slot); + return _savegameManager->loadGame(slot); } /** @@ -154,7 +158,7 @@ Common::Error MortevielleEngine::saveGameState(int slot, const Common::String &d if (slot == 0) return Common::kWritingFailed; - return _savegameManager.saveGame(slot, desc); + return _savegameManager->saveGame(slot, desc); } /** @@ -200,7 +204,7 @@ Common::ErrorCode MortevielleEngine::initialize() { DebugMan.addDebugChannel(kMortevielleGraphics, "graphics", "Graphics debugging"); // Set up an intermediate screen surface - _screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); + _screenSurface->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); _txxFileFl = false; // Load texts from TXX files @@ -209,7 +213,7 @@ Common::ErrorCode MortevielleEngine::initialize() { // Load the mort.dat resource Common::ErrorCode result = loadMortDat(); if (result != Common::kNoError) { - _screenSurface.free(); + _screenSurface->free(); return result; } @@ -282,7 +286,7 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { if (!strncmp(dataType, "FONT", 4)) { // Font resource - _screenSurface.readFontData(f, dataSize); + _screenSurface->readFontData(f, dataSize); } else if (!strncmp(dataType, "SSTR", 4)) { readStaticStrings(f, dataSize, kStaticStrings); } else if ((!strncmp(dataType, "GSTR", 4)) && (!_txxFileFl)) { @@ -380,13 +384,13 @@ Common::Error MortevielleEngine::run() { adzon(); resetVariables(); if (loadSlot != 0) - _savegameManager.loadSavegame(generateSaveFilename(loadSlot)); + _savegameManager->loadSavegame(generateSaveFilename(loadSlot)); // Run the main game loop mainGame(); // Cleanup (allocated in initialize()) - _screenSurface.free(); + _screenSurface->free(); free(_soundManager->_cfiphBuffer); free(_cfiecBuffer); @@ -397,13 +401,13 @@ Common::Error MortevielleEngine::run() { * Show the game introduction */ void MortevielleEngine::showIntroduction() { - _dialogManager.displayIntroScreen(false); - _dialogManager.checkForF8(142, false); + _dialogManager->displayIntroScreen(false); + _dialogManager->checkForF8(142, false); if (shouldQuit()) return; - _dialogManager.displayIntroFrame2(); - _dialogManager.checkForF8(143, true); + _dialogManager->displayIntroFrame2(); + _dialogManager->checkForF8(143, true); if (shouldQuit()) return; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 180d8460b64..579e495b65b 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -427,17 +427,18 @@ public: byte *_curAnim; byte *_rightFramePict; - Debugger _debugger; - ScreenSurface _screenSurface; PaletteManager _paletteManager; GfxSurface _backgroundSurface; Common::RandomSource _randomSource; + + Debugger *_debugger; + ScreenSurface *_screenSurface; SoundManager *_soundManager; - SavegameManager _savegameManager; + SavegameManager *_savegameManager; Menu *_menu; MouseHandler *_mouse; TextHandler *_text; - DialogManager _dialogManager; + DialogManager *_dialogManager; MortevielleEngine(OSystem *system, const MortevielleGameDescription *gameDesc); ~MortevielleEngine(); @@ -448,7 +449,7 @@ public: virtual Common::Error saveGameState(int slot, const Common::String &desc); virtual Common::Error run(); virtual void pauseEngineIntern(bool pause); - virtual GUI::Debugger *getDebugger() {return &_debugger;} + virtual GUI::Debugger *getDebugger() {return _debugger;} uint32 getGameFlags() const; Common::Language getLanguage() const; Common::Language getOriginalLanguage() const; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 16bce24a93b..2518b317d54 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -63,7 +63,7 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int // Safeguard: add $ just in case inputStr += '$'; - _vm->_screenSurface.putxy(x, y); + _vm->_screenSurface->putxy(x, y); int tab = 6; dx *= 6; dy *= 6; @@ -77,19 +77,19 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int while (!stringParsed) { switch (inputStr[p]) { case '@': - _vm->_screenSurface.drawString(s, typ); + _vm->_screenSurface->drawString(s, typ); s = ""; ++p; xc = x; yc += 6; - _vm->_screenSurface.putxy(xc, yc); + _vm->_screenSurface->putxy(xc, yc); break; case ' ': s += ' '; xc += tab; ++p; if (nextWord(p, inputStr.c_str(), tab) + xc > xf) { - _vm->_screenSurface.drawString(s, typ); + _vm->_screenSurface->drawString(s, typ); s = ""; xc = x; yc += 6; @@ -100,20 +100,20 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int do { j = x; do { - _vm->_screenSurface.putxy(j, i); - _vm->_screenSurface.drawString(" ", 0); + _vm->_screenSurface->putxy(j, i); + _vm->_screenSurface->drawString(" ", 0); j += 6; } while (j <= xf); i += 6; } while (i <= yf); yc = y; } - _vm->_screenSurface.putxy(xc, yc); + _vm->_screenSurface->putxy(xc, yc); } break; case '$': stringParsed = true; - _vm->_screenSurface.drawString(s, typ); + _vm->_screenSurface->drawString(s, typ); break; default: s += inputStr[p]; diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 9f6a36c98c7..77a9a6371ec 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -37,7 +37,7 @@ namespace Mortevielle { static const char SAVEGAME_ID[4] = { 'M', 'O', 'R', 'T' }; -void SavegameManager::setParent(MortevielleEngine *vm) { +SavegameManager::SavegameManager(MortevielleEngine *vm) { _vm = vm; } @@ -191,7 +191,7 @@ void SavegameManager::writeSavegameHeader(Common::OutSaveFile *out, const Common // Create a thumbnail and save it Graphics::Surface *thumb = new Graphics::Surface(); - Graphics::Surface s = g_vm->_screenSurface.lockArea(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); + Graphics::Surface s = g_vm->_screenSurface->lockArea(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); ::createThumbnail(thumb, (const byte *)s.getPixels(), SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette); Graphics::saveThumbnail(*out, *thumb); diff --git a/engines/mortevielle/saveload.h b/engines/mortevielle/saveload.h index 79747e6889b..9c21b0c294e 100644 --- a/engines/mortevielle/saveload.h +++ b/engines/mortevielle/saveload.h @@ -56,7 +56,8 @@ private: void sync_save(Common::Serializer &sz); public: - void setParent(MortevielleEngine *vm); + SavegameManager(MortevielleEngine *vm); + bool loadSavegame(const Common::String &filename); Common::Error loadGame(const Common::String &filename); Common::Error saveGame(int n, const Common::String &saveName); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 433d06377cf..6e0f266f9b4 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -50,9 +50,9 @@ bool MortevielleEngine::keyPressed() { if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { _lastGameFrame = g_system->getMillis(); - _screenSurface.updateScreen(); + _screenSurface->updateScreen(); - _debugger.onFrame(); + _debugger->onFrame(); } // Delay briefly to keep CPU usage down @@ -121,8 +121,8 @@ void MortevielleEngine::addKeypress(Common::Event &evt) { // Check for debugger if ((evt.kbd.keycode == Common::KEYCODE_d) && (evt.kbd.flags & Common::KBD_CTRL)) { // Attach to the debugger - _debugger.attach(); - _debugger.onFrame(); + _debugger->attach(); + _debugger->onFrame(); } else if ((evt.kbd.keycode >= Common::KEYCODE_a) && (evt.kbd.keycode <= Common::KEYCODE_z)) { // Handle alphabetic keys if (evt.kbd.hasFlags(Common::KBD_CTRL)) @@ -237,9 +237,9 @@ void MortevielleEngine::delay(int amount) { while (g_system->getMillis() < endTime) { if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { _lastGameFrame = g_system->getMillis(); - _screenSurface.updateScreen(); + _screenSurface->updateScreen(); - _debugger.onFrame(); + _debugger->onFrame(); } g_system->delayMillis(10); @@ -286,12 +286,12 @@ void MortevielleEngine::handleAction() { _menu->_menuDisplayed = false; if (_menu->_menuSelected && (_currMenu == MENU_SAVE)) { Common::String saveName = Common::String::format("Savegame #%d", _currAction & 15); - _savegameManager.saveGame(_currAction & 15, saveName); + _savegameManager->saveGame(_currAction & 15, saveName); } if (_menu->_menuSelected && (_currMenu == MENU_LOAD)) - _savegameManager.loadGame((_currAction & 15) - 1); + _savegameManager->loadGame((_currAction & 15) - 1); if (inkey == '\103') { /* F9 */ - temps = _dialogManager.show(_hintPctMessage); + temps = _dialogManager->show(_hintPctMessage); return; } else if (inkey == '\77') { if ((_menuOpcode != OPCODE_NONE) && ((_currMenu == MENU_ACTION) || (_currMenu == MENU_SELF))) { @@ -389,7 +389,7 @@ void MortevielleEngine::setTextColor(int col) { */ void MortevielleEngine::prepareScreenType1() { // Large drawing - _screenSurface.drawBox(0, 11, 512, 164, 15); + _screenSurface->drawBox(0, 11, 512, 164, 15); } /** @@ -500,50 +500,50 @@ void MortevielleEngine::resetPresenceInRooms(int roomId) { * @remarks Originally called 'affper' */ void MortevielleEngine::showPeoplePresent(int bitIndex) { - int xp = 580 - (_screenSurface.getStringWidth("LEO") / 2); + int xp = 580 - (_screenSurface->getStringWidth("LEO") / 2); for (int i = 1; i <= 8; ++i) _menu->disableMenuItem(_menu->_discussMenu[i]); clearUpperRightPart(); if ((bitIndex & 128) == 128) { - _screenSurface.putxy(xp, 24); - _screenSurface.drawString("LEO", 4); + _screenSurface->putxy(xp, 24); + _screenSurface->drawString("LEO", 4); _menu->enableMenuItem(_menu->_discussMenu[1]); } if ((bitIndex & 64) == 64) { - _screenSurface.putxy(xp, 32); - _screenSurface.drawString("PAT", 4); + _screenSurface->putxy(xp, 32); + _screenSurface->drawString("PAT", 4); _menu->enableMenuItem(_menu->_discussMenu[2]); } if ((bitIndex & 32) == 32) { - _screenSurface.putxy(xp, 40); - _screenSurface.drawString("GUY", 4); + _screenSurface->putxy(xp, 40); + _screenSurface->drawString("GUY", 4); _menu->enableMenuItem(_menu->_discussMenu[3]); } if ((bitIndex & 16) == 16) { - _screenSurface.putxy(xp, 48); - _screenSurface.drawString("EVA", 4); + _screenSurface->putxy(xp, 48); + _screenSurface->drawString("EVA", 4); _menu->enableMenuItem(_menu->_discussMenu[4]); } if ((bitIndex & 8) == 8) { - _screenSurface.putxy(xp, 56); - _screenSurface.drawString("BOB", 4); + _screenSurface->putxy(xp, 56); + _screenSurface->drawString("BOB", 4); _menu->enableMenuItem(_menu->_discussMenu[5]); } if ((bitIndex & 4) == 4) { - _screenSurface.putxy(xp, 64); - _screenSurface.drawString("LUC", 4); + _screenSurface->putxy(xp, 64); + _screenSurface->drawString("LUC", 4); _menu->enableMenuItem(_menu->_discussMenu[6]); } if ((bitIndex & 2) == 2) { - _screenSurface.putxy(xp, 72); - _screenSurface.drawString("IDA", 4); + _screenSurface->putxy(xp, 72); + _screenSurface->drawString("IDA", 4); _menu->enableMenuItem(_menu->_discussMenu[7]); } if ((bitIndex & 1) == 1) { - _screenSurface.putxy(xp, 80); - _screenSurface.drawString("MAX", 4); + _screenSurface->putxy(xp, 80); + _screenSurface->drawString("MAX", 4); _menu->enableMenuItem(_menu->_discussMenu[8]); } _currBitIndex = bitIndex; @@ -705,12 +705,12 @@ void MortevielleEngine::displayAloneText() { Common::String sAlone = getEngineString(S_ALONE); clearUpperRightPart(); - _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sYou) / 2), 30); - _screenSurface.drawString(sYou, 4); - _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAre) / 2), 50); - _screenSurface.drawString(sAre, 4); - _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAlone) / 2), 70); - _screenSurface.drawString(sAlone, 4); + _screenSurface->putxy(580 - (_screenSurface->getStringWidth(sYou) / 2), 30); + _screenSurface->drawString(sYou, 4); + _screenSurface->putxy(580 - (_screenSurface->getStringWidth(sAre) / 2), 50); + _screenSurface->drawString(sAre, 4); + _screenSurface->putxy(580 - (_screenSurface->getStringWidth(sAlone) / 2), 70); + _screenSurface->drawString(sAlone, 4); _currBitIndex = 0; } @@ -1290,7 +1290,7 @@ void MortevielleEngine::loseGame() { _loseGame = true; clearUpperLeftPart(); - _screenSurface.drawBox(60, 35, 400, 50, 15); + _screenSurface->drawBox(60, 35, 400, 50, 15); handleDescriptionText(9, _crep); clearDescriptionBar(); clearVerbBar(); @@ -1336,12 +1336,12 @@ void MortevielleEngine::startDialog(int16 rep) { _mouse->hideMouse(); Common::String dialogStr = getString(rep + kDialogStringIndex); _text->displayStr(dialogStr, 230, 4, 65, 26, 5); - _dialogManager.drawF3F8(); + _dialogManager->drawF3F8(); key = 0; do { _soundManager->startSpeech(rep, haut[_caff - 69], 0); - key = _dialogManager.waitForF3F8(); + key = _dialogManager->waitForF3F8(); if (shouldQuit()) return; } while (key != 66); @@ -1379,7 +1379,7 @@ void MortevielleEngine::gotoDiningRoom() { showPeoplePresent(_currBitIndex); _caff = 77; drawPictureWithText(); - _screenSurface.drawBox(223, 47, 155, 92, 15); + _screenSurface->drawBox(223, 47, 155, 92, 15); handleDescriptionText(2, 33); testKey(false); menuUp(); @@ -1641,7 +1641,7 @@ void MortevielleEngine::charToHour() { */ void MortevielleEngine::clearUpperLeftPart() { _mouse->hideMouse(); - _screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); + _screenSurface->fillRect(0, Common::Rect(0, 11, 514, 175)); _mouse->showMouse(); } @@ -1652,12 +1652,12 @@ void MortevielleEngine::clearUpperLeftPart() { void MortevielleEngine::clearDescriptionBar() { _mouse->hideMouse(); if (_largestClearScreen) { - _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); - _screenSurface.drawBox(0, 176, 634, 23, 15); + _screenSurface->fillRect(0, Common::Rect(1, 176, 633, 199)); + _screenSurface->drawBox(0, 176, 634, 23, 15); _largestClearScreen = false; } else { - _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190)); - _screenSurface.drawBox(0, 176, 634, 14, 15); + _screenSurface->fillRect(0, Common::Rect(1, 176, 633, 190)); + _screenSurface->drawBox(0, 176, 634, 14, 15); } _mouse->showMouse(); } @@ -1668,8 +1668,8 @@ void MortevielleEngine::clearDescriptionBar() { */ void MortevielleEngine::clearVerbBar() { _mouse->hideMouse(); - _screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); - _screenSurface.drawBox(0, 191, 634, 8, 15); + _screenSurface->fillRect(0, Common::Rect(1, 192, 633, 199)); + _screenSurface->drawBox(0, 191, 634, 8, 15); _mouse->showMouse(); } @@ -1683,7 +1683,7 @@ void MortevielleEngine::clearUpperRightPart() { _mouse->hideMouse(); // Clear ambiance description - _screenSurface.fillRect(15, Common::Rect(544, 93, 600, 98)); + _screenSurface->fillRect(15, Common::Rect(544, 93, 600, 98)); if (_coreVar._faithScore < 33) st = getEngineString(S_COOL); else if (_coreVar._faithScore < 66) @@ -1691,12 +1691,12 @@ void MortevielleEngine::clearUpperRightPart() { else if (_coreVar._faithScore > 65) st = getEngineString(S_MALSAINE); - int x1 = 580 - (_screenSurface.getStringWidth(st) / 2); - _screenSurface.putxy(x1, 92); - _screenSurface.drawString(st, 4); + int x1 = 580 - (_screenSurface->getStringWidth(st) / 2); + _screenSurface->putxy(x1, 92); + _screenSurface->drawString(st, 4); // Clear person list - _screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86)); + _screenSurface->fillRect(15, Common::Rect(560, 24, 610, 86)); _mouse->showMouse(); } @@ -1713,7 +1713,7 @@ int MortevielleEngine::getRandomNumber(int minval, int maxval) { * @remarks Originally called 'aldepl' */ void MortevielleEngine::showMoveMenuAlert() { - _dialogManager.show(getEngineString(S_USE_DEP_MENU)); + _dialogManager->show(getEngineString(S_USE_DEP_MENU)); } /** @@ -2126,8 +2126,8 @@ void MortevielleEngine::showTitleScreen() { draw(0, 0); Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; - _screenSurface.putxy(104 + 72 * kResolutionScaler, 185); - _screenSurface.drawString(cpr, 0); + _screenSurface->putxy(104 + 72 * kResolutionScaler, 185); + _screenSurface->drawString(cpr, 0); } /** @@ -2317,13 +2317,13 @@ void MortevielleEngine::drawClock() { _mouse->hideMouse(); - _screenSurface.drawRectangle(570, 118, 20, 10); - _screenSurface.drawRectangle(578, 114, 6, 18); + _screenSurface->drawRectangle(570, 118, 20, 10); + _screenSurface->drawRectangle(578, 114, 6, 18); if (_minute == 0) - _screenSurface.drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)x >> 1) * kResolutionScaler, (y - rg), 1); + _screenSurface->drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)x >> 1) * kResolutionScaler, (y - rg), 1); else - _screenSurface.drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)x >> 1) * kResolutionScaler, (y + rg), 1); + _screenSurface->drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)x >> 1) * kResolutionScaler, (y + rg), 1); int hour12 = _hour; if (hour12 > 12) @@ -2331,20 +2331,20 @@ void MortevielleEngine::drawClock() { if (hour12 == 0) hour12 = 12; - _screenSurface.drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)(x + cv[0][hour12 - 1]) >> 1) * kResolutionScaler, y + cv[1][hour12 - 1], 1); + _screenSurface->drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)(x + cv[0][hour12 - 1]) >> 1) * kResolutionScaler, y + cv[1][hour12 - 1], 1); _mouse->showMouse(); - _screenSurface.putxy(568, 154); + _screenSurface->putxy(568, 154); if (_hour > 11) - _screenSurface.drawString("PM ", 1); + _screenSurface->drawString("PM ", 1); else - _screenSurface.drawString("AM ", 1); + _screenSurface->drawString("AM ", 1); - _screenSurface.putxy(550, 160); + _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); + _screenSurface->drawString(tmp, 1); } } @@ -2376,7 +2376,7 @@ Common::String MortevielleEngine::copy(const Common::String &s, int idx, size_t * @remarks Originally called 'hirs' */ void MortevielleEngine::clearScreen() { - _screenSurface.clearScreen(); + _screenSurface->clearScreen(); } /** @@ -2416,7 +2416,7 @@ void MortevielleEngine::displayControlMenu() { void MortevielleEngine::displayPicture(const byte *pic, int x, int y) { GfxSurface surface; surface.decode(pic); - _screenSurface.drawPicture(surface, x, y); + _screenSurface->drawPicture(surface, x, y); } void MortevielleEngine::adzon() { @@ -2584,32 +2584,32 @@ void MortevielleEngine::resetOpenObjects() { */ void MortevielleEngine::displayTextBlock(Common::String text) { // Some dead code was present in the original: removed - _screenSurface.putxy(8, 177); + _screenSurface->putxy(8, 177); int tlig = 59 + (kResolutionScaler - 1) * 36; if ((int)text.size() < tlig) - _screenSurface.drawString(text, 5); + _screenSurface->drawString(text, 5); else if ((int)text.size() < (tlig << 1)) { - _screenSurface.putxy(8, 176); - _screenSurface.drawString(copy(text, 1, (tlig - 1)), 5); - _screenSurface.putxy(8, 182); - _screenSurface.drawString(copy(text, tlig, tlig << 1), 5); + _screenSurface->putxy(8, 176); + _screenSurface->drawString(copy(text, 1, (tlig - 1)), 5); + _screenSurface->putxy(8, 182); + _screenSurface->drawString(copy(text, tlig, tlig << 1), 5); } else { _largestClearScreen = true; clearDescriptionBar(); - _screenSurface.putxy(8, 176); - _screenSurface.drawString(copy(text, 1, (tlig - 1)), 5); - _screenSurface.putxy(8, 182); - _screenSurface.drawString(copy(text, tlig, ((tlig << 1) - 1)), 5); - _screenSurface.putxy(8, 190); - _screenSurface.drawString(copy(text, tlig << 1, tlig * 3), 5); + _screenSurface->putxy(8, 176); + _screenSurface->drawString(copy(text, 1, (tlig - 1)), 5); + _screenSurface->putxy(8, 182); + _screenSurface->drawString(copy(text, tlig, ((tlig << 1) - 1)), 5); + _screenSurface->putxy(8, 190); + _screenSurface->drawString(copy(text, tlig << 1, tlig * 3), 5); } } void MortevielleEngine::displayTextInVerbBar(Common::String text) { clearVerbBar(); - _screenSurface.putxy(8, 192); - _screenSurface.drawString(text, 5); + _screenSurface->putxy(8, 192); + _screenSurface->drawString(text, 5); } /** @@ -2831,7 +2831,7 @@ int MortevielleEngine::getPresence(int roomId) { * @remarks Originally called 'writetp' */ void MortevielleEngine::displayQuestionText(Common::String s, int cmd) { - _screenSurface.drawString(s, cmd); + _screenSurface->drawString(s, cmd); } /** @@ -2855,7 +2855,7 @@ void MortevielleEngine::displayAnimFrame(int frameNum, int animId) { GfxSurface surface; surface.decode(&_curAnim[offset]); - _screenSurface.drawPicture(surface, 0, 12); + _screenSurface->drawPicture(surface, 0, 12); prepareScreenType1(); } @@ -2868,10 +2868,10 @@ void MortevielleEngine::drawPicture() { clearUpperLeftPart(); if (_caff > 99) { draw(60, 33); - _screenSurface.drawBox(118, 32, 291, 122, 15); // Medium box + _screenSurface->drawBox(118, 32, 291, 122, 15); // Medium box } else if (_caff > 69) { draw(112, 48); // Heads - _screenSurface.drawBox(222, 47, 155, 92, 15); + _screenSurface->drawBox(222, 47, 155, 92, 15); } else { draw(0, 12); prepareScreenType1(); @@ -3070,7 +3070,7 @@ void MortevielleEngine::menuUp() { */ void MortevielleEngine::drawDiscussionBox() { draw(10, 80); - _screenSurface.drawBox(18, 79, 155, 92, 15); + _screenSurface->drawBox(18, 79, 155, 92, 15); } /** @@ -3216,7 +3216,7 @@ void MortevielleEngine::displayStatusArrow() { } while (!(qust || inRect || _anyone)); if (qust && (touch == '\103')) - _dialogManager.show(_hintPctMessage); + _dialogManager->show(_hintPctMessage); } while (!((touch == '\73') || ((touch == '\104') && (_x != 0) && (_y != 0)) || (_anyone) || (inRect))); if (touch == '\73') @@ -3358,8 +3358,8 @@ int MortevielleEngine::checkLeaveSecretPassage() { */ void MortevielleEngine::displayStatusInDescriptionBar(char stat) { _mouse->hideMouse(); - _screenSurface.writeCharacter(Common::Point(306, 193), stat, 12); - _screenSurface.drawBox(300, 191, 16, 8, 15); + _screenSurface->writeCharacter(Common::Point(306, 193), stat, 12); + _screenSurface->drawBox(300, 191, 16, 8, 15); _mouse->showMouse(); }