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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Wed Dec 30 22:43:57 CET 2009


Revision: 46775
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46775&view=rev
Author:   m_kiewitz
Date:     2009-12-30 21:43:57 +0000 (Wed, 30 Dec 2009)

Log Message:
-----------
SCI: fix palette merging (fixes lsl1demo right at the beginning and sq5 wilco on title screen)

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

Modified: scummvm/trunk/engines/sci/gui/gui_palette.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_palette.cpp	2009-12-30 21:22:00 UTC (rev 46774)
+++ scummvm/trunk/engines/sci/gui/gui_palette.cpp	2009-12-30 21:43:57 UTC (rev 46775)
@@ -208,6 +208,13 @@
 			pFrom->mapping[i] = i;
 			continue;
 		}
+		// is the same color already at the same position? -> match it directly w/o lookup
+		//  this fixes games like lsl1demo/sq5 where the same rgb color exists multiple times and where we would
+		//  otherwise match the wrong one
+		if ((pTo->colors[i].r == pFrom->colors[i].r) && (pTo->colors[i].g == pFrom->colors[i].g) && (pTo->colors[i].b == pFrom->colors[i].b)) {
+			pFrom->mapping[i] = i;
+			continue;
+		}
 		// check if exact color could be matched
 		res = matchColor(pTo, pFrom->colors[i].r, pFrom->colors[i].g, pFrom->colors[i].b);
 		if (res & 0x8000) { // exact match was found
@@ -238,7 +245,7 @@
 	int diff = 0x2FFFF, cdiff;
 	int16 dr,dg,db;
 
-	for (int i = 0; i < 256; i++) {
+	for (int i = 1; i < 255; i++) {
 		if ((!pPal->colors[i].used))
 			continue;
 		dr = pPal->colors[i].r - r;


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