[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.457,2.458 intern.h,2.500,2.501 palette_he.cpp,1.19,1.20 script_v100he.cpp,2.155,2.156 script_v72he.cpp,2.297,2.298 script_v80he.cpp,2.116,2.117 script_v90he.cpp,2.260,2.261 scumm.cpp,1.532,1.533 sprite_he.cpp,1.141,1.142 wiz_he.cpp,2.82,2.83 wiz_he.h,2.23,2.24

kirben kirben at users.sourceforge.net
Sun May 22 20:38:05 CEST 2005


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

Modified Files:
	gfx.cpp intern.h palette_he.cpp script_v100he.cpp 
	script_v72he.cpp script_v80he.cpp script_v90he.cpp scumm.cpp 
	sprite_he.cpp wiz_he.cpp wiz_he.h 
Log Message:

Move wizImage functions to Wiz class.


Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.457
retrieving revision 2.458
diff -u -d -r2.457 -r2.458
--- gfx.cpp	22 May 2005 10:38:57 -0000	2.457
+++ gfx.cpp	23 May 2005 03:33:08 -0000	2.458
@@ -816,7 +816,7 @@
 
 void ScummEngine_v72he::redrawBGAreas() {
 	ScummEngine_v71he::redrawBGAreas();
-	flushWizBuffer();
+	_wiz->flushWizBuffer();
 }
 #endif
 

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.500
retrieving revision 2.501
diff -u -d -r2.500 -r2.501
--- intern.h	23 May 2005 02:00:47 -0000	2.500
+++ intern.h	23 May 2005 03:33:08 -0000	2.501
@@ -780,6 +780,7 @@
 #ifndef DISABLE_HE
 class ScummEngine_v70he : public ScummEngine_v60he {
 	friend class ResExtractor;
+	friend class Wiz;
 
 protected:
 	typedef void (ScummEngine_v70he::*OpcodeProcv70he)();
@@ -804,6 +805,10 @@
 
 	Wiz *_wiz;
 
+	byte *heFindResourceData(uint32 tag, byte *ptr);
+	byte *heFindResource(uint32 tag, byte *ptr);
+	byte *findWrappedBlock(uint32 tag, byte *ptr, int state, bool flagError);
+
 protected:
 	virtual void setupOpcodes();
 	virtual void executeOpcode(byte i);
@@ -826,6 +831,8 @@
 
 	virtual void clearDrawQueues();
 
+	void remapHEPalette(const uint8 *src, uint8 *dst);
+
 	/* HE version 70 script opcodes */
 	void o70_startSound();
 	void o70_pickupObject();
@@ -850,6 +857,7 @@
 	void o70_polygonHit();
 
 	byte VAR_NUM_SOUND_CHANNELS;
+	byte VAR_WIZ_TCOLOR;
 };
 
 class ScummEngine_v71he : public ScummEngine_v70he {
@@ -938,25 +946,11 @@
 	int readFileToArray(int slot, int32 size);
 	void writeFileFromArray(int slot, int resID);
 
-	void remapHEPalette(const uint8 *src, uint8 *dst);
-
-	void displayWizImage(WizImage *pwi);
-	void displayWizComplexImage(const WizParameters *params);
-	void drawWizComplexPolygon(int resNum, int state, int po_x, int po_y, int xmapNum, int angle, int zoom, const Common::Rect *r, int flags, int dstResNum, int paletteNum);
-	void captureWizImage(int resNum, const Common::Rect& r, bool frontBuffer, int compType);
-	void getWizImageDim(int resNum, int state,  int32 &w, int32 &h);
-	uint8 *drawWizImage(int resNum, int state, int x1, int y1, int zorder, int xmapNum, int field_390, const Common::Rect *clipBox, int flags, int dstResNum, int paletteNum);
-	void drawWizPolygon(int resNum, int state, int id, int flags, int xmapNum, int dstResNum, int paletteNum);
-	void flushWizBuffer();
-
 	virtual void decodeParseString(int a, int b);
 	void decodeScriptString(byte *dst, bool scriptString = false);
 	void copyScriptString(byte *dst, int dstSize);
 	int convertFilePath(byte *dst, bool setFilePath = 0);
 
-	byte *heFindResourceData(uint32 tag, byte *ptr);
-	byte *heFindResource(uint32 tag, byte *ptr);
-	byte *findWrappedBlock(uint32 tag, byte *ptr, int state, bool flagError);
 	int findObject(int x, int y, int num, int *args);
 	int getSoundResourceSize(int id);
 
@@ -1024,7 +1018,6 @@
 	byte VAR_CURRENT_CHARSET;
 	byte VAR_U32_VERSION;
 	byte VAR_U32_ARRAY_UNK;
-	byte VAR_WIZ_TCOLOR;
 };
 
 class ScummEngine_v80he : public ScummEngine_v72he {
@@ -1053,8 +1046,6 @@
 
 	virtual void clearDrawQueues();
 
-	void loadImgSpot(int resId, int state, int16 &x, int16 &y);
-	void loadWizCursor(int resId);
 	void drawLine(int x1, int y1, int x, int unk1, int unk2, int type, int id);
 	void drawPixel(int x, int y, int flags);
 	
@@ -1135,15 +1126,7 @@
 
 	virtual void processActors();
 
-	void createWizEmptyImage(const WizParameters *params);
-	void fillWizRect(const WizParameters *params);
-	void fillWizParallelogram(const WizParameters *params);
-	void processWizImage(const WizParameters *params);
-	int getWizImageStates(int resnum);	
-	int isWizPixelNonTransparent(int resnum, int state, int x, int y, int flags);
-	uint8 getWizPixelColor(int resnum, int state, int x, int y, int flags);
 	int computeWizHistogram(int resnum, int state, int x, int y, int w, int h);
-
 	void getArrayDim(int array, int *dim2start, int *dim2end, int *dim1start, int *dim1end);
 	void sortArray(int array, int dim2start, int dim2end, int dim1start, int dim1end, int sortOrder);
 	

Index: palette_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/palette_he.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- palette_he.cpp	8 May 2005 10:26:11 -0000	1.19
+++ palette_he.cpp	23 May 2005 03:33:08 -0000	1.20
@@ -30,7 +30,7 @@
 
 namespace Scumm {
 
-void ScummEngine_v72he::remapHEPalette(const uint8 *src, uint8 *dst) {
+void ScummEngine_v70he::remapHEPalette(const uint8 *src, uint8 *dst) {
 	int r, g, b, sum, bestitem, bestsum;
 	int ar, ag, ab;
 	uint8 *palPtr;

Index: script_v100he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v100he.cpp,v
retrieving revision 2.155
retrieving revision 2.156
diff -u -d -r2.155 -r2.156
--- script_v100he.cpp	22 May 2005 15:52:39 -0000	2.155
+++ script_v100he.cpp	23 May 2005 03:33:08 -0000	2.156
@@ -1221,7 +1221,7 @@
 		_wizParams.spriteId = 0;
 		_wizParams.groupNum = 0;
 		_wizParams.img.resNum = pop();
-		displayWizImage(&_wizParams.img);
+		_wiz->displayWizImage(&_wizParams.img);
 		break;
 	case 57:
 		_wizParams.processFlags |= kWPFPaletteNum;
@@ -1267,7 +1267,7 @@
 		break;
 	case 92:
 		if (_wizParams.img.resNum)
-			processWizImage(&_wizParams);
+			_wiz->processWizImage(&_wizParams);
 		break;
 	case 128:
 		_wizParams.field_239D = pop();
@@ -2093,12 +2093,12 @@
 	case 0x80:
 	case 0x81:
 		a = pop();
-		loadWizCursor(a);
+		_wiz->loadWizCursor(a);
 		break;
 	case 0x82:
 		pop();
 		a = pop();
-		loadWizCursor(a);
+		_wiz->loadWizCursor(a);
 		break;
 	case 0x86:		// SO_CURSOR_ON Turn cursor on
 		_cursor.state = 1;
@@ -2359,23 +2359,23 @@
 		x = pop();
 		state = pop();
 		resId = pop();
-		push(getWizPixelColor(resId, state, x, y, 0));
+		push(_wiz->getWizPixelColor(resId, state, x, y, 0));
 		break;		
 	case 6:
 		resId = pop();
-		push(getWizImageStates(resId));
+		push(_wiz->getWizImageStates(resId));
 		break;
 	case 13:
 		y = pop();
 		x = pop();
 		state = pop();
 		resId = pop();
-		push(isWizPixelNonTransparent(resId, state, x, y, 0));
+		push(_wiz->isWizPixelNonTransparent(resId, state, x, y, 0));
 		break;
 	case 19:
 		state = pop();
 		resId = pop();
-		getWizImageDim(resId, state, w, h);
+		_wiz->getWizImageDim(resId, state, w, h);
 		push(h);
 		break;
 	case 34:
@@ -2388,19 +2388,19 @@
 	case 64:
 		state = pop();
 		resId = pop();
-		getWizImageDim(resId, state, w, h);
+		_wiz->getWizImageDim(resId, state, w, h);
 		push(w);
 		break;
 	case 65:
 		state = pop();
 		resId = pop();
-		loadImgSpot(resId, state, x, y);
+		_wiz->loadImgSpot(resId, state, x, y);
 		push(x);
 		break;	
 	case 66:
 		state = pop();
 		resId = pop();
-		loadImgSpot(resId, state, x, y);
+		_wiz->loadImgSpot(resId, state, x, y);
 		push(y);
 		break;
 	case 111:
@@ -2418,7 +2418,7 @@
 		state = pop();
 		resId = pop();
 		if (x == -1 && y == -1 && w == -1 && h == -1) {
-			getWizImageDim(resId, state, w, h);
+			_wiz->getWizImageDim(resId, state, w, h);
 			x = 0;
 			y = 0;
 		}		

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.297
retrieving revision 2.298
diff -u -d -r2.297 -r2.298
--- script_v72he.cpp	23 May 2005 02:00:48 -0000	2.297
+++ script_v72he.cpp	23 May 2005 03:33:08 -0000	2.298
@@ -657,7 +657,7 @@
 	*dst = 0;
 }
 
-byte *ScummEngine_v72he::heFindResourceData(uint32 tag, byte *ptr) {
+byte *ScummEngine_v70he::heFindResourceData(uint32 tag, byte *ptr) {
 	ptr = heFindResource(tag, ptr);
 
 	if (ptr == NULL)
@@ -665,7 +665,7 @@
 	return ptr + _resourceHeaderSize;
 }
 
-byte *ScummEngine_v72he::heFindResource(uint32 tag, byte *searchin) {
+byte *ScummEngine_v70he::heFindResource(uint32 tag, byte *searchin) {
 	uint32 curpos, totalsize, size;
 
 	debugC(DEBUG_RESOURCE, "heFindResource(%s, %lx)", tag2str(tag), searchin);
@@ -694,7 +694,7 @@
 	return NULL;
 }
 
-byte *ScummEngine_v72he::findWrappedBlock(uint32 tag, byte *ptr, int state, bool errorFlag) {
+byte *ScummEngine_v70he::findWrappedBlock(uint32 tag, byte *ptr, int state, bool errorFlag) {
 	if (READ_UINT32(ptr) == MKID('MULT')) {
 		byte *offs, *wrap;
 		uint32 size;
@@ -859,7 +859,7 @@
 	grab.right = pop() + 1;
 	grab.top = pop();
 	grab.left = pop();
-	captureWizImage(pop(), grab, false, true);	
+	_wiz->captureWizImage(pop(), grab, false, true);	
 }
 
 void ScummEngine_v72he::o72_getTimer() {
@@ -963,7 +963,7 @@
 	wi.x1 = wi.y1 = 0;
 	wi.state = 0;
 	wi.flags = kWIFPrint;
-	displayWizImage(&wi);
+	_wiz->displayWizImage(&wi);
 }
 
 void ScummEngine_v72he::o72_getArrayDimSize() {
@@ -1690,7 +1690,7 @@
 	wi.x1 = pop();
 	wi.resNum = pop();
 	wi.state = 0;
-	displayWizImage(&wi);
+	_wiz->displayWizImage(&wi);
 }
 
 void ScummEngine_v72he::o72_debugInput() {

Index: script_v80he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v80he.cpp,v
retrieving revision 2.116
retrieving revision 2.117
diff -u -d -r2.116 -r2.117
--- script_v80he.cpp	22 May 2005 10:38:57 -0000	2.116
+++ script_v80he.cpp	23 May 2005 03:33:08 -0000	2.117
@@ -532,12 +532,12 @@
 	case 0x13:
 	case 0x14:
 		a = pop();
-		loadWizCursor(a);
+		_wiz->loadWizCursor(a);
 		break;
 	case 0x3C:
 		pop();
 		a = pop();
-		loadWizCursor(a);
+		_wiz->loadWizCursor(a);
 		break;
 	case 0x90:		// SO_CURSOR_ON Turn cursor on
 		_cursor.state = 1;
@@ -596,7 +596,7 @@
 	wi.resNum = pop();
 	wi.state = 0;
 	wi.flags = kWIFIsPolygon;
-	displayWizImage(&wi);	
+	_wiz->displayWizImage(&wi);	
 }
 
 /**
@@ -643,7 +643,7 @@
 		wi.x1 = x;
 		wi.resNum = id;
 		wi.state = 0;
-		displayWizImage(&wi);
+		_wiz->displayWizImage(&wi);
 	} else {
 		drawPixel(x, y, id);
 	}
@@ -694,7 +694,7 @@
 			wi.x1 = x;
 			wi.resNum = id;
 			wi.state = 0;
-			displayWizImage(&wi);
+			_wiz->displayWizImage(&wi);
 		} else {
 			drawPixel(x, y, id);
 		}

Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.260
retrieving revision 2.261
diff -u -d -r2.260 -r2.261
--- script_v90he.cpp	23 May 2005 02:00:48 -0000	2.260
+++ script_v90he.cpp	23 May 2005 03:33:08 -0000	2.261
@@ -639,7 +639,7 @@
 		_wizParams.img.y1 = pop();
 		_wizParams.img.x1 = pop();
 		_wizParams.img.resNum = pop();
-		displayWizImage(&_wizParams.img);
+		_wiz->displayWizImage(&_wizParams.img);
 		break;
 	case 11:
 		_wizParams.img.resNum = pop();
@@ -781,7 +781,7 @@
 		break;
 	case 209:
 		if (_wizParams.img.resNum)
-			processWizImage(&_wizParams);
+			_wiz->processWizImage(&_wizParams);
 		break;
 	default:
 		error("o90_wizImageOps: unhandled case %d", subOp);
@@ -1670,44 +1670,44 @@
 	case 0:
 		state = pop();
 		resId = pop();
-		loadImgSpot(resId, state, x, y);
+		_wiz->loadImgSpot(resId, state, x, y);
 		push(x);
 		break;
 	case 1:
 		state = pop();
 		resId = pop();
-		loadImgSpot(resId, state, x, y);
+		_wiz->loadImgSpot(resId, state, x, y);
 		push(y);
 		break;
 	case 2:
 		state = pop();
 		resId = pop();
-		getWizImageDim(resId, state, w, h);
+		_wiz->getWizImageDim(resId, state, w, h);
 		push(w);
 		break;
 	case 3:
 		state = pop();
 		resId = pop();
-		getWizImageDim(resId, state, w, h);
+		_wiz->getWizImageDim(resId, state, w, h);
 		push(h);
 		break;
 	case 6:
 		resId = pop();
-		push(getWizImageStates(resId));
+		push(_wiz->getWizImageStates(resId));
 		break;
 	case 15:
 		y = pop();
 		x = pop();
 		state = pop();
 		resId = pop();
-		push(isWizPixelNonTransparent(resId, state, x, y, 0));
+		push(_wiz->isWizPixelNonTransparent(resId, state, x, y, 0));
 		break;
 	case 36:
 		y = pop();
 		x = pop();
 		state = pop();
 		resId = pop();
-		push(getWizPixelColor(resId, state, x, y, 0));
+		push(_wiz->getWizPixelColor(resId, state, x, y, 0));
 		break;
 	case 100:
 		h = pop();
@@ -1717,7 +1717,7 @@
 		state = pop();
 		resId = pop();
 		if (x == -1 && y == -1 && w == -1 && h == -1) {
-			getWizImageDim(resId, state, w, h);
+			_wiz->getWizImageDim(resId, state, w, h);
 			x = 0;
 			y = 0;
 		}		

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.532
retrieving revision 1.533
diff -u -d -r1.532 -r1.533
--- scumm.cpp	23 May 2005 02:00:48 -0000	1.532
+++ scumm.cpp	23 May 2005 03:33:08 -0000	1.533
@@ -1331,6 +1331,7 @@
 	_skipProcessActors = 0;
 
 	VAR_NUM_SOUND_CHANNELS = 0xFF;
+	VAR_WIZ_TCOLOR = 0xFF;
 }
 
 ScummEngine_v70he::~ScummEngine_v70he() {
@@ -1364,7 +1365,6 @@
 	VAR_WINDOWS_VERSION = 0xFF;
 	VAR_CURRENT_CHARSET = 0xFF;
 	VAR_U32_VERSION = 0xFF;
-	VAR_WIZ_TCOLOR = 0xFF;
 }
 
 ScummEngine_v80he::ScummEngine_v80he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], int substResFileNameIndex)

Index: sprite_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sprite_he.cpp,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -d -r1.141 -r1.142
--- sprite_he.cpp	23 May 2005 02:00:48 -0000	1.141
+++ sprite_he.cpp	23 May 2005 03:33:08 -0000	1.142
@@ -46,7 +46,7 @@
 
 	SpriteInfo *spi = &_spriteTable[spriteId];
 
-	loadImgSpot(spi->resId, spi->resState, spr_wiz_x, spr_wiz_y);
+	_wiz->loadImgSpot(spi->resId, spi->resState, spr_wiz_x, spr_wiz_y);
 	if (checkGroup && spi->groupNum) {
 		SpriteGroup *spg = &_spriteGroups[spi->groupNum];
 
@@ -65,7 +65,7 @@
 	if (spi->resId) {
 		angle = spi->angle;
 		zoom = spi->zoom;
-		getWizImageDim(spi->resId, spi->resState, w, h);
+		_wiz->getWizImageDim(spi->resId, spi->resState, w, h);
 		if (!(spi->flags & (kSFZoomed | kSFRotated))) {
 			bound.left = x1;
 			bound.top = y1;
@@ -156,13 +156,13 @@
 			if (spi->field_80) {
 				int16 x1, x2, y1, y2;
 
-				resState = spi->curImageState % getWizImageStates(spi->field_80);
+				resState = spi->curImageState % _wiz->getWizImageStates(spi->field_80);
 
 				x = x_pos - spi->pos.x;
 				y = y_pos - spi->pos.y;
 
-				loadImgSpot(spi->curResId, resState, x1, y1);
-				loadImgSpot(spi->field_80, resState, x2, y2);
+				_wiz->loadImgSpot(spi->curResId, resState, x1, y1);
+				_wiz->loadImgSpot(spi->field_80, resState, x2, y2);
 
 				x += (x2 - x1);
 				y += (y2 - y1);
@@ -198,12 +198,12 @@
 					_wiz->polygonRotatePoints(pts, 1, angle);
 				}
 
-				getWizImageDim(resId, resState, w, h);
+				_wiz->getWizImageDim(resId, resState, w, h);
 				x += w / 2;
 				y += h / 2;
 			}
 
-			if (isWizPixelNonTransparent(resId, resState, x, y, spi->curImgFlags))
+			if (_wiz->isWizPixelNonTransparent(resId, resState, x, y, spi->curImgFlags))
 				return spi->id;
 		}
 	}
@@ -394,7 +394,7 @@
 	checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d");
 
 	if (_spriteTable[spriteId].resId) {
-		getWizImageDim(_spriteTable[spriteId].resId, _spriteTable[spriteId].resState, w, h);
+		_wiz->getWizImageDim(_spriteTable[spriteId].resId, _spriteTable[spriteId].resState, w, h);
 	} else {
 		w = 0;
 		h = 0;
@@ -812,7 +812,7 @@
 	_spriteTable[spriteId].resState = 0;
 
 	if (_spriteTable[spriteId].resId) {
-		_spriteTable[spriteId].res_wiz_states = getWizImageStates(_spriteTable[spriteId].resId);
+		_spriteTable[spriteId].res_wiz_states = _wiz->getWizImageStates(_spriteTable[spriteId].resId);
 		_spriteTable[spriteId].flags |= kSFActive | kSFDelayed | kSFMarkDirty | kSFBlitDirectly;
 
 		if (_spriteTable[spriteId].resId != origResId || _spriteTable[spriteId].res_wiz_states != origResWizStates)
@@ -1263,7 +1263,7 @@
 		spi->flags &= ~kSFNeedRedraw;
 		resId = spi->resId;
 		resState = spi->resState;
-		loadImgSpot(spi->resId, spi->resState, spr_wiz_x, spr_wiz_y);
+		_wiz->loadImgSpot(spi->resId, spi->resState, spr_wiz_x, spr_wiz_y);
 
 		if (spi->groupNum) {
 			SpriteGroup *spg = &_spriteGroups[spi->groupNum];
@@ -1294,7 +1294,7 @@
 		if (resId) {
 			angle = spi->angle;
 			zoom = spi->zoom;
-			getWizImageDim(resId, resState, w, h);
+			_wiz->getWizImageDim(resId, resState, w, h);
 			if (!(spi->flags & (kSFZoomed | kSFRotated))) {
 				bboxPtr->left = wiz.img.x1;
 				bboxPtr->top = wiz.img.y1;
@@ -1389,7 +1389,7 @@
 			wiz.processFlags |= kWPFDstResNum;
 			wiz.dstResNum = _spriteGroups[spi->groupNum].dstResNum;
 		}
-		displayWizComplexImage(&wiz);
+		_wiz->displayWizComplexImage(&wiz);
 	}
 }
 

Index: wiz_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.cpp,v
retrieving revision 2.82
retrieving revision 2.83
diff -u -d -r2.82 -r2.83
--- wiz_he.cpp	23 May 2005 02:00:49 -0000	2.82
+++ wiz_he.cpp	23 May 2005 03:33:08 -0000	2.83
@@ -854,10 +854,10 @@
 	return size;
 }
 
-void ScummEngine_v72he::captureWizImage(int resNum, const Common::Rect& r, bool backBuffer, int compType) {
+void Wiz::captureWizImage(int resNum, const Common::Rect& r, bool backBuffer, int compType) {
 	debug(1, "ScummEngine_v72he::captureWizImage(%d, %d, [%d,%d,%d,%d])", resNum, compType, r.left, r.top, r.right, r.bottom);
 	uint8 *src = NULL;
-	VirtScreen *pvs = &virtscr[kMainVirtScreen];
+	VirtScreen *pvs = &_vm->virtscr[kMainVirtScreen];
 	if (backBuffer) {
 		src = pvs->getBackPixels(0, 0);
 	} else {
@@ -867,15 +867,15 @@
 	if (rCapt.intersects(r)) {
 		rCapt.clip(r);
 		const uint8 *palPtr;
-		if (_heversion >= 99) {
-			palPtr = _hePalettes + 1024;
+		if (_vm->_heversion >= 99) {
+			palPtr = _vm->_hePalettes + 1024;
 		} else {
-			palPtr = _currentPalette;
+			palPtr = _vm->_currentPalette;
 		}
 
 		int w = rCapt.width();
 		int h = rCapt.height();
-		int tColor = (VAR_WIZ_TCOLOR != 0xFF) ? VAR(VAR_WIZ_TCOLOR) : 5;
+		int tColor = (_vm->VAR_WIZ_TCOLOR != 0xFF) ? _vm->VAR(_vm->VAR_WIZ_TCOLOR) : 5;
 
 		// compute compressed size
 		int dataSize = 0;
@@ -896,7 +896,7 @@
 		dataSize = (dataSize + 1) & ~1;
 		int wizSize = headerSize + dataSize;
 		// write header
-		uint8 *wizImg = res.createResource(rtImage, resNum, dataSize + headerSize);
+		uint8 *wizImg = _vm->res.createResource(rtImage, resNum, dataSize + headerSize);
 		WRITE_BE_UINT32(wizImg + 0x00, 'AWIZ');
 		WRITE_BE_UINT32(wizImg + 0x04, wizSize);
 		WRITE_BE_UINT32(wizImg + 0x08, 'WIZH');
@@ -936,19 +936,19 @@
 	}
 }
 
-void ScummEngine_v72he::getWizImageDim(int resNum, int state, int32 &w, int32 &h) {
-	uint8 *dataPtr = getResourceAddress(rtImage, resNum);
+void Wiz::getWizImageDim(int resNum, int state, int32 &w, int32 &h) {
+	uint8 *dataPtr = _vm->getResourceAddress(rtImage, resNum);
 	assert(dataPtr);
-	uint8 *wizh = findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
+	uint8 *wizh = _vm->findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
 	assert(wizh);
 	w = READ_LE_UINT32(wizh + 0x4);
 	h = READ_LE_UINT32(wizh + 0x8);
 }
 
-void ScummEngine_v72he::displayWizImage(WizImage *pwi) {
-	if (_fullRedraw) {
-		assert(_wiz->_imagesNum < ARRAYSIZE(_wiz->_images));
-		WizImage *wi = &_wiz->_images[_wiz->_imagesNum];
+void Wiz::displayWizImage(WizImage *pwi) {
+	if (_vm->_fullRedraw) {
+		assert(_imagesNum < ARRAYSIZE(_images));
+		WizImage *wi = &_images[_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;
+		++_imagesNum;
 	} else if (pwi->flags & kWIFIsPolygon) {
 		drawWizPolygon(pwi->resNum, pwi->state, pwi->x1, pwi->flags, 0, 0, 0);
 	} else {
@@ -967,16 +967,16 @@
 	}
 }
 
-uint8 *ScummEngine_v72he::drawWizImage(int resNum, int state, int x1, int y1, int zorder, int xmapNum, int field_390, const Common::Rect *clipBox, int flags, int dstResNum, int paletteNum) {
+uint8 *Wiz::drawWizImage(int resNum, int state, int x1, int y1, int zorder, int xmapNum, int field_390, const Common::Rect *clipBox, int flags, int dstResNum, int paletteNum) {
 	debug(2, "drawWizImage(resNum %d, x1 %d y1 %d flags 0x%X zorder %d xmapNum %d field_390 %d dstResNum %d paletteNum %d)", resNum, x1, y1, flags, zorder, xmapNum, field_390, dstResNum, paletteNum);
 	uint8 *dst = NULL;
 
 	const uint8 *palPtr = NULL;
-	if (_heversion >= 99) {
+	if (_vm->_heversion >= 99) {
 		if (paletteNum) {
-			palPtr = _hePalettes + paletteNum * 1024 + 768;
+			palPtr = _vm->_hePalettes + paletteNum * 1024 + 768;
 		} else {
-			palPtr = _hePalettes + 1792;
+			palPtr = _vm->_hePalettes + 1792;
 		}
 	}
 
@@ -985,32 +985,32 @@
 		// TODO: Handle 'XMAP' data for shadows
 	}
 
-	uint8 *dataPtr = getResourceAddress(rtImage, resNum);
+	uint8 *dataPtr = _vm->getResourceAddress(rtImage, resNum);
 	assert(dataPtr);
-	uint8 *wizh = findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
+	uint8 *wizh = _vm->findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
 	assert(wizh);
 	uint32 comp   = READ_LE_UINT32(wizh + 0x0);
 	uint32 width  = READ_LE_UINT32(wizh + 0x4);
 	uint32 height = READ_LE_UINT32(wizh + 0x8);
 	debug(2, "wiz_header.comp = %d wiz_header.w = %d wiz_header.h = %d", comp, width, height);
 	
-	uint8 *wizd = findWrappedBlock(MKID('WIZD'), dataPtr, state, 0);
+	uint8 *wizd = _vm->findWrappedBlock(MKID('WIZD'), dataPtr, state, 0);
 	assert(wizd);
 
 	if (flags & kWIFHasPalette) {
-		uint8 *pal = findWrappedBlock(MKID('RGBS'), dataPtr, state, 0);
+		uint8 *pal = _vm->findWrappedBlock(MKID('RGBS'), dataPtr, state, 0);
 		assert(pal);
-		setPaletteFromPtr(pal, 256);
+		_vm->setPaletteFromPtr(pal, 256);
 	}
 
 	uint8 *rmap = NULL;
 	if (flags & kWIFRemapPalette) {
-		rmap = findWrappedBlock(MKID('RMAP'), dataPtr, state, 0);
+		rmap = _vm->findWrappedBlock(MKID('RMAP'), dataPtr, state, 0);
 		assert(rmap);
-		if (_heversion <= 80 || READ_BE_UINT32(rmap) != 0x01234567) {
-			uint8 *rgbs = findWrappedBlock(MKID('RGBS'), dataPtr, state, 0);
+		if (_vm->_heversion <= 80 || READ_BE_UINT32(rmap) != 0x01234567) {
+			uint8 *rgbs = _vm->findWrappedBlock(MKID('RGBS'), dataPtr, state, 0);
 			assert(rgbs);
-			remapHEPalette(rgbs, rmap + 4);
+			_vm->remapHEPalette(rgbs, rmap + 4);
 		}
 	}
 
@@ -1027,14 +1027,14 @@
 		ch = height;
 	} else {
 		if (dstResNum) {
-			uint8 *dstPtr = getResourceAddress(rtImage, dstResNum);
+			uint8 *dstPtr = _vm->getResourceAddress(rtImage, dstResNum);
 			assert(dstPtr);
-			dst = findWrappedBlock(MKID('WIZD'), dstPtr, 0, 0);
+			dst = _vm->findWrappedBlock(MKID('WIZD'), dstPtr, 0, 0);
 			assert(dst);
 
 			getWizImageDim(dstResNum, 0, cw, ch);
 		} else {
-			VirtScreen *pvs = &virtscr[kMainVirtScreen];
+			VirtScreen *pvs = &_vm->virtscr[kMainVirtScreen];
 			if (flags & kWIFMarkBufferDirty) {
 				dst = pvs->getPixels(0, pvs->topline);
 			} else {
@@ -1053,9 +1053,9 @@
 		} else {
 			return 0;
 		}
-	} else if (_wiz->_rectOverrideEnabled) {
-		if (rScreen.intersects(_wiz->_rectOverride)) {
-			rScreen.clip(_wiz->_rectOverride);
+	} else if (_rectOverrideEnabled) {
+		if (rScreen.intersects(_rectOverride)) {
+			rScreen.clip(_rectOverride);
 		} else {
 			return 0;
 		}
@@ -1069,12 +1069,12 @@
 	}
 
 	int color;
-	uint8 *trns = findWrappedBlock(MKID('TRNS'), dataPtr, state, 0);
+	uint8 *trns = _vm->findWrappedBlock(MKID('TRNS'), dataPtr, state, 0);
 
 	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);
+		color = (trns == NULL) ? _vm->VAR(_vm->VAR_WIZ_TCOLOR) : -1;
+		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);
+		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);
+		color = (trns == NULL) ? _vm->VAR(_vm->VAR_WIZ_TCOLOR) : -1;
+		copyRaw16BitWizImage(dst, wizd, cw, ch, x1, y1, width, height, &rScreen, flags, palPtr, color);
 		break;
 	case 5:
 		// Used in Moonbase Commander
@@ -1105,9 +1105,9 @@
 			rImage.clip(rScreen);
 			if (!(flags & kWIFBlitToFrontVideoBuffer) && (flags & (kWIFBlitToFrontVideoBuffer | kWIFMarkBufferDirty))) {
 				++rImage.bottom;
-				markRectAsDirty(kMainVirtScreen, rImage);
+				_vm->markRectAsDirty(kMainVirtScreen, rImage);
 			} else {
-				gdi.copyVirtScreenBuffers(rImage);
+				_vm->gdi.copyVirtScreenBuffers(rImage);
 			}
 		}
 	}
@@ -1181,7 +1181,7 @@
 	}
 };
 
-void ScummEngine_v72he::drawWizComplexPolygon(int resNum, int state, int po_x, int po_y, int xmapNum, int angle, int zoom, const Common::Rect *r, int flags, int dstResNum, int paletteNum) {
+void Wiz::drawWizComplexPolygon(int resNum, int state, int po_x, int po_y, int xmapNum, int angle, int zoom, const Common::Rect *r, int flags, int dstResNum, int paletteNum) {
 	Common::Point pts[4];
 	int32 w, h;
 	getWizImageDim(resNum, state, w, h);
@@ -1198,7 +1198,7 @@
 		}
 	}
 	if (angle)
-		_wiz->polygonRotatePoints(pts, 4, angle);
+		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);
+		polygonCalcBoundBox(pts, 4, bounds);
 		int x1 = bounds.left;
 		int y1 = bounds.top;
 
@@ -1244,13 +1244,13 @@
 	}
 }
 
-void ScummEngine_v72he::drawWizPolygon(int resNum, int state, int id, int flags, int xmapNum, int dstResNum, int paletteNum) {
+void Wiz::drawWizPolygon(int resNum, int state, int id, int flags, int xmapNum, int dstResNum, int paletteNum) {
 	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(_polygons); ++i) {
+		if (_polygons[i].id == id) {
+			wp = &_polygons[i];
 			break;
 		}
 	}
@@ -1265,12 +1265,12 @@
 	if (srcWizBuf) {
 		uint8 *dst;
 		int32 wizW, wizH;
-		VirtScreen *pvs = &virtscr[kMainVirtScreen];
+		VirtScreen *pvs = &_vm->virtscr[kMainVirtScreen];
 
 		if (dstResNum) {
-			uint8 *dstPtr = getResourceAddress(rtImage, dstResNum);
+			uint8 *dstPtr = _vm->getResourceAddress(rtImage, dstResNum);
 			assert(dstPtr);
-			dst = findWrappedBlock(MKID('WIZD'), dstPtr, 0, 0);
+			dst = _vm->findWrappedBlock(MKID('WIZD'), dstPtr, 0, 0);
 			assert(dst);
 
 			getWizImageDim(dstResNum, 0, wizW, wizH);
@@ -1342,18 +1342,18 @@
 		}
 
 		if (flags & kWIFMarkBufferDirty) {
-			markRectAsDirty(kMainVirtScreen, wp->bound);
+			_vm->markRectAsDirty(kMainVirtScreen, wp->bound);
 		} else {
-			gdi.copyVirtScreenBuffers(wp->bound);
+			_vm->gdi.copyVirtScreenBuffers(wp->bound);
 		}
 
 		free(srcWizBuf);
 	}
 }
 
-void ScummEngine_v72he::flushWizBuffer() {
-	for (int i = 0; i < _wiz->_imagesNum; ++i) {
-		WizImage *pwi = &_wiz->_images[i];
+void Wiz::flushWizBuffer() {
+	for (int i = 0; i < _imagesNum; ++i) {
+		WizImage *pwi = &_images[i];
 		if (pwi->flags & kWIFIsPolygon) {
 			drawWizPolygon(pwi->resNum, pwi->state, pwi->x1, pwi->flags, pwi->xmapNum, 0, pwi->paletteNum);
 		} else {
@@ -1361,13 +1361,13 @@
 			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;
+	_imagesNum = 0;
 }
 
-void ScummEngine_v80he::loadImgSpot(int resId, int state, int16 &x, int16 &y) {
-	uint8 *dataPtr = getResourceAddress(rtImage, resId);
+void Wiz::loadImgSpot(int resId, int state, int16 &x, int16 &y) {
+	uint8 *dataPtr = _vm->getResourceAddress(rtImage, resId);
 	assert(dataPtr);
-	uint8 *spotPtr = findWrappedBlock(MKID('SPOT'), dataPtr, state, 0);
+	uint8 *spotPtr = _vm->findWrappedBlock(MKID('SPOT'), dataPtr, state, 0);
 	if (spotPtr) {
 		x = (int16)READ_LE_UINT32(spotPtr + 0);
 		y = (int16)READ_LE_UINT32(spotPtr + 4);
@@ -1377,7 +1377,7 @@
 	}
 }
 
-void ScummEngine_v80he::loadWizCursor(int resId) {
+void Wiz::loadWizCursor(int resId) {
 	int16 x, y;
 	loadImgSpot(resId, 0, x, y);
 	if (x < 0) {
@@ -1395,12 +1395,12 @@
 	uint8 *cursor = drawWizImage(resId, 0, 0, 0, 0, 0, 0, r, kWIFBlitToMemBuffer, 0, 0);
 	int32 cw, ch;	
 	getWizImageDim(resId, 0, cw, ch);
-	setCursorFromBuffer(cursor, cw, ch, cw);
-	setCursorHotspot(x, y);
+	_vm->setCursorFromBuffer(cursor, cw, ch, cw);
+	_vm->setCursorHotspot(x, y);
 	free(cursor);
 }
 
-void ScummEngine_v72he::displayWizComplexImage(const WizParameters *params) {
+void Wiz::displayWizComplexImage(const WizParameters *params) {
 	int maskImgResNum = 0;
 	if (params->processFlags & kWPFMaskImg) {
 		maskImgResNum = params->maskImgResNum;
@@ -1453,9 +1453,9 @@
 		int st = (params->processFlags & kWPFNewState) ? params->img.state : 0;
 		int num = params->remapNum;
 		const uint8 *index = params->remapIndex;
-		uint8 *iwiz = getResourceAddress(rtImage, params->img.resNum);
+		uint8 *iwiz = _vm->getResourceAddress(rtImage, params->img.resNum);
 		assert(iwiz);
-		uint8 *rmap = findWrappedBlock(MKID('RMAP'), iwiz, st, 0) ;
+		uint8 *rmap = _vm->findWrappedBlock(MKID('RMAP'), iwiz, st, 0) ;
 		assert(rmap);
 		WRITE_BE_UINT32(rmap, 0x01234567);
 		while (num--) {
@@ -1465,12 +1465,12 @@
 		flags |= kWIFRemapPalette;
 	}
 
-	if (_fullRedraw && dstResNum == 0) {
+	if (_vm->_fullRedraw && dstResNum == 0) {
 		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(_imagesNum < ARRAYSIZE(_images));
+		WizImage *pwi = &_images[_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;
+		++_imagesNum;
 	} else {
 		if (maskImgResNum != 0) {
 			// TODO
@@ -1496,7 +1496,7 @@
 	}
 }
 
-void ScummEngine_v90he::createWizEmptyImage(const WizParameters *params) {
+void Wiz::createWizEmptyImage(const WizParameters *params) {
 	debug(1, "ScummEngine_v90he::createWizEmptyImage(%d, %d, %d)", params->img.resNum, params->resDefImgW, params->resDefImgH);
 	int img_w = 640;
 	if (params->processFlags & kWPFUseDefImgWidth) {
@@ -1526,16 +1526,16 @@
 	res_size += 8 + img_w * img_h;
 	
 	const uint8 *palPtr;
-	if (_heversion >= 99) {
-		palPtr = _hePalettes + 1024;
+	if (_vm->_heversion >= 99) {
+		palPtr = _vm->_hePalettes + 1024;
 	} else {
-		palPtr = _currentPalette;
+		palPtr = _vm->_currentPalette;
 	}
-	uint8 *res_data = res.createResource(rtImage, params->img.resNum, res_size);
+	uint8 *res_data = _vm->res.createResource(rtImage, params->img.resNum, res_size);
 	if (!res_data) {
-		VAR(119) = -1;
+		_vm->VAR(119) = -1;
 	} else {
-		VAR(119) = 0;
+		_vm->VAR(119) = 0;
 		WRITE_BE_UINT32(res_data, 'AWIZ'); res_data += 4;
 		WRITE_BE_UINT32(res_data, res_size); res_data += 4;
 		WRITE_BE_UINT32(res_data, 'WIZH'); res_data += 4;
@@ -1567,14 +1567,14 @@
 	}
 }
 
-void ScummEngine_v90he::fillWizRect(const WizParameters *params) {
+void Wiz::fillWizRect(const WizParameters *params) {
 	int state = 0;
 	if (params->processFlags & kWPFNewState) {
 		state = params->img.state;
 	}
-	uint8 *dataPtr = getResourceAddress(rtImage, params->img.resNum);
+	uint8 *dataPtr = _vm->getResourceAddress(rtImage, params->img.resNum);
 	if (dataPtr) {	
-		uint8 *wizh = findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
+		uint8 *wizh = _vm->findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
 		assert(wizh);
 		int c = READ_LE_UINT32(wizh + 0x0);
 		int w = READ_LE_UINT32(wizh + 0x4);
@@ -1590,11 +1590,11 @@
 		if (params->processFlags & kWPFClipBox2) {
 			r1.clip(params->box2);
 		}
-		uint8 color = VAR(93);
+		uint8 color = _vm->VAR(93);
 		if (params->processFlags & kWPFFillColor) {
 			color = params->fillColor;
 		}
-		uint8 *wizd = findWrappedBlock(MKID('WIZD'), dataPtr, state, 0);
+		uint8 *wizd = _vm->findWrappedBlock(MKID('WIZD'), dataPtr, state, 0);
 		assert(wizd);
 		int dx = r1.width();
 		int dy = r1.height();
@@ -1606,15 +1606,15 @@
 	}
 }
 
-void ScummEngine_v90he::fillWizParallelogram(const WizParameters *params) {	
+void Wiz::fillWizParallelogram(const WizParameters *params) {	
 	if (params->processFlags & kWPFClipBox2) {
 		int state = 0;
 		if (params->processFlags & kWPFNewState) {
 			state = params->img.state;
 		}
-		uint8 *dataPtr = getResourceAddress(rtImage, params->img.resNum);
+		uint8 *dataPtr = _vm->getResourceAddress(rtImage, params->img.resNum);
 		if (dataPtr) {
-			uint8 *wizh = findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
+			uint8 *wizh = _vm->findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
 			assert(wizh);
 			int c = READ_LE_UINT32(wizh + 0x0);
 			int w = READ_LE_UINT32(wizh + 0x4);
@@ -1627,11 +1627,11 @@
 				}
 				r1.clip(params->box);
 			}
-			uint8 color = VAR(93);
+			uint8 color = _vm->VAR(93);
 			if (params->processFlags & kWPFFillColor) {
 				color = params->fillColor;
 			}
-			uint8 *wizd = findWrappedBlock(MKID('WIZD'), dataPtr, state, 0);
+			uint8 *wizd = _vm->findWrappedBlock(MKID('WIZD'), dataPtr, state, 0);
 			assert(wizd);
 			int x1 = params->box2.left;
 			int y1 = params->box2.top;
@@ -1694,7 +1694,7 @@
 	}
 }
 
-void ScummEngine_v90he::processWizImage(const WizParameters *params) {
+void Wiz::processWizImage(const WizParameters *params) {
 	char buf[512];
 	unsigned int i;
 
@@ -1725,24 +1725,24 @@
 				if (id == TO_LE_32(MKID('AWIZ')) || id == TO_LE_32(MKID('MULT'))) {
 					uint32 size = f.readUint32BE();
 					f.seek(0, SEEK_SET);
-					byte *p = res.createResource(rtImage, params->img.resNum, size);
+					byte *p = _vm->res.createResource(rtImage, params->img.resNum, size);
 					if (f.read(p, size) != size) {
-						res.nukeResource(rtImage, params->img.resNum);
+						_vm->res.nukeResource(rtImage, params->img.resNum);
 						warning("i/o error when reading '%s'", buf);
-						VAR(VAR_GAME_LOADED) = -2;
-						VAR(119) = -2;
+						_vm->VAR(_vm->VAR_GAME_LOADED) = -2;
+						_vm->VAR(119) = -2;
 					} else {
-						VAR(VAR_GAME_LOADED) = 0;
-						VAR(119) = 0;
+						_vm->VAR(_vm->VAR_GAME_LOADED) = 0;
+						_vm->VAR(119) = 0;
 					}
 				} else {
-					VAR(VAR_GAME_LOADED) = -1;
-					VAR(119) = -1;
+					_vm->VAR(_vm->VAR_GAME_LOADED) = -1;
+					_vm->VAR(119) = -1;
 				}
 				f.close();
 			} else {
-				VAR(VAR_GAME_LOADED) = -3;
-				VAR(119) = -3;
+				_vm->VAR(_vm->VAR_GAME_LOADED) = -3;
+				_vm->VAR(119) = -3;
 				warning("Unable to open for read '%s'", buf);
 			}
 		}
@@ -1753,7 +1753,7 @@
 
 			switch(params->fileWriteMode) {
 			case 2:
-				VAR(119) = -1;
+				_vm->VAR(119) = -1;
 				break;
 			case 1:
 				// TODO Write image to file
@@ -1768,15 +1768,15 @@
 
 				if (!f.open((const char *)buf, Common::File::kFileWriteMode)) {
 					warning("Unable to open for write '%s'", buf);
-					VAR(119) = -3;
+					_vm->VAR(119) = -3;
 				} else {
-					byte *p = getResourceAddress(rtImage, params->img.resNum);
+					byte *p = _vm->getResourceAddress(rtImage, params->img.resNum);
 					uint32 size = READ_BE_UINT32(p + 4);
 					if (f.write(p, size) != size) {
 						warning("i/o error when writing '%s'", params->filename);
-						VAR(119) = -2;
+						_vm->VAR(119) = -2;
 					} else {
-						VAR(119) = 0;
+						_vm->VAR(119) = 0;
 					}
 					f.close();
 				}
@@ -1791,9 +1791,9 @@
 			int state = (params->processFlags & kWPFNewState) ? params->img.state : 0;
 			int num = params->remapNum;
 			const uint8 *index = params->remapIndex;
-			uint8 *iwiz = getResourceAddress(rtImage, params->img.resNum);
+			uint8 *iwiz = _vm->getResourceAddress(rtImage, params->img.resNum);
 			assert(iwiz);
-			uint8 *rmap = findWrappedBlock(MKID('RMAP'), iwiz, state, 0) ;
+			uint8 *rmap = _vm->findWrappedBlock(MKID('RMAP'), iwiz, state, 0) ;
 			assert(rmap);
 			WRITE_BE_UINT32(rmap, 0x01234567);
 			while (num--) {
@@ -1841,36 +1841,36 @@
 	}
 }
 
-int ScummEngine_v90he::getWizImageStates(int resNum) {
-	const uint8 *dataPtr = getResourceAddress(rtImage, resNum);
+int Wiz::getWizImageStates(int resNum) {
+	const uint8 *dataPtr = _vm->getResourceAddress(rtImage, resNum);
 	assert(dataPtr);
 	if (READ_UINT32(dataPtr) == MKID('MULT')) {
 		const byte *offs, *wrap;
 
-		wrap = findResource(MKID('WRAP'), dataPtr);
+		wrap = _vm->findResource(MKID('WRAP'), dataPtr);
 		if (wrap == NULL)
 			return 1;
 
-		offs = findResourceData(MKID('OFFS'), wrap);
+		offs = _vm->findResourceData(MKID('OFFS'), wrap);
 		if (offs == NULL)
 			return 1;
 
-		return getResourceDataSize(offs) / 4;
+		return _vm->getResourceDataSize(offs) / 4;
 	} else {
 		return 1;
 	}
 }
 
-int ScummEngine_v90he::isWizPixelNonTransparent(int resNum, int state, int x, int y, int flags) {
+int Wiz::isWizPixelNonTransparent(int resNum, int state, int x, int y, int flags) {
 	int ret = 0;
-	uint8 *data = getResourceAddress(rtImage, resNum);
+	uint8 *data = _vm->getResourceAddress(rtImage, resNum);
 	assert(data);
-	uint8 *wizh = findWrappedBlock(MKID('WIZH'), data, state, 0);
+	uint8 *wizh = _vm->findWrappedBlock(MKID('WIZH'), data, state, 0);
 	assert(wizh);
 	int c = READ_LE_UINT32(wizh + 0x0);
 	int w = READ_LE_UINT32(wizh + 0x4);
 	int h = READ_LE_UINT32(wizh + 0x8);
-	uint8 *wizd = findWrappedBlock(MKID('WIZD'), data, state, 0);
+	uint8 *wizd = _vm->findWrappedBlock(MKID('WIZD'), data, state, 0);
 	assert(wizd);
 	if (x >= 0 && x < w && y >= 0 && y < h) {
 		if (flags & kWIFFlipX) {
@@ -1881,10 +1881,10 @@
 		}
 		switch (c) {
 		case 0:
-			ret = _wiz->getRawWizPixelColor(wizd, x, y, w, h, VAR(VAR_WIZ_TCOLOR)) != VAR(VAR_WIZ_TCOLOR) ? 1 : 0;
+			ret = getRawWizPixelColor(wizd, x, y, w, h, _vm->VAR(_vm->VAR_WIZ_TCOLOR)) != _vm->VAR(_vm->VAR_WIZ_TCOLOR) ? 1 : 0;
 			break;
 		case 1:
-			ret = _wiz->isWizPixelNonTransparent(wizd, x, y, w, h);
+			ret = isWizPixelNonTransparent(wizd, x, y, w, h);
 			break;
 		case 2:
 			// Used baseball2003
@@ -1903,23 +1903,23 @@
 	return ret;
 }
 
-uint8 ScummEngine_v90he::getWizPixelColor(int resNum, int state, int x, int y, int flags) {
+uint8 Wiz::getWizPixelColor(int resNum, int state, int x, int y, int flags) {
 	uint8 color;
-	uint8 *data = getResourceAddress(rtImage, resNum);
+	uint8 *data = _vm->getResourceAddress(rtImage, resNum);
 	assert(data);
-	uint8 *wizh = findWrappedBlock(MKID('WIZH'), data, state, 0);
+	uint8 *wizh = _vm->findWrappedBlock(MKID('WIZH'), data, state, 0);
 	assert(wizh);
 	int c = READ_LE_UINT32(wizh + 0x0);
 	int w = READ_LE_UINT32(wizh + 0x4);
 	int h = READ_LE_UINT32(wizh + 0x8);
-	uint8 *wizd = findWrappedBlock(MKID('WIZD'), data, state, 0);
+	uint8 *wizd = _vm->findWrappedBlock(MKID('WIZD'), data, state, 0);
 	assert(wizd);
 	switch (c) {
 	case 0:
-		color = _wiz->getRawWizPixelColor(wizd, x, y, w, h, VAR(VAR_WIZ_TCOLOR));
+		color = getRawWizPixelColor(wizd, x, y, w, h, _vm->VAR(_vm->VAR_WIZ_TCOLOR));
 		break;
 	case 1:
-		color = _wiz->getWizPixelColor(wizd, x, y, w, h, VAR(VAR_WIZ_TCOLOR));
+		color = getWizPixelColor(wizd, x, y, w, h, _vm->VAR(_vm->VAR_WIZ_TCOLOR));
 		break;
 	case 4:
 	case 5:

Index: wiz_he.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.h,v
retrieving revision 2.23
retrieving revision 2.24
diff -u -d -r2.23 -r2.24
--- wiz_he.h	23 May 2005 02:00:49 -0000	2.23
+++ wiz_he.h	23 May 2005 03:33:08 -0000	2.24
@@ -162,6 +162,28 @@
 	bool polygonContains(const WizPolygon &pol, int x, int y);
 	void polygonRotatePoints(Common::Point *pts, int num, int alpha);
 
+	void createWizEmptyImage(const WizParameters *params);
+	void fillWizRect(const WizParameters *params);
+	void fillWizParallelogram(const WizParameters *params);
+
+	void getWizImageDim(int resNum, int state,  int32 &w, int32 &h);
+	int getWizImageStates(int resnum);	
+	int isWizPixelNonTransparent(int resnum, int state, int x, int y, int flags);
+	uint8 getWizPixelColor(int resnum, int state, int x, int y, int flags);
+
+	void flushWizBuffer();
+
+	void loadImgSpot(int resId, int state, int16 &x, int16 &y);
+	void loadWizCursor(int resId);
+
+	void displayWizComplexImage(const WizParameters *params);
+	void displayWizImage(WizImage *pwi);
+	void captureWizImage(int resNum, const Common::Rect& r, bool frontBuffer, int compType);
+	uint8 *drawWizImage(int resNum, int state, int x1, int y1, int zorder, int xmapNum, int field_390, const Common::Rect *clipBox, int flags, int dstResNum, int paletteNum);
+	void drawWizPolygon(int resNum, int state, int id, int flags, int xmapNum, int dstResNum, int paletteNum);
+	void drawWizComplexPolygon(int resNum, int state, int po_x, int po_y, int xmapNum, int angle, int zoom, const Common::Rect *r, int flags, int dstResNum, int paletteNum);
+	void processWizImage(const WizParameters *params);
+
 	static void copyAuxImage(uint8 *dst1, uint8 *dst2, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch);	
 	static void copyWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, const uint8 *palPtr = NULL);
 	static void copyRawWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags, const uint8 *palPtr, int transColor);





More information about the Scummvm-git-logs mailing list