[Scummvm-cvs-logs] CVS: scummvm/scumm floodfill_he.cpp,2.2,2.3 wiz_he.cpp,2.101,2.102 wiz_he.h,2.33,2.34

kirben kirben at users.sourceforge.net
Mon Oct 31 16:53:15 CET 2005


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

Modified Files:
	floodfill_he.cpp wiz_he.cpp wiz_he.h 
Log Message:

Add floodFill support for wizImages.


Index: floodfill_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/floodfill_he.cpp,v
retrieving revision 2.2
retrieving revision 2.3
diff -u -d -r2.2 -r2.3
--- floodfill_he.cpp	19 Oct 2005 13:47:58 -0000	2.2
+++ floodfill_he.cpp	1 Nov 2005 00:52:25 -0000	2.3
@@ -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: wiz_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.cpp,v
retrieving revision 2.101
retrieving revision 2.102
diff -u -d -r2.101 -r2.102
--- wiz_he.cpp	22 Oct 2005 04:08:48 -0000	2.101
+++ wiz_he.cpp	1 Nov 2005 00:52:25 -0000	2.102
@@ -1834,8 +1834,7 @@
 		fillWizPixel(params);
 		break;
 	case 12:
-		// Used in PuttsFunShop/SamsFunShop
-		// TODO: Flood Fill
+		fillWizFlood(params);
 		break;
 	case 13:
 		// Used in PuttsFunShop/SamsFunShop

Index: wiz_he.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.h,v
retrieving revision 2.33
retrieving revision 2.34
diff -u -d -r2.33 -r2.34
--- wiz_he.h	21 Oct 2005 01:34:41 -0000	2.33
+++ wiz_he.h	1 Nov 2005 00:52:25 -0000	2.34
@@ -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);





More information about the Scummvm-git-logs mailing list