[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.79,2.80 gfx.h,1.24,1.25 object.cpp,1.87,1.88 verbs.cpp,1.34,1.35

Max Horn fingolfin at users.sourceforge.net
Sat May 10 06:00:08 CEST 2003


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

Modified Files:
	gfx.cpp gfx.h object.cpp verbs.cpp 
Log Message:
added a 'width' parameter to drawBitmap (contrary to 'numstrips', it specifies the full width of the image passed in, not how much we shoul draw of it) - this will be used for the new V2 drawBitmap code; renamed drawBitmap parameter 'h' to 'height'

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.79
retrieving revision 2.80
diff -u -d -r2.79 -r2.80
--- gfx.cpp	10 May 2003 12:23:02 -0000	2.79
+++ gfx.cpp	10 May 2003 12:59:32 -0000	2.80
@@ -720,7 +720,7 @@
 		setGfxUsageBit(s + i, USAGE_BIT_DIRTY);
 
 	gdi.drawBitmap(getResourceAddress(rtRoom, _roomResource) + _IM00_offs,
-								&virtscr[0], s, 0, virtscr[0].height, s, num, 0);
+								&virtscr[0], s, 0, virtscr[0].width, virtscr[0].height, s, num, 0);
 }
 
 void Scumm::restoreCharsetBg() {
@@ -838,10 +838,10 @@
 	return false;
 }
 
-void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int h,
-										 int stripnr, int numstrip, byte flag) {
+void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height,
+                     int stripnr, int numstrip, byte flag) {
 	assert(ptr);
-	assert(h > 0);
+	assert(height > 0);
 	byte *backbuff_ptr, *bgbak_ptr, *smap_ptr;
 	int i;
 	byte *zplane_list[9];
@@ -926,18 +926,23 @@
 		smap_ptr += 24;
 	}
 
-	bottom = y + h;
+	bottom = y + height;
 	if (bottom > vs->height) {
 		warning("Gdi::drawBitmap, strip drawn to %d below window bottom %d", bottom, vs->height);
 	}
 
-	_vertStripNextInc = h * _vm->_realWidth - 1;
+	_vertStripNextInc = height * _vm->_realWidth - 1;
 
 	sx = x;
 	if (vs->scrollable)
 		sx -= vs->xstart >> 3;
 
-	do {
+	if (_vm->_features & GF_AFTER_V2) {
+		// TODO: implement new V2 strip / zplane drawing in here
+		
+		//return;
+	}
+	while (numstrip--) {
 		CHECK_HEAP;
 
 		if (sx < 0)
@@ -961,27 +966,27 @@
 		_mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + (y * _numStrips + x);
 
 		if (_vm->_features & GF_AFTER_V2) {
-			decodeStripOldEGA(bgbak_ptr, roomptr + _vm->_egaStripOffsets[stripnr], h, stripnr);
+			decodeStripOldEGA(bgbak_ptr, roomptr + _vm->_egaStripOffsets[stripnr], height, stripnr);
 		} else if (_vm->_features & GF_16COLOR) {
-			decodeStripEGA(bgbak_ptr, smap_ptr + READ_LE_UINT16(smap_ptr + stripnr * 2 + 2), h);
+			decodeStripEGA(bgbak_ptr, smap_ptr + READ_LE_UINT16(smap_ptr + stripnr * 2 + 2), height);
 		} else if (_vm->_features & GF_SMALL_HEADER) {
-			useOrDecompress = decompressBitmap(bgbak_ptr, smap_ptr + READ_LE_UINT32(smap_ptr + stripnr * 4 + 4), h);
+			useOrDecompress = decompressBitmap(bgbak_ptr, smap_ptr + READ_LE_UINT32(smap_ptr + stripnr * 4 + 4), height);
 		} else {
-			useOrDecompress = decompressBitmap(bgbak_ptr, smap_ptr + READ_LE_UINT32(smap_ptr + stripnr * 4 + 8), h);
+			useOrDecompress = decompressBitmap(bgbak_ptr, smap_ptr + READ_LE_UINT32(smap_ptr + stripnr * 4 + 8), height);
 		}
 
 		CHECK_HEAP;
 		if (vs->alloctwobuffers) {
 			if (_vm->hasCharsetMask(sx << 3, y, (sx + 1) << 3, bottom)) {
 				if (flag & dbClear || !lightsOn)
-					clear8ColWithMasking(backbuff_ptr, h, _mask_ptr);
+					clear8ColWithMasking(backbuff_ptr, height, _mask_ptr);
 				else
-					draw8ColWithMasking(backbuff_ptr, bgbak_ptr, h, _mask_ptr);
+					draw8ColWithMasking(backbuff_ptr, bgbak_ptr, height, _mask_ptr);
 			} else {
 				if (flag & dbClear || !lightsOn)
-					clear8Col(backbuff_ptr, h);
+					clear8Col(backbuff_ptr, height);
 				else
-					draw8Col(backbuff_ptr, bgbak_ptr, h);
+					draw8Col(backbuff_ptr, bgbak_ptr, height);
 			}
 		}
 		CHECK_HEAP;
@@ -1011,9 +1016,9 @@
 			for (i = 0; i < numzbuf; i++) {
 				_mask_ptr_dest = _vm->getResourceAddress(rtBuffer, 9) + y * _numStrips + x + _imgBufOffs[i];
 				if (useOrDecompress && (flag & dbAllowMaskOr))
-					decompressMaskImgOr(_mask_ptr_dest, z_plane_ptr, h);
+					decompressMaskImgOr(_mask_ptr_dest, z_plane_ptr, height);
 				else
-					decompressMaskImg(_mask_ptr_dest, z_plane_ptr, h);
+					decompressMaskImg(_mask_ptr_dest, z_plane_ptr, height);
 			}
 		} else {
 			for (i = 1; i < numzbuf; i++) {
@@ -1043,16 +1048,16 @@
 					if (_vm->_features & GF_AFTER_V2)
 						decompressMaskImgOld(_mask_ptr_dest, roomptr + _vm->_egaStripZOffsets[stripnr], stripnr);
 					else if (useOrDecompress && (flag & dbAllowMaskOr)) {
-						decompressMaskImgOr(_mask_ptr_dest, z_plane_ptr, h);
+						decompressMaskImgOr(_mask_ptr_dest, z_plane_ptr, height);
 					} else {
-						decompressMaskImg(_mask_ptr_dest, z_plane_ptr, h);
+						decompressMaskImg(_mask_ptr_dest, z_plane_ptr, height);
 					}
 
 				} else {
 					if (!(useOrDecompress && (flag & dbAllowMaskOr)))
-						for (int height = 0; height < h; height++)
-							_mask_ptr_dest[height * _numStrips] = 0;
-					/* needs better abstraction, FIXME */
+						for (int h = 0; h < height; h++)
+							_mask_ptr_dest[h * _numStrips] = 0;
+					// FIXME: needs better abstraction
 				}
 			}
 		}
@@ -1062,7 +1067,7 @@
 		x++;
 		sx++;
 		stripnr++;
-	} while (--numstrip);
+	}
 }
 
 void Gdi::decodeStripEGA(byte *dst, byte *src, int height) {
@@ -3392,7 +3397,7 @@
 
 	vs->alloctwobuffers = false;
 	gdi._disable_zbuffer = true;
-	gdi.drawBitmap(im, vs, _screenStartStrip, 0, h, 0, w >> 3, 0);
+	gdi.drawBitmap(im, vs, _screenStartStrip, 0, w, h, 0, w >> 3, 0);
 	vs->alloctwobuffers = true;
 	gdi._disable_zbuffer = false;
 

Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- gfx.h	30 Apr 2003 05:48:54 -0000	1.24
+++ gfx.h	10 May 2003 12:59:32 -0000	1.25
@@ -161,7 +161,8 @@
 	void updateDirtyScreen(VirtScreen *vs);
 
 public:
-	void drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int h, int stripnr, int numstrip, byte flag);
+	void drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height,
+	                int stripnr, int numstrip, byte flag);
 	void clearUpperMask();
 
 	void disableZBuffer() { _disable_zbuffer++; }

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- object.cpp	8 May 2003 15:48:48 -0000	1.87
+++ object.cpp	10 May 2003 12:59:32 -0000	1.88
@@ -396,7 +396,7 @@
 		// the inventory and conversation icons.
 		if ((_features & GF_AFTER_V7 || _gameId == GID_SAMNMAX) && getClass(od->obj_nr, 22))
 			flags |= Gdi::dbDrawMaskOnAll;
-		gdi.drawBitmap(ptr, &virtscr[0], x, ypos, height, x - xpos, numstrip, flags);
+		gdi.drawBitmap(ptr, &virtscr[0], x, ypos, width << 3, height, x - xpos, numstrip, flags);
 	}
 }
 

Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/verbs.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- verbs.cpp	9 May 2003 22:26:00 -0000	1.34
+++ verbs.cpp	10 May 2003 12:59:32 -0000	1.35
@@ -270,12 +270,12 @@
 	for (i = 0; i < imgw; i++) {
 		tmp = xstrip + i;
 		if (tmp < gdi._numStrips)
-			gdi.drawBitmap(imptr, vs, tmp, ydiff, imgh << 3, i, 1, Gdi::dbAllowMaskOr);
+			gdi.drawBitmap(imptr, vs, tmp, ydiff, imgw << 3, imgh << 3, i, 1, Gdi::dbAllowMaskOr);
 	}
 
 	vst = &_verbs[verb];
-	vst->right = vst->x + imgw * 8;
-	vst->bottom = vst->y + imgh * 8;
+	vst->right = vst->x + imgw << 3;
+	vst->bottom = vst->y + imgh << 3;
 	vst->oldleft = vst->x;
 	vst->oldright = vst->right;
 	vst->oldtop = vst->y;





More information about the Scummvm-git-logs mailing list