[Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.60,1.61 akos.h,1.17,1.18 costume.cpp,1.45,1.46

Max Horn fingolfin at users.sourceforge.net
Thu May 29 03:17:02 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv28270

Modified Files:
	akos.cpp akos.h costume.cpp 
Log Message:
more costume cleanup

Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- akos.cpp	29 May 2003 02:46:05 -0000	1.60
+++ akos.cpp	29 May 2003 10:16:00 -0000	1.61
@@ -237,6 +237,7 @@
 	const CostumeInfo *costumeInfo;
 	uint i, extra;
 	byte result = 0;
+	int xmoveCur, ymoveCur;
 
 	if (!cost.active[limb] || cost.stopped & (1 << limb))
 		return 0;
@@ -261,20 +262,20 @@
 
 		_width = READ_LE_UINT16(&costumeInfo->width);
 		_height = READ_LE_UINT16(&costumeInfo->height);
-		_xmoveCur = _xmove + (int16)READ_LE_UINT16(&costumeInfo->rel_x);
-		_ymoveCur = _ymove + (int16)READ_LE_UINT16(&costumeInfo->rel_y);
+		xmoveCur = _xmove + (int16)READ_LE_UINT16(&costumeInfo->rel_x);
+		ymoveCur = _ymove + (int16)READ_LE_UINT16(&costumeInfo->rel_y);
 		_xmove += (int16)READ_LE_UINT16(&costumeInfo->move_x);
 		_ymove -= (int16)READ_LE_UINT16(&costumeInfo->move_y);
 
 		switch (codec) {
 		case 1:
-			result |= codec1();
+			result |= codec1(xmoveCur, ymoveCur);
 			break;
 		case 5:
-			result |= codec5();
+			result |= codec5(xmoveCur, ymoveCur);
 			break;
 		case 16:
-			result |= codec16();
+			result |= codec16(xmoveCur, ymoveCur);
 			break;
 		default:
 			error("akos_drawCostumeChannel: invalid codec %d", codec);
@@ -295,20 +296,20 @@
 			_width = READ_LE_UINT16(&costumeInfo->width);
 			_height = READ_LE_UINT16(&costumeInfo->height);
 
-			_xmoveCur = _xmove + (int16)READ_LE_UINT16(p + 0);
-			_ymoveCur = _ymove + (int16)READ_LE_UINT16(p + 2);
+			xmoveCur = _xmove + (int16)READ_LE_UINT16(p + 0);
+			ymoveCur = _ymove + (int16)READ_LE_UINT16(p + 2);
 
 			p += (p[4] & 0x80) ? 6 : 5;
 
 			switch (codec) {
 			case 1:
-				result |= codec1();
+				result |= codec1(xmoveCur, ymoveCur);
 				break;
 			case 5:
-				result |= codec5();
+				result |= codec5(xmoveCur, ymoveCur);
 				break;
 			case 16:
-				result |= codec16();
+				result |= codec16(xmoveCur, ymoveCur);
 				break;
 			default:
 				error("akos_drawCostumeChannel: invalid codec %d", codec);
@@ -625,7 +626,7 @@
 };
 #endif
 
-byte AkosRenderer::codec1() {
+byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) {
 	int num_colors;
 	bool use_scaling;
 	int i, j;
@@ -668,16 +669,16 @@
 
 		/* Scale direction */
 		v1.scaleXstep = -1;
-		if (_xmoveCur < 0) {
-			_xmoveCur = -_xmoveCur;
+		if (xmoveCur < 0) {
+			xmoveCur = -xmoveCur;
 			v1.scaleXstep = 1;
 		}
 
 		if (_mirror) {
 			/* Adjust X position */
-			startScaleIndexX = 0x180 - _xmoveCur;
+			startScaleIndexX = 0x180 - xmoveCur;
 			j = startScaleIndexX;
-			for (i = 0; i < _xmoveCur; i++) {
+			for (i = 0; i < xmoveCur; i++) {
 				if (v1.scaletable[j++] < _scaleX)
 					cur_x -= v1.scaleXstep;
 			}
@@ -696,9 +697,9 @@
 		} else {
 			/* No mirror */
 			/* Adjust X position */
-			startScaleIndexX = 0x180 + _xmoveCur;
+			startScaleIndexX = 0x180 + xmoveCur;
 			j = startScaleIndexX;
-			for (i = 0; i < _xmoveCur; i++) {
+			for (i = 0; i < xmoveCur; i++) {
 				if (v1.scaletable[j++] < _scaleX)
 					cur_x += v1.scaleXstep;
 			}
@@ -720,31 +721,31 @@
 			skip--;
 
 		step = -1;
-		if (_ymoveCur < 0) {
-			_ymoveCur = -_ymoveCur;
+		if (ymoveCur < 0) {
+			ymoveCur = -ymoveCur;
 			step = -step;
 		}
 
-		tmp_y = 0x180 - _ymoveCur;
-		for (i = 0; i < _ymoveCur; i++) {
+		tmp_y = 0x180 - ymoveCur;
+		for (i = 0; i < ymoveCur; i++) {
 			if (v1.scaletable[tmp_y++] < _scaleY)
 				cur_y -= step;
 		}
 
 		y_top = y_bottom = cur_y;
-		tmp_y = 0x180 - _ymoveCur;
+		tmp_y = 0x180 - ymoveCur;
 		for (i = 0; i < _height; i++) {
 			if (v1.scaletable[tmp_y++] < _scaleY)
 				y_bottom++;
 		}
 
-		tmp_y = 0x180 - _ymoveCur;
+		tmp_y = 0x180 - ymoveCur;
 	} else {
 		if (!_mirror)
-			_xmoveCur = -_xmoveCur;
+			xmoveCur = -xmoveCur;
 
-		cur_x += _xmoveCur;
-		cur_y += _ymoveCur;
+		cur_x += xmoveCur;
+		cur_y += ymoveCur;
 
 		if (_mirror) {
 			x_left = cur_x;
@@ -896,17 +897,17 @@
 	} while (1);
 }
 
-byte AkosRenderer::codec5() {
+byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
 	int32 clip_left, clip_right, clip_top, clip_bottom, maxw, maxh, tmp_x, tmp_y;
 
 	if (!_mirror) {
-		clip_left = (_actorX - _xmoveCur - _width) + 1;
+		clip_left = (_actorX - xmoveCur - _width) + 1;
 	} else {
-		clip_left = _actorX + _xmoveCur - 1;
+		clip_left = _actorX + xmoveCur - 1;
 	}
 
 	clip_right = (clip_left + _width) - 1;
-	clip_top = _actorY + _ymoveCur;
+	clip_top = _actorY + ymoveCur;
 	clip_bottom = (clip_top + _height) - 1;
 	maxw = _outwidth - 1;
 	maxh = _outheight - 1;
@@ -958,14 +959,14 @@
 	int decode_mode;
 
 	if (!_mirror) {
-		bdd.x = (_actorX - _xmoveCur - _width) + 1;
+		bdd.x = (_actorX - xmoveCur - _width) + 1;
 		decode_mode = 3;
 	} else {
-		bdd.x = _actorX + _xmoveCur;
+		bdd.x = _actorX + xmoveCur;
 		decode_mode = 1;
 	}
 
-	bdd.y = _actorY + _ymoveCur;
+	bdd.y = _actorY + ymoveCur;
 
 	if (_zbuf != 0) {
 		_vm->_bompMaskPtr = _vm->getResourceAddress(rtBuffer, 9) + _vm->gdi._imgBufOffs[_zbuf];
@@ -1177,16 +1178,16 @@
 	}
 }
 
-byte AkosRenderer::codec16() {
+byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) {
 	int32 clip_left;
 
 	if(!_mirror) {
-		clip_left = (_actorX - _xmoveCur - _width) + 1;
+		clip_left = (_actorX - xmoveCur - _width) + 1;
 	} else {
-		clip_left = _actorX + _xmoveCur;
+		clip_left = _actorX + xmoveCur;
 	}
 
-	int32 clip_top = _ymoveCur + _actorY;
+	int32 clip_top = ymoveCur + _actorY;
 	int32 clip_right = (clip_left + _width) - 1;
 	int32 clip_bottom = (clip_top + _height) - 1;
 	int32 skip_x = 0;

Index: akos.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- akos.h	29 May 2003 02:46:05 -0000	1.17
+++ akos.h	29 May 2003 10:16:00 -0000	1.18
@@ -33,9 +33,6 @@
 protected:
 	uint16 codec;
 
-	// movement of cel to decode
-	int _xmoveCur, _ymoveCur;
-
 	// actor palette
 	byte palette[256];
 
@@ -77,16 +74,16 @@
 protected:
 	byte drawLimb(const CostumeData &cost, int limb);
 
-	byte codec1();
+	byte codec1(int _xmoveCur, int _ymoveCur);
 	void codec1_spec1();
 	void codec1_spec2();
 	void codec1_spec3();
 	void codec1_genericDecode();
 	void codec1_ignorePakCols(int num);
 
-	byte codec5();
+	byte codec5(int _xmoveCur, int _ymoveCur);
 
-	byte codec16();
+	byte codec16(int _xmoveCur, int _ymoveCur);
 	void akos16SetupBitReader(const byte *src);
 	void akos16PutOnScreen(byte *dest, const byte *src, byte transparency, int32 count);
 	void akos16SkipData(int32 numskip);

Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- costume.cpp	29 May 2003 02:46:06 -0000	1.45
+++ costume.cpp	29 May 2003 10:16:00 -0000	1.46
@@ -78,7 +78,7 @@
 };
 
 byte CostumeRenderer::mainRoutine() {
-	int xmove, ymove, i, skip;
+	int xmoveCur, ymoveCur, i, skip;
 	byte drawFlag = 1;
 	uint scal;
 	bool use_scaling;
@@ -104,8 +104,8 @@
 	costumeInfo = (const CostumeInfo *)_srcptr;
 	_width = _width2 = READ_LE_UINT16(&costumeInfo->width);
 	_height = READ_LE_UINT16(&costumeInfo->height);
-	xmove = _xmove + (int16)READ_LE_UINT16(&costumeInfo->rel_x);
-	ymove = _ymove + (int16)READ_LE_UINT16(&costumeInfo->rel_y);
+	xmoveCur = _xmove + (int16)READ_LE_UINT16(&costumeInfo->rel_x);
+	ymoveCur = _ymove + (int16)READ_LE_UINT16(&costumeInfo->rel_y);
 	_xmove += (int16)READ_LE_UINT16(&costumeInfo->move_x);
 	_ymove -= (int16)READ_LE_UINT16(&costumeInfo->move_y);
 	_srcptr += 12;
@@ -131,14 +131,14 @@
 
 	if (use_scaling) {
 		v1.scaleXstep = -1;
-		if (xmove < 0) {
-			xmove = -xmove;
+		if (xmoveCur < 0) {
+			xmoveCur = -xmoveCur;
 			v1.scaleXstep = 1;
 		}
 
 		if (_mirror) {
-			startScaleIndexX = _scaleIndexX = 128 - xmove;
-			for (i = 0; i < xmove; i++) {
+			startScaleIndexX = _scaleIndexX = 128 - xmoveCur;
+			for (i = 0; i < xmoveCur; i++) {
 				if (cost_scaleTable[_scaleIndexX++] < _scaleX)
 					v1.x -= v1.scaleXstep;
 			}
@@ -154,8 +154,8 @@
 					x_right++;
 			}
 		} else {
-			startScaleIndexX = _scaleIndexX = xmove + 128;
-			for (i = 0; i < xmove; i++) {
+			startScaleIndexX = _scaleIndexX = xmoveCur + 128;
+			for (i = 0; i < xmoveCur; i++) {
 				scal = cost_scaleTable[_scaleIndexX--];
 				if (scal < _scaleX)
 					v1.x += v1.scaleXstep;
@@ -177,29 +177,29 @@
 			skip--;
 
 		step = -1;
-		if (ymove < 0) {
-			ymove = -ymove;
+		if (ymoveCur < 0) {
+			ymoveCur = -ymoveCur;
 			step = 1;
 		}
-		_scaleIndexY = 128 - ymove;
-		for (i = 0; i < ymove; i++) {
+		_scaleIndexY = 128 - ymoveCur;
+		for (i = 0; i < ymoveCur; i++) {
 			scal = cost_scaleTable[_scaleIndexY++];
 			if (scal < _scaleY)
 				v1.y -= step;
 		}
 		y_top = y_bottom = v1.y;
-		_scaleIndexY = 128 - ymove;
+		_scaleIndexY = 128 - ymoveCur;
 		for (i = 0; i < _height; i++) {
 			scal = cost_scaleTable[_scaleIndexY++];
 			if (scal < _scaleY)
 				y_bottom++;
 		}
-		_scaleIndexY = _scaleIndexYTop = 128 - ymove;
+		_scaleIndexY = _scaleIndexYTop = 128 - ymoveCur;
 	} else {
 		if (!_mirror)
-			xmove = -xmove;
-		v1.x += xmove;
-		v1.y += ymove;
+			xmoveCur = -xmoveCur;
+		v1.x += xmoveCur;
+		v1.y += ymoveCur;
 		if (_mirror) {
 			x_left = v1.x;
 			x_right = v1.x + _width;





More information about the Scummvm-git-logs mailing list