[Scummvm-cvs-logs] CVS: scummvm/scumm costume.cpp,1.139,1.140 akos.cpp,1.151,1.152

Max Horn fingolfin at users.sourceforge.net
Thu Sep 2 16:18:01 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21654

Modified Files:
	costume.cpp akos.cpp 
Log Message:
Cleanup: renamed 'value' to 'scaletableSize' and made akos codec1 & the old costume code look even more alike

Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -d -r1.139 -r1.140
--- costume.cpp	10 Aug 2004 02:17:34 -0000	1.139
+++ costume.cpp	2 Sep 2004 23:16:58 -0000	1.140
@@ -74,12 +74,12 @@
 	byte drawFlag = 1;
 	bool use_scaling;
 	byte startScaleIndexX;
-	byte newAmiCost;
 	int ex1, ex2;
 	Common::Rect rect;
 	int step;
 	
-	newAmiCost = (_vm->_version == 5) && (_vm->_features & GF_AMIGA);
+	const int scaletableSize = 128;
+	const bool newAmiCost = (_vm->_version == 5) && (_vm->_features & GF_AMIGA);
 
 	CHECK_HEAP
 
@@ -89,7 +89,7 @@
 		v1.mask = 7;
 		v1.shr = 3;
 	} else {
-		v1.mask = 0xF;
+		v1.mask = 15;
 		v1.shr = 4;
 	}
 
@@ -106,11 +106,11 @@
 		}
 	}
 
+	use_scaling = (_scaleX != 0xFF) || (_scaleY != 0xFF);
+
 	v1.x = _actorX;
 	v1.y = _actorY;
 
-	use_scaling = (_scaleX != 0xFF) || (_scaleY != 0xFF);
-
 	if (use_scaling) {
 
 		/* Scale direction */
@@ -122,13 +122,13 @@
 
 		if (_mirror) {
 			/* Adjust X position */
-			startScaleIndexX = _scaleIndexX = 128 - xmoveCur;
+			startScaleIndexX = _scaleIndexX = scaletableSize - xmoveCur;
 			for (i = 0; i < xmoveCur; i++) {
-				if (cost_scaleTable[_scaleIndexX++] < _scaleX)
+				if (v1.scaletable[_scaleIndexX++] < _scaleX)
 					v1.x -= v1.scaleXstep;
 			}
 
-			rect.right = rect.left = v1.x;
+			rect.left = rect.right = v1.x;
 
 			_scaleIndexX = startScaleIndexX;
 			for (i = 0; i < _width; i++) {
@@ -136,19 +136,19 @@
 					skip++;
 					startScaleIndexX = _scaleIndexX;
 				}
-				if (cost_scaleTable[_scaleIndexX++] < _scaleX)
+				if (v1.scaletable[_scaleIndexX++] < _scaleX)
 					rect.right++;
 			}
 		} else {
 			/* No mirror */
 			/* Adjust X position */
-			startScaleIndexX = _scaleIndexX = xmoveCur + 128;
+			startScaleIndexX = _scaleIndexX = xmoveCur + scaletableSize;
 			for (i = 0; i < xmoveCur; i++) {
-				if (cost_scaleTable[_scaleIndexX--] < _scaleX)
+				if (v1.scaletable[_scaleIndexX--] < _scaleX)
 					v1.x += v1.scaleXstep;
 			}
 
-			rect.right = rect.left = v1.x;
+			rect.left = rect.right = v1.x;
 
 			_scaleIndexX = startScaleIndexX;
 			for (i = 0; i < _width; i++) {
@@ -156,7 +156,7 @@
 					startScaleIndexX = _scaleIndexX;
 					skip++;
 				}
-				if (cost_scaleTable[_scaleIndexX--] < _scaleX)
+				if (v1.scaletable[_scaleIndexX--] < _scaleX)
 					rect.left--;
 			}
 		}
@@ -171,20 +171,20 @@
 			step = 1;
 		}
 
-		_scaleIndexY = 128 - ymoveCur;
+		_scaleIndexY = scaletableSize - ymoveCur;
 		for (i = 0; i < ymoveCur; i++) {
-			if (cost_scaleTable[_scaleIndexY++] < _scaleY)
+			if (v1.scaletable[_scaleIndexY++] < _scaleY)
 				v1.y -= step;
 		}
 
 		rect.top = rect.bottom = v1.y;
-		_scaleIndexY = 128 - ymoveCur;
+		_scaleIndexY = scaletableSize - ymoveCur;
 		for (i = 0; i < _height; i++) {
-			if (cost_scaleTable[_scaleIndexY++] < _scaleY)
+			if (v1.scaletable[_scaleIndexY++] < _scaleY)
 				rect.bottom++;
 		}
 
-		_scaleIndexY = 128 - ymoveCur;
+		_scaleIndexY = scaletableSize - ymoveCur;
 	} else {
 		if (!_mirror)
 			xmoveCur = -xmoveCur;
@@ -498,14 +498,14 @@
 		if (!len)
 			len = *src++;
 		do {
-			if (_scaleY == 255 || cost_scaleTable[_scaleIndexY] < _scaleY) {
+			if (_scaleY == 255 || v1.scaletable[_scaleIndexY] < _scaleY) {
 				masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && (mask[0] & maskbit));
 				
 				if (color && v1.x >= 0 && v1.x < _outwidth && !masked) {
 					*dst = _palette[color];
 				}
 
-				if (_scaleX == 255 || cost_scaleTable[_scaleIndexX] < _scaleX) {
+				if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
 					v1.x += v1.scaleXstep;
 					dst += v1.scaleXstep;
 					maskbit = revBitMask[v1.x & 7];

Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -d -r1.151 -r1.152
--- akos.cpp	31 Aug 2004 08:57:36 -0000	1.151
+++ akos.cpp	2 Sep 2004 23:16:58 -0000	1.152
@@ -604,16 +604,15 @@
 #endif
 
 byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) {
-	int num_colors, value;
+	int num_colors;
 	bool use_scaling;
 	int i, j;
 	int skip = 0, startScaleIndexX, startScaleIndexY;
 	Common::Rect rect;
-	int cur_x, cur_y;
 	int step;
 	byte drawFlag = 1;
 
-	value = (_vm->_features & GF_HUMONGOUS) ? 0x80 : 0x180;
+	const int scaletableSize = (_vm->_features & GF_HUMONGOUS) ? 128 : 384;
 
 	/* implement custom scale table */
 	v1.scaletable = (_vm->_features & GF_HUMONGOUS) ? oldScaleTable : defaultScaleTable;
@@ -636,8 +635,8 @@
 
 	use_scaling = (_scaleX != 0xFF) || (_scaleY != 0xFF);
 
-	cur_x = _actorX;
-	cur_y = _actorY;
+	v1.x = _actorX;
+	v1.y = _actorY;
 
 	if (use_scaling) {
 
@@ -650,13 +649,13 @@
 
 		if (_mirror) {
 			/* Adjust X position */
-			startScaleIndexX = j = value - xmoveCur;
+			startScaleIndexX = j = scaletableSize - xmoveCur;
 			for (i = 0; i < xmoveCur; i++) {
 				if (v1.scaletable[j++] < _scaleX)
-					cur_x -= v1.scaleXstep;
+					v1.x -= v1.scaleXstep;
 			}
 
-			rect.left = rect.right = cur_x;
+			rect.left = rect.right = v1.x;
 
 			j = startScaleIndexX;
 			for (i = 0, skip = 0; i < _width; i++) {
@@ -670,13 +669,13 @@
 		} else {
 			/* No mirror */
 			/* Adjust X position */
-			startScaleIndexX = j = value + xmoveCur;
+			startScaleIndexX = j = scaletableSize + xmoveCur;
 			for (i = 0; i < xmoveCur; i++) {
 				if (v1.scaletable[j--] < _scaleX)
-					cur_x += v1.scaleXstep;
+					v1.x += v1.scaleXstep;
 			}
 
-			rect.left = rect.right = cur_x;
+			rect.left = rect.right = v1.x;
 
 			j = startScaleIndexX;
 			for (i = 0; i < _width; i++) {
@@ -699,40 +698,40 @@
 			step = -step;
 		}
 
-		startScaleIndexY = value - ymoveCur;
+		startScaleIndexY = scaletableSize - ymoveCur;
 		for (i = 0; i < ymoveCur; i++) {
 			if (v1.scaletable[startScaleIndexY++] < _scaleY)
-				cur_y -= step;
+				v1.y -= step;
 		}
 
-		rect.top = rect.bottom = cur_y;
-		startScaleIndexY = value - ymoveCur;
+		rect.top = rect.bottom = v1.y;
+		startScaleIndexY = scaletableSize - ymoveCur;
 		for (i = 0; i < _height; i++) {
 			if (v1.scaletable[startScaleIndexY++] < _scaleY)
 				rect.bottom++;
 		}
 
-		startScaleIndexY = value - ymoveCur;
+		startScaleIndexY = scaletableSize - ymoveCur;
 	} else {
 		if (!_mirror)
 			xmoveCur = -xmoveCur;
 
-		cur_x += xmoveCur;
-		cur_y += ymoveCur;
+		v1.x += xmoveCur;
+		v1.y += ymoveCur;
 
 		if (_mirror) {
-			rect.left = cur_x;
-			rect.right = cur_x + _width;
+			rect.left = v1.x;
+			rect.right = v1.x + _width;
 		} else {
-			rect.right = cur_x;
-			rect.left = cur_x - _width;
+			rect.left = v1.x - _width;
+			rect.right = v1.x;
 		}
 
-		rect.top = cur_y;
-		rect.bottom = cur_y + _height;
+		rect.top = v1.y;
+		rect.bottom = rect.top + _height;
 
-		startScaleIndexX = value;
-		startScaleIndexY = value;
+		startScaleIndexX = scaletableSize;
+		startScaleIndexY = scaletableSize;
 	}
 
 	v1.scaleXindex = startScaleIndexX;
@@ -756,11 +755,11 @@
 
 	if (_mirror) {
 		if (!use_scaling)
-			skip = -cur_x;
+			skip = -v1.x;
 		if (skip > 0) {
 			v1.skip_width -= skip;
 			codec1_ignorePakCols(skip);
-			cur_x = 0;
+			v1.x = 0;
 		} else {
 			skip = rect.right - _outwidth;
 			if (skip <= 0) {
@@ -775,7 +774,7 @@
 		if (skip > 0) {
 			v1.skip_width -= skip;
 			codec1_ignorePakCols(skip);
-			cur_x = _outwidth - 1;
+			v1.x = _outwidth - 1;
 		} else {
 			skip = -1 - rect.left;
 			if (skip <= 0)
@@ -785,9 +784,6 @@
 		}
 	}
 
-	v1.x = cur_x;
-	v1.y = cur_y;
-
 	if (v1.skip_width <= 0 || _height <= 0)
 		return 0;
 





More information about the Scummvm-git-logs mailing list