[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.435,2.436 wiz_he.cpp,2.47,2.48

Gregory Montoir cyx at users.sourceforge.net
Mon Apr 11 11:00:45 CEST 2005


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

Modified Files:
	intern.h wiz_he.cpp 
Log Message:
added processWizImage mode 10

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.435
retrieving revision 2.436
diff -u -d -r2.435 -r2.436
--- intern.h	11 Apr 2005 07:40:13 -0000	2.435
+++ intern.h	11 Apr 2005 17:59:54 -0000	2.436
@@ -940,6 +940,7 @@
 
 	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);

Index: wiz_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.cpp,v
retrieving revision 2.47
retrieving revision 2.48
diff -u -d -r2.47 -r2.48
--- wiz_he.cpp	10 Apr 2005 03:50:17 -0000	2.47
+++ wiz_he.cpp	11 Apr 2005 17:59:55 -0000	2.48
@@ -1445,7 +1445,7 @@
 		uint32 iw = READ_LE_UINT32(wizh + 0x4);
 		uint32 ih = READ_LE_UINT32(wizh + 0x8);
 		assert(ic == 0 || ic == 2 || ic == 3);	
-		Common::Rect r1(iw, ih);
+		Common::Rect r1(iw + 1, ih + 1);
 		if (params->processFlags & kWPFClipBox) {
 			if (!r1.intersects(params->box)) {
 				return;
@@ -1455,11 +1455,9 @@
 		if (params->processFlags & kWPFClipBox2) {
 			r1.clip(params->box2);
 		}
-		uint8 color;
+		uint8 color = VAR(93);
 		if (params->processFlags & kWPFFillColor) {
 			color = params->fillColor;
-		} else {
-			color = VAR(93);
 		}
 		uint8 *wizd = findWrappedBlock(MKID('WIZD'), dataPtr, state, 0);
 		assert(wizd);
@@ -1473,6 +1471,94 @@
 	}
 }
 
+void ScummEngine_v90he::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);
+		if (dataPtr) {
+			uint8 *wizh = findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
+			assert(wizh);
+			uint32 ic = READ_LE_UINT32(wizh + 0x0);
+			uint32 iw = READ_LE_UINT32(wizh + 0x4);
+			uint32 ih = READ_LE_UINT32(wizh + 0x8);
+			assert(ic == 0 || ic == 2 || ic == 3);
+			Common::Rect r1(iw + 1, ih + 1);
+			if (params->processFlags & kWPFClipBox) {
+				if (!r1.intersects(params->box)) {
+					return;
+				}
+				r1.clip(params->box);
+			}
+			uint8 color = VAR(93);
+			if (params->processFlags & kWPFFillColor) {
+				color = params->fillColor;
+			}
+			uint8 *wizd = findWrappedBlock(MKID('WIZD'), dataPtr, state, 0);
+			assert(wizd);
+			int x1 = params->box2.left;
+			int y1 = params->box2.top;
+			int x2 = params->box2.right;
+			int y2 = params->box2.bottom;
+			
+			int dx = x2 - x1;
+			int incx = 0;
+			if (dx > 0) {
+				incx = 1;
+			} else if (dx < 0) {
+				incx = -1;
+			}
+			int dy = y2 - y1;
+			int incy = 0;
+			if (dy > 0) {
+				incy = 1;
+			} else if (dy < 0) {
+				incy = -1;
+			}
+			
+			if (r1.contains(x1, y1)) {
+				*(wizd + y1 * iw + x1) = color;
+			}
+			
+			if (dx >= dy) {
+				int step1_y = (dy - dx) * 2;
+				int step2_y = dy * 2;
+				int accum_y = dy * 2 - dx;
+				while (x1 != x2) {
+					if (accum_y <= 0) {
+						accum_y += step2_y;
+					} else {
+						accum_y += step1_y;
+						y1 += incy;
+					}
+					x1 += incx;
+					if (r1.contains(x1, y1)) {
+						*(wizd + y1 * iw + x1) = color;
+					}
+				}
+			} else {
+				int step1_x = (dx - dy) * 2;
+				int step2_x = dx * 2;
+				int accum_x = dx * 2 - dy;
+				while (y1 != y2) {
+					if (accum_x <= 0) {
+						accum_x += step2_x;
+					} else {
+						accum_x += step1_x;
+						x1 += incx;
+					}
+					y1 += incy;
+					if (r1.contains(x1, y1)) {
+						*(wizd + y1 * iw + x1) = color;
+					}					
+				}
+			}
+		}
+	}
+}
+
 void ScummEngine_v90he::processWizImage(const WizParameters *params) {
 	debug(1, "processWizImage: processMode %d", params->processMode);
 	switch (params->processMode) {
@@ -1575,8 +1661,7 @@
 		fillWizRect(params);
 		break;
 	case 10:
-		// Used in footdemo
-		// TODO
+		fillWizParallelogram(params);
 		break;
 	default:
 		error("Unhandled processWizImage mode %d", params->processMode);





More information about the Scummvm-git-logs mailing list