[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.499,2.500 object.cpp,1.242,1.243 room.cpp,1.14,1.15 saveload.cpp,1.226,1.227 script_v72he.cpp,2.296,2.297 script_v7he.cpp,2.155,2.156 script_v90he.cpp,2.259,2.260 scumm.cpp,1.531,1.532 sprite_he.cpp,1.140,1.141 wiz_he.cpp,2.81,2.82 wiz_he.h,2.22,2.23

Eugene Sandulenko sev at users.sourceforge.net
Sun May 22 19:05:42 CEST 2005


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

Modified Files:
	intern.h object.cpp room.cpp saveload.cpp script_v72he.cpp 
	script_v7he.cpp script_v90he.cpp scumm.cpp sprite_he.cpp 
	wiz_he.cpp wiz_he.h 
Log Message:
Turn Wiz struct into class as requested.


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.499
retrieving revision 2.500
diff -u -d -r2.499 -r2.500
--- intern.h	22 May 2005 10:38:57 -0000	2.499
+++ intern.h	23 May 2005 02:00:47 -0000	2.500
@@ -802,7 +802,7 @@
 	ScummEngine_v70he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], int substResFileNameIndex);
 	~ScummEngine_v70he();
 
-	Wiz _wiz;
+	Wiz *_wiz;
 
 protected:
 	virtual void setupOpcodes();

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.242
retrieving revision 1.243
diff -u -d -r1.242 -r1.243
--- object.cpp	18 May 2005 23:17:04 -0000	1.242
+++ object.cpp	23 May 2005 02:00:47 -0000	1.243
@@ -342,7 +342,7 @@
 			if (b == 0) {
 #ifndef DISABLE_HE
 				if (_heversion >= 70) {
-					if (((ScummEngine_v70he *)this)->_wiz.polygonHit(_objs[i].obj_nr, x, y))
+					if (((ScummEngine_v70he *)this)->_wiz->polygonHit(_objs[i].obj_nr, x, y))
 						return _objs[i].obj_nr;
 				}
 #endif
@@ -870,13 +870,13 @@
 void ScummEngine_v70he::clearDrawQueues() {
 	ScummEngine_v6::clearDrawQueues();
 
-	_wiz.polygonClear();
+	_wiz->polygonClear();
 }
 
 void ScummEngine_v80he::clearDrawQueues() {
 	ScummEngine_v70he::clearDrawQueues();
 
-	_wiz.clearWizBuffer();
+	_wiz->clearWizBuffer();
 }
 #endif
 

Index: room.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/room.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- room.cpp	18 May 2005 15:30:31 -0000	1.14
+++ room.cpp	23 May 2005 02:00:48 -0000	1.15
@@ -526,7 +526,7 @@
 	if (_heversion >= 80) {
 		ptr = findResourceData(MKID('POLD'), roomptr);
 		if (ptr) {
-			((ScummEngine_v70he *)this)->_wiz.polygonLoad(ptr);
+			((ScummEngine_v70he *)this)->_wiz->polygonLoad(ptr);
 		}
 	}
 #endif

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.226
retrieving revision 1.227
diff -u -d -r1.226 -r1.227
--- saveload.cpp	21 May 2005 15:45:09 -0000	1.226
+++ saveload.cpp	23 May 2005 02:00:48 -0000	1.227
@@ -1052,7 +1052,7 @@
 	};
 
 	if (_heversion >= 71) {
-		s->saveLoadArrayOf(_wiz._polygons, ARRAYSIZE(_wiz._polygons), sizeof(_wiz._polygons[0]), polygonEntries);
+		s->saveLoadArrayOf(_wiz->_polygons, ARRAYSIZE(_wiz->_polygons), sizeof(_wiz->_polygons[0]), polygonEntries);
 	}
 
 	s->saveLoadEntries(this, HE70Entries);

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.296
retrieving revision 2.297
diff -u -d -r2.296 -r2.297
--- script_v72he.cpp	22 May 2005 15:52:39 -0000	2.296
+++ script_v72he.cpp	23 May 2005 02:00:48 -0000	2.297
@@ -735,8 +735,8 @@
 			continue;
 
 		// Check polygon bounds
-		if (_wiz.polygonDefined(_objs[i].obj_nr)) {
-			if (_wiz.polygonHit(_objs[i].obj_nr, x, y))
+		if (_wiz->polygonDefined(_objs[i].obj_nr)) {
+			if (_wiz->polygonHit(_objs[i].obj_nr, x, y))
 				result = _objs[i].obj_nr;
 			else if (VAR_POLYGONS_ONLY != 0xFF && VAR(VAR_POLYGONS_ONLY))
 				continue;

Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.155
retrieving revision 2.156
diff -u -d -r2.155 -r2.156
--- script_v7he.cpp	15 May 2005 09:46:33 -0000	2.155
+++ script_v7he.cpp	23 May 2005 02:00:48 -0000	2.156
@@ -813,14 +813,14 @@
 		a->_clipOverride.bottom = args[2];
 		break;
 	case 42:
-		_wiz._rectOverrideEnabled = true;
-		_wiz._rectOverride.left = args[1];
-		_wiz._rectOverride.top = args[2];
-		_wiz._rectOverride.right = args[3];
-		_wiz._rectOverride.bottom = args[4];
+		_wiz->_rectOverrideEnabled = true;
+		_wiz->_rectOverride.left = args[1];
+		_wiz->_rectOverride.top = args[2];
+		_wiz->_rectOverride.right = args[3];
+		_wiz->_rectOverride.bottom = args[4];
 		break;
 	case 43:
-		_wiz._rectOverrideEnabled = false;
+		_wiz->_rectOverrideEnabled = false;
 		break;
 	default:
 		error("o70_kernelSetFunctions: default case %d (param count %d)", args[0], num);
@@ -1067,13 +1067,13 @@
 		vert1x = pop();
 		flag = (subOp == 69 || subOp == 248);
 		id = pop();
-		_wiz.polygonStore(id, flag, vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y);
+		_wiz->polygonStore(id, flag, vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y);
 		break;
 	case 28: // HE 100
 	case 247:
 		toId = pop();
 		fromId = pop();
-		_wiz.polygonErase(fromId, toId);
+		_wiz->polygonErase(fromId, toId);
 		break;
 	default:
 		error("o70_polygonOps: default case %d", subOp);
@@ -1083,7 +1083,7 @@
 void ScummEngine_v70he::o70_polygonHit() {
 	int y = pop();
 	int x = pop();
-	push(_wiz.polygonHit(0, x, y));
+	push(_wiz->polygonHit(0, x, y));
 }
 
 } // End of namespace Scumm

Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.259
retrieving revision 2.260
diff -u -d -r2.259 -r2.260
--- script_v90he.cpp	23 May 2005 00:39:55 -0000	2.259
+++ script_v90he.cpp	23 May 2005 02:00:48 -0000	2.260
@@ -1899,7 +1899,7 @@
 					wp.vert[i].x = args1[i * 2 + 0];
 					wp.vert[i].y = args1[i * 2 + 1];
 				}
-				push(_wiz.polygonContains(wp, args2[0], args2[1]) ? 1 : 0);
+				push(_wiz->polygonContains(wp, args2[0], args2[1]) ? 1 : 0);
 			}
 		}
 		break;
@@ -2591,14 +2591,14 @@
 		// Used in readdemo
 		break;
 	case 42:
-		_wiz._rectOverrideEnabled = true;
-		_wiz._rectOverride.left = args[1];
-		_wiz._rectOverride.top = args[2];
-		_wiz._rectOverride.right = args[3];
-		_wiz._rectOverride.bottom = args[4];
+		_wiz->_rectOverrideEnabled = true;
+		_wiz->_rectOverride.left = args[1];
+		_wiz->_rectOverride.top = args[2];
+		_wiz->_rectOverride.right = args[3];
+		_wiz->_rectOverride.bottom = args[4];
 		break;
 	case 43:
-		_wiz._rectOverrideEnabled = false;
+		_wiz->_rectOverrideEnabled = false;
 		break;
 	case 714:
 		break;

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.531
retrieving revision 1.532
diff -u -d -r1.531 -r1.532
--- scumm.cpp	22 May 2005 02:07:31 -0000	1.531
+++ scumm.cpp	23 May 2005 02:00:48 -0000	1.532
@@ -1318,6 +1318,8 @@
 	else
 		_resExtractor = new Win32ResExtractor(this);
 
+	_wiz = new Wiz(this);
+
 	_heV7RoomOffsets = NULL;
 
 	_heSndSoundId = 0;

Index: sprite_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sprite_he.cpp,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -d -r1.140 -r1.141
--- sprite_he.cpp	22 May 2005 12:45:06 -0000	1.140
+++ sprite_he.cpp	23 May 2005 02:00:48 -0000	1.141
@@ -85,14 +85,14 @@
 				}
 			}
 			if ((spi->flags & kSFRotated) && angle)
-				_wiz.polygonRotatePoints(pts, 4, angle);
+				_wiz->polygonRotatePoints(pts, 4, angle);
 
 			for (int j = 0; j < 4; ++j) {
 				pts[j].x += x1;
 				pts[j].y += y1;
 			}
 
-			_wiz.polygonCalcBoundBox(pts, 4, bound);
+			_wiz->polygonCalcBoundBox(pts, 4, bound);
 		}
 	} else {
 		bound.left = 1234;
@@ -195,7 +195,7 @@
 				if (spi->flags & kSFRotated && angle) {
 					angle = (360 - angle) % 360;
 					Common::Point pts[1];
-					_wiz.polygonRotatePoints(pts, 1, angle);
+					_wiz->polygonRotatePoints(pts, 1, angle);
 				}
 
 				getWizImageDim(resId, resState, w, h);
@@ -1314,14 +1314,14 @@
 					}
 				}
 				if ((spi->flags & kSFRotated) && angle)
-					_wiz.polygonRotatePoints(pts, 4, angle);
+					_wiz->polygonRotatePoints(pts, 4, angle);
 
 				for (int j = 0; j < 4; ++j) {
 					pts[j].x += wiz.img.x1;
 					pts[j].y += wiz.img.y1;
 				}
 
-				_wiz.polygonCalcBoundBox(pts, 4, spi->bbox);
+				_wiz->polygonCalcBoundBox(pts, 4, spi->bbox);
 			}
 		} else {
 			bboxPtr->left = 1234;

Index: wiz_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.cpp,v
retrieving revision 2.81
retrieving revision 2.82
diff -u -d -r2.81 -r2.82
--- wiz_he.cpp	12 May 2005 09:12:30 -0000	2.81
+++ wiz_he.cpp	23 May 2005 02:00:49 -0000	2.82
@@ -29,7 +29,7 @@
 
 namespace Scumm {
 
-Wiz::Wiz() {
+Wiz::Wiz(ScummEngine_v70he *vm) : _vm(vm) {
 	_imagesNum = 0;
 	memset(&_images, 0, sizeof(_images));
 	memset(&_polygons, 0, sizeof(_polygons));
@@ -947,8 +947,8 @@
 
 void ScummEngine_v72he::displayWizImage(WizImage *pwi) {
 	if (_fullRedraw) {
-		assert(_wiz._imagesNum < ARRAYSIZE(_wiz._images));
-		WizImage *wi = &_wiz._images[_wiz._imagesNum];
+		assert(_wiz->_imagesNum < ARRAYSIZE(_wiz->_images));
+		WizImage *wi = &_wiz->_images[_wiz->_imagesNum];
 		wi->resNum = pwi->resNum;
 		wi->x1 = pwi->x1;
 		wi->y1 = pwi->y1;
@@ -958,7 +958,7 @@
 		wi->xmapNum = 0;
 		wi->field_390 = 0;
 		wi->paletteNum = 0;
-		++_wiz._imagesNum;
+		++_wiz->_imagesNum;
 	} else if (pwi->flags & kWIFIsPolygon) {
 		drawWizPolygon(pwi->resNum, pwi->state, pwi->x1, pwi->flags, 0, 0, 0);
 	} else {
@@ -1053,9 +1053,9 @@
 		} else {
 			return 0;
 		}
-	} else if (_wiz._rectOverrideEnabled) {
-		if (rScreen.intersects(_wiz._rectOverride)) {
-			rScreen.clip(_wiz._rectOverride);
+	} else if (_wiz->_rectOverrideEnabled) {
+		if (rScreen.intersects(_wiz->_rectOverride)) {
+			rScreen.clip(_wiz->_rectOverride);
 		} else {
 			return 0;
 		}
@@ -1074,7 +1074,7 @@
 	switch (comp) {
 	case 0:
 		color = (trns == NULL) ? VAR(VAR_WIZ_TCOLOR) : -1;
-		_wiz.copyRawWizImage(dst, wizd, cw, ch, x1, y1, width, height, &rScreen, flags, palPtr, color);
+		_wiz->copyRawWizImage(dst, wizd, cw, ch, x1, y1, width, height, &rScreen, flags, palPtr, color);
 		break;
 	case 1:
 		// TODO Adding masking for flags 0x80 and 0x100
@@ -1085,11 +1085,11 @@
 			// Used in readdemo
 			warning("drawWizImage: Unhandled flag 0x100");
 		}
-		_wiz.copyWizImage(dst, wizd, cw, ch, x1, y1, width, height, &rScreen, palPtr);
+		_wiz->copyWizImage(dst, wizd, cw, ch, x1, y1, width, height, &rScreen, palPtr);
 		break;
 	case 2:
 		color = (trns == NULL) ? VAR(VAR_WIZ_TCOLOR) : -1;
-		_wiz.copyRaw16BitWizImage(dst, wizd, cw, ch, x1, y1, width, height, &rScreen, flags, palPtr, color);
+		_wiz->copyRaw16BitWizImage(dst, wizd, cw, ch, x1, y1, width, height, &rScreen, flags, palPtr, color);
 		break;
 	case 5:
 		// Used in Moonbase Commander
@@ -1198,7 +1198,7 @@
 		}
 	}
 	if (angle)
-		_wiz.polygonRotatePoints(pts, 4, angle);
+		_wiz->polygonRotatePoints(pts, 4, angle);
 
 	for (int i = 0; i < 4; ++i) {
 		pts[i].x += po_x;
@@ -1218,7 +1218,7 @@
 		}
 
 		Common::Rect bounds;
-		_wiz.polygonCalcBoundBox(pts, 4, bounds);
+		_wiz->polygonCalcBoundBox(pts, 4, bounds);
 		int x1 = bounds.left;
 		int y1 = bounds.top;
 
@@ -1248,9 +1248,9 @@
 	debug(1, "drawWizPolygon(resNum %d, id %d, flags 0x%X, xmapNum %d paletteNum %d)", resNum, id, flags, xmapNum, paletteNum);
 	int i;
 	WizPolygon *wp = NULL;
-	for (i = 0; i < ARRAYSIZE(_wiz._polygons); ++i) {
-		if (_wiz._polygons[i].id == id) {
-			wp = &_wiz._polygons[i];
+	for (i = 0; i < ARRAYSIZE(_wiz->_polygons); ++i) {
+		if (_wiz->_polygons[i].id == id) {
+			wp = &_wiz->_polygons[i];
 			break;
 		}
 	}
@@ -1352,8 +1352,8 @@
 }
 
 void ScummEngine_v72he::flushWizBuffer() {
-	for (int i = 0; i < _wiz._imagesNum; ++i) {
-		WizImage *pwi = &_wiz._images[i];
+	for (int i = 0; i < _wiz->_imagesNum; ++i) {
+		WizImage *pwi = &_wiz->_images[i];
 		if (pwi->flags & kWIFIsPolygon) {
 			drawWizPolygon(pwi->resNum, pwi->state, pwi->x1, pwi->flags, pwi->xmapNum, 0, pwi->paletteNum);
 		} else {
@@ -1361,7 +1361,7 @@
 			drawWizImage(pwi->resNum, pwi->state, pwi->x1, pwi->y1, pwi->zorder, pwi->xmapNum, pwi->field_390, r, pwi->flags, 0, pwi->paletteNum);
 		}
 	}
-	_wiz._imagesNum = 0;
+	_wiz->_imagesNum = 0;
 }
 
 void ScummEngine_v80he::loadImgSpot(int resId, int state, int16 &x, int16 &y) {
@@ -1469,8 +1469,8 @@
 		if (maskImgResNum != 0 || (params->processFlags & (kWPFZoom | kWPFRotate)))
 			error("Can't do this command in the enter script.");
 
-		assert(_wiz._imagesNum < ARRAYSIZE(_wiz._images));
-		WizImage *pwi = &_wiz._images[_wiz._imagesNum];
+		assert(_wiz->_imagesNum < ARRAYSIZE(_wiz->_images));
+		WizImage *pwi = &_wiz->_images[_wiz->_imagesNum];
 		pwi->resNum = params->img.resNum;
 		pwi->x1 = po_x;
 		pwi->y1 = po_y;
@@ -1480,7 +1480,7 @@
 		pwi->xmapNum = xmapNum;
 		pwi->field_390 = field_390;
 		pwi->paletteNum = paletteNum;
-		++_wiz._imagesNum;
+		++_wiz->_imagesNum;
 	} else {
 		if (maskImgResNum != 0) {
 			// TODO
@@ -1881,15 +1881,20 @@
 		}
 		switch (c) {
 		case 0:
-			ret = _wiz.getRawWizPixelColor(wizd, x, y, w, h, VAR(VAR_WIZ_TCOLOR)) != VAR(VAR_WIZ_TCOLOR) ? 1 : 0;
+			ret = _wiz->getRawWizPixelColor(wizd, x, y, w, h, VAR(VAR_WIZ_TCOLOR)) != VAR(VAR_WIZ_TCOLOR) ? 1 : 0;
 			break;
 		case 1:
-			ret = _wiz.isWizPixelNonTransparent(wizd, x, y, w, h);
+			ret = _wiz->isWizPixelNonTransparent(wizd, x, y, w, h);
 			break;
 		case 2:
 			// Used baseball2003
 			warning("isWizPixelNonTransparent: Unhandled wiz compression type %d", c);
 			break;
+		case 4:
+		case 5:
+			// Used in Moonbase Commander
+			warning("isWizPixelNonTransparent: Unhandled wiz compression type %d", c);
+			break;
 		default:
 			error("isWizPixelNonTransparent: Unhandled wiz compression type %d", c);
 			break;
@@ -1911,11 +1916,12 @@
 	assert(wizd);
 	switch (c) {
 	case 0:
-		color = _wiz.getRawWizPixelColor(wizd, x, y, w, h, VAR(VAR_WIZ_TCOLOR));
+		color = _wiz->getRawWizPixelColor(wizd, x, y, w, h, VAR(VAR_WIZ_TCOLOR));
 		break;
 	case 1:
-		color = _wiz.getWizPixelColor(wizd, x, y, w, h, VAR(VAR_WIZ_TCOLOR));
+		color = _wiz->getWizPixelColor(wizd, x, y, w, h, VAR(VAR_WIZ_TCOLOR));
 		break;
+	case 4:
 	case 5:
 		// Used in Moonbase Commander
 		color = 1;
@@ -1949,10 +1955,10 @@
 			memset(histogram, 0, sizeof(histogram));
 			switch (c) {
 			case 0:
-				_wiz.computeRawWizHistogram(histogram, wizd, w, &rCap);
+				_wiz->computeRawWizHistogram(histogram, wizd, w, &rCap);
 				break;
 			case 1:
-				_wiz.computeWizHistogram(histogram, wizd, &rCap);
+				_wiz->computeWizHistogram(histogram, wizd, &rCap);
 				break;
 			default:
 				error("computeWizHistogram: Unhandled wiz compression type %d", c);

Index: wiz_he.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.h,v
retrieving revision 2.22
retrieving revision 2.23
diff -u -d -r2.22 -r2.23
--- wiz_he.h	14 May 2005 23:28:21 -0000	2.22
+++ wiz_he.h	23 May 2005 02:00:49 -0000	2.23
@@ -133,7 +133,10 @@
 	kWPFMaskImg = 0x80000
 };
 
-struct Wiz {
+class ScummEngine_v70he;
+
+class Wiz {
+public:
 	enum {
 		NUM_POLYGONS = 200,
 		NUM_IMAGES   = 255
@@ -143,7 +146,8 @@
 	uint16 _imagesNum;
 	WizPolygon _polygons[NUM_POLYGONS];
 	
-	Wiz();
+	Wiz(ScummEngine_v70he *vm);
+
 	void clearWizBuffer();
 	Common::Rect _rectOverride;
 	bool _rectOverrideEnabled;
@@ -168,6 +172,9 @@
 	uint8 getRawWizPixelColor(const uint8 *data, int x, int y, int w, int h, uint8 color);
 	void computeWizHistogram(uint32 *histogram, const uint8 *data, const Common::Rect *srcRect);
 	void computeRawWizHistogram(uint32 *histogram, const uint8 *data, int srcPitch, const Common::Rect *srcRect);
+
+private:
+	ScummEngine_v70he *_vm;
 };
 
 } // End of namespace Scumm





More information about the Scummvm-git-logs mailing list