aboutsummaryrefslogtreecommitdiff
path: root/engines/mortevielle
diff options
context:
space:
mode:
Diffstat (limited to 'engines/mortevielle')
-rw-r--r--engines/mortevielle/actions.cpp132
-rw-r--r--engines/mortevielle/debugger.cpp7
-rw-r--r--engines/mortevielle/debugger.h3
-rw-r--r--engines/mortevielle/dialogs.cpp99
-rw-r--r--engines/mortevielle/dialogs.h3
-rw-r--r--engines/mortevielle/graphics.cpp25
-rw-r--r--engines/mortevielle/graphics.h3
-rw-r--r--engines/mortevielle/menu.cpp63
-rw-r--r--engines/mortevielle/menu.h3
-rw-r--r--engines/mortevielle/mortevielle.cpp64
-rw-r--r--engines/mortevielle/mortevielle.h19
-rw-r--r--engines/mortevielle/mouse.cpp8
-rw-r--r--engines/mortevielle/mouse.h2
-rw-r--r--engines/mortevielle/outtext.cpp30
-rw-r--r--engines/mortevielle/outtext.h3
-rw-r--r--engines/mortevielle/saveload.cpp12
-rw-r--r--engines/mortevielle/saveload.h3
-rw-r--r--engines/mortevielle/sound.cpp7
-rw-r--r--engines/mortevielle/sound.h4
-rw-r--r--engines/mortevielle/utils.cpp432
20 files changed, 461 insertions, 461 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp
index b68dd48b0f..6f57019cf2 100644
--- a/engines/mortevielle/actions.cpp
+++ b/engines/mortevielle/actions.cpp
@@ -40,7 +40,7 @@ namespace Mortevielle {
* @remarks Originally called 'taller'
*/
void MortevielleEngine::fctMove() {
- int oldMenu = (_menu._moveMenu[6]._menuId << 8) | _menu._moveMenu[6]._actionId;
+ int oldMenu = (_menu->_moveMenu[6]._menuId << 8) | _menu->_moveMenu[6]._actionId;
if ((_coreVar._currPlace == ROOM26) && (_currAction == oldMenu)) {
_coreVar._currPlace = LANDING;
_caff = _coreVar._currPlace;
@@ -65,10 +65,10 @@ void MortevielleEngine::fctMove() {
if (_num == 1) {
_coreVar._currPlace = OWN_ROOM;
- _menu.setDestinationText(OWN_ROOM);
+ _menu->setDestinationText(OWN_ROOM);
} else if (_num == 7) {
_coreVar._currPlace = ATTIC;
- _menu.setDestinationText(ATTIC);
+ _menu->setDestinationText(ATTIC);
} else if (_num != 6)
_coreVar._currPlace = ROOM26;
@@ -85,10 +85,10 @@ void MortevielleEngine::fctMove() {
}
exitRoom();
int menuChoice = 1;
- oldMenu = (_menu._moveMenu[menuChoice]._menuId << 8) | _menu._moveMenu[menuChoice]._actionId;
+ oldMenu = (_menu->_moveMenu[menuChoice]._menuId << 8) | _menu->_moveMenu[menuChoice]._actionId;
while (oldMenu != _currAction) {
++menuChoice;
- oldMenu = (_menu._moveMenu[menuChoice]._menuId << 8) | _menu._moveMenu[menuChoice]._actionId;
+ oldMenu = (_menu->_moveMenu[menuChoice]._menuId << 8) | _menu->_moveMenu[menuChoice]._actionId;
}
switch (_coreVar._currPlace) {
@@ -97,14 +97,14 @@ void MortevielleEngine::fctMove() {
gotoManorFront();
else if (menuChoice == 2)
checkManorDistance();
- _menu.setDestinationText(_coreVar._currPlace);
+ _menu->setDestinationText(_coreVar._currPlace);
return;
case INSIDE_WELL:
if (menuChoice == 1)
floodedInWell();
else if (menuChoice == 2)
gotoManorBack();
- _menu.setDestinationText(_coreVar._currPlace);
+ _menu->setDestinationText(_coreVar._currPlace);
return;
case BUREAU:
if (menuChoice == 1)
@@ -193,7 +193,7 @@ void MortevielleEngine::fctMove() {
if ((menuChoice < 5) || (menuChoice == 13) || (menuChoice == 14))
prepareDisplayText();
resetRoomVariables(_coreVar._currPlace);
- _menu.setDestinationText(_coreVar._currPlace);
+ _menu->setDestinationText(_coreVar._currPlace);
}
/**
@@ -224,7 +224,7 @@ void MortevielleEngine::fctTake() {
_coreVar._secretPassageObjectId = 0;
if (_coreVar._currPlace == WELL)
_coreVar._wellObjectId = 0;
- _menu.unsetSearchMenu();
+ _menu->unsetSearchMenu();
_obpart = false;
prepareDisplayText();
} else {
@@ -325,7 +325,7 @@ void MortevielleEngine::fctInventoryTake() {
int oldMenu = 0;
do {
++inventIndex;
- oldMenu = (_menu._inventoryMenu[inventIndex]._menuId << 8) | _menu._inventoryMenu[inventIndex]._actionId;
+ oldMenu = (_menu->_inventoryMenu[inventIndex]._menuId << 8) | _menu->_inventoryMenu[inventIndex]._actionId;
} while (oldMenu != _currAction);
int cz = 0;
int cy = 0;
@@ -336,7 +336,7 @@ void MortevielleEngine::fctInventoryTake() {
} while (cz != inventIndex);
cz = _coreVar._inventory[cy];
_coreVar._inventory[cy] = 0;
- _menu.setInventoryText();
+ _menu->setInventoryText();
putInHand(cz);
_crep = 998;
clearDescriptionBar();
@@ -536,7 +536,7 @@ void MortevielleEngine::fctSearch() {
if (_curSearchObjId != 0) {
_searchCount = 0;
_heroSearching = true;
- _menu.setSearchMenu();
+ _menu->setSearchMenu();
prepareNextObject();
} else
_crep = 997;
@@ -607,7 +607,7 @@ void MortevielleEngine::fctOpen() {
if (_caff == ROOM26) {
if (_roomDoorId != OWN_ROOM) {
- _currAction = _menu._opcodeEnter;
+ _currAction = _menu->_opcodeEnter;
_syn = true;
} else
_crep = 997;
@@ -663,11 +663,11 @@ void MortevielleEngine::fctOpen() {
|| (_coreVar._currPlace == PURPLE_ROOM)
|| (_coreVar._currPlace == BLUE_ROOM)) {
if (getRandomNumber(1, 4) == 3)
- _soundManager.startSpeech(7, 9, 1);
+ _soundManager->startSpeech(7, 9, 1);
}
_openObjects[i] = _num;
displayAnimFrame(1, _num);
- _soundManager.waitSpeech();
+ _soundManager->waitSpeech();
}
int tmpPlace = _coreVar._currPlace;
if (_coreVar._currPlace == CRYPT)
@@ -731,21 +731,21 @@ void MortevielleEngine::fctPlace() {
displayAnimFrame(1, 1);
handleDescriptionText(2, 165);
displayEmptyHand();
- _soundManager.startSpeech(6, -9, 1);
+ _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();
- _mouse.hideMouse();
+ bool enterPassageFl = _dialogManager->showKnowledgeCheck();
+ _mouse->hideMouse();
clearScreen();
drawRightFrame();
clearDescriptionBar();
clearVerbBar();
- _mouse.showMouse();
+ _mouse->showMouse();
prepareRoom();
drawClock();
if (_currBitIndex != 0)
@@ -753,18 +753,18 @@ void MortevielleEngine::fctPlace() {
else
displayAloneText();
- _menu.displayMenu();
+ _menu->displayMenu();
if (enterPassageFl) {
_coreVar._currPlace = SECRET_PASSAGE;
- _menu.setDestinationText(SECRET_PASSAGE);
+ _menu->setDestinationText(SECRET_PASSAGE);
} else {
- _menu.setDestinationText(_coreVar._currPlace);
+ _menu->setDestinationText(_coreVar._currPlace);
setPal(14);
drawPicture();
displayAnimFrame(1, 2);
displayAnimFrame(1, 1);
alertTxt = getString(577);
- _dialogManager.show(alertTxt);
+ _dialogManager->show(alertTxt);
displayAnimFrame(2, 1);
_crep = 166;
}
@@ -832,8 +832,8 @@ void MortevielleEngine::fctTurn() {
_crep = 997;
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));
+ _soundManager->startSpeech(7, 9, 1);
+ int answer = _dialogManager->show(getEngineString(S_YES_NO));
if (answer == 1)
_endGame = true;
else
@@ -842,8 +842,8 @@ void MortevielleEngine::fctTurn() {
if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) {
handleDescriptionText(2, 175);
clearVerbBar();
- _soundManager.startSpeech(6, -9, 1);
- int answer = _dialogManager.show(getEngineString(S_YES_NO));
+ _soundManager->startSpeech(6, -9, 1);
+ 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;
}
@@ -967,7 +967,7 @@ void MortevielleEngine::fctKnock() {
if (_coreVar._currPlace == ROOM26) {
int rand = (getRandomNumber(0, 8)) - 4;
- _soundManager.startSpeech(11, rand, 1);
+ _soundManager->startSpeech(11, rand, 1);
int pres = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId);
if (_roomDoorId != OWN_ROOM) {
if (pres != -500) {
@@ -1132,7 +1132,7 @@ void MortevielleEngine::fctEat() {
_coreVar._currPlace = DINING_ROOM;
_caff = DINING_ROOM;
resetRoomVariables(_coreVar._currPlace);
- _menu.setDestinationText(_coreVar._currPlace);
+ _menu->setDestinationText(_coreVar._currPlace);
int day, hour, minute;
updateHour(day, hour, minute);
@@ -1168,7 +1168,7 @@ void MortevielleEngine::fctEat() {
void MortevielleEngine::fctEnter() {
if ((_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) {
gotoDiningRoom();
- _menu.setDestinationText(_coreVar._currPlace);
+ _menu->setDestinationText(_coreVar._currPlace);
} else if (_coreVar._currPlace == LANDING)
showMoveMenuAlert();
else if (_roomDoorId == OWN_ROOM)
@@ -1185,15 +1185,15 @@ void MortevielleEngine::fctEnter() {
_crep = 179;
else {
int randVal = (getRandomNumber(0, 10)) - 5;
- _soundManager.startSpeech(7, randVal, 1);
+ _soundManager->startSpeech(7, randVal, 1);
displayAnimFrame(1, 1);
- _soundManager.waitSpeech();
+ _soundManager->waitSpeech();
int charIndex = convertBitIndexToCharacterIndex(pres);
++_coreVar._faithScore;
_coreVar._currPlace = LANDING;
_currMenu = MENU_DISCUSS;
- _currAction = (_menu._discussMenu[charIndex]._menuId << 8) | _menu._discussMenu[charIndex]._actionId;
+ _currAction = (_menu->_discussMenu[charIndex]._menuId << 8) | _menu->_discussMenu[charIndex]._actionId;
_syn = true;
if (_roomDoorId == JULIA_ROOM) {
_col = true;
@@ -1207,14 +1207,14 @@ void MortevielleEngine::fctEnter() {
}
} else {
int randVal = (getRandomNumber(0, 10)) - 5;
- _soundManager.startSpeech(7, randVal, 1);
+ _soundManager->startSpeech(7, randVal, 1);
displayAnimFrame(1, 1);
- _soundManager.waitSpeech();
+ _soundManager->waitSpeech();
_coreVar._currPlace = _roomDoorId;
prepareDisplayText();
resetRoomVariables(_coreVar._currPlace);
- _menu.setDestinationText(_coreVar._currPlace);
+ _menu->setDestinationText(_coreVar._currPlace);
_roomDoorId = OWN_ROOM;
_savedBitIndex = 0;
_currBitIndex = 0;
@@ -1237,7 +1237,7 @@ void MortevielleEngine::fctSleep() {
prepareDisplayText();
drawPictureWithText();
resetRoomVariables(_coreVar._currPlace);
- _menu.setDestinationText(_coreVar._currPlace);
+ _menu->setDestinationText(_coreVar._currPlace);
}
clearVerbBar();
clearDescriptionBar();
@@ -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;
@@ -1321,7 +1321,7 @@ void MortevielleEngine::fctLeave() {
if (_crep == 0)
_crep = nextPlace;
resetRoomVariables(nextPlace);
- _menu.setDestinationText(nextPlace);
+ _menu->setDestinationText(nextPlace);
}
}
@@ -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)
@@ -1394,7 +1394,7 @@ void MortevielleEngine::fctDiscuss() {
int oldMenu;
do {
++cx;
- oldMenu = (_menu._discussMenu[cx]._menuId << 8) | _menu._discussMenu[cx]._actionId;
+ oldMenu = (_menu->_discussMenu[cx]._menuId << 8) | _menu->_discussMenu[cx]._actionId;
} while (oldMenu != _currAction);
_caff = 69 + cx;
drawPictureWithText();
@@ -1403,7 +1403,7 @@ void MortevielleEngine::fctDiscuss() {
}
testKey(false);
menuUp();
- _mouse.hideMouse();
+ _mouse->hideMouse();
clearScreen();
drawDiscussionBox();
startDialog(displId);
@@ -1417,13 +1417,13 @@ void MortevielleEngine::fctDiscuss() {
}
lib[46] = lib[45];
lib[45] = ' ';
- _mouse.showMouse();
+ _mouse->showMouse();
do {
choice = 0;
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,17 +1438,17 @@ void MortevielleEngine::fctDiscuss() {
} else
posY += 8;
}
- _screenSurface.putxy(320, 176);
+ _screenSurface->putxy(320, 176);
displayQuestionText(lib[46], 0);
char retKey = '\0';
bool click;
do {
bool dummyFl;
- _mouse.moveMouse(dummyFl, retKey);
+ _mouse->moveMouse(dummyFl, retKey);
if (shouldQuit())
return;
- _mouse.getMousePosition(x, y, click);
+ _mouse->getMousePosition(x, y, click);
x *= (3 - kResolutionScaler);
if (x > 319)
cx = 41;
@@ -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
@@ -1533,11 +1533,11 @@ void MortevielleEngine::fctDiscuss() {
_coreVar._faithScore += 3;
displId = 139;
}
- _mouse.hideMouse();
+ _mouse->hideMouse();
clearScreen();
drawDiscussionBox();
startDialog(displId);
- _mouse.showMouse();
+ _mouse->showMouse();
if ((displId == 84) || (displId == 86)) {
_coreVar._pctHintFound[5] = '*';
_coreVar._availableQuestion[7] = '*';
@@ -1551,32 +1551,32 @@ void MortevielleEngine::fctDiscuss() {
_coreVar._pctHintFound[8] = '*';
_coreVar._availableQuestion[32] = '*';
}
- _mouse.hideMouse();
+ _mouse->hideMouse();
clearScreen();
- _mouse.showMouse();
+ _mouse->showMouse();
}
} while ((choice != 46) && (displId != 138));
if (_col) {
_coreVar._faithScore += (3 * (_coreVar._faithScore / 10));
- _mouse.hideMouse();
+ _mouse->hideMouse();
clearScreen();
drawDiscussionBox();
startDialog(138);
- _mouse.showMouse();
+ _mouse->showMouse();
_col = false;
_coreVar._currPlace = LANDING;
}
_controlMenu = 0;
- _mouse.hideMouse();
+ _mouse->hideMouse();
clearScreen();
drawRightFrame();
- _mouse.showMouse();
+ _mouse->showMouse();
showPeoplePresent(_currBitIndex);
prepareRoom();
drawClock();
prepareDisplayText();
/* chech;*/
- _menu.setDestinationText(_coreVar._currPlace);
+ _menu->setDestinationText(_coreVar._currPlace);
clearVerbBar();
}
@@ -1625,13 +1625,13 @@ void MortevielleEngine::endGame() {
clearVerbBar();
handleDescriptionText(9, 1509);
testKey(false);
- _mouse.hideMouse();
+ _mouse->hideMouse();
_caff = 70;
- _text.taffich();
+ _text->taffich();
clearScreen();
drawDiscussionBox();
startDialog(141);
- _mouse.showMouse();
+ _mouse->showMouse();
clearUpperLeftPart();
handleDescriptionText(9, 1509);
handleDescriptionText(2, 142);
@@ -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 4ef5151c81..4b39462cde 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 9041d90110..6e1006681c 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 9a2ade60ab..09a4227cc0 100644
--- a/engines/mortevielle/dialogs.cpp
+++ b/engines/mortevielle/dialogs.cpp
@@ -35,15 +35,19 @@
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();
+ _vm->_mouse->hideMouse();
while (_vm->keyPressed())
_vm->getChar();
@@ -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] != ']');
}
@@ -99,17 +103,17 @@ int DialogManager::show(const Common::String &msg) {
limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) / 2) * kResolutionScaler;
limit[2][2] = (limit[2][1]) + 40;
}
- _vm->_mouse.showMouse();
+ _vm->_mouse->showMouse();
int id = 0;
bool dummyFl = false;
bool test3;
do {
char dummyKey = '\377';
- _vm->_mouse.moveMouse(dummyFl, dummyKey);
+ _vm->_mouse->moveMouse(dummyFl, dummyKey);
if (_vm->shouldQuit())
return 0;
- curPos = _vm->_mouse._pos;
+ curPos = _vm->_mouse->_pos;
bool newaff = false;
if ((curPos.y > 95) && (curPos.y < 105)) {
bool test1 = (curPos.x > limit[1][1]) && (curPos.x < limit[1][2]);
@@ -125,56 +129,56 @@ int DialogManager::show(const Common::String &msg) {
else
ix = 2;
if (ix != id) {
- _vm->_mouse.hideMouse();
+ _vm->_mouse->hideMouse();
if (id != 0) {
setPosition(id, coldep, esp);
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();
+ _vm->_mouse->showMouse();
}
}
}
if ((id != 0) && !newaff) {
- _vm->_mouse.hideMouse();
+ _vm->_mouse->hideMouse();
setPosition(id, coldep, esp);
Common::String tmp3(" ");
tmp3 += buttonStr[id];
tmp3 += " ";
- _vm->_screenSurface.drawString(tmp3, 0);
+ _vm->_screenSurface->drawString(tmp3, 0);
id = 0;
- _vm->_mouse.showMouse();
+ _vm->_mouse->showMouse();
}
test3 = (curPos.y > 95) && (curPos.y < 105) && (((curPos.x > limit[1][1]) && (curPos.x < limit[1][2]))
|| ((curPos.x > limit[2][1]) && (curPos.x < limit[2][2])));
} while (!_vm->getMouseClick());
_vm->setMouseClick(false);
- _vm->_mouse.hideMouse();
+ _vm->_mouse->hideMouse();
if (!test3) {
id = 1;
setPosition(1, coldep, esp);
Common::String tmp4(" ");
tmp4 += buttonStr[1];
tmp4 += " ";
- _vm->_screenSurface.drawString(tmp4, 1);
+ _vm->_screenSurface->drawString(tmp4, 1);
}
- _vm->_mouse.showMouse();
+ _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;
}
}
@@ -292,13 +296,13 @@ bool DialogManager::showKnowledgeCheck() {
int correctCount = 0;
for (int indx = 0; indx < 10; ++indx) {
- _vm->_mouse.hideMouse();
+ _vm->_mouse->hideMouse();
_vm->clearScreen();
- _vm->_mouse.showMouse();
+ _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);
+ _vm->_text->displayStr(tmpStr, 20, 15, 100, 2, 0);
int firstOption;
int lastOption;
@@ -318,7 +322,7 @@ bool DialogManager::showKnowledgeCheck() {
tmpStr = _vm->getString(j);
if ((int) tmpStr.size() > maxLength)
maxLength = tmpStr.size();
- _vm->_text.displayStr(tmpStr, 100, optionPosY, 100, 1, 0);
+ _vm->_text->displayStr(tmpStr, 100, optionPosY, 100, 1, 0);
choiceArray[prevChoice] = tmpStr;
optionPosY += 8;
}
@@ -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;
@@ -342,26 +346,26 @@ bool DialogManager::showKnowledgeCheck() {
_vm->setMouseClick(false);
bool flag;
char key;
- _vm->_mouse.moveMouse(flag, key);
+ _vm->_mouse->moveMouse(flag, key);
if (_vm->shouldQuit())
return false;
currChoice = 1;
- while (coor[currChoice]._enabled && !_vm->_mouse.isMouseIn(coor[currChoice]._rect))
+ while (coor[currChoice]._enabled && !_vm->_mouse->isMouseIn(coor[currChoice]._rect))
++currChoice;
if (coor[currChoice]._enabled) {
if ((prevChoice != 0) && (prevChoice != currChoice)) {
tmpStr = choiceArray[prevChoice] + '$';
- _vm->_text.displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0);
+ _vm->_text->displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0);
}
if (prevChoice != currChoice) {
tmpStr = choiceArray[currChoice] + '$';
- _vm->_text.displayStr(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1);
+ _vm->_text->displayStr(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1);
prevChoice = currChoice;
}
} else if (prevChoice != 0) {
tmpStr = choiceArray[prevChoice] + '$';
- _vm->_text.displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0);
+ _vm->_text->displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0);
prevChoice = 0;
}
} while (!((prevChoice != 0) && _vm->getMouseClick()));
@@ -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);
}
/**
@@ -412,7 +416,7 @@ void DialogManager::drawF3F8() {
void DialogManager::checkForF8(int SpeechNum, bool drawFrame2Fl) {
_vm->testKeyboard();
do {
- _vm->_soundManager.startSpeech(SpeechNum, 0, 0);
+ _vm->_soundManager->startSpeech(SpeechNum, 0, 0);
_vm->_key = waitForF3F8();
if (_vm->shouldQuit())
return;
@@ -442,7 +446,7 @@ int DialogManager::waitForF3F8() {
void DialogManager::displayIntroScreen(bool drawFrame2Fl) {
_vm->_caff = 50;
_vm->_maff = 0;
- _vm->_text.taffich();
+ _vm->_text->taffich();
_vm->draw(63, 12);
if (drawFrame2Fl)
displayIntroFrame2();
@@ -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 3f30851960..03dfc78023 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 daf7926438..18b0e7f1c1 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
*/
@@ -1070,7 +1074,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) {
if (l == "")
return;
- _vm->_mouse.hideMouse();
+ _vm->_mouse->hideMouse();
Common::Point pt = _textPos;
int charWidth = 6;
@@ -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,10 +1103,10 @@ 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();
+ _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 e31f5da29a..7f0d4823cb 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 641a527c98..14fc8d4084 100644
--- a/engines/mortevielle/menu.cpp
+++ b/engines/mortevielle/menu.cpp
@@ -48,7 +48,8 @@ const byte menuConstants[8][4] = {
{62, 46, 13, 10}
};
-Menu::Menu() {
+Menu::Menu(MortevielleEngine *vm) {
+ _vm = vm;
_opcodeAttach = _opcodeWait = _opcodeForce = _opcodeSleep = OPCODE_NONE;
_opcodeListen = _opcodeEnter = _opcodeClose = _opcodeSearch = OPCODE_NONE;
_opcodeKnock = _opcodeScratch = _opcodeRead = _opcodeEat = OPCODE_NONE;
@@ -295,8 +296,8 @@ void Menu::enableMenuItem(MenuItem item) {
}
void Menu::displayMenu() {
- _vm->_mouse.hideMouse();
- _vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10));
+ _vm->_mouse->hideMouse();
+ _vm->_screenSurface->fillRect(7, Common::Rect(0, 0, 639, 10));
int col = 28 * kResolutionScaler;
for (int charNum = 0; charNum < 6; charNum++) {
@@ -310,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;
@@ -322,7 +323,7 @@ void Menu::displayMenu() {
}
col += 48 * kResolutionScaler;
}
- _vm->_mouse.showMouse();
+ _vm->_mouse->showMouse();
}
/**
@@ -348,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) {
@@ -388,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;
}
@@ -419,71 +420,71 @@ 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;
int lineNum = menuConstants[ii - 1][3];
- _vm->_mouse.hideMouse();
+ _vm->_mouse->hideMouse();
int deltaX = 6;
int maxX = minX + (menuConstants[ii - 1][2] * deltaX) + 6;
if ((ii == 4) && (_vm->getLanguage() == Common::EN_ANY))
// 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();
+ _vm->_mouse->showMouse();
}
/**
@@ -492,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
@@ -523,7 +524,7 @@ void Menu::updateMenu() {
if (!_menuActive)
return;
- Common::Point curPos = _vm->_mouse._pos;
+ Common::Point curPos = _vm->_mouse->_pos;
if (!_vm->getMouseClick()) {
if (curPos == _vm->_prevPos)
return;
@@ -590,10 +591,6 @@ void Menu::updateMenu() {
}
}
-void Menu::setParent(MortevielleEngine *vm) {
- _vm = vm;
-}
-
void Menu::initMenu() {
Common::File f;
diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h
index debf5b09b6..d8a3b4d0d6 100644
--- a/engines/mortevielle/menu.h
+++ b/engines/mortevielle/menu.h
@@ -60,7 +60,7 @@ private:
void menuDown(int ii);
public:
- Menu();
+ Menu(MortevielleEngine *vm);
bool _menuActive;
bool _menuSelected;
@@ -103,7 +103,6 @@ public:
int _opcodeSLook;
MenuItem _actionMenu[12];
- void setParent(MortevielleEngine *vm);
void readVerbNums(Common::File &f, int dataSize);
void setText(MenuItem item, Common::String name);
void setDestinationText(int roomId);
diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp
index d434150977..34372ba32a 100644
--- a/engines/mortevielle/mortevielle.cpp
+++ b/engines/mortevielle/mortevielle.cpp
@@ -47,17 +47,16 @@ namespace Mortevielle {
MortevielleEngine *g_vm;
MortevielleEngine::MortevielleEngine(OSystem *system, const MortevielleGameDescription *gameDesc):
- Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle"),
- _soundManager(_mixer) {
+ Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle") {
g_vm = this;
- _debugger.setParent(this);
- _dialogManager.setParent(this);
- _screenSurface.setParent(this);
- _mouse.setParent(this);
- _text.setParent(this);
- _soundManager.setParent(this);
- _savegameManager.setParent(this);
- _menu.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 = new SavegameManager(this);
+ _menu = new Menu(this);
_lastGameFrame = 0;
_mouseClick = false;
@@ -105,6 +104,15 @@ 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);
free(_rightFramePict);
@@ -140,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);
}
/**
@@ -150,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);
}
/**
@@ -196,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
@@ -205,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;
}
@@ -235,8 +243,8 @@ Common::ErrorCode MortevielleEngine::initialize() {
testKeyboard();
clearScreen();
- _soundManager.loadNoise();
- _soundManager.loadAmbiantSounds();
+ _soundManager->loadNoise();
+ _soundManager->loadAmbiantSounds();
return Common::kNoError;
}
@@ -278,13 +286,13 @@ 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)) {
readStaticStrings(f, dataSize, kGameStrings);
} else if (!strncmp(dataType, "VERB", 4)) {
- _menu.readVerbNums(f, dataSize);
+ _menu->readVerbNums(f, dataSize);
} else {
// Unknown section
f.skip(dataSize);
@@ -369,21 +377,21 @@ Common::Error MortevielleEngine::run() {
showIntroduction();
else {
_caff = 51;
- _text.taffich();
+ _text->taffich();
}
// Either load the initial game state savegame, or the specified savegame number
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();
- free(_soundManager._cfiphBuffer);
+ _screenSurface->free();
+ free(_soundManager->_cfiphBuffer);
free(_cfiecBuffer);
return Common::kNoError;
@@ -393,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;
@@ -419,13 +427,13 @@ void MortevielleEngine::mainGame() {
for (_crep = 1; _crep <= _x26KeyCount; ++_crep)
decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64);
- _menu.initMenu();
+ _menu->initMenu();
charToHour();
initGame();
clearScreen();
drawRightFrame();
- _mouse.showMouse();
+ _mouse->showMouse();
// Loop to play the game
do {
diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h
index 5ae94987a0..579e495b65 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;
- SoundManager _soundManager;
- SavegameManager _savegameManager;
- Menu _menu;
- MouseHandler _mouse;
- TextHandler _text;
- DialogManager _dialogManager;
+
+ Debugger *_debugger;
+ ScreenSurface *_screenSurface;
+ SoundManager *_soundManager;
+ SavegameManager *_savegameManager;
+ Menu *_menu;
+ MouseHandler *_mouse;
+ TextHandler *_text;
+ 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/mouse.cpp b/engines/mortevielle/mouse.cpp
index 480b4381ef..2077a4cdc5 100644
--- a/engines/mortevielle/mouse.cpp
+++ b/engines/mortevielle/mouse.cpp
@@ -33,6 +33,10 @@
namespace Mortevielle {
+MouseHandler::MouseHandler(MortevielleEngine *vm) {
+ _vm = vm;
+}
+
/**
* Initialize the mouse
* @remarks Originally called 'init_mouse'
@@ -264,8 +268,4 @@ bool MouseHandler::isMouseIn(Common::Rect r) {
return false;
}
-void MouseHandler::setParent(MortevielleEngine *vm) {
- _vm = vm;
-}
-
} // End of namespace Mortevielle
diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h
index 90d1ef310e..81c02dc8bd 100644
--- a/engines/mortevielle/mouse.h
+++ b/engines/mortevielle/mouse.h
@@ -38,8 +38,8 @@ private:
MortevielleEngine *_vm;
public:
Common::Point _pos;
+ MouseHandler(MortevielleEngine *vm);
- void setParent(MortevielleEngine *vm);
void initMouse();
void hideMouse();
void showMouse();
diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp
index d50f4005de..2518b317d5 100644
--- a/engines/mortevielle/outtext.cpp
+++ b/engines/mortevielle/outtext.cpp
@@ -35,6 +35,10 @@
namespace Mortevielle {
+TextHandler::TextHandler(MortevielleEngine *vm) {
+ _vm = vm;
+}
+
/**
* Next word
* @remarks Originally called 'l_motsuiv'
@@ -59,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;
@@ -73,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;
@@ -96,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];
@@ -218,7 +222,7 @@ void TextHandler::taffich() {
}
_vm->_destinationOk = true;
- _vm->_mouse.hideMouse();
+ _vm->_mouse->hideMouse();
drawingStartPos = 0;
Common::String filename, altFilename;
@@ -291,8 +295,8 @@ void TextHandler::taffich() {
}
loadAniFile(filename, drawingStartPos, drawingSize);
}
- _vm->_mouse.showMouse();
- if ((a < COAT_ARMS) && ((_vm->_maff < COAT_ARMS) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != _vm->_menu._opcodeEnter)) {
+ _vm->_mouse->showMouse();
+ if ((a < COAT_ARMS) && ((_vm->_maff < COAT_ARMS) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != _vm->_menu->_opcodeEnter)) {
if ((a == ATTIC) || (a == CELLAR))
_vm->displayAloneText();
else if (!_vm->_blo)
@@ -301,8 +305,4 @@ void TextHandler::taffich() {
}
}
-void TextHandler::setParent(MortevielleEngine *vm) {
- _vm = vm;
-}
-
} // End of namespace Mortevielle
diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h
index 44868036d5..397ca850dd 100644
--- a/engines/mortevielle/outtext.h
+++ b/engines/mortevielle/outtext.h
@@ -38,7 +38,8 @@ private:
MortevielleEngine *_vm;
int nextWord(int p, const char *ch, int &tab);
public:
- void setParent(MortevielleEngine *vm);
+ TextHandler (MortevielleEngine *vm);
+
void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ);
void loadPictureFile(Common::String filename, Common::String altFilename, int32 skipSize, int length);
void loadAniFile(Common::String filename, int32 skipSize, int length);
diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp
index c14a03cd60..77a9a6371e 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;
}
@@ -116,14 +116,14 @@ bool SavegameManager::loadSavegame(const Common::String &filename) {
* Load a saved game
*/
Common::Error SavegameManager::loadGame(const Common::String &filename) {
- g_vm->_mouse.hideMouse();
+ g_vm->_mouse->hideMouse();
g_vm->displayEmptyHand();
if (loadSavegame(filename)) {
/* Initialization */
g_vm->charToHour();
g_vm->initGame();
g_vm->gameLoaded();
- g_vm->_mouse.showMouse();
+ g_vm->_mouse->showMouse();
return Common::kNoError;
} else
return Common::kUnknownError;
@@ -136,7 +136,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) {
Common::OutSaveFile *f;
int i;
- g_vm->_mouse.hideMouse();
+ g_vm->_mouse->hideMouse();
g_vm->hourToChar();
for (i = 0; i <= 389; ++i)
@@ -165,7 +165,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) {
// Skipped: dialog asking to swap floppy
- g_vm->_mouse.showMouse();
+ g_vm->_mouse->showMouse();
return Common::kNoError;
}
@@ -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 79747e6889..9c21b0c294 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/sound.cpp b/engines/mortevielle/sound.cpp
index b670246726..c39c8e7024 100644
--- a/engines/mortevielle/sound.cpp
+++ b/engines/mortevielle/sound.cpp
@@ -55,7 +55,8 @@ namespace Mortevielle {
const byte _tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10};
const byte _tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9};
-SoundManager::SoundManager(Audio::Mixer *mixer) {
+SoundManager::SoundManager(MortevielleEngine *vm, Audio::Mixer *mixer) {
+ _vm = vm;
_mixer = mixer;
_audioStream = nullptr;
_ambiantNoiseBuf = nullptr;
@@ -281,10 +282,6 @@ void SoundManager::playSong(const byte* buf, uint size, uint loops) {
_mixer->stopHandle(songHandle);
}
-void SoundManager::setParent(MortevielleEngine *vm) {
- _vm = vm;
-}
-
void SoundManager::spfrac(int wor) {
_queue[2]._rep = (uint)wor >> 12;
if ((_soundType == 0) && (_queue[2]._code != 9)) {
diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h
index cc0567fd98..5321c8946c 100644
--- a/engines/mortevielle/sound.h
+++ b/engines/mortevielle/sound.h
@@ -84,15 +84,13 @@ private:
void litph(tablint &t, int typ, int tempo);
public:
- SoundManager(Audio::Mixer *mixer);
+ SoundManager(MortevielleEngine *vm, Audio::Mixer *mixer);
~SoundManager();
Audio::Mixer *_mixer;
Audio::SoundHandle _soundHandle;
uint16 *_cfiphBuffer;
- void setParent(MortevielleEngine *vm);
-
int decodeMusic(const byte *PSrc, byte *PDest, int size);
void playSong(const byte *buf, uint usize, uint loops);
void loadAmbiantSounds();
diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp
index c4f2d5714b..6e0f266f9b 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
@@ -92,8 +92,8 @@ bool MortevielleEngine::handleEvents() {
case Common::EVENT_LBUTTONUP:
case Common::EVENT_MOUSEMOVE:
_mousePos = Common::Point(event.mouse.x, event.mouse.y / 2);
- _mouse._pos.x = event.mouse.x;
- _mouse._pos.y = event.mouse.y / 2;
+ _mouse->_pos.x = event.mouse.x;
+ _mouse->_pos.y = event.mouse.y / 2;
if (event.type == Common::EVENT_LBUTTONDOWN)
_mouseClick = true;
@@ -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))
@@ -208,7 +208,7 @@ void MortevielleEngine::initMouse() {
CursorMan.replaceCursor(CURSOR_ARROW_DATA, 16, 16, 0, 0, 0xff);
CursorMan.showMouse(true);
- _mouse.initMouse();
+ _mouse->initMouse();
}
/**
@@ -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);
@@ -261,8 +261,8 @@ void MortevielleEngine::handleAction() {
bool handledOpcodeFl = false;
_controlMenu = 0;
if (!_keyPressedEsc) {
- _menu.drawMenu();
- _menu._menuDisplayed = true;
+ _menu->drawMenu();
+ _menu->_menuDisplayed = true;
temps = 0;
_key = 0;
funct = false;
@@ -270,28 +270,28 @@ void MortevielleEngine::handleAction() {
_inMainGameLoop = true;
do {
- _menu.updateMenu();
+ _menu->updateMenu();
prepareRoom();
- _mouse.moveMouse(funct, inkey);
+ _mouse->moveMouse(funct, inkey);
if (shouldQuit())
return;
++temps;
if (keyPressed() || _mouseClick) {
- _soundManager._mixer->stopHandle(_soundManager._soundHandle);
+ _soundManager->_mixer->stopHandle(_soundManager->_soundHandle);
}
- } while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone)));
+ } while (!((_menu->_menuSelected) || (temps > lim) || (funct) || (_anyone)));
_inMainGameLoop = false;
- _menu.eraseMenu();
- _menu._menuDisplayed = false;
- if (_menu._menuSelected && (_currMenu == MENU_SAVE)) {
+ _menu->eraseMenu();
+ _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);
+ if (_menu->_menuSelected && (_currMenu == MENU_LOAD))
+ _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))) {
@@ -321,12 +321,12 @@ void MortevielleEngine::handleAction() {
_menuOpcode = _currAction;
if (!_anyone) {
if ((_heroSearching) || (_obpart)) {
- if (_mouse._pos.y < 12)
+ if (_mouse->_pos.y < 12)
return;
- if ((_currAction == _menu._opcodeSound) || (_currAction == _menu._opcodeLift)) {
+ if ((_currAction == _menu->_opcodeSound) || (_currAction == _menu->_opcodeLift)) {
handledOpcodeFl = true;
- if ((_currAction == _menu._opcodeLift) || (_obpart)) {
+ if ((_currAction == _menu->_opcodeLift) || (_obpart)) {
endSearch();
_caff = _coreVar._currPlace;
_crep = 998;
@@ -341,7 +341,7 @@ void MortevielleEngine::handleAction() {
handleOpcode();
if ((_controlMenu == 0) && (! _loseGame) && (! _endGame)) {
- _text.taffich();
+ _text->taffich();
if (_destinationOk) {
_destinationOk = false;
drawPicture();
@@ -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,51 +500,51 @@ 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]);
+ _menu->disableMenuItem(_menu->_discussMenu[i]);
clearUpperRightPart();
if ((bitIndex & 128) == 128) {
- _screenSurface.putxy(xp, 24);
- _screenSurface.drawString("LEO", 4);
- _menu.enableMenuItem(_menu._discussMenu[1]);
+ _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);
- _menu.enableMenuItem(_menu._discussMenu[2]);
+ _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);
- _menu.enableMenuItem(_menu._discussMenu[3]);
+ _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);
- _menu.enableMenuItem(_menu._discussMenu[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);
- _menu.enableMenuItem(_menu._discussMenu[5]);
+ _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);
- _menu.enableMenuItem(_menu._discussMenu[6]);
+ _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);
- _menu.enableMenuItem(_menu._discussMenu[7]);
+ _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);
- _menu.enableMenuItem(_menu._discussMenu[8]);
+ _screenSurface->putxy(xp, 80);
+ _screenSurface->drawString("MAX", 4);
+ _menu->enableMenuItem(_menu->_discussMenu[8]);
}
_currBitIndex = bitIndex;
}
@@ -605,7 +605,7 @@ int MortevielleEngine::getPresenceStatsGreenRoom() {
else if ((hour >= 0) && (hour < 8))
retVal = 70;
- _menu.updateMenu();
+ _menu->updateMenu();
return retVal;
}
@@ -698,19 +698,19 @@ int MortevielleEngine::getPresenceStatsRedRoom() {
*/
void MortevielleEngine::displayAloneText() {
for (int i = 1; i <= 8; ++i)
- _menu.disableMenuItem(_menu._discussMenu[i]);
+ _menu->disableMenuItem(_menu->_discussMenu[i]);
Common::String sYou = getEngineString(S_YOU);
Common::String sAre = getEngineString(S_ARE);
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;
}
@@ -1255,24 +1255,24 @@ void MortevielleEngine::startMusicOrSpeech(int so) {
;
} else if ((!_introSpeechPlayed) && (!_coreVar._alreadyEnteredManor)) {
// Type 1: Speech
- _soundManager.startSpeech(10, 1, 1);
+ _soundManager->startSpeech(10, 1, 1);
_introSpeechPlayed = true;
} else {
if (((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2))
// Type 1: Speech
- _soundManager.startSpeech(9, getRandomNumber(2, 4), 1);
+ _soundManager->startSpeech(9, getRandomNumber(2, 4), 1);
else if ((_coreVar._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1))
// Type 1: Speech
- _soundManager.startSpeech(8, 1, 1);
+ _soundManager->startSpeech(8, 1, 1);
else if ((_coreVar._currPlace == WELL) && (getRandomNumber(1, 2) == 2))
// Type 1: Speech
- _soundManager.startSpeech(12, 1, 1);
+ _soundManager->startSpeech(12, 1, 1);
else if (_coreVar._currPlace == INSIDE_WELL)
// Type 1: Speech
- _soundManager.startSpeech(13, 1, 1);
+ _soundManager->startSpeech(13, 1, 1);
else
// Type 2 : music
- _soundManager.startSpeech(getRandomNumber(1, 17), 1, 2);
+ _soundManager->startSpeech(getRandomNumber(1, 17), 1, 2);
}
}
@@ -1284,13 +1284,13 @@ void MortevielleEngine::loseGame() {
resetOpenObjects();
_roomDoorId = OWN_ROOM;
_curSearchObjId = 0;
- _menu.unsetSearchMenu();
+ _menu->unsetSearchMenu();
if (!_blo)
getPresence(MANOR_FRONT);
_loseGame = true;
clearUpperLeftPart();
- _screenSurface.drawBox(60, 35, 400, 50, 15);
+ _screenSurface->drawBox(60, 35, 400, 50, 15);
handleDescriptionText(9, _crep);
clearDescriptionBar();
clearVerbBar();
@@ -1333,20 +1333,20 @@ void MortevielleEngine::startDialog(int16 rep) {
assert(rep >= 0);
- _mouse.hideMouse();
+ _mouse->hideMouse();
Common::String dialogStr = getString(rep + kDialogStringIndex);
- _text.displayStr(dialogStr, 230, 4, 65, 26, 5);
- _dialogManager.drawF3F8();
+ _text->displayStr(dialogStr, 230, 4, 65, 26, 5);
+ _dialogManager->drawF3F8();
key = 0;
do {
- _soundManager.startSpeech(rep, haut[_caff - 69], 0);
- key = _dialogManager.waitForF3F8();
+ _soundManager->startSpeech(rep, haut[_caff - 69], 0);
+ key = _dialogManager->waitForF3F8();
if (shouldQuit())
return;
} while (key != 66);
clearScreen();
- _mouse.showMouse();
+ _mouse->showMouse();
}
/**
@@ -1357,7 +1357,7 @@ void MortevielleEngine::endSearch() {
_heroSearching = false;
_obpart = false;
_searchCount = 0;
- _menu.unsetSearchMenu();
+ _menu->unsetSearchMenu();
}
/**
@@ -1379,17 +1379,17 @@ 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();
- _mouse.hideMouse();
+ _mouse->hideMouse();
clearScreen();
drawDiscussionBox();
startDialog(140);
drawRightFrame();
drawClock();
- _mouse.showMouse();
+ _mouse->showMouse();
_coreVar._currPlace = OWN_ROOM;
prepareDisplayText();
resetPresenceInRooms(DINING_ROOM);
@@ -1451,8 +1451,8 @@ void MortevielleEngine::floodedInWell() {
* @remarks Originally called 'antegame'
*/
void MortevielleEngine::gameLoaded() {
- _mouse.hideMouse();
- _menu._menuDisplayed = false;
+ _mouse->hideMouse();
+ _menu->_menuDisplayed = false;
_loseGame = true;
_anyone = false;
_destinationOk = true;
@@ -1490,11 +1490,11 @@ void MortevielleEngine::gameLoaded() {
handleDescriptionText(2, _crep);
clearVerbBar();
_endGame = false;
- _menu.setDestinationText(_coreVar._currPlace);
- _menu.setInventoryText();
+ _menu->setDestinationText(_coreVar._currPlace);
+ _menu->setInventoryText();
if (_coreVar._selectedObjectId != 0)
displayItemInHand(_coreVar._selectedObjectId + 400);
- _mouse.showMouse();
+ _mouse->showMouse();
}
/**
@@ -1508,7 +1508,7 @@ void MortevielleEngine::handleOpcode() {
_keyPressedEsc = false;
if (!_anyone) {
if (_uptodatePresence) {
- if ((_currMenu == MENU_MOVE) || (_currAction == _menu._opcodeLeave) || (_currAction == _menu._opcodeSleep) || (_currAction == _menu._opcodeEat)) {
+ if ((_currMenu == MENU_MOVE) || (_currAction == _menu->_opcodeLeave) || (_currAction == _menu->_opcodeSleep) || (_currAction == _menu->_opcodeEat)) {
_controlMenu = 4;
menuUp();
return;
@@ -1521,60 +1521,60 @@ void MortevielleEngine::handleOpcode() {
fctDiscuss();
else if (_currMenu == MENU_INVENTORY)
fctInventoryTake();
- else if (_currAction == _menu._opcodeAttach)
+ else if (_currAction == _menu->_opcodeAttach)
fctAttach();
- else if (_currAction == _menu._opcodeWait)
+ else if (_currAction == _menu->_opcodeWait)
fctWait();
- else if (_currAction == _menu._opcodeForce)
+ else if (_currAction == _menu->_opcodeForce)
fctForce();
- else if (_currAction == _menu._opcodeSleep)
+ else if (_currAction == _menu->_opcodeSleep)
fctSleep();
- else if (_currAction == _menu._opcodeListen)
+ else if (_currAction == _menu->_opcodeListen)
fctListen();
- else if (_currAction == _menu._opcodeEnter)
+ else if (_currAction == _menu->_opcodeEnter)
fctEnter();
- else if (_currAction == _menu._opcodeClose)
+ else if (_currAction == _menu->_opcodeClose)
fctClose();
- else if (_currAction == _menu._opcodeSearch)
+ else if (_currAction == _menu->_opcodeSearch)
fctSearch();
- else if (_currAction == _menu._opcodeKnock)
+ else if (_currAction == _menu->_opcodeKnock)
fctKnock();
- else if (_currAction == _menu._opcodeScratch)
+ else if (_currAction == _menu->_opcodeScratch)
fctScratch();
- else if (_currAction == _menu._opcodeRead)
+ else if (_currAction == _menu->_opcodeRead)
fctRead();
- else if (_currAction == _menu._opcodeEat)
+ else if (_currAction == _menu->_opcodeEat)
fctEat();
- else if (_currAction == _menu._opcodePlace)
+ else if (_currAction == _menu->_opcodePlace)
fctPlace();
- else if (_currAction == _menu._opcodeOpen)
+ else if (_currAction == _menu->_opcodeOpen)
fctOpen();
- else if (_currAction == _menu._opcodeTake)
+ else if (_currAction == _menu->_opcodeTake)
fctTake();
- else if (_currAction == _menu._opcodeLook)
+ else if (_currAction == _menu->_opcodeLook)
fctLook();
- else if (_currAction == _menu._opcodeSmell)
+ else if (_currAction == _menu->_opcodeSmell)
fctSmell();
- else if (_currAction == _menu._opcodeSound)
+ else if (_currAction == _menu->_opcodeSound)
fctSound();
- else if (_currAction == _menu._opcodeLeave)
+ else if (_currAction == _menu->_opcodeLeave)
fctLeave();
- else if (_currAction == _menu._opcodeLift)
+ else if (_currAction == _menu->_opcodeLift)
fctLift();
- else if (_currAction == _menu._opcodeTurn)
+ else if (_currAction == _menu->_opcodeTurn)
fctTurn();
- else if (_currAction == _menu._opcodeSSearch)
+ else if (_currAction == _menu->_opcodeSSearch)
fctSelfSearch();
- else if (_currAction == _menu._opcodeSRead)
+ else if (_currAction == _menu->_opcodeSRead)
fctSelfRead();
- else if (_currAction == _menu._opcodeSPut)
+ else if (_currAction == _menu->_opcodeSPut)
fctSelfPut();
- else if (_currAction == _menu._opcodeSLook)
+ else if (_currAction == _menu->_opcodeSLook)
fctSelftLook();
_hiddenHero = false;
- if (_currAction == _menu._opcodeSHide)
+ if (_currAction == _menu->_opcodeSHide)
fctSelfHide();
} else if (_anyone) {
interactNPC();
@@ -1640,9 +1640,9 @@ void MortevielleEngine::charToHour() {
* @remarks Originally called 'clsf1'
*/
void MortevielleEngine::clearUpperLeftPart() {
- _mouse.hideMouse();
- _screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175));
- _mouse.showMouse();
+ _mouse->hideMouse();
+ _screenSurface->fillRect(0, Common::Rect(0, 11, 514, 175));
+ _mouse->showMouse();
}
/**
@@ -1650,16 +1650,16 @@ void MortevielleEngine::clearUpperLeftPart() {
* @remarks Originally called 'clsf2'
*/
void MortevielleEngine::clearDescriptionBar() {
- _mouse.hideMouse();
+ _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();
+ _mouse->showMouse();
}
/**
@@ -1667,10 +1667,10 @@ void MortevielleEngine::clearDescriptionBar() {
* @remarks Originally called 'clsf3'
*/
void MortevielleEngine::clearVerbBar() {
- _mouse.hideMouse();
- _screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199));
- _screenSurface.drawBox(0, 191, 634, 8, 15);
- _mouse.showMouse();
+ _mouse->hideMouse();
+ _screenSurface->fillRect(0, Common::Rect(1, 192, 633, 199));
+ _screenSurface->drawBox(0, 191, 634, 8, 15);
+ _mouse->showMouse();
}
/**
@@ -1680,10 +1680,10 @@ void MortevielleEngine::clearVerbBar() {
void MortevielleEngine::clearUpperRightPart() {
Common::String st;
- _mouse.hideMouse();
+ _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,13 +1691,13 @@ 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));
- _mouse.showMouse();
+ _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));
}
/**
@@ -2074,10 +2074,10 @@ void MortevielleEngine::loadCFIPH() {
error("Missing file - *cfiph.mor");
}
- _soundManager._cfiphBuffer = (uint16 *)malloc(sizeof(uint16) * (f.size() / 2));
+ _soundManager->_cfiphBuffer = (uint16 *)malloc(sizeof(uint16) * (f.size() / 2));
for (int i = 0; i < (f.size() / 2); ++i)
- _soundManager._cfiphBuffer[i] = f.readUint16BE();
+ _soundManager->_cfiphBuffer[i] = f.readUint16BE();
f.close();
}
@@ -2102,10 +2102,10 @@ void MortevielleEngine::music() {
f.read(compMusicBuf, size);
f.close();
- int musicSize = _soundManager.decodeMusic(compMusicBuf, musicBuf, size);
+ int musicSize = _soundManager->decodeMusic(compMusicBuf, musicBuf, size);
free(compMusicBuf);
- _soundManager.playSong(musicBuf, musicSize, 5);
+ _soundManager->playSong(musicBuf, musicSize, 5);
while (keyPressed())
getChar();
@@ -2120,14 +2120,14 @@ void MortevielleEngine::showTitleScreen() {
clearScreen();
handleDescriptionText(7, 2035);
_caff = 51;
- _text.taffich();
+ _text->taffich();
testKeyboard();
clearScreen();
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);
}
/**
@@ -2135,10 +2135,10 @@ void MortevielleEngine::showTitleScreen() {
* @remarks Originally called 'dessine'
*/
void MortevielleEngine::draw(int x, int y) {
- _mouse.hideMouse();
+ _mouse->hideMouse();
setPal(_numpal);
displayPicture(_curPict, x, y);
- _mouse.showMouse();
+ _mouse->showMouse();
}
/**
@@ -2147,9 +2147,9 @@ void MortevielleEngine::draw(int x, int y) {
*/
void MortevielleEngine::drawRightFrame() {
setPal(89);
- _mouse.hideMouse();
+ _mouse->hideMouse();
displayPicture(_rightFramePict, 0, 0);
- _mouse.showMouse();
+ _mouse->showMouse();
}
/**
@@ -2205,7 +2205,7 @@ void MortevielleEngine::prepareRoom() {
_minute = 30;
drawClock();
}
- if (_mouse._pos.y < 12)
+ if (_mouse->_pos.y < 12)
return;
if (!_blo) {
@@ -2221,8 +2221,8 @@ void MortevielleEngine::prepareRoom() {
int newTime = readclock();
if ((newTime - _currentTime) > _inGameHourDuration) {
- bool activeMenu = _menu._menuActive;
- _menu.eraseMenu();
+ bool activeMenu = _menu->_menuActive;
+ _menu->eraseMenu();
_currentHourCount += ((newTime - _currentTime) / _inGameHourDuration);
_currentTime = newTime;
switch (_place) {
@@ -2280,8 +2280,8 @@ void MortevielleEngine::prepareRoom() {
prepareScreenType2();
displayTextInVerbBar(getEngineString(S_HEAR_NOISE));
int rand = (getRandomNumber(0, 4)) - 2;
- _soundManager.startSpeech(1, rand, 1);
- _soundManager.waitSpeech();
+ _soundManager->startSpeech(1, rand, 1);
+ _soundManager->waitSpeech();
clearVerbBar();
}
}
@@ -2289,7 +2289,7 @@ void MortevielleEngine::prepareRoom() {
}
if (activeMenu)
- _menu.drawMenu();
+ _menu->drawMenu();
}
}
_endTime = readclock();
@@ -2315,15 +2315,15 @@ void MortevielleEngine::drawClock() {
const int y = 123;
const int rg = 9;
- _mouse.hideMouse();
+ _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);
- _mouse.showMouse();
- _screenSurface.putxy(568, 154);
+ _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);
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();
}
/**
@@ -2391,8 +2391,8 @@ void MortevielleEngine::initCaveOrCellar() {
prepareScreenType2();
displayTextInVerbBar(getEngineString(S_SOMEONE_ENTERS));
int rand = (getRandomNumber(0, 4)) - 2;
- _soundManager.startSpeech(2, rand, 1);
- _soundManager.waitSpeech();
+ _soundManager->startSpeech(2, rand, 1);
+ _soundManager->waitSpeech();
// The original was doing here a useless loop.
// It has been removed
@@ -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() {
@@ -2465,7 +2465,7 @@ void MortevielleEngine::displayTextInDescriptionBar(int x, int y, int nb, int me
Common::String tmpStr = getString(mesgId);
if ((y == 182) && ((int) tmpStr.size() > nb))
y = 176;
- _text.displayStr(tmpStr, x, y, nb, 20, _textColor);
+ _text->displayStr(tmpStr, x, y, nb, 20, _textColor);
}
/**
@@ -2482,7 +2482,7 @@ void MortevielleEngine::handleDescriptionText(int f, int mesgId) {
_largestClearScreen = false;
clearDescriptionBar();
- _text.displayStr(tmpStr, 8, 176, 85, 3, 5);
+ _text->displayStr(tmpStr, 8, 176, 85, 3, 5);
} else {
mapMessageId(mesgId);
switch (f) {
@@ -2511,7 +2511,7 @@ void MortevielleEngine::handleDescriptionText(int f, int mesgId) {
i = 5;
Common::String tmpStr = getString(mesgId);
- _text.displayStr(tmpStr, 80, 40, 60, 25, i);
+ _text->displayStr(tmpStr, 80, 40, 60, 25, i);
if (mesgId == 180)
_coreVar._pctHintFound[6] = '*';
@@ -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);
}
/**
@@ -2622,8 +2622,8 @@ void MortevielleEngine::displayItemInHand(int objId) {
if (objId != 500)
strp = getString(objId - 501 + kInventoryStringIndex);
- _menu.setText(_menu._inventoryMenu[8], strp);
- _menu.disableMenuItem(_menu._inventoryMenu[8]);
+ _menu->setText(_menu->_inventoryMenu[8], strp);
+ _menu->disableMenuItem(_menu->_inventoryMenu[8]);
}
/**
@@ -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();
@@ -2910,7 +2910,7 @@ void MortevielleEngine::drawPicture() {
}
void MortevielleEngine::drawPictureWithText() {
- _text.taffich();
+ _text->taffich();
drawPicture();
_destinationOk = false;
}
@@ -2924,7 +2924,7 @@ void MortevielleEngine::testKey(bool d) {
int x, y;
bool click;
- _mouse.hideMouse();
+ _mouse->hideMouse();
displayStatusInDescriptionBar('K');
// Wait for release from any key or mouse button
@@ -2932,7 +2932,7 @@ void MortevielleEngine::testKey(bool d) {
_key = gettKeyPressed();
do {
- _mouse.getMousePosition(x, y, click);
+ _mouse->getMousePosition(x, y, click);
quest = keyPressed();
if (quest && shouldQuit())
return;
@@ -2943,14 +2943,14 @@ void MortevielleEngine::testKey(bool d) {
if (d)
prepareRoom();
quest = keyPressed();
- _mouse.getMousePosition(x, y, click);
+ _mouse->getMousePosition(x, y, click);
if (shouldQuit())
return;
} while (!(quest || (click) || (d && _anyone)));
if (quest)
gettKeyPressed();
setMouseClick(false);
- _mouse.showMouse();
+ _mouse->showMouse();
}
/**
@@ -3061,7 +3061,7 @@ void MortevielleEngine::getSearchDescription(int objId) {
* @remarks Originally called 'mennor'
*/
void MortevielleEngine::menuUp() {
- _menu.menuUp(_currMenu);
+ _menu->menuUp(_currMenu);
}
/**
@@ -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);
}
/**
@@ -3101,7 +3101,7 @@ void MortevielleEngine::addObjectToInventory(int objectId) {
if (_coreVar._inventory[i] == 0) {
_coreVar._inventory[i] = objectId;
- _menu.setInventoryText();
+ _menu->setInventoryText();
} else
// Inventory is full
_crep = 139;
@@ -3112,8 +3112,8 @@ void MortevielleEngine::addObjectToInventory(int objectId) {
* @remarks Originally called 'quelquun'
*/
void MortevielleEngine::interactNPC() {
- if (_menu._menuDisplayed)
- _menu.eraseMenu();
+ if (_menu->_menuDisplayed)
+ _menu->eraseMenu();
endSearch();
_crep = 997;
@@ -3123,9 +3123,9 @@ L1:
_crep = 138;
handleDescriptionText(2, _crep);
if (_crep == 138)
- _soundManager.startSpeech(5, 2, 1);
+ _soundManager->startSpeech(5, 2, 1);
else
- _soundManager.startSpeech(4, 4, 1);
+ _soundManager->startSpeech(4, 4, 1);
if (_openObjCount == 0)
_coreVar._faithScore += 2;
@@ -3134,12 +3134,12 @@ L1:
else
_coreVar._faithScore += 3 * (_coreVar._faithScore / 10);
exitRoom();
- _menu.setDestinationText(LANDING);
+ _menu->setDestinationText(LANDING);
int charIdx = convertBitIndexToCharacterIndex(_currBitIndex);
_caff = 69 + charIdx;
_crep = _caff;
_currMenu = MENU_DISCUSS;
- _currAction = (_menu._discussMenu[charIdx]._menuId << 8) | _menu._discussMenu[charIdx]._actionId;
+ _currAction = (_menu->_discussMenu[charIdx]._menuId << 8) | _menu->_discussMenu[charIdx]._actionId;
_syn = true;
_col = true;
} else {
@@ -3150,15 +3150,15 @@ L1:
} else {
handleDescriptionText(2, 136);
int rand = (getRandomNumber(0, 4)) - 2;
- _soundManager.startSpeech(3, rand, 1);
+ _soundManager->startSpeech(3, rand, 1);
clearDescriptionBar();
displayAloneText();
resetRoomVariables(MANOR_FRONT);
prepareDisplayText();
}
}
- if (_menu._menuDisplayed)
- _menu.drawMenu();
+ if (_menu->_menuDisplayed)
+ _menu->drawMenu();
}
/**
@@ -3206,25 +3206,25 @@ void MortevielleEngine::displayStatusArrow() {
touch = '\0';
do {
- _mouse.moveMouse(qust, touch);
+ _mouse->moveMouse(qust, touch);
if (shouldQuit())
return;
if (getMouseClick())
- inRect = (_mouse._pos.x < 256 * kResolutionScaler) && (_mouse._pos.y < 176) && (_mouse._pos.y > 12);
+ inRect = (_mouse->_pos.x < 256 * kResolutionScaler) && (_mouse->_pos.y < 176) && (_mouse->_pos.y > 12);
prepareRoom();
} 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')
_keyPressedEsc = true;
if (inRect) {
- _x = _mouse._pos.x;
- _y = _mouse._pos.y;
+ _x = _mouse->_pos.x;
+ _y = _mouse->_pos.y;
}
}
@@ -3292,7 +3292,7 @@ void MortevielleEngine::displayLookScreen(int objId) {
int mdes = _caff;
_caff = objId;
- if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_currAction == _menu._opcodeSLook)) {
+ if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_currAction == _menu->_opcodeSLook)) {
drawPictureWithText();
if ((_caff > 29) && (_caff < 33))
handleDescriptionText(2, _caff);
@@ -3305,7 +3305,7 @@ void MortevielleEngine::displayLookScreen(int objId) {
} else {
_obpart = true;
_crep = _caff + 400;
- _menu.setSearchMenu();
+ _menu->setSearchMenu();
}
}
@@ -3357,10 +3357,10 @@ int MortevielleEngine::checkLeaveSecretPassage() {
* @remarks Originally called 'fenat'
*/
void MortevielleEngine::displayStatusInDescriptionBar(char stat) {
- _mouse.hideMouse();
- _screenSurface.writeCharacter(Common::Point(306, 193), stat, 12);
- _screenSurface.drawBox(300, 191, 16, 8, 15);
- _mouse.showMouse();
+ _mouse->hideMouse();
+ _screenSurface->writeCharacter(Common::Point(306, 193), stat, 12);
+ _screenSurface->drawBox(300, 191, 16, 8, 15);
+ _mouse->showMouse();
}
/**