[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.298,1.299 gfx.cpp,2.316,2.317 script_v72he.cpp,2.119,2.120

Gregory Montoir cyx at users.sourceforge.net
Tue Sep 21 13:22:12 CEST 2004


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

Modified Files:
	actor.cpp gfx.cpp script_v72he.cpp 
Log Message:
fix freddemo intro glitches

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.298
retrieving revision 1.299
diff -u -d -r1.298 -r1.299
--- actor.cpp	21 Sep 2004 13:54:29 -0000	1.298
+++ actor.cpp	21 Sep 2004 20:21:30 -0000	1.299
@@ -1890,39 +1890,32 @@
 			if (ae->actorNum != -1) {
 				Actor *a = derefActor(ae->actorNum, "postProcessAuxQueue");
 				const uint8 *cost = getResourceAddress(rtCostume, a->costume);
-				
 				int dy = a->offs_y + a->_pos.y - a->getElevation();
 				int dx = a->offs_x + a->_pos.x;
 
 				const uint8 *akax = findResource(MKID('AKAX'), cost);
-				if (!akax) {
-					error("No AKAX block for actor %d", ae->actorNum);
-				}
+				assert(akax);
 				const uint8 *auxd = findPalInPals(akax, ae->subIndex) - _resourceHeaderSize;
-				if (!auxd) {
-					error("No AUXD block for actor %d", ae->actorNum);
-				}
+				assert(auxd);
 				const uint8 *axfd = findResourceData(MKID('AXFD'), auxd);
-				if (!axfd) {
-					error("No AXFD block for actor %d", ae->actorNum);
-				} else {
-					uint16 comp = READ_LE_UINT16(axfd);
-					if (comp != 0) {
-						int x = (int16)READ_LE_UINT16(axfd + 2) + dx;
-						int y = (int16)READ_LE_UINT16(axfd + 4) + dy;
-						int w = (int16)READ_LE_UINT16(axfd + 6);
-						int h = (int16)READ_LE_UINT16(axfd + 8);
-						VirtScreen *pvs = &virtscr[kMainVirtScreen];
-						uint8 *dst1 = pvs->getPixels(0, pvs->topline);
-						uint8 *dst2 = pvs->getBackPixels(0, pvs->topline);
-						switch (comp) {
-						case 1:
-							gdi.copyAuxImage(dst1, dst2, axfd + 10, pvs->w, pvs->h, x, y, w, h, NULL);
-							break;
-						default:
-							warning("unimplemented compression type %d", comp);
-							break;
-						}
+				assert(axfd);
+
+				uint16 comp = READ_LE_UINT16(axfd);
+				if (comp != 0) {
+					int x = (int16)READ_LE_UINT16(axfd + 2) + dx;
+					int y = (int16)READ_LE_UINT16(axfd + 4) + dy;
+					int w = (int16)READ_LE_UINT16(axfd + 6);
+					int h = (int16)READ_LE_UINT16(axfd + 8);
+					VirtScreen *pvs = &virtscr[kMainVirtScreen];
+					uint8 *dst1 = pvs->getPixels(0, pvs->topline);
+					uint8 *dst2 = pvs->getBackPixels(0, pvs->topline);
+					switch (comp) {
+					case 1:
+						gdi.copyAuxImage(dst1, dst2, axfd + 10, pvs->w, pvs->h, x, y, w, h, NULL);
+						break;
+					default:
+						warning("unimplemented compression type %d", comp);
+						break;
 					}
 				}
 				const uint8 *axur = findResourceData(MKID('AXUR'), auxd);
@@ -1932,8 +1925,8 @@
 						int x1 = (int16)READ_LE_UINT16(axur + 0) + dx;
 						int y1 = (int16)READ_LE_UINT16(axur + 2) + dy;
 						int x2 = (int16)READ_LE_UINT16(axur + 4) + dx;
-						int y2 = (int16)READ_LE_UINT16(axur + 6) + dy;
-						markRectAsDirty(kMainVirtScreen, x1, x2, y1, y2);
+						int y2 = (int16)READ_LE_UINT16(axur + 6) + dy;					
+						markRectAsDirty(kMainVirtScreen, x1, x2, y1, y2 + 1);
 						axur += 8;
 					}
 				}

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.316
retrieving revision 2.317
diff -u -d -r2.316 -r2.317
--- gfx.cpp	20 Sep 2004 22:04:00 -0000	2.316
+++ gfx.cpp	21 Sep 2004 20:21:31 -0000	2.317
@@ -1404,21 +1404,21 @@
 }
 
 static bool calcClipRects(int dst_w, int dst_h, int src_x, int src_y, int src_w, int src_h, const Common::Rect *rect, Common::Rect &srcRect, Common::Rect &dstRect) {
-	srcRect = Common::Rect(0, 0, src_w, src_h);
-	dstRect = Common::Rect(src_x, src_y, src_x + src_w, src_y + src_h);
+	srcRect = Common::Rect(0, 0, src_w - 1, src_h - 1);
+	dstRect = Common::Rect(src_x, src_y, src_x + src_w - 1, src_y + src_h - 1);
 	Common::Rect r3;
 	int diff;
 
 	if (rect) {
 		r3 = *rect;
-		Common::Rect r4(0, 0, dst_w, dst_h);
+		Common::Rect r4(0, 0, dst_w - 1, dst_h - 1);
 		if (r3.intersects(r4)) {
 			r3.clip(r4);
 		} else {
 			return false;
 		}
 	} else {
-		r3 = Common::Rect(0, 0, dst_w, dst_h);
+		r3 = Common::Rect(0, 0, dst_w - 1, dst_h - 1);
 	}
 	diff = dstRect.left - r3.left;
 	if (diff < 0) {
@@ -1564,8 +1564,6 @@
 	Common::Rect r1, r2;
 	if (calcClipRects(dstw, dsth, srcx, srcy, srcw, srch, rect, r1, r2)) {
 		if (r1.isValidRect() && r2.isValidRect()) {
-			--r1.right;
-			--r1.bottom;
 			decompressAuxImage(dst1, dst2, dstw, r2, src, r1);
 		}
 	}

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.119
retrieving revision 2.120
diff -u -d -r2.119 -r2.120
--- script_v72he.cpp	21 Sep 2004 11:46:56 -0000	2.119
+++ script_v72he.cpp	21 Sep 2004 20:21:31 -0000	2.120
@@ -1454,7 +1454,7 @@
 			cw = pvs->w;
 			ch = pvs->h;
 		}
-		Common::Rect rScreen(0, 0, cw, ch);
+		Common::Rect rScreen(0, 0, cw - 1, ch - 1);
 		if (flags & 0x80) {    
 //  		drawWizImageHelper2(p, wizd, cw, ch, x1, y1, width, height, &rScreen, 0, 2);
 			warning("drawWizImage() unhandled flag 0x80");
@@ -1470,15 +1470,13 @@
 			warning("printing Wiz image is unimplemented");
 			dst = NULL;
 		} else {
-			Common::Rect rImage(x1, y1, x1 + width, y1 + height);
+			Common::Rect rImage(x1, y1, x1 + width - 1, y1 + height - 1);
 			if (rImage.intersects(rScreen)) {
 				rImage.clip(rScreen);
 				if (flags & 0x18) {
 					++rImage.bottom;
 					markRectAsDirty(kMainVirtScreen, rImage);
 				} else {
-					--rImage.right;
-					--rImage.bottom;
 					gdi.copyVirtScreenBuffers(rImage);
 				}
 			}
@@ -1497,12 +1495,12 @@
 		int16 y2;
 	};
 	struct ResArea {
-		int16 off;
+		uint16 off;
 		int16 x_step;
 		int16 y_step;
 		int16 x_s;
 		int16 y_s;
-		uint16 w;
+		int16 w;
 	};
 	Common::Point pts[4];
 	ResArea *ra;
@@ -1556,7 +1554,7 @@
   			x3 += x_step_2;
   			y3 += y_step;
   			
-  			if (p2->y > p1->y) {
+  			if (p2->y <= p1->y) {
   				--iaidx;
   			} else {
   				++iaidx;
@@ -1663,6 +1661,7 @@
 			uint16 rw = pra->w;
 			while (rw--) {
 				uint srcWizOff = (y_acc >> 0x10) * wizW + (x_acc >> 0x10);
+				assert(srcWizOff < wizW * wizH);
 				x_acc += pra->x_step;
 				y_acc += pra->y_step;
 				*dstPtr++ = srcWizBuf[srcWizOff];
@@ -1679,7 +1678,6 @@
 
 		free(srcWizBuf);
 	}
-
 }
 
 void ScummEngine_v72he::redrawBGAreas() {





More information about the Scummvm-git-logs mailing list