[Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.65,1.66 costume.cpp,1.49,1.50 costume.h,1.16,1.17

Max Horn fingolfin at users.sourceforge.net
Thu May 29 12:12:04 CEST 2003


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

Modified Files:
	akos.cpp costume.cpp costume.h 
Log Message:
cleanup; fixed crashes that occured when an actor was drawn partly offscreen

Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- akos.cpp	29 May 2003 18:09:16 -0000	1.65
+++ akos.cpp	29 May 2003 18:45:58 -0000	1.66
@@ -351,7 +351,7 @@
 
 		do {
 			if (*scaleytab++ < _scaleY) {
-				masked = v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
+				masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
 
 				if (color && y < _outheight && !masked) {
 					pcolor = palette[color];
@@ -508,7 +508,6 @@
 	int skip = 0, startScaleIndexX, startScaleIndexY;
 	int cur_x, x_right, x_left;
 	int cur_y, y_top, y_bottom;
-	bool y_clipping;
 	bool charsetmask, masking;
 	int step;
 	byte drawFlag = 1;
@@ -690,8 +689,6 @@
 
 	_vm->updateDirtyRect(0, x_left, x_right, y_top, y_bottom, _dirty_id);
 
-	y_clipping = ((uint) y_bottom > _outheight || y_top < 0);
-
 	if ((uint) y_top > (uint) _outheight)
 		y_top = 0;
 
@@ -703,10 +700,7 @@
 	if (_draw_bottom < y_bottom)
 		_draw_bottom = y_bottom;
 
-	if (cur_x == -1)
-		cur_x = 0;									/* ?? */
-
-	v1.destptr = _outptr + cur_x + cur_y * _outwidth;
+	v1.destptr = _outptr + v1.y * _outwidth + v1.x;
 
 	charsetmask =
 		_vm->hasCharsetMask(x_left, y_top + _vm->virtscr[0].topline, x_right,
@@ -720,7 +714,7 @@
 
 	v1.mask_ptr = NULL;
 	if (masking || charsetmask || _shadow_mode) {
-		v1.mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + cur_y * _numStrips + _vm->_screenStartStrip;
+		v1.mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + v1.y * _numStrips + _vm->_screenStartStrip;
 		v1.imgbufoffs = _vm->gdi._imgBufOffs[_zbuf];
 		if (!charsetmask && masking) {
 			v1.mask_ptr += v1.imgbufoffs;

Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- costume.cpp	29 May 2003 11:07:54 -0000	1.49
+++ costume.cpp	29 May 2003 18:45:58 -0000	1.50
@@ -223,12 +223,12 @@
 	if (_width2 == 0)
 		return 0;
 
-	if ((uint) y_top > (uint) _outheight)
-		y_top = 0;
-
 	if (x_left < 0)
 		x_left = 0;
 
+	if ((uint) y_top > (uint) _outheight)
+		y_top = 0;
+
 	if ((uint) y_bottom > _outheight)
 		y_bottom = _outheight;
 
@@ -247,18 +247,6 @@
 	v1.mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + v1.y * _numStrips + _vm->_screenStartStrip;
 	v1.imgbufoffs = _vm->gdi._imgBufOffs[_zbuf];
 
-	// FIXME: Masking used to be conditional. Will it cause regressions
-	// to always do it? I don't think so, since the behaviour used to be
-	// to mask if there was a mask to apply, unless _zbuf is 0.
-	//
-	// However, when _zbuf is 0 masking and charset masking are the same
-	// thing. I believe the only thing that is ever written to the
-	// frontmost mask buffer is the charset mask, except in Sam & Max
-	// where it's also used for the inventory box and conversation icons.
-
-	_use_mask = true;
-	_use_charset_mask = true;
-
 	CHECK_HEAP
 
 	if (_vm->_features & GF_AMIGA)
@@ -278,8 +266,6 @@
 	uint y;
 	bool masked;
 
-	mask = v1.mask_ptr + (v1.x >> 3);
-	maskbit = revBitMask[v1.x & 7];
 	y = v1.y;
 	src = _srcptr;
 	dst = v1.destptr;
@@ -288,6 +274,9 @@
 	height = _height;
 	width = _width2;
 
+	maskbit = revBitMask[v1.x & 7];
+	mask = v1.mask_ptr + (v1.x >> 3);
+
 	if (len)
 		goto StartPos;
 
@@ -300,7 +289,7 @@
 
 		do {
 			if (_scaleY == 255 || cost_scaleTable[_scaleIndexY++] < _scaleY) {
-				masked = (_use_mask && (mask[v1.imgbufoffs] & maskbit)) || (_use_charset_mask && (mask[0] & maskbit));
+				masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
 				
 				if (color && y < _outheight && !masked) {
 					// FIXME: Fully implement _shadow_mode.
@@ -369,7 +358,7 @@
 			len = *src++;
 		do {
 			if (_scaleY == 255 || cost_scaleTable[_scaleIndexY] < _scaleY) {
-				masked = (_use_mask && (mask[v1.imgbufoffs] & maskbit)) || (_use_charset_mask && (mask[0] & maskbit));
+				masked = (y < _outheight) && v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
 				
 				if (color && v1.x >= 0 && v1.x < _vm->_screenWidth && !masked) {
 					*dst = _palette[color];

Index: costume.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- costume.h	29 May 2003 10:46:07 -0000	1.16
+++ costume.h	29 May 2003 18:45:58 -0000	1.17
@@ -47,7 +47,6 @@
 protected:
 	LoadedCostume _loaded;
 	
-	bool _use_mask, _use_charset_mask;
 	byte _width2;
 
 	byte _scaleIndexX;						/* must wrap at 256 */





More information about the Scummvm-git-logs mailing list