Skip to content

Commit

Permalink
MORTEVIELLE: More renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Oct 13, 2012
1 parent ef7681a commit dd3e3a4
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 64 deletions.
65 changes: 38 additions & 27 deletions engines/mortevielle/actions.cpp
Expand Up @@ -205,7 +205,7 @@ void MortevielleEngine::fctTake() {
_obpart = false;
affrep();
} else {
_tabdon[kAcha + ((_mchai - 1) * 10) + _cs - 1] = 0;
_tabdon[kAcha + ((_mchai - 1) * 10) + _searchCount - 1] = 0;
tsuiv();
++_takeObjCount;
if (_takeObjCount > 6) {
Expand Down Expand Up @@ -502,16 +502,16 @@ void MortevielleEngine::fctSearch() {
int cx = 0;
do {
++cx;
} while ((cx <= 6) && (_num != ord(_touv[cx])));
if (_num != ord(_touv[cx]))
} while ((cx <= 6) && (_num != ord(_openObjects[cx])));
if (_num != ord(_openObjects[cx]))
_crep = 187;
else {
if (_currBitIndex > 0)
_coreVar._faithScore += 3;

rechai(_mchai);
if (_mchai != 0) {
_cs = 0;
_searchCount = 0;
_heroSearching = true;
_menu.setSearchMenu();
tsuiv();
Expand Down Expand Up @@ -590,7 +590,7 @@ void MortevielleEngine::fctOpen() {
return;
}

if (_caff == 15) {
if (_caff == LANDING) {
showMoveMenuAlert();
return;
}
Expand All @@ -607,21 +607,31 @@ void MortevielleEngine::fctOpen() {
int tmpPlace = 0;
do {
++tmpPlace;
} while (!((tmpPlace > 6) || (ord(_touv[tmpPlace]) == 0) || (ord(_touv[tmpPlace]) == _num)));
if (ord(_touv[tmpPlace]) != _num) {
if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == ROOM9) || (_coreVar._currPlace == BLUE_ROOM) || (_coreVar._currPlace == BATHROOM)))
|| ((_num == 4) && ((_coreVar._currPlace == GREEN_ROOM) || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == RED_ROOM)))
} while (!((tmpPlace > 6) || (ord(_openObjects[tmpPlace]) == 0) || (ord(_openObjects[tmpPlace]) == _num)));
if (ord(_openObjects[tmpPlace]) != _num) {
if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM)
|| (_coreVar._currPlace == ROOM9)
|| (_coreVar._currPlace == BLUE_ROOM)
|| (_coreVar._currPlace == BATHROOM)))
|| ((_num == 4) && ((_coreVar._currPlace == GREEN_ROOM)
|| (_coreVar._currPlace == PURPLE_ROOM)
|| (_coreVar._currPlace == RED_ROOM)))
|| ((_coreVar._currPlace == DARKBLUE_ROOM) && (_num == 5))
|| ((_num == 6) && ((_coreVar._currPlace == BATHROOM) || (_coreVar._currPlace == DINING_ROOM) || (_coreVar._currPlace == GREEN_ROOM2) || (_coreVar._currPlace == ATTIC)))
|| ((_num == 6) && ((_coreVar._currPlace == BATHROOM)
|| (_coreVar._currPlace == DINING_ROOM)
|| (_coreVar._currPlace == GREEN_ROOM2)
|| (_coreVar._currPlace == ATTIC)))
|| ((_coreVar._currPlace == GREEN_ROOM2) && (_num == 2))
|| ((_coreVar._currPlace == KITCHEN) && (_num == 7))) ) {
if ( ((_coreVar._currPlace > DINING_ROOM) && (_coreVar._currPlace < CELLAR))
|| ((_coreVar._currPlace > RED_ROOM) && (_coreVar._currPlace < DINING_ROOM))
|| (_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == BLUE_ROOM)) {
|| (_coreVar._currPlace == OWN_ROOM)
|| (_coreVar._currPlace == PURPLE_ROOM)
|| (_coreVar._currPlace == BLUE_ROOM)) {
if (getRandomNumber(1, 4) == 3)
_speechManager.startSpeech(7, 9, 1);
}
_touv[tmpPlace] = chr(_num);
_openObjects[tmpPlace] = chr(_num);
aniof(1, _num);
}
tmpPlace = _coreVar._currPlace;
Expand All @@ -631,6 +641,7 @@ void MortevielleEngine::fctOpen() {
if (_crep == 254)
_crep = 999;
} else
// display "Already Opened"
_crep = 18;
}
}
Expand Down Expand Up @@ -874,11 +885,11 @@ void MortevielleEngine::fctClose() {
int cx = 0;
do {
++cx;
} while ((cx <= 6) && (_num != ord(_touv[cx])));
if (_num == ord(_touv[cx])) {
} while ((cx <= 6) && (_num != ord(_openObjects[cx])));
if (_num == ord(_openObjects[cx])) {
aniof(2, _num);
_crep = 998;
_touv[cx] = chr(0);
_openObjects[cx] = chr(0);
--_openObjCount;
if (_openObjCount < 0)
_openObjCount = 0;
Expand Down Expand Up @@ -973,8 +984,8 @@ void MortevielleEngine::fctSelfPut() {
int cx = 0;
do {
++cx;
} while ((cx <= 6) && (_num != ord(_touv[cx])));
if (_num != ord(_touv[cx]))
} while ((cx <= 6) && (_num != ord(_openObjects[cx])));
if (_num != ord(_openObjects[cx]))
_crep = 187;
else {
_mchai = chai;
Expand Down Expand Up @@ -1106,7 +1117,7 @@ void MortevielleEngine::fctEat() {
h = 1;
}

_jh += h;
_currentHourCount += h;
_crep = 135;
prepareRoom();
} else {
Expand Down Expand Up @@ -1138,15 +1149,15 @@ void MortevielleEngine::fctEnter() {
if ((_roomDoorId == TOILETS) || (_roomDoorId == BATHROOM))
_crep = 179;
else {
_x = (getRandomNumber(0, 10)) - 5;
_speechManager.startSpeech(7, _x, 1);
int randVal = (getRandomNumber(0, 10)) - 5;
_speechManager.startSpeech(7, randVal, 1);
aniof(1, 1);

_x = convertBitIndexToCharacterIndex(z);
int charIndex = convertBitIndexToCharacterIndex(z);
++_coreVar._faithScore;
_coreVar._currPlace = LANDING;
_msg[3] = MENU_DISCUSS;
_msg[4] = _menu._discussMenu[_x];
_msg[4] = _menu._discussMenu[charIndex];
_syn = true;
if (_roomDoorId == ROOM9) {
_col = true;
Expand All @@ -1159,8 +1170,8 @@ void MortevielleEngine::fctEnter() {
_roomDoorId = OWN_ROOM;
}
} else {
_x = (getRandomNumber(0, 10)) - 5;
_speechManager.startSpeech(7, _x, 1);
int randVal = (getRandomNumber(0, 10)) - 5;
_speechManager.startSpeech(7, randVal, 1);
aniof(1, 1);

_coreVar._currPlace = _roomDoorId;
Expand Down Expand Up @@ -1206,10 +1217,10 @@ void MortevielleEngine::fctSleep() {
z = (7 - h) * 2;
if (m == 30)
--z;
_jh += z;
_currentHourCount += z;
h = 7;
}
_jh += 2;
_currentHourCount += 2;
++h;
if (h > 23)
h = 0;
Expand Down Expand Up @@ -1288,7 +1299,7 @@ void MortevielleEngine::fctWait() {

int answer;
do {
++_jh;
++_currentHourCount;
prepareRoom();
if (!_blo)
getPresence(_coreVar._currPlace);
Expand Down
50 changes: 25 additions & 25 deletions engines/mortevielle/mortevielle.cpp
Expand Up @@ -791,7 +791,7 @@ void MortevielleEngine::prepareScreenType3() {
*/
void MortevielleEngine::updateHour(int &day, int &hour, int &minute) {
int newHour = readclock();
int th = _jh + ((newHour - _mh) / _t);
int th = _currentHourCount + ((newHour - _currentDayHour) / _inGameHourDuration);
minute = ((th % 2) + _currHalfHour) * 30;
hour = ((uint)th >> 1) + _currHour;
if (minute == 60) {
Expand Down Expand Up @@ -1455,11 +1455,11 @@ int MortevielleEngine::getPresenceBitIndex(int roomId) {
*/
void MortevielleEngine::initGame() {
_place = MANOR_FRONT;
_jh = 0;
_currentHourCount = 0;
if (!_coreVar._alreadyEnteredManor)
_blo = true;
_t = kTime1;
_mh = readclock();
_inGameHourDuration = kTime1;
_currentDayHour = readclock();
}

/**
Expand Down Expand Up @@ -1649,10 +1649,10 @@ void MortevielleEngine::startMusicOrSpeech(int so) {
if (so == 0) {
/* musik(0) */
;
} else if ((_prebru == 0) && (!_coreVar._alreadyEnteredManor)) {
} else if ((!_introSpeechPlayed) && (!_coreVar._alreadyEnteredManor)) {
// Type 1: Speech
_speechManager.startSpeech(10, 1, 1);
++_prebru;
_introSpeechPlayed = true;
} else {
if (((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2))
// Type 1: Speech
Expand Down Expand Up @@ -1752,7 +1752,7 @@ void MortevielleEngine::startDialog(int16 rep) {
void MortevielleEngine::endSearch() {
_heroSearching = false;
_obpart = false;
_cs = 0;
_searchCount = 0;
_menu.unsetSearchMenu();
}

Expand Down Expand Up @@ -1882,13 +1882,13 @@ void MortevielleEngine::gameLoaded() {
_uptodatePresence = false;
_maff = 68;
_menuOpcode = OPCODE_NONE;
_prebru = 0;
_introSpeechPlayed = false;
_x = 0;
_y = 0;
_num = 0;
_startHour = 0;
_endHour = 0;
_cs = 0;
_searchCount = 0;
_roomDoorId = OWN_ROOM;
_syn = true;
_heroSearching = true;
Expand Down Expand Up @@ -2667,22 +2667,22 @@ void MortevielleEngine::prepareRoom() {

if (!_blo) {
if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7)))
_t = kTime2;
_inGameHourDuration = kTime2;
else
_t = kTime1;
_inGameHourDuration = kTime1;
cf = _coreVar._faithScore;
if ((cf > 33) && (cf < 66))
_t -= (_t / 3);
_inGameHourDuration -= (_inGameHourDuration / 3);

if (cf > 65)
_t -= ((_t / 3) * 2);
_inGameHourDuration -= ((_inGameHourDuration / 3) * 2);

int nh = readclock();
if ((nh - _mh) > _t) {
int newHour = readclock();
if ((newHour - _currentDayHour) > _inGameHourDuration) {
bool activeMenu = _menu._menuActive;
_menu.eraseMenu();
_jh += ((nh - _mh) / _t);
_mh = nh;
_currentHourCount += ((newHour - _currentDayHour) / _inGameHourDuration);
_currentDayHour = newHour;
switch (_place) {
case GREEN_ROOM:
case DARKBLUE_ROOM:
Expand Down Expand Up @@ -3050,7 +3050,7 @@ void MortevielleEngine::mapMessageId(int &mesgId) {

void MortevielleEngine::initouv() {
for (int cx = 1; cx <= 7; ++cx)
_touv[cx] = chr(0);
_openObjects[cx] = chr(0);
}

void MortevielleEngine::ecr2(Common::String text) {
Expand Down Expand Up @@ -3323,8 +3323,8 @@ void MortevielleEngine::drawPicture() {
prepareScreenType1();
if ((_caff < 30) || (_caff > 32)) {
for (int cx = 1; cx <= 6; ++cx) {
if (ord(_touv[cx]) != 0)
aniof(1, ord(_touv[cx]));
if (ord(_openObjects[cx]) != 0)
aniof(1, ord(_openObjects[cx]));
}

if (_caff == 13) {
Expand Down Expand Up @@ -3415,7 +3415,7 @@ void MortevielleEngine::exitRoom() {
}

for (int cx = 1; cx <= 7; ++cx)
_touv[cx] = chr(0);
_openObjects[cx] = chr(0);
_roomDoorId = OWN_ROOM;
_openObjCount = 0;
_mchai = 0;
Expand Down Expand Up @@ -3577,12 +3577,12 @@ void MortevielleEngine::tsuiv() {
int cx = 0;
do {
++cx;
++_cs;
int cl = cy + _cs;
++_searchCount;
int cl = cy + _searchCount;
tbcl = _tabdon[cl];
} while ((tbcl == 0) && (_cs <= 9));
} while ((tbcl == 0) && (_searchCount <= 9));

if ((tbcl != 0) && (_cs < 11)) {
if ((tbcl != 0) && (_searchCount < 11)) {
_caff = tbcl;
_crep = _caff + 400;
if (_currBitIndex != 0)
Expand Down
23 changes: 11 additions & 12 deletions engines/mortevielle/mortevielle.h
Expand Up @@ -267,23 +267,22 @@ class MortevielleEngine : public Engine {
int _openObjCount;
int _takeObjCount;
int _num;
int _cs;
int _prebru;
int _t;
int _searchCount;
bool _introSpeechPlayed;
int _inGameHourDuration;
int _x;
int _y;
int _jh;
int _mh;

int _currentHourCount;
int _currentDayHour;

Common::String _hintPctMessage;
byte *_cfiecBuffer;
int _cfiecBufferSize;
byte _touv[8];
int _nbrep[9];
int _nbrepm[9];
byte *_cfiecBuffer;
int _cfiecBufferSize;
byte _openObjects[8];
int _nbrep[9];
int _nbrepm[9];
uint16 _inpBuffer[kMaxTi + 1];
Hint _ntpBuffer[kMaxTd + 1];
Hint _ntpBuffer[kMaxTd + 1];

Common::ErrorCode initialise();
Common::ErrorCode loadMortDat();
Expand Down

0 comments on commit dd3e3a4

Please sign in to comment.