[Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.59,1.60 akos.h,1.16,1.17 base-costume.h,1.5,1.6 costume.cpp,1.44,1.45 costume.h,1.13,1.14

Max Horn fingolfin at users.sourceforge.net
Wed May 28 19:47:02 CEST 2003


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

Modified Files:
	akos.cpp akos.h base-costume.h costume.cpp costume.h 
Log Message:
more costume/akos changes

Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- akos.cpp	29 May 2003 02:14:31 -0000	1.59
+++ akos.cpp	29 May 2003 02:46:05 -0000	1.60
@@ -333,7 +333,7 @@
 	color = v1.repcolor;
 	height = _height;
 
-	scaleytab = &v1.scaletable[v1.tmp_y];
+	scaleytab = &v1.scaletable[v1.scaleYindex];
 	maskbit = revBitMask[v1.x & 7];
 	mask = v1.mask_ptr + (v1.x >> 3);
 
@@ -363,9 +363,9 @@
 				height = _height;
 				y = v1.y;
 
-				scaleytab = &v1.scaletable[v1.tmp_y];
+				scaleytab = &v1.scaletable[v1.scaleYindex];
 
-				if (v1.scaletable[v1.tmp_x] < _scaleX) {
+				if (v1.scaletable[v1.scaleXindex] < _scaleX) {
 					v1.x += v1.scaleXstep;
 					if (v1.x < 0 || v1.x >= _vm->_screenWidth)
 						return;
@@ -373,7 +373,7 @@
 					v1.destptr += v1.scaleXstep;
 				}
 				mask = v1.mask_ptr + (v1.x >> 3);
-				v1.tmp_x += v1.scaleXstep;
+				v1.scaleXindex += v1.scaleXstep;
 				dst = v1.destptr;
 			}
 		StartPos:;
@@ -396,7 +396,7 @@
 	color = v1.repcolor;
 	height = _height;
 
-	scaleytab = &v1.scaletable[v1.tmp_y];
+	scaleytab = &v1.scaletable[v1.scaleYindex];
 	maskbit = revBitMask[v1.x & 7];
 	mask = v1.mask_ptr + (v1.x >> 3);
 
@@ -429,9 +429,9 @@
 				height = _height;
 				y = v1.y;
 
-				scaleytab = &v1.scaletable[v1.tmp_y];
+				scaleytab = &v1.scaletable[v1.scaleYindex];
 
-				if (v1.scaletable[v1.tmp_x] < _scaleX) {
+				if (v1.scaletable[v1.scaleXindex] < _scaleX) {
 					v1.x += v1.scaleXstep;
 					if (v1.x < 0 || v1.x >= _vm->_screenWidth)
 						return;
@@ -439,7 +439,7 @@
 					v1.destptr += v1.scaleXstep;
 				}
 				mask = v1.mask_ptr + (v1.x >> 3);
-				v1.tmp_x += v1.scaleXstep;
+				v1.scaleXindex += v1.scaleXstep;
 				dst = v1.destptr;
 			}
 		StartPos:;
@@ -466,7 +466,7 @@
 	color = v1.repcolor;
 	height = _height;
 
-	scaleytab = &v1.scaletable[v1.tmp_y];
+	scaleytab = &v1.scaletable[v1.scaleYindex];
 	maskbit = revBitMask[v1.x & 7];
 	mask = v1.mask_ptr + (v1.x >> 3);
 
@@ -502,9 +502,9 @@
 				height = _height;
 				y = v1.y;
 
-				scaleytab = &v1.scaletable[v1.tmp_y];
+				scaleytab = &v1.scaletable[v1.scaleYindex];
 
-				if (v1.scaletable[v1.tmp_x] < _scaleX) {
+				if (v1.scaletable[v1.scaleXindex] < _scaleX) {
 					v1.x += v1.scaleXstep;
 					if (v1.x < 0 || v1.x >= _vm->_screenWidth)
 						return;
@@ -512,7 +512,7 @@
 					v1.destptr += v1.scaleXstep;
 				}
 				mask = v1.mask_ptr + (v1.x >> 3);
-				v1.tmp_x += v1.scaleXstep;
+				v1.scaleXindex += v1.scaleXstep;
 				dst = v1.destptr;
 			}
 		StartPos:;
@@ -761,8 +761,8 @@
 		tmp_y = 0x180;
 	}
 
-	v1.tmp_x = startScaleIndexX;
-	v1.tmp_y = tmp_y;
+	v1.scaleXindex = startScaleIndexX;
+	v1.scaleYindex = tmp_y;
 	v1.skip_width = _width;
 
 	v1.scaleXstep = -1;

Index: akos.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- akos.h	29 May 2003 02:14:31 -0000	1.16
+++ akos.h	29 May 2003 02:46:05 -0000	1.17
@@ -32,7 +32,6 @@
 class AkosRenderer : public BaseCostumeRenderer {
 protected:
 	uint16 codec;
-	const byte *_srcptr;
 
 	// movement of cel to decode
 	int _xmoveCur, _ymoveCur;
@@ -62,7 +61,6 @@
 
 public:
 	AkosRenderer(Scumm *scumm) : BaseCostumeRenderer(scumm) {
-		_srcptr = 0;
 		akos = 0;
 		akhd = 0;
 		akpl = 0;

Index: base-costume.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/base-costume.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- base-costume.h	29 May 2003 02:14:31 -0000	1.5
+++ base-costume.h	29 May 2003 02:46:05 -0000	1.6
@@ -57,7 +57,7 @@
 
 	int _draw_top, _draw_bottom;
 
-	// Destination params
+	// Destination
 	byte *_outptr;
 	uint _outwidth, _outheight;
 
@@ -65,6 +65,9 @@
 	Scumm *_vm;
 	int32 _numStrips;
 
+	// Source pointer
+	const byte *_srcptr;
+
 	// current move offset
 	int _xmove, _ymove;
 
@@ -75,14 +78,14 @@
 	int _width, _height;
 
 	struct {
-		/* codec stuff */
+		// Parameters for the original ("V1") costume codec.
 		const byte *scaletable;
 		byte mask, shr;
 		byte repcolor;
 		byte replen;
 		int scaleXstep;
 		int x, y;
-		int tmp_x, tmp_y;
+		int scaleXindex, scaleYindex;
 		int skip_width;
 		byte *destptr;
 		const byte *mask_ptr;
@@ -101,6 +104,7 @@
 		
 		_vm = scumm;
 		_numStrips = _vm->gdi._numStrips;
+		_srcptr = 0;
 		_xmove = _ymove = 0;
 		_mirror = false;
 		_width = _height = 0;

Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- costume.cpp	29 May 2003 02:14:31 -0000	1.44
+++ costume.cpp	29 May 2003 02:46:06 -0000	1.45
@@ -78,7 +78,7 @@
 };
 
 byte CostumeRenderer::mainRoutine() {
-	int xmove, ymove, i, s;
+	int xmove, ymove, i, skip;
 	byte drawFlag = 1;
 	uint scal;
 	bool use_scaling;
@@ -86,6 +86,7 @@
 	int ex1, ex2;
 	int y_top, y_bottom;
 	int x_left, x_right;
+	int step;
 	const CostumeInfo *costumeInfo;
 	
 	CHECK_HEAP
@@ -126,26 +127,26 @@
 
 	use_scaling = (_scaleX != 0xFF) || (_scaleY != 0xFF);
 
-	s = 0;
+	skip = 0;
 
 	if (use_scaling) {
-		_scaleIndexXStep = -1;
+		v1.scaleXstep = -1;
 		if (xmove < 0) {
 			xmove = -xmove;
-			_scaleIndexXStep = 1;
+			v1.scaleXstep = 1;
 		}
 
 		if (_mirror) {
 			startScaleIndexX = _scaleIndexX = 128 - xmove;
 			for (i = 0; i < xmove; i++) {
 				if (cost_scaleTable[_scaleIndexX++] < _scaleX)
-					v1.x -= _scaleIndexXStep;
+					v1.x -= v1.scaleXstep;
 			}
 			x_right = x_left = v1.x;
 			_scaleIndexX = startScaleIndexX;
 			for (i = 0; i < _width; i++) {
 				if (x_right < 0) {
-					s++;
+					skip++;
 					startScaleIndexX = _scaleIndexX;
 				}
 				scal = cost_scaleTable[_scaleIndexX++];
@@ -157,13 +158,13 @@
 			for (i = 0; i < xmove; i++) {
 				scal = cost_scaleTable[_scaleIndexX--];
 				if (scal < _scaleX)
-					v1.x += _scaleIndexXStep;
+					v1.x += v1.scaleXstep;
 			}
 			x_right = x_left = v1.x;
 			_scaleIndexX = startScaleIndexX;
 			for (i = 0; i < _width; i++) {
 				if (x_left > (_vm->_screenWidth - 1)) {
-					s++;
+					skip++;
 					startScaleIndexX = _scaleIndexX;
 				}
 				scal = cost_scaleTable[_scaleIndexX--];
@@ -172,18 +173,19 @@
 			}
 		}
 		_scaleIndexX = startScaleIndexX;
-		if (s)
-			s--;
-		_scaleIndexYStep = -1;
+		if (skip)
+			skip--;
+
+		step = -1;
 		if (ymove < 0) {
 			ymove = -ymove;
-			_scaleIndexYStep = 1;
+			step = 1;
 		}
 		_scaleIndexY = 128 - ymove;
 		for (i = 0; i < ymove; i++) {
 			scal = cost_scaleTable[_scaleIndexY++];
 			if (scal < _scaleY)
-				v1.y -= _scaleIndexYStep;
+				v1.y -= step;
 		}
 		y_top = y_bottom = v1.y;
 		_scaleIndexY = 128 - ymove;
@@ -209,10 +211,9 @@
 		y_bottom = y_top + _height;
 	}
 
-	_scaleIndexXStep = -1;
+	v1.scaleXstep = -1;
 	if (_mirror)
-		_scaleIndexXStep = 1;
-	_ypostop = v1.y;
+		v1.scaleXstep = 1;
 
 	_vm->updateDirtyRect(0, x_left, x_right + 1, y_top, y_bottom, _dirty_id);
 
@@ -225,34 +226,34 @@
 
 	if (_mirror) {
 		if (!use_scaling)
-			s = -v1.x;
-		if (s > 0) {
-			_width2 -= s;
-			ignorePakCols(s);
+			skip = -v1.x;
+		if (skip > 0) {
+			_width2 -= skip;
+			ignorePakCols(skip);
 			v1.x = 0;
 			_docontinue = 1;
 		} else {
-			s = x_right - _vm->_screenWidth;
-			if (s <= 0) {
+			skip = x_right - _vm->_screenWidth;
+			if (skip <= 0) {
 				drawFlag = 2;
 			} else {
-				_width2 -= s;
+				_width2 -= skip;
 			}
 		}
 	} else {
 		if (!use_scaling)
-			s = x_right - _vm->_screenWidth;
-		if (s > 0) {
-			_width2 -= s;
-			ignorePakCols(s);
+			skip = x_right - _vm->_screenWidth;
+		if (skip > 0) {
+			_width2 -= skip;
+			ignorePakCols(skip);
 			v1.x = _vm->_screenWidth - 1;
 			_docontinue = 1;
 		} else {
-			s = -1 - x_left;
-			if (s <= 0)
+			skip = -1 - x_left;
+			if (skip <= 0)
 				drawFlag = 2;
 			else
-				_width2 -= s;
+				_width2 -= skip;
 		}
 	}
 
@@ -310,7 +311,7 @@
 	const byte *mask, *src;
 	byte *dst;
 	byte maskbit, len, height, pcolor, width;
-	int color, t;
+	int color;
 	uint y;
 	bool masked;
 
@@ -359,17 +360,17 @@
 				if (!--width)
 					return;
 				height = _height;
-				y = _ypostop;
+				y = v1.y;
+
 				_scaleIndexY = _scaleIndexYTop;
-				t = _scaleIndexX;
-				_scaleIndexX += _scaleIndexXStep;
-				if (_scaleX == 255 || cost_scaleTable[t] < _scaleX) {
-					v1.x += _scaleIndexXStep;
+				if (_scaleX == 255 || cost_scaleTable[_scaleIndexX] < _scaleX) {
+					v1.x += v1.scaleXstep;
 					if (v1.x < 0 || v1.x >= _vm->_screenWidth)
 						return;
 					maskbit = revBitMask[v1.x & 7];
-					v1.destptr += _scaleIndexXStep;
+					v1.destptr += v1.scaleXstep;
 				}
+				_scaleIndexX += v1.scaleXstep;
 				dst = v1.destptr;
 				mask = v1.mask_ptr + (v1.x >> 3);
 			}
@@ -382,7 +383,7 @@
 	const byte *mask, *src;
 	byte *dst;
 	byte maskbit, len, height, width;
-	int color, t;
+	int color;
 	uint y;
 	bool masked;
 	int oldXpos, oldScaleIndexX;
@@ -411,13 +412,12 @@
 					*dst = _palette[color];
 				}
 
-				t = _scaleIndexX;
-				_scaleIndexX = t + _scaleIndexXStep;
-				if (_scaleX == 255 || cost_scaleTable[t] < _scaleX) {
-					v1.x += _scaleIndexXStep;
-					dst += _scaleIndexXStep;
+				if (_scaleX == 255 || cost_scaleTable[_scaleIndexX] < _scaleX) {
+					v1.x += v1.scaleXstep;
+					dst += v1.scaleXstep;
 					maskbit = revBitMask[v1.x & 7];
 				}
+				_scaleIndexX += v1.scaleXstep;
 				mask = v1.mask_ptr + (v1.x >> 3);
 			}
 			if (!--width) {
@@ -487,19 +487,24 @@
 byte CostumeRenderer::drawLimb(const CostumeData &cost, int limb) {
 	int i;
 	int code;
+	const byte *frameptr;
 
+	// If the specified limb is stopped or not existing, do nothing.
 	if (cost.curpos[limb] == 0xFFFF || cost.stopped & (1 << limb))
 		return 0;
 
+	// Determine the position the limb is at
 	i = cost.curpos[limb] & 0x7FFF;
-
-	_frameptr = _loaded._baseptr + READ_LE_UINT16(_loaded._ptr + _loaded._numColors + limb * 2 + 10);
-
-	code = _loaded._dataptr[i] & 0x7F;
 	
-	_srcptr = _loaded._baseptr + READ_LE_UINT16(_frameptr + code * 2);
+	// Get the base pointer for that limb
+	frameptr = _loaded._baseptr + READ_LE_UINT16(_loaded._ptr + _loaded._numColors + limb * 2 + 10);
+	
+	// Determine the offset to the costume data for the limb at position i
+	code = _loaded._dataptr[i] & 0x7F;
 
+	// Code 0x7B indicates a limb for which there is nothing to draw
 	if (code != 0x7B) {
+		_srcptr = _loaded._baseptr + READ_LE_UINT16(frameptr + code * 2);
 		if (!(_vm->_features & GF_OLD256) || code < 0x79)
 			return mainRoutine();
 	}
@@ -513,11 +518,11 @@
 }
 
 void Scumm::cost_decodeData(Actor *a, int frame, uint usemask) {
-	byte *r;
+	const byte *r;
 	uint mask, j;
 	int i;
 	byte extra, cmd;
-	byte *dataptr;
+	const byte *dataptr;
 	int anim;
 	LoadedCostume lc(this);
 

Index: costume.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- costume.h	29 May 2003 02:14:31 -0000	1.13
+++ costume.h	29 May 2003 02:46:06 -0000	1.14
@@ -28,9 +28,9 @@
 	Scumm *_vm;
 
 public:
-	byte *_ptr;
-	byte *_baseptr;
-	byte *_dataptr;
+	const byte *_ptr;
+	const byte *_baseptr;
+	const byte *_dataptr;
 	byte _numColors;
 
 	LoadedCostume(Scumm *vm) : _vm(vm), _ptr(0), _dataptr(0), _numColors(0) {}
@@ -47,16 +47,11 @@
 protected:
 	LoadedCostume _loaded;
 	
-	byte *_frameptr;
-	const byte *_srcptr;
 	bool _use_mask, _use_charset_mask;
 	byte _width2;
 
-	int _scaleIndexXStep;
-	int _scaleIndexYStep;
 	byte _scaleIndexX;						/* must wrap at 256 */
 	byte _scaleIndexY, _scaleIndexYTop;
-	int _ypostop;
 	byte _docontinue;
 	byte _palette[32];
 





More information about the Scummvm-git-logs mailing list