[Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.107.2.2,1.107.2.3 base-costume.h,1.18,1.18.2.1 costume.cpp,1.126,1.126.2.1

Max Horn fingolfin at users.sourceforge.net
Sat Apr 10 11:29:01 CEST 2004


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

Modified Files:
      Tag: branch-0-6-0
	akos.cpp base-costume.h costume.cpp 
Log Message:
backport 64 bit fix to 0.6.0 branch

Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.107.2.2
retrieving revision 1.107.2.3
diff -u -d -r1.107.2.2 -r1.107.2.3
--- akos.cpp	19 Feb 2004 10:01:02 -0000	1.107.2.2
+++ akos.cpp	10 Apr 2004 18:14:56 -0000	1.107.2.3
@@ -347,7 +347,8 @@
 	const byte *mask, *src;
 	byte *dst;
 	byte len, maskbit;
-	uint y, color, height, pcolor;
+	int y;
+	uint color, height, pcolor;
 	const byte *scaleytab;
 	bool masked;
 	bool skip_column = false;
@@ -376,14 +377,14 @@
 		do {
 			if (*scaleytab++ < _scaleY) {
 				if (_actorHitMode) {
-					if (color && (int16) y == _actorHitY && v1.x == _actorHitX) {
+					if (color && y == _actorHitY && v1.x == _actorHitX) {
 						_actorHitResult = true;
 						return;
 					}
 				} else {
-					masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
+					masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit));
 
-					if (color && y < _outheight && !masked && !skip_column) {
+					if (color && !masked && !skip_column) {
 						pcolor = palette[color];
 						if (_shadow_mode == 1) {
 							if (pcolor == 13)	
@@ -413,7 +414,7 @@
 
 				if (v1.scaletable[v1.scaleXindex] < _scaleX) {
 					v1.x += v1.scaleXstep;
-					if (v1.x < 0 || v1.x >= (int)_outwidth)
+					if (v1.x < 0 || v1.x >= _outwidth)
 						return;
 					maskbit = revBitMask[v1.x & 7];
 					v1.destptr += v1.scaleXstep;
@@ -548,7 +549,6 @@
 
 	v1.scaletable = defaultScaleTable;
 
-	// FIXME - which value for VAR_CUSTOMSCALETABLE in V8 ?
 	if (_vm->VAR_CUSTOMSCALETABLE != 0xFF && _vm->isGlobInMemory(rtString, _vm->VAR(_vm->VAR_CUSTOMSCALETABLE))) {
 		v1.scaletable = _vm->getStringAddressVar(_vm->VAR_CUSTOMSCALETABLE);
 	}
@@ -614,7 +614,7 @@
 
 			j = startScaleIndexX;
 			for (i = 0, skip = 0; i < _width; i++) {
-				if (rect.left >= (int)_outwidth) {
+				if (rect.left >= _outwidth) {
 					startScaleIndexX = j;
 					skip++;
 				}
@@ -679,10 +679,10 @@
 	} else
 		_vm->markRectAsDirty(kMainVirtScreen, rect, _actorID);
 
-	if (rect.top >= (int)_outheight || rect.bottom <= 0)
+	if (rect.top >= _outheight || rect.bottom <= 0)
 		return 0;
 
-	if (rect.left >= (int)_outwidth || rect.right <= 0)
+	if (rect.left >= _outwidth || rect.right <= 0)
 		return 0;
 
 	v1.replen = 0;
@@ -725,10 +725,16 @@
 	if (v1.skip_width <= 0 || _height <= 0)
 		return 0;
 
-	if ((uint) rect.top > _outheight)
+	if (rect.left < 0)
+		rect.left = 0;
+
+	if (rect.top < 0)
 		rect.top = 0;
 
-	if ((uint) rect.bottom > _outheight)
+	if (rect.top > _outheight)
+		rect.top = _outheight;
+
+	if (rect.bottom > _outheight)
 		rect.bottom = _outheight;
 
 	if (_draw_top > rect.top)

Index: base-costume.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/base-costume.h,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -u -d -r1.18 -r1.18.2.1
--- base-costume.h	12 Jan 2004 14:09:39 -0000	1.18
+++ base-costume.h	10 Apr 2004 18:14:56 -0000	1.18.2.1
@@ -69,7 +69,7 @@
 
 	// Destination
 	byte *_outptr;
-	uint _outwidth, _outheight;
+	int _outwidth, _outheight;
 	int32 _numStrips;
 
 	// Source pointer

Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.126
retrieving revision 1.126.2.1
diff -u -d -r1.126 -r1.126.2.1
--- costume.cpp	8 Jan 2004 03:10:16 -0000	1.126
+++ costume.cpp	10 Apr 2004 18:14:56 -0000	1.126.2.1
@@ -148,7 +148,7 @@
 			rect.right = rect.left = v1.x;
 			_scaleIndexX = startScaleIndexX;
 			for (i = 0; i < _width; i++) {
-				if (rect.left >= (int)_outwidth) {
+				if (rect.left >= _outwidth) {
 					skip++;
 					startScaleIndexX = _scaleIndexX;
 				}
@@ -200,15 +200,15 @@
 	v1.scaleXstep = _mirror ? 1 : -1;
 
 	if (_vm->_version == 1)
-		//HACK: it fix gfx glitches leaved by actor costume in V1 games, when actor moving to left
+		//HACK: it fix gfx glitches left by actor costume in V1 games, when actor moving to left
 		_vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 8, rect.top, rect.bottom, _actorID);
 	else
 		_vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 1, rect.top, rect.bottom, _actorID);
 
-	if (rect.top >= (int)_outheight || rect.bottom <= 0)
+	if (rect.top >= _outheight || rect.bottom <= 0)
 		return 0;
 
-	if (rect.left >= (int)_outwidth || rect.right <= 0)
+	if (rect.left >= _outwidth || rect.right <= 0)
 		return 0;
 
 	v1.replen = 0;
@@ -254,10 +254,13 @@
 	if (rect.left < 0)
 		rect.left = 0;
 
-	if ((uint) rect.top > _outheight)
+	if (rect.top < 0)
 		rect.top = 0;
 
-	if ((uint) rect.bottom > _outheight)
+	if (rect.top > _outheight)
+		rect.top = _outheight;
+
+	if (rect.bottom > _outheight)
 		rect.bottom = _outheight;
 
 	if (_draw_top > rect.top)
@@ -352,7 +355,8 @@
 	const byte *mask, *src;
 	byte *dst;
 	byte len;
-	uint y, height;
+	int y;
+	uint height;
 	byte color, pcolor;
 	bool rep;
 
@@ -393,7 +397,7 @@
 			if (!rep)
 				color = *src++;
 			
-			if (y < _outheight) {
+			if (0 <= y && y < _outheight) {
 				if (!_mirror) {
 					LINE(0, 0); LINE(2, 2); LINE(4, 4); LINE(6, 6);
 				} else {
@@ -409,7 +413,7 @@
 				height = _height;
 				y = v1.y;
 				v1.x += 8 * v1.scaleXstep;
-				if (v1.x < 0 || v1.x >= (int)_outwidth)
+				if (v1.x < 0 || v1.x >= _outwidth)
 					return;
 				mask = v1.mask_ptr;
 				v1.destptr += 8 * v1.scaleXstep;
@@ -426,7 +430,8 @@
 	const byte *mask, *src;
 	byte *dst;
 	byte len, maskbit;
-	uint y, color, height, pcolor;
+	int y;
+	uint color, height, pcolor;
 	const byte *scaleytab;
 	bool masked;
 
@@ -453,9 +458,9 @@
 
 		do {
 			if (_scaleY == 255 || *scaleytab++ < _scaleY) {
-				masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
+				masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit));
 				
-				if (color && y < _outheight && !masked) {
+				if (color && !masked) {
 					// FIXME: Fully implement _shadow_mode.
 					// For now, it's enough for Sam & Max
 					// transparency.
@@ -482,7 +487,7 @@
 
 				if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
 					v1.x += v1.scaleXstep;
-					if (v1.x < 0 || v1.x >= (int)_outwidth)
+					if (v1.x < 0 || v1.x >= _outwidth)
 						return;
 					maskbit = revBitMask[v1.x & 7];
 					v1.destptr += v1.scaleXstep;
@@ -501,7 +506,7 @@
 	byte *dst;
 	byte maskbit, len, height, width;
 	int color;
-	uint y;
+	int y;
 	bool masked;
 	int oldXpos, oldScaleIndexX;
 
@@ -523,9 +528,9 @@
 			len = *src++;
 		do {
 			if (_scaleY == 255 || cost_scaleTable[_scaleIndexY] < _scaleY) {
-				masked = (y >= _outheight) || v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
+				masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit));
 				
-				if (color && v1.x >= 0 && v1.x < (int)_outwidth && !masked) {
+				if (color && v1.x >= 0 && v1.x < _outwidth && !masked) {
 					*dst = _palette[color];
 				}
 





More information about the Scummvm-git-logs mailing list