[Scummvm-cvs-logs] SF.net SVN: scummvm:[45005] scummvm/trunk/engines/sci/gui/gui_picture.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Tue Oct 13 10:03:09 CEST 2009


Revision: 45005
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45005&view=rev
Author:   m_kiewitz
Date:     2009-10-13 08:03:09 +0000 (Tue, 13 Oct 2009)

Log Message:
-----------
SCI/newgui: finally changed floodfill to behave the same way as sierra sci. Fixes sq3 priority map

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gui/gui_picture.cpp

Modified: scummvm/trunk/engines/sci/gui/gui_picture.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_picture.cpp	2009-10-13 07:17:30 UTC (rev 45004)
+++ scummvm/trunk/engines/sci/gui/gui_picture.cpp	2009-10-13 08:03:09 UTC (rev 45005)
@@ -570,8 +570,10 @@
 	GuiPort *curPort = _gfx->GetPort();
 	Common::Stack<Common::Point> stack;
 	Common::Point p, p1;
+	byte screenMask = _screen->getDrawingMask(color, priority, control);
+	byte matchedMask;
+	int16 w, e, a_set, b_set;
 
-	byte screenMask = _screen->getDrawingMask(color, priority, control), matchMask;
 	p.x = x + curPort->left;
 	p.y = y + curPort->top;
 	stack.push(p);
@@ -579,21 +581,24 @@
 	byte searchColor = _screen->getVisual(p.x, p.y);
 	byte searchPriority = _screen->getPriority(p.x, p.y);
 	byte searchControl = _screen->getControl(p.x, p.y);
-	int16 w, e, a_set, b_set;
-	// It seems as if fills on visual screen, where color is not "initial" will not get done at all
-	//  this fixes pictures in qfg1(ega)
-	if (screenMask & SCI_SCREEN_MASK_VISUAL && searchColor != 15)
-		screenMask ^= SCI_SCREEN_MASK_VISUAL;
-	// if in 1st point priority,control or color is already set to target, clear the flag
-	if (screenMask & SCI_SCREEN_MASK_VISUAL && searchColor == color)
-		screenMask ^= SCI_SCREEN_MASK_VISUAL;
-	if (screenMask & SCI_SCREEN_MASK_PRIORITY && searchPriority == priority)
-		screenMask ^= SCI_SCREEN_MASK_PRIORITY;
-	if (screenMask & SCI_SCREEN_MASK_CONTROL && searchControl == control)
-		screenMask ^= SCI_SCREEN_MASK_CONTROL;
-	if (screenMask == 0)// nothing to fill
-		return;
 
+	// This logic was taken directly from sierra sci, floodfill will get aborted on various occations
+	if (screenMask & SCI_SCREEN_MASK_VISUAL) {
+		if (_resMan->isVGA()) {
+			if ((color == 255) || (searchColor != 255))
+				return;
+		} else {
+			if ((color == 15) || (searchColor != 15))
+				return;
+		}
+	} else if (screenMask & SCI_SCREEN_MASK_PRIORITY) {
+		if ((priority == 0) || (searchPriority != 0))
+			return;
+	} else if (screenMask & SCI_SCREEN_MASK_CONTROL) {
+		if ((control == 0) || (searchControl != 0))
+			return;
+	}
+
 	// hard borders for filling
 	int l = curPort->rect.left + curPort->left;
 	int t = curPort->rect.top + curPort->top;
@@ -601,20 +606,20 @@
 	int b = curPort->rect.bottom + curPort->top - 1;
 	while (stack.size()) {
 		p = stack.pop();
-		if ((matchMask = _screen->isFillMatch(p.x, p.y, screenMask, searchColor, searchPriority, searchControl)) == 0) // already filled
+		if ((matchedMask = _screen->isFillMatch(p.x, p.y, screenMask, searchColor, searchPriority, searchControl)) == 0) // already filled
 			continue;
 		_screen->putPixel(p.x, p.y, screenMask, color, priority, control);
 		w = p.x;
 		e = p.x;
 		// moving west and east pointers as long as there is a matching color to fill
-		while (w > l && (matchMask == _screen->isFillMatch(w - 1, p.y, screenMask, searchColor, searchPriority, searchControl)))
-			_screen->putPixel(--w, p.y, matchMask, color, priority, control);
-		while (e < r && (matchMask == _screen->isFillMatch(e + 1, p.y, screenMask, searchColor, searchPriority, searchControl)))
-			_screen->putPixel(++e, p.y, matchMask, color, priority, control);
+		while (w > l && (matchedMask == _screen->isFillMatch(w - 1, p.y, screenMask, searchColor, searchPriority, searchControl)))
+			_screen->putPixel(--w, p.y, screenMask, color, priority, control);
+		while (e < r && (matchedMask == _screen->isFillMatch(e + 1, p.y, screenMask, searchColor, searchPriority, searchControl)))
+			_screen->putPixel(++e, p.y, screenMask, color, priority, control);
 		// checking lines above and below for possible flood targets
 		a_set = b_set = 0;
 		while (w <= e) {
-			if (p.y > t && (matchMask == _screen->isFillMatch(w, p.y - 1, screenMask, searchColor, searchPriority, searchControl))) { // one line above
+			if (p.y > t && (matchedMask == _screen->isFillMatch(w, p.y - 1, screenMask, searchColor, searchPriority, searchControl))) { // one line above
 				if (a_set == 0) {
 					p1.x = w;
 					p1.y = p.y - 1;
@@ -624,7 +629,7 @@
 			} else
 				a_set = 0;
 
-			if (p.y < b && (matchMask == _screen->isFillMatch(w, p.y + 1, screenMask, searchColor, searchPriority, searchControl))) { // one line below
+			if (p.y < b && (matchedMask == _screen->isFillMatch(w, p.y + 1, screenMask, searchColor, searchPriority, searchControl))) { // one line below
 				if (b_set == 0) {
 					p1.x = w;
 					p1.y = p.y + 1;


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