[Scummvm-cvs-logs] scummvm master -> 9ce5f1c90cf885a35758a804f5e6795058166211

Strangerke Strangerke at scummvm.org
Fri Mar 7 19:23:15 CET 2014


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

Summary:
d0b9a52f64 TUCKER: Some more renaming
9ce5f1c90c TUCKER: Use a boolean for drawFlag instead of an integer


Commit: d0b9a52f64d6a933e3ea21960e2e98e4ae4d655c
    https://github.com/scummvm/scummvm/commit/d0b9a52f64d6a933e3ea21960e2e98e4ae4d655c
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-03-07T19:21:11+01:00

Commit Message:
TUCKER: Some more renaming

Changed paths:
    engines/tucker/locations.cpp
    engines/tucker/resource.cpp
    engines/tucker/sequences.cpp
    engines/tucker/tucker.cpp
    engines/tucker/tucker.h



diff --git a/engines/tucker/locations.cpp b/engines/tucker/locations.cpp
index 0dfbc95..bb75f46 100644
--- a/engines/tucker/locations.cpp
+++ b/engines/tucker/locations.cpp
@@ -538,12 +538,12 @@ void TuckerEngine::execData3PreUpdate_locationNum6Helper1() {
 		x2 = 15 - _flagsTable[27];
 	}
 	for (int i = 0; i < x1; ++i) {
-		execData3PreUpdate_locationNum6Helper2(20 * 640 + 325 + i * 8, _data3GfxBuf + _dataTable[238].sourceOffset);
-		execData3PreUpdate_locationNum6Helper2(20 * 640 + 445 - i * 8, _data3GfxBuf + _dataTable[238].sourceOffset);
+		execData3PreUpdate_locationNum6Helper2(20 * 640 + 325 + i * 8, _data3GfxBuf + _dataTable[238]._sourceOffset);
+		execData3PreUpdate_locationNum6Helper2(20 * 640 + 445 - i * 8, _data3GfxBuf + _dataTable[238]._sourceOffset);
 	}
 	for (int i = 0; i < x2; ++i) {
-		execData3PreUpdate_locationNum6Helper3(20 * 640 + 325 + x1 * 8 + i * 4, _data3GfxBuf + _dataTable[238].sourceOffset);
-		execData3PreUpdate_locationNum6Helper3(20 * 640 + 449 - x1 * 8 - i * 4, _data3GfxBuf + _dataTable[238].sourceOffset);
+		execData3PreUpdate_locationNum6Helper3(20 * 640 + 325 + x1 * 8 + i * 4, _data3GfxBuf + _dataTable[238]._sourceOffset);
+		execData3PreUpdate_locationNum6Helper3(20 * 640 + 449 - x1 * 8 - i * 4, _data3GfxBuf + _dataTable[238]._sourceOffset);
 	}
 	addDirtyRect(0, 20, 640, 51);
 }
@@ -1008,11 +1008,11 @@ void TuckerEngine::execData3PreUpdate_locationNum14() {
 		}
 		const int num = _updateLocation14ObjNum[i];
 		if (num > 0) {
-			const int w = _dataTable[num].xSize;
-			const int h = _dataTable[num].ySize;
+			const int w = _dataTable[num]._xSize;
+			const int h = _dataTable[num]._ySize;
 			const int x = _updateLocationXPosTable2[i] - w / 2;
 			const int y = _updateLocationYPosTable2[i] / 16 - h / 2;
-			Graphics::decodeRLE_248(_locationBackgroundGfxBuf + y * 640 + x, _data3GfxBuf + _dataTable[num].sourceOffset, w, h, 0, 0, false);
+			Graphics::decodeRLE_248(_locationBackgroundGfxBuf + y * 640 + x, _data3GfxBuf + _dataTable[num]._sourceOffset, w, h, 0, 0, false);
 			addDirtyRect(x, y, w, h);
 		}
 	}
diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp
index 306b616..00ce00b 100644
--- a/engines/tucker/resource.cpp
+++ b/engines/tucker/resource.cpp
@@ -571,12 +571,12 @@ void TuckerEngine::loadData() {
 			const int x = t.getNextInteger();
 			const int y = t.getNextInteger();
 			Data *d = &_dataTable[_dataCount];
-			d->sourceOffset = y * 320 + x;
-			d->xSize = t.getNextInteger();
-			d->ySize = t.getNextInteger();
-			d->xDest = t.getNextInteger();
-			d->yDest = t.getNextInteger();
-			d->index = count;
+			d->_sourceOffset = y * 320 + x;
+			d->_xSize = t.getNextInteger();
+			d->_ySize = t.getNextInteger();
+			d->_xDest = t.getNextInteger();
+			d->_yDest = t.getNextInteger();
+			d->_index = count;
 		}
 		++objNum;
 		++count;
@@ -592,9 +592,9 @@ void TuckerEngine::loadData() {
 
 int TuckerEngine::loadDataHelper(int offset, int index) {
 	for (int i = 0; i < _dataCount + 1; ++i) {
-		if (_dataTable[i].index == index) {
-			int sz = Graphics::encodeRLE(_loadTempBuf + _dataTable[i].sourceOffset, _data3GfxBuf + offset, _dataTable[i].xSize, _dataTable[i].ySize);
-			_dataTable[i].sourceOffset = offset;
+		if (_dataTable[i]._index == index) {
+			int sz = Graphics::encodeRLE(_loadTempBuf + _dataTable[i]._sourceOffset, _data3GfxBuf + offset, _dataTable[i]._xSize, _dataTable[i]._ySize);
+			_dataTable[i]._sourceOffset = offset;
 			offset += sz;
 		}
 	}
@@ -626,7 +626,7 @@ void TuckerEngine::loadData3() {
 			}
 			assert(_locationAnimationsCount < kLocationAnimationsTableSize);
 			LocationAnimation *d = &_locationAnimationsTable[_locationAnimationsCount++];
-			d->graphicNum = num;
+			d->_graphicNum = num;
 			const int seqNum = t.getNextInteger();
 			if (seqNum > 0) {
 				int anim = 0;
@@ -636,22 +636,22 @@ void TuckerEngine::loadData3() {
 					}
 					++anim;
 				}
-				d->animCurrentCounter = d->animInitCounter = anim;
+				d->_animCurrentCounter = d->_animInitCounter = anim;
 				while (_staticData3Table[anim + 1] != 999) {
 					++anim;
 				}
-				d->animLastCounter = anim;
+				d->_animLastCounter = anim;
 			} else {
-				d->animLastCounter = 0;
+				d->_animLastCounter = 0;
 			}
-			d->getFlag = t.getNextInteger();
-			d->inventoryNum = t.getNextInteger();
-			d->flagNum = t.getNextInteger();
-			d->flagValue = t.getNextInteger();
-			d->selectable = t.getNextInteger();
-			d->standX = t.getNextInteger();
-			d->standY = t.getNextInteger();
-			d->drawFlag = 0;
+			d->_getFlag = t.getNextInteger();
+			d->_inventoryNum = t.getNextInteger();
+			d->_flagNum = t.getNextInteger();
+			d->_flagValue = t.getNextInteger();
+			d->_selectable = t.getNextInteger();
+			d->_standX = t.getNextInteger();
+			d->_standY = t.getNextInteger();
+			d->_drawFlag = 0;
 		}
 	}
 }
diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp
index 4b36a13..cfc3503 100644
--- a/engines/tucker/sequences.cpp
+++ b/engines/tucker/sequences.cpp
@@ -460,10 +460,10 @@ int TuckerEngine::handleSpecialObjectSelectionSequence() {
 		}
 		if (_partNum == 3 && _selectedObjectNum == 45) {
 			for (int i = 0; i < 13; ++i) {
-				const int offset = _dataTable[204 + i].yDest * 640 + _dataTable[204 + i].xDest;
+				const int offset = _dataTable[204 + i]._yDest * 640 + _dataTable[204 + i]._xDest;
 				static const int itemsTable[] = { 15, 44, 25, 19, 21, 24, 12, 27, 20, 29, 35, 23, 3 };
 				if (_inventoryItemsState[itemsTable[i]] > 1) {
-					Graphics::decodeRLE(_locationBackgroundGfxBuf + _scrollOffset + offset, _data3GfxBuf + _dataTable[204 + i].sourceOffset, _dataTable[204 + i].xSize, _dataTable[204 + i].ySize);
+					Graphics::decodeRLE(_locationBackgroundGfxBuf + _scrollOffset + offset, _data3GfxBuf + _dataTable[204 + i]._sourceOffset, _dataTable[204 + i]._xSize, _dataTable[204 + i]._ySize);
 				}
 			}
 		}
diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp
index 4620bd3..4d4663e 100644
--- a/engines/tucker/tucker.cpp
+++ b/engines/tucker/tucker.cpp
@@ -829,8 +829,8 @@ void TuckerEngine::updateCharPosition() {
 			updateCharPositionHelper();
 			return;
 		case 1:
-			if (_locationAnimationsTable[_selectedCharacter2Num].getFlag == 1) {
-				_speechSoundNum = _speechSoundBaseNum + _locationAnimationsTable[_selectedCharacter2Num].inventoryNum;
+			if (_locationAnimationsTable[_selectedCharacter2Num]._getFlag == 1) {
+				_speechSoundNum = _speechSoundBaseNum + _locationAnimationsTable[_selectedCharacter2Num]._inventoryNum;
 				_characterSpeechDataPtr = _ptTextBuf;
 				updateCharPositionHelper();
 				return;
@@ -1200,12 +1200,12 @@ void TuckerEngine::setSoundVolumeDistance() {
 void TuckerEngine::updateData3DrawFlag() {
 	for (int i = 0; i < _locationAnimationsCount; ++i) {
 		LocationAnimation *a = &_locationAnimationsTable[i];
-		if (a->flagNum > 0 && a->flagValue != _flagsTable[a->flagNum]) {
-			a->drawFlag = 0;
-		} else if (a->getFlag == 0) {
-			a->drawFlag = 1;
+		if (a->_flagNum > 0 && a->_flagValue != _flagsTable[a->_flagNum]) {
+			a->_drawFlag = 0;
+		} else if (a->_getFlag == 0) {
+			a->_drawFlag = 1;
 		} else {
-			a->drawFlag = (_inventoryItemsState[a->inventoryNum] == 0) ? 1 : 0;
+			a->_drawFlag = (_inventoryItemsState[a->_inventoryNum] == 0) ? 1 : 0;
 		}
 	}
 }
@@ -1214,26 +1214,26 @@ void TuckerEngine::updateData3() {
 	updateData3DrawFlag();
 	for (int i = 0; i < _locationAnimationsCount; ++i) {
 		LocationAnimation *a = &_locationAnimationsTable[i];
-		if (a->animLastCounter != 0 && a->drawFlag != 0) {
-			if (a->animLastCounter == a->animCurrentCounter) {
-				a->animCurrentCounter = a->animInitCounter;
+		if (a->_animLastCounter != 0 && a->_drawFlag != 0) {
+			if (a->_animLastCounter == a->_animCurrentCounter) {
+				a->_animCurrentCounter = a->_animInitCounter;
 			} else {
-				++a->animCurrentCounter;
+				++a->_animCurrentCounter;
 			}
-			const int index = a->animCurrentCounter;
+			const int index = a->_animCurrentCounter;
 			if (_staticData3Table[index] == 998) {
 				_flagsTable[_staticData3Table[index + 1]] = _staticData3Table[index + 2];
-				a->animCurrentCounter = a->animInitCounter;
-				a->drawFlag = 0;
+				a->_animCurrentCounter = a->_animInitCounter;
+				a->_drawFlag = 0;
 			}
 			if (_locationNum == 24 && i == 0) {
 				// workaround bug #2872385: update fish animation sequence for correct
 				// position in aquarium.
-				if (a->animInitCounter == 505 && a->animCurrentCounter == 513) {
-					a->animCurrentCounter = 525;
+				if (a->_animInitCounter == 505 && a->_animCurrentCounter == 513) {
+					a->_animCurrentCounter = 525;
 				}
 			}
-			a->graphicNum = _staticData3Table[a->animCurrentCounter];
+			a->_graphicNum = _staticData3Table[a->_animCurrentCounter];
 		}
 	}
 	updateData3DrawFlag();
@@ -1532,11 +1532,11 @@ void TuckerEngine::updateSoundsTypes3_4() {
 
 void TuckerEngine::drawData3() {
 	for (int i = 0; i < _locationAnimationsCount; ++i) {
-		if (_locationAnimationsTable[i].drawFlag != 0) {
-			int num = _locationAnimationsTable[i].graphicNum;
+		if (_locationAnimationsTable[i]._drawFlag != 0) {
+			int num = _locationAnimationsTable[i]._graphicNum;
 			const Data *d = &_dataTable[num];
-			Graphics::decodeRLE(_locationBackgroundGfxBuf + d->yDest * 640 + d->xDest, _data3GfxBuf + d->sourceOffset, d->xSize, d->ySize);
-			addDirtyRect(d->xDest, d->yDest, d->xSize, d->ySize);
+			Graphics::decodeRLE(_locationBackgroundGfxBuf + d->_yDest * 640 + d->_xDest, _data3GfxBuf + d->_sourceOffset, d->_xSize, d->_ySize);
+			addDirtyRect(d->_xDest, d->_yDest, d->_xSize, d->_ySize);
 		}
 	}
 }
@@ -3433,8 +3433,8 @@ void TuckerEngine::setSelectedObjectKey() {
 	} else {
 		switch (_selectedObjectType) {
 		case 1:
-			_selectedObject.xPos = _locationAnimationsTable[_selectedCharacterNum].standX;
-			_selectedObject.yPos = _locationAnimationsTable[_selectedCharacterNum].standY;
+			_selectedObject.xPos = _locationAnimationsTable[_selectedCharacterNum]._standX;
+			_selectedObject.yPos = _locationAnimationsTable[_selectedCharacterNum]._standY;
 			break;
 		case 2:
 			_selectedObject.xPos = _charPosTable[_selectedCharacterNum]._xWalkTo;
@@ -3614,29 +3614,29 @@ int TuckerEngine::setLocationAnimationUnderCursor() {
 		return -1;
 	}
 	for (int i = _locationAnimationsCount - 1; i >= 0; --i) {
-		if (_locationAnimationsTable[i].drawFlag == 0) {
+		if (_locationAnimationsTable[i]._drawFlag == 0) {
 			continue;
 		}
-		int num = _locationAnimationsTable[i].graphicNum;
-		if (_mousePosX + _scrollOffset + 1 <= _dataTable[num].xDest) {
+		int num = _locationAnimationsTable[i]._graphicNum;
+		if (_mousePosX + _scrollOffset + 1 <= _dataTable[num]._xDest) {
 			continue;
 		}
-		if (_mousePosX + _scrollOffset >= _dataTable[num].xDest + _dataTable[num].xSize) {
+		if (_mousePosX + _scrollOffset >= _dataTable[num]._xDest + _dataTable[num]._xSize) {
 			continue;
 		}
-		if (_mousePosY <= _dataTable[num].yDest) {
+		if (_mousePosY <= _dataTable[num]._yDest) {
 			continue;
 		}
-		if (_mousePosY >= _dataTable[num].yDest + _dataTable[num].ySize) {
+		if (_mousePosY >= _dataTable[num]._yDest + _dataTable[num]._ySize) {
 			continue;
 		}
-		if (_locationAnimationsTable[i].selectable == 0) {
+		if (_locationAnimationsTable[i]._selectable == 0) {
 			return -1;
 		}
 		_selectedObjectType = 1;
 		_selectedCharacterNum = i;
 		_selectedCharacter2Num = i;
-		return _locationAnimationsTable[i].selectable;
+		return _locationAnimationsTable[i]._selectable;
 	}
 	return -1;
 }
diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h
index 777200e..6618b08 100644
--- a/engines/tucker/tucker.h
+++ b/engines/tucker/tucker.h
@@ -114,32 +114,32 @@ struct SpriteFrame {
 
 struct SpriteAnimation {
 	int _numParts;
-	int _rotateFlag;
+	int _rotateFlag;  // Useless variable
 	int _firstFrameIndex;
 };
 
 struct Data {
-	int sourceOffset;
-	int xSize;
-	int ySize;
-	int xDest;
-	int yDest;
-	int index;
+	int _sourceOffset;
+	int _xSize;
+	int _ySize;
+	int _xDest;
+	int _yDest;
+	int _index;
 };
 
 struct LocationAnimation {
-	int graphicNum;
-	int animInitCounter;
-	int animCurrentCounter;
-	int animLastCounter;
-	int getFlag;
-	int inventoryNum;
-	int flagNum;
-	int flagValue;
-	int selectable;
-	int standX;
-	int standY;
-	int drawFlag;
+	int _graphicNum;
+	int _animInitCounter;
+	int _animCurrentCounter;
+	int _animLastCounter;
+	int _getFlag;
+	int _inventoryNum;
+	int _flagNum;
+	int _flagValue;
+	int _selectable;
+	int _standX;
+	int _standY;
+	int _drawFlag;
 };
 
 struct LocationObject {


Commit: 9ce5f1c90cf885a35758a804f5e6795058166211
    https://github.com/scummvm/scummvm/commit/9ce5f1c90cf885a35758a804f5e6795058166211
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-03-07T19:21:13+01:00

Commit Message:
TUCKER: Use a boolean for drawFlag instead of an integer

Changed paths:
    engines/tucker/resource.cpp
    engines/tucker/tucker.cpp
    engines/tucker/tucker.h



diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp
index 00ce00b..af69651 100644
--- a/engines/tucker/resource.cpp
+++ b/engines/tucker/resource.cpp
@@ -651,7 +651,7 @@ void TuckerEngine::loadData3() {
 			d->_selectable = t.getNextInteger();
 			d->_standX = t.getNextInteger();
 			d->_standY = t.getNextInteger();
-			d->_drawFlag = 0;
+			d->_drawFlag = false;
 		}
 	}
 }
diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp
index 4d4663e..130c417 100644
--- a/engines/tucker/tucker.cpp
+++ b/engines/tucker/tucker.cpp
@@ -1201,11 +1201,11 @@ void TuckerEngine::updateData3DrawFlag() {
 	for (int i = 0; i < _locationAnimationsCount; ++i) {
 		LocationAnimation *a = &_locationAnimationsTable[i];
 		if (a->_flagNum > 0 && a->_flagValue != _flagsTable[a->_flagNum]) {
-			a->_drawFlag = 0;
+			a->_drawFlag = false;
 		} else if (a->_getFlag == 0) {
-			a->_drawFlag = 1;
+			a->_drawFlag = true;
 		} else {
-			a->_drawFlag = (_inventoryItemsState[a->_inventoryNum] == 0) ? 1 : 0;
+			a->_drawFlag = (_inventoryItemsState[a->_inventoryNum] == 0);
 		}
 	}
 }
@@ -1214,7 +1214,7 @@ void TuckerEngine::updateData3() {
 	updateData3DrawFlag();
 	for (int i = 0; i < _locationAnimationsCount; ++i) {
 		LocationAnimation *a = &_locationAnimationsTable[i];
-		if (a->_animLastCounter != 0 && a->_drawFlag != 0) {
+		if (a->_animLastCounter != 0 && a->_drawFlag) {
 			if (a->_animLastCounter == a->_animCurrentCounter) {
 				a->_animCurrentCounter = a->_animInitCounter;
 			} else {
@@ -1224,7 +1224,7 @@ void TuckerEngine::updateData3() {
 			if (_staticData3Table[index] == 998) {
 				_flagsTable[_staticData3Table[index + 1]] = _staticData3Table[index + 2];
 				a->_animCurrentCounter = a->_animInitCounter;
-				a->_drawFlag = 0;
+				a->_drawFlag = false;
 			}
 			if (_locationNum == 24 && i == 0) {
 				// workaround bug #2872385: update fish animation sequence for correct
@@ -1532,7 +1532,7 @@ void TuckerEngine::updateSoundsTypes3_4() {
 
 void TuckerEngine::drawData3() {
 	for (int i = 0; i < _locationAnimationsCount; ++i) {
-		if (_locationAnimationsTable[i]._drawFlag != 0) {
+		if (_locationAnimationsTable[i]._drawFlag) {
 			int num = _locationAnimationsTable[i]._graphicNum;
 			const Data *d = &_dataTable[num];
 			Graphics::decodeRLE(_locationBackgroundGfxBuf + d->_yDest * 640 + d->_xDest, _data3GfxBuf + d->_sourceOffset, d->_xSize, d->_ySize);
@@ -3614,9 +3614,9 @@ int TuckerEngine::setLocationAnimationUnderCursor() {
 		return -1;
 	}
 	for (int i = _locationAnimationsCount - 1; i >= 0; --i) {
-		if (_locationAnimationsTable[i]._drawFlag == 0) {
+		if (!_locationAnimationsTable[i]._drawFlag)
 			continue;
-		}
+
 		int num = _locationAnimationsTable[i]._graphicNum;
 		if (_mousePosX + _scrollOffset + 1 <= _dataTable[num]._xDest) {
 			continue;
diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h
index 6618b08..dc2e785 100644
--- a/engines/tucker/tucker.h
+++ b/engines/tucker/tucker.h
@@ -139,7 +139,7 @@ struct LocationAnimation {
 	int _selectable;
 	int _standX;
 	int _standY;
-	int _drawFlag;
+	bool _drawFlag;
 };
 
 struct LocationObject {






More information about the Scummvm-git-logs mailing list