diff options
Diffstat (limited to 'engines/mortevielle')
-rw-r--r-- | engines/mortevielle/actions.cpp | 65 | ||||
-rw-r--r-- | engines/mortevielle/mortevielle.cpp | 50 | ||||
-rw-r--r-- | engines/mortevielle/mortevielle.h | 23 |
3 files changed, 74 insertions, 64 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 5bcaf4cf03..1bf64cca0f 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -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) { @@ -502,8 +502,8 @@ 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) @@ -511,7 +511,7 @@ void MortevielleEngine::fctSearch() { rechai(_mchai); if (_mchai != 0) { - _cs = 0; + _searchCount = 0; _heroSearching = true; _menu.setSearchMenu(); tsuiv(); @@ -590,7 +590,7 @@ void MortevielleEngine::fctOpen() { return; } - if (_caff == 15) { + if (_caff == LANDING) { showMoveMenuAlert(); return; } @@ -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; @@ -631,6 +641,7 @@ void MortevielleEngine::fctOpen() { if (_crep == 254) _crep = 999; } else + // display "Already Opened" _crep = 18; } } @@ -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; @@ -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; @@ -1106,7 +1117,7 @@ void MortevielleEngine::fctEat() { h = 1; } - _jh += h; + _currentHourCount += h; _crep = 135; prepareRoom(); } else { @@ -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; @@ -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; @@ -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; @@ -1288,7 +1299,7 @@ void MortevielleEngine::fctWait() { int answer; do { - ++_jh; + ++_currentHourCount; prepareRoom(); if (!_blo) getPresence(_coreVar._currPlace); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index e4e9610f4a..68889b4796 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -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) { @@ -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(); } /** @@ -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 @@ -1752,7 +1752,7 @@ void MortevielleEngine::startDialog(int16 rep) { void MortevielleEngine::endSearch() { _heroSearching = false; _obpart = false; - _cs = 0; + _searchCount = 0; _menu.unsetSearchMenu(); } @@ -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; @@ -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: @@ -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) { @@ -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) { @@ -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; @@ -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) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 59fd6f645b..a57a304ad1 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -267,23 +267,22 @@ private: 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(); |