aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2013-08-03 12:09:13 +0200
committerStrangerke2013-08-03 12:09:13 +0200
commitc79ce89680d2c46e468152791a46f2700d04b336 (patch)
treeea73b648332c7e232ecb7ccbc0b584005b4fddf3 /engines
parent4790a4abd5c157254cab069bc34aa8ef8347f668 (diff)
downloadscummvm-rg350-c79ce89680d2c46e468152791a46f2700d04b336.tar.gz
scummvm-rg350-c79ce89680d2c46e468152791a46f2700d04b336.tar.bz2
scummvm-rg350-c79ce89680d2c46e468152791a46f2700d04b336.zip
MORTEVIELLE: Rework code using _openObjects
Diffstat (limited to 'engines')
-rw-r--r--engines/mortevielle/actions.cpp52
-rw-r--r--engines/mortevielle/mortevielle.h2
-rw-r--r--engines/mortevielle/utils.cpp16
3 files changed, 32 insertions, 38 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp
index 5738a8fd3a..f9426def85 100644
--- a/engines/mortevielle/actions.cpp
+++ b/engines/mortevielle/actions.cpp
@@ -503,13 +503,10 @@ void MortevielleEngine::fctSearch() {
if (_num == 0) {
setCoordinates(7);
if (_num != 0) {
- int cx = 0;
- do {
- ++cx;
- } while ((cx <= 6) && (_num != _openObjects[cx]));
- if (_num != _openObjects[cx])
- _crep = 187;
- else {
+ int i;
+ for (i = 1; (i <= 6) && (_num != _openObjects[i]); i++)
+ ;
+ if (_num == _openObjects[i]) {
if (_currBitIndex > 0)
_coreVar._faithScore += 3;
@@ -521,7 +518,8 @@ void MortevielleEngine::fctSearch() {
tsuiv();
} else
_crep = 997;
- }
+ } else
+ _crep = 187;
} else {
setCoordinates(8);
_crep = 997;
@@ -608,11 +606,10 @@ void MortevielleEngine::fctOpen() {
if (_currBitIndex > 0)
_coreVar._faithScore += 2;
++_openObjCount;
- int tmpPlace = 0;
- do {
- ++tmpPlace;
- } while (!((tmpPlace > 6) || (_openObjects[tmpPlace] == 0) || (_openObjects[tmpPlace] == _num)));
- if (_openObjects[tmpPlace] != _num) {
+ int i;
+ for (i = 1; !(i <= 6) && (_openObjects[i] != 0) && (_openObjects[i] != _num); i++)
+ ;
+ if (_openObjects[i] != _num) {
if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM)
|| (_coreVar._currPlace == ROOM9)
|| (_coreVar._currPlace == BLUE_ROOM)
@@ -635,10 +632,10 @@ void MortevielleEngine::fctOpen() {
if (getRandomNumber(1, 4) == 3)
_speechManager.startSpeech(7, 9, 1);
}
- _openObjects[tmpPlace] = _num;
+ _openObjects[i] = _num;
displayAnimFrame(1, _num);
}
- tmpPlace = _coreVar._currPlace;
+ int tmpPlace = _coreVar._currPlace;
if (_coreVar._currPlace == CRYPT)
tmpPlace = CELLAR;
_crep = _tabdon[kAouvr + (tmpPlace * 7) + _num - 1];
@@ -886,14 +883,13 @@ void MortevielleEngine::fctClose() {
return;
setCoordinates(7);
if (_num != 0) {
- int cx = 0;
- do {
- ++cx;
- } while ((cx <= 6) && (_num != _openObjects[cx]));
- if (_num == _openObjects[cx]) {
+ int i;
+ for (i = 1; (i <= 6) && (_num != _openObjects[i]); ++i)
+ ;
+ if (_num == _openObjects[i]) {
displayAnimFrame(2, _num);
_crep = 998;
- _openObjects[cx] = 0;
+ _openObjects[i] = 0;
--_openObjCount;
if (_openObjCount < 0)
_openObjCount = 0;
@@ -983,16 +979,14 @@ void MortevielleEngine::fctSelfPut() {
if (chai == 0)
_crep = 997;
else {
- int cx = 0;
- do {
- ++cx;
- } while ((cx <= 6) && (_num != _openObjects[cx]));
- if (_num != _openObjects[cx])
- _crep = 187;
- else {
+ int i;
+ for (i = 1; (i <= 6) && (_num != _openObjects[i]); i++)
+ ;
+ if (_num == _openObjects[i]) {
_mchai = chai;
_crep = 999;
- }
+ } else
+ _crep = 187;
}
} else {
setCoordinates(8);
diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h
index 795bac5652..62935137b0 100644
--- a/engines/mortevielle/mortevielle.h
+++ b/engines/mortevielle/mortevielle.h
@@ -257,7 +257,7 @@ private:
Common::String _hintPctMessage;
byte *_cfiecBuffer;
int _cfiecBufferSize;
- int _openObjects[8];
+ int _openObjects[7];
uint16 _dialogIndexArray[kMaxDialogIndex + 1];
Hint _dialogHintArray[kMaxDialogHint + 1];
diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp
index 8fa608953d..4985a6023c 100644
--- a/engines/mortevielle/utils.cpp
+++ b/engines/mortevielle/utils.cpp
@@ -2717,8 +2717,8 @@ void MortevielleEngine::mapMessageId(int &mesgId) {
* @remarks Originally called 'initouv'
*/
void MortevielleEngine::resetOpenObjects() {
- for (int cx = 1; cx <= 7; ++cx)
- _openObjects[cx] = 0;
+ for (int i = 1; i <= 6; ++i)
+ _openObjects[i] = 0;
_openObjCount = 0;
}
@@ -2997,9 +2997,9 @@ void MortevielleEngine::drawPicture() {
draw(0, 12);
prepareScreenType1();
if ((_caff < 30) || (_caff > 32)) {
- for (int cx = 1; cx <= 6; ++cx) {
- if (_openObjects[cx] != 0)
- displayAnimFrame(1, _openObjects[cx]);
+ for (int i = 1; i <= 6; ++i) {
+ if (_openObjects[i] != 0)
+ displayAnimFrame(1, _openObjects[i]);
}
if (_caff == ATTIC) {
@@ -3230,11 +3230,11 @@ L1:
_coreVar._faithScore += 3 * (_coreVar._faithScore / 10);
exitRoom();
_menu.setDestinationText(LANDING);
- int cx = convertBitIndexToCharacterIndex(_currBitIndex);
- _caff = 69 + cx;
+ int charIdx = convertBitIndexToCharacterIndex(_currBitIndex);
+ _caff = 69 + charIdx;
_crep = _caff;
_currMenu = MENU_DISCUSS;
- _currAction = (_menu._discussMenu[cx]._menuId << 8) | _menu._discussMenu[cx]._actionId;
+ _currAction = (_menu._discussMenu[charIdx]._menuId << 8) | _menu._discussMenu[charIdx]._actionId;
_syn = true;
_col = true;
} else {