[Scummvm-cvs-logs] SF.net SVN: scummvm:[49742] scummvm/trunk/engines/agi

sev at users.sourceforge.net sev at users.sourceforge.net
Tue Jun 15 12:31:18 CEST 2010


Revision: 49742
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49742&view=rev
Author:   sev
Date:     2010-06-15 10:31:18 +0000 (Tue, 15 Jun 2010)

Log Message:
-----------
AGI: Fix bug #1945716.

Bug #1945716: "AGI: Fan(Kings Quest 2 1/4) - Sprite not erased".
Added a workaround, since it is design flaw of our rendering
system.

Modified Paths:
--------------
    scummvm/trunk/engines/agi/op_cmd.cpp
    scummvm/trunk/engines/agi/sprite.cpp
    scummvm/trunk/engines/agi/view.cpp
    scummvm/trunk/engines/agi/view.h

Modified: scummvm/trunk/engines/agi/op_cmd.cpp
===================================================================
--- scummvm/trunk/engines/agi/op_cmd.cpp	2010-06-15 10:30:54 UTC (rev 49741)
+++ scummvm/trunk/engines/agi/op_cmd.cpp	2010-06-15 10:31:18 UTC (rev 49742)
@@ -889,27 +889,13 @@
 	}
 	g_sprites->blitUpdSprites();
 
-	int x1, y1, x2, y2, w, h;
+	int x1, y1, x2, y2;
 
-	w = MAX(vt.celData->width, vt.celData2->width);
-	h = MAX(vt.celData->height, vt.celData2->height);
+	x1 = MIN((int)MIN(vt.xPos, vt.xPos2), MIN(vt.xPos + vt.celData->width, vt.xPos2 + vt.celData2->width));
+	x2 = MAX((int)MAX(vt.xPos, vt.xPos2), MAX(vt.xPos + vt.celData->width, vt.xPos2 + vt.celData2->width));
+	y1 = MIN((int)MIN(vt.yPos, vt.yPos2), MIN(vt.yPos - vt.celData->height, vt.yPos2 - vt.celData2->height));
+	y2 = MAX((int)MAX(vt.yPos, vt.yPos2), MAX(vt.yPos - vt.celData->height, vt.yPos2 - vt.celData2->height));
 
-	if (vt.xPos < vt.xPos2) {
-		x1 = vt.xPos;
-		x2 = vt.xPos2 + w - 1;
-	} else {
-		x1 = vt.xPos2;
-		x2 = vt.xPos + w - 1;
-	}
-
-	if (vt.yPos < vt.yPos2) {
-		y1 = vt.yPos - h + 1;
-		y2 = vt.yPos2;
-	} else {
-		y1 = vt.yPos2 - h + 1;
-		y2 = vt.yPos;
-	}
-
 	g_sprites->commitBlock(x1, y1, x2, y2);
 }
 

Modified: scummvm/trunk/engines/agi/sprite.cpp
===================================================================
--- scummvm/trunk/engines/agi/sprite.cpp	2010-06-15 10:30:54 UTC (rev 49741)
+++ scummvm/trunk/engines/agi/sprite.cpp	2010-06-15 10:31:18 UTC (rev 49742)
@@ -241,6 +241,14 @@
 		q += xSize;
 		pos0 += _WIDTH;
 	}
+
+	// WORKAROUND
+	// When set.view command is called, current code cannot detect  this situation while updating
+	// Thus we force removal of the old sprite
+	if (s->v->viewReplaced) {
+		commitBlock(xPos, yPos, xPos + xSize, yPos + ySize);
+		s->v->viewReplaced = false;
+	}
 }
 
 
@@ -387,29 +395,15 @@
 	SpriteList::iterator iter;
 	for (iter = l.begin(); iter != l.end(); ++iter) {
 		Sprite *s = *iter;
-		int x1, y1, x2, y2, w, h;
+		int x1, y1, x2, y2;
 
-		w = MAX(s->v->celData->width, s->v->celData2->width);
-		h = MAX(s->v->celData->height, s->v->celData2->height);
+		x1 = MIN((int)MIN(s->v->xPos, s->v->xPos2), MIN(s->v->xPos + s->v->celData->width, s->v->xPos2 + s->v->celData2->width));
+		x2 = MAX((int)MAX(s->v->xPos, s->v->xPos2), MAX(s->v->xPos + s->v->celData->width, s->v->xPos2 + s->v->celData2->width));
+		y1 = MIN((int)MIN(s->v->yPos, s->v->yPos2), MIN(s->v->yPos - s->v->celData->height, s->v->yPos2 - s->v->celData2->height));
+		y2 = MAX((int)MAX(s->v->yPos, s->v->yPos2), MAX(s->v->yPos - s->v->celData->height, s->v->yPos2 - s->v->celData2->height));
 
 		s->v->celData2 = s->v->celData;
 
-		if (s->v->xPos < s->v->xPos2) {
-			x1 = s->v->xPos;
-			x2 = s->v->xPos2 + w - 1;
-		} else {
-			x1 = s->v->xPos2;
-			x2 = s->v->xPos + w - 1;
-		}
-
-		if (s->v->yPos < s->v->yPos2) {
-			y1 = s->v->yPos - h + 1;
-			y2 = s->v->yPos2;
-		} else {
-			y1 = s->v->yPos2 - h + 1;
-			y2 = s->v->yPos;
-		}
-
 		commitBlock(x1, y1, x2, y2);
 
 		if (s->v->stepTimeCount != s->v->stepTime)

Modified: scummvm/trunk/engines/agi/view.cpp
===================================================================
--- scummvm/trunk/engines/agi/view.cpp	2010-06-15 10:30:54 UTC (rev 49741)
+++ scummvm/trunk/engines/agi/view.cpp	2010-06-15 10:31:18 UTC (rev 49742)
@@ -297,6 +297,7 @@
 	v->viewData = &_game.views[n];
 	v->currentView = n;
 	v->numLoops = v->viewData->numLoops;
+	v->viewReplaced = true;
 	setLoop(v, v->currentLoop >= v->numLoops ? 0 : v->currentLoop);
 }
 

Modified: scummvm/trunk/engines/agi/view.h
===================================================================
--- scummvm/trunk/engines/agi/view.h	2010-06-15 10:30:54 UTC (rev 49741)
+++ scummvm/trunk/engines/agi/view.h	2010-06-15 10:31:18 UTC (rev 49742)
@@ -63,6 +63,7 @@
 	int16 xPos;
 	int16 yPos;
 	uint8 currentView;
+	bool viewReplaced;
 	struct AgiView *viewData;
 	uint8 currentLoop;
 	uint8 numLoops;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list