[Scummvm-cvs-logs] CVS: scummvm/scumm floodfill_he.cpp,2.1.2.4,2.1.2.5 intern.h,2.529.2.11,2.529.2.12 script_v100he.cpp,2.173.2.6,2.173.2.7 script_v72he.cpp,2.307.2.7,2.307.2.8 script_v7he.cpp,2.166.2.7,2.166.2.8 script_v80he.cpp,2.125.2.4,2.125.2.5 script_v90he.cpp,2.281.2.6,2.281.2.7 sprite_he.cpp,1.153.2.3,1.153.2.4 wiz_he.cpp,2.96.2.6,2.96.2.7 wiz_he.h,2.30.2.4,2.30.2.5

kirben kirben at users.sourceforge.net
Thu Jan 26 02:46:06 CET 2006


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

Modified Files:
      Tag: branch-0-8-0
	floodfill_he.cpp intern.h script_v100he.cpp script_v72he.cpp 
	script_v7he.cpp script_v80he.cpp script_v90he.cpp 
	sprite_he.cpp wiz_he.cpp wiz_he.h 
Log Message:

Backport more floodFill changes for wizImages.
Backport more fixes for HE games.


Index: floodfill_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/floodfill_he.cpp,v
retrieving revision 2.1.2.4
retrieving revision 2.1.2.5
diff -u -d -r2.1.2.4 -r2.1.2.5
--- floodfill_he.cpp	18 Jan 2006 18:07:31 -0000	2.1.2.4
+++ floodfill_he.cpp	26 Jan 2006 10:45:45 -0000	2.1.2.5
@@ -226,4 +226,65 @@
 	}
 }
 
+void Wiz::fillWizFlood(const WizParameters *params) {
+	if (params->processFlags & kWPFClipBox2) {
+		int px = params->box2.left;
+		int py = params->box2.top;
+		uint8 *dataPtr = _vm->getResourceAddress(rtImage, params->img.resNum);
+		if (dataPtr) {
+			int state = 0;
+			if (params->processFlags & kWPFNewState) {
+				state = params->img.state;
+			}
+			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);
+			int h = READ_LE_UINT32(wizh + 0x8);
+			assert(c == 0);
+			Common::Rect imageRect(w, h);
+			if (params->processFlags & kWPFClipBox) {
+				if (!imageRect.intersects(params->box)) {
+					return;
+				}
+				imageRect.clip(params->box);
+			}
+			uint8 color = _vm->VAR(93);
+			if (params->processFlags & kWPFFillColor) {
+				color = params->fillColor;
+			}
+			if (imageRect.contains(px, py)) {
+				uint8 *wizd = _vm->findWrappedBlock(MKID('WIZD'), dataPtr, state, 0);
+				assert(wizd);
+
+				FloodFillState *ffs = new FloodFillState;
+				ffs->fillLineTableCount = h * 2;
+				ffs->fillLineTable = new FloodFillLine[ffs->fillLineTableCount];
+				ffs->color2 = color;
+				ffs->dst = wizd;
+				ffs->dst_w = w;
+				ffs->dst_h = h;
+				ffs->srcBox = imageRect;
+				ffs->fillLineTableCur = &ffs->fillLineTable[0];
+				ffs->fillLineTableEnd = &ffs->fillLineTable[ffs->fillLineTableCount];
+	
+				if (px < 0 || py < 0 || px >= w || py >= h) {
+					ffs->color1 = color;
+				} else {
+					ffs->color1 = *(wizd + py * w + px);
+				}
+	
+				debug(0, "floodFill() x=%d y=%d color1=%d", px, py, ffs->color1);
+
+				if (ffs->color1 != color) {
+					floodFillProcess(px, py, ffs, floodFillPixelCheck);
+				}
+	
+				delete[] ffs->fillLineTable;
+				delete ffs;
+			}
+		}
+	}
+}
+
 } // End of namespace Scumm

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.529.2.11
retrieving revision 2.529.2.12
diff -u -d -r2.529.2.11 -r2.529.2.12
--- intern.h	18 Jan 2006 22:17:51 -0000	2.529.2.11
+++ intern.h	26 Jan 2006 10:45:45 -0000	2.529.2.12
@@ -887,6 +887,7 @@
 	void o70_appendString();
 	void o70_concatString();
 	void o70_compareString();
+	void o70_isResourceLoaded();
 	void o70_readINI();
 	void o70_writeINI();
 	void o70_getStringLenForWidth();
@@ -1040,7 +1041,6 @@
 	void o72_getPixel();
 	void o72_pickVarRandom();
 	void o72_redimArray();
-	void o72_isResourceLoaded();
 	void o72_readINI();
 	void o72_writeINI();
 	void o72_getResourceSize();
@@ -1287,6 +1287,7 @@
 	void o100_dimArray();
 	void o100_drawLine();
 	void o100_drawObject();
+	void o100_floodFill();
 	void o100_setSpriteGroupInfo();
 	void o100_resourceRoutines();
 	void o100_wizImageOps();

Index: script_v100he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v100he.cpp,v
retrieving revision 2.173.2.6
retrieving revision 2.173.2.7
diff -u -d -r2.173.2.6 -r2.173.2.7
--- script_v100he.cpp	18 Jan 2006 18:07:32 -0000	2.173.2.6
+++ script_v100he.cpp	26 Jan 2006 10:45:45 -0000	2.173.2.7
@@ -59,7 +59,7 @@
 		OPCODE(o6_loadRoom),
 		OPCODE(o6_panCameraTo),
 		/* 10 */
-		OPCODE(o6_invalid),
+		OPCODE(o72_captureWizImage),
 		OPCODE(o100_jumpToScript),
 		OPCODE(o6_setClass),
 		OPCODE(o60_closeFile),
@@ -96,7 +96,7 @@
 		/* 2C */
 		OPCODE(o6_stopObjectCode),
 		OPCODE(o6_eq),
-		OPCODE(o6_invalid),
+		OPCODE(o100_floodFill),
 		OPCODE(o6_freezeUnfreeze),
 		/* 30 */
 		OPCODE(o6_ge),
@@ -861,6 +861,40 @@
 	}
 }
 
+void ScummEngine_v100he::o100_floodFill() {
+	byte subOp = fetchScriptByte();
+	switch (subOp) {
+	case 0:
+		memset(&_floodFillParams, 0, sizeof(_floodFillParams));
+		_floodFillParams.box.left = 0;
+		_floodFillParams.box.top = 0;
+		_floodFillParams.box.right = 639;
+		_floodFillParams.box.bottom = 479;
+		break;
+	case 6:
+		_floodFillParams.y = pop();
+		_floodFillParams.x = pop();
+		break;
+	case 18:
+		_floodFillParams.box.bottom = pop();
+		_floodFillParams.box.right = pop();
+		_floodFillParams.box.top = pop();
+		_floodFillParams.box.left = pop();
+		break;
+	case 20:
+		_floodFillParams.flags = pop();
+		break;
+	case 67:
+		pop();
+		break;
+	case 92:
+		floodFill(&_floodFillParams, this);
+		break;
+	default:
+		error("o100_floodFill: Unknown case %d", subOp);
+	}
+}
+
 void ScummEngine_v100he::o100_setSpriteGroupInfo() {
 	byte string[260];
 	int type, value1, value2, value3, value4;
@@ -2232,7 +2266,7 @@
 }
 
 void ScummEngine_v100he::o100_writeFile() {
-	int16 resID = pop();
+	int resID = pop();
 	int slot = pop();
 	byte subOp = fetchScriptByte();
 
@@ -2405,7 +2439,7 @@
 	byte filename[4096];
 	int resId, state, type;
 	int32 w, h;
-	int16 x, y;
+	int32 x, y;
 
 	byte subOp = fetchScriptByte();
 	subOp -= 20;

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.307.2.7
retrieving revision 2.307.2.8
diff -u -d -r2.307.2.7 -r2.307.2.8
--- script_v72he.cpp	18 Jan 2006 18:07:33 -0000	2.307.2.7
+++ script_v72he.cpp	26 Jan 2006 10:45:45 -0000	2.307.2.8
@@ -346,7 +346,7 @@
 		/* F0 */
 		OPCODE(o70_concatString),
 		OPCODE(o70_compareString),
-		OPCODE(o72_isResourceLoaded),
+		OPCODE(o70_isResourceLoaded),
 		OPCODE(o72_readINI),
 		/* F4 */
 		OPCODE(o72_writeINI),
@@ -1974,7 +1974,7 @@
 	dim1end = FROM_LE_32(ah->dim1end);
 
 	if (dim1end < num) {
-		int16 var_2 = readArray(value, 0, num - 1);
+		int32 var_2 = readArray(value, 0, num - 1);
 		shuffleArray(value, 1, dim1end);
 		if (readArray(value, 0, 1) == var_2) {
 			num = 2;
@@ -2140,36 +2140,6 @@
 	}
 }
 
-void ScummEngine_v72he::o72_isResourceLoaded() {
-	// Reports percentage of resource loaded by queue
-	int type;
-
-	byte subOp = fetchScriptByte();
-	/* int idx = */ pop();
-
-	switch (subOp) {
-	case 18:
-		type = rtImage;
-		break;
-	case 226:
-		type = rtRoom;
-		break;
-	case 227:
-		type = rtCostume;
-		break;
-	case 228:
-		type = rtSound;
-		break;
-	case 229:
-		type = rtScript;
-		break;
-	default:
-		error("o72_isResourceLoaded: default case %d", subOp);
-	}
-
-	push(100);
-}
-
 void ScummEngine_v72he::o72_readINI() {
 	byte option[128];
 	ArrayHeader *ah;

Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.166.2.7
retrieving revision 2.166.2.8
diff -u -d -r2.166.2.7 -r2.166.2.8
--- script_v7he.cpp	18 Jan 2006 18:07:33 -0000	2.166.2.7
+++ script_v7he.cpp	26 Jan 2006 10:45:45 -0000	2.166.2.8
@@ -343,7 +343,7 @@
 		/* F0 */
 		OPCODE(o70_concatString),
 		OPCODE(o70_compareString),
-		OPCODE(o6_invalid),
+		OPCODE(o70_isResourceLoaded),
 		OPCODE(o70_readINI),
 		/* F4 */
 		OPCODE(o70_writeINI),
@@ -533,20 +533,20 @@
 		break;
 	case 104:		// SO_NUKE_SCRIPT
 		resid = pop();
-		res.setResourceCounter(rtScript, resid, 0x7F);
+		res.nukeResource(rtScript, resid);
 		break;
 	case 105:		// SO_NUKE_SOUND
 		resid = pop();
-		res.setResourceCounter(rtSound, resid, 0x7F);
+		res.nukeResource(rtSound, resid);
 		break;
 	case 106:		// SO_NUKE_COSTUME
 		resid = pop();
-		res.setResourceCounter(rtCostume, resid, 0x7F);
+		res.nukeResource(rtCostume, resid);
 		break;
 	case 107:		// SO_NUKE_ROOM
 		resid = pop();
-		res.setResourceCounter(rtRoom, resid, 0x7F);
-		res.setResourceCounter(rtRoomImage, resid, 0x7F);
+		res.nukeResource(rtRoom, resid);
+		res.nukeResource(rtRoomImage, resid);
 		break;
 	case 108:		// SO_LOCK_SCRIPT
 		resid = pop();
@@ -911,6 +911,36 @@
 	push(result);
 }
 
+void ScummEngine_v70he::o70_isResourceLoaded() {
+	// Reports percentage of resource loaded by queue
+	int type;
+
+	byte subOp = fetchScriptByte();
+	/* int idx = */ pop();
+
+	switch (subOp) {
+	case 18:
+		type = rtImage;
+		break;
+	case 226:
+		type = rtRoom;
+		break;
+	case 227:
+		type = rtCostume;
+		break;
+	case 228:
+		type = rtSound;
+		break;
+	case 229:
+		type = rtScript;
+		break;
+	default:
+		error("o70_isResourceLoaded: default case %d", subOp);
+	}
+
+	push(100);
+}
+
 void ScummEngine_v70he::o70_readINI() {
 	byte option[256];
 	ArrayHeader *ah;

Index: script_v80he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v80he.cpp,v
retrieving revision 2.125.2.4
retrieving revision 2.125.2.5
diff -u -d -r2.125.2.4 -r2.125.2.5
--- script_v80he.cpp	18 Jan 2006 18:07:33 -0000	2.125.2.4
+++ script_v80he.cpp	26 Jan 2006 10:45:45 -0000	2.125.2.5
@@ -345,7 +345,7 @@
 		/* F0 */
 		OPCODE(o70_concatString),
 		OPCODE(o70_compareString),
-		OPCODE(o72_isResourceLoaded),
+		OPCODE(o70_isResourceLoaded),
 		OPCODE(o72_readINI),
 		/* F4 */
 		OPCODE(o72_writeINI),
@@ -787,11 +787,11 @@
 	dim1end = FROM_LE_32(ah->dim1end);
 
 	if (dim1end < num) {
-		int16 var_2 = readArray(value, 0, num - 1);
+		int32 var_2 = readArray(value, 0, num - 1);
 		shuffleArray(value, 1, dim1end);
 		num = 1;
 		if (readArray(value, 0, 1) == var_2 && dim1end >= 3) {
-			int16 tmp = readArray(value, 0, 2);
+			int32 tmp = readArray(value, 0, 2);
 			writeArray(value, 0, num, tmp);
 			writeArray(value, 0, 2, var_2);
 		}

Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.281.2.6
retrieving revision 2.281.2.7
diff -u -d -r2.281.2.6 -r2.281.2.7
--- script_v90he.cpp	18 Jan 2006 18:07:33 -0000	2.281.2.6
+++ script_v90he.cpp	26 Jan 2006 10:45:45 -0000	2.281.2.7
@@ -342,7 +342,7 @@
 		/* F0 */
 		OPCODE(o70_concatString),
 		OPCODE(o70_compareString),
-		OPCODE(o72_isResourceLoaded),
+		OPCODE(o70_isResourceLoaded),
 		OPCODE(o72_readINI),
 		/* F4 */
 		OPCODE(o72_writeINI),
@@ -1681,7 +1681,7 @@
 	byte filename[4096];
 	int state, resId;
 	int32 w, h;
-	int16 x, y;
+	int32 x, y;
 
 	byte subOp = fetchScriptByte();
 	subOp -= 30;
@@ -1766,7 +1766,7 @@
 
 	switch (subOp) {
 	case 0:
-		_floodFillParams.unk1C = pop();
+		pop();
 		break;
 	case 3:
 		memset(&_floodFillParams, 0, sizeof(_floodFillParams));
@@ -2620,9 +2620,10 @@
 		_wiz->_rectOverrideEnabled = false;
 		break;
 	case 714:
+		debug(5, "o90_kernelSetFunctions: case 714: type %d resId %d unk1 %d", args[1], args[2], args[3]);
 		break;
 	case 1492:
-		_sprite->setSpriteFlagDoubleBuffered(args[1], args[2]);
+		// Remote start script function
 		break;
 	case 1969:
 		a = derefActor(args[1], "o90_kernelSetFunctions: 1969");

Index: sprite_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sprite_he.cpp,v
retrieving revision 1.153.2.3
retrieving revision 1.153.2.4
diff -u -d -r1.153.2.3 -r1.153.2.4
--- sprite_he.cpp	18 Jan 2006 18:07:33 -0000	1.153.2.3
+++ sprite_he.cpp	26 Jan 2006 10:45:45 -0000	1.153.2.4
@@ -43,7 +43,7 @@
 
 void Sprite::getSpriteBounds(int spriteId, bool checkGroup, Common::Rect &bound) {
 	checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d");
-	int16 spr_wiz_x, spr_wiz_y;
+	int32 spr_wiz_x, spr_wiz_y;
 	int angle, scale, x1, y1;
 	int32 w, h;
 
@@ -157,7 +157,7 @@
 
 			image = spi->curImage;
 			if (spi->maskImage) {
-				int16 x1, x2, y1, y2;
+				int32 x1, x2, y1, y2;
 
 				imageState = spi->curImageState % _vm->_wiz->getWizImageStates(spi->maskImage);
 
@@ -1233,7 +1233,7 @@
 
 void Sprite::processImages(bool arg) {
 	int spr_flags;
-	int16 spr_wiz_x, spr_wiz_y;
+	int32 spr_wiz_x, spr_wiz_y;
 	int image, imageState;
 	Common::Rect *bboxPtr;
 	int angle, scale;

Index: wiz_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.cpp,v
retrieving revision 2.96.2.6
retrieving revision 2.96.2.7
diff -u -d -r2.96.2.6 -r2.96.2.7
--- wiz_he.cpp	18 Jan 2006 18:07:33 -0000	2.96.2.6
+++ wiz_he.cpp	26 Jan 2006 10:45:45 -0000	2.96.2.7
@@ -1003,7 +1003,7 @@
 	int32 cw, ch;
 	if (flags & kWIFBlitToMemBuffer) {
 		dst = (uint8 *)malloc(width * height);
-		int color = 255; // FIXME: should be (VAR_WIZ_TCOLOR != 0xFF) ? VAR(VAR_WIZ_TCOLOR) : 5;
+		int color = 255;
 		memset(dst, color, width * height);
 		cw = width;
 		ch = height;
@@ -1341,7 +1341,7 @@
 	_imagesNum = 0;
 }
 
-void Wiz::loadImgSpot(int resId, int state, int16 &x, int16 &y) {
+void Wiz::loadImgSpot(int resId, int state, int32 &x, int32 &y) {
 	uint8 *dataPtr = _vm->getResourceAddress(rtImage, resId);
 	assert(dataPtr);
 	uint8 *spotPtr = _vm->findWrappedBlock(MKID('SPOT'), dataPtr, state, 0);
@@ -1355,7 +1355,7 @@
 }
 
 void Wiz::loadWizCursor(int resId) {
-	int16 x, y;
+	int32 x, y;
 	loadImgSpot(resId, 0, x, y);
 	if (x < 0) {
 		x = 0;
@@ -1719,7 +1719,7 @@
 	char buf[512];
 	unsigned int i;
 
-	debug(1, "processWizImage: processMode %d", params->processMode);
+	debug(5, "processWizImage: processMode %d", params->processMode);
 	switch (params->processMode) {
 	case 0:
 		// Used in racedemo
@@ -1842,19 +1842,18 @@
 		fillWizPixel(params);
 		break;
 	case 12:
-		// Used in PuttsFunShop/SamsFunShop
-		// TODO: Flood Fill
+		fillWizFlood(params);
 		break;
 	case 13:
-		// Used in PuttsFunShop/SamsFunShop
+		// Used for text in FreddisFunShop/PuttsFunShop/SamsFunShop
 		// TODO: Start Font
 		break;
 	case 14:
-		// Used in PuttsFunShop/SamsFunShop
+		// Used for text in FreddisFunShop/PuttsFunShop/SamsFunShop
 		// TODO: End Font
 		break;
 	case 15:
-		// Used in PuttsFunShop/SamsFunShop
+		// Used for text in FreddisFunShop/PuttsFunShop/SamsFunShop
 		// TODO: Create Font
 		break;
 	case 16:
@@ -1862,7 +1861,7 @@
 		error("Render Font String");
 		break;
 	case 17:
-		// Used in PuttsFunShop/SamsFunShop
+		// Used in to draw circles in FreddisFunShop/PuttsFunShop/SamsFunShop
 		// TODO: Ellipse
 		break;
 	default:

Index: wiz_he.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.h,v
retrieving revision 2.30.2.4
retrieving revision 2.30.2.5
diff -u -d -r2.30.2.4 -r2.30.2.5
--- wiz_he.h	18 Jan 2006 18:07:34 -0000	2.30.2.4
+++ wiz_he.h	26 Jan 2006 10:45:45 -0000	2.30.2.5
@@ -165,6 +165,7 @@
 	void fillWizRect(const WizParameters *params);
 	void fillWizLine(const WizParameters *params);
 	void fillWizPixel(const WizParameters *params);
+	void fillWizFlood(const WizParameters *params);
 
 	void getWizImageDim(int resNum, int state, int32 &w, int32 &h);
 	int getWizImageStates(int resnum);
@@ -174,7 +175,7 @@
 
 	void flushWizBuffer();
 
-	void loadImgSpot(int resId, int state, int16 &x, int16 &y);
+	void loadImgSpot(int resId, int state, int32 &x, int32 &y);
 	void loadWizCursor(int resId);
 
 	void displayWizComplexImage(const WizParameters *params);





More information about the Scummvm-git-logs mailing list