[Scummvm-cvs-logs] scummvm master -> c79ce89680d2c46e468152791a46f2700d04b336

Strangerke Strangerke at scummvm.org
Sat Aug 3 12:10:21 CEST 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c79ce89680 MORTEVIELLE: Rework code using _openObjects


Commit: c79ce89680d2c46e468152791a46f2700d04b336
    https://github.com/scummvm/scummvm/commit/c79ce89680d2c46e468152791a46f2700d04b336
Author: Strangerke (strangerke at scummvm.org)
Date: 2013-08-03T03:09:13-07:00

Commit Message:
MORTEVIELLE: Rework code using _openObjects

Changed paths:
    engines/mortevielle/actions.cpp
    engines/mortevielle/mortevielle.h
    engines/mortevielle/utils.cpp



diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp
index 5738a8f..f9426de 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 795bac5..6293513 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 8fa6089..4985a60 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 {






More information about the Scummvm-git-logs mailing list