[Scummvm-cvs-logs] SF.net SVN: scummvm:[44448] scummvm/trunk/engines/sci/gfx/palette.cpp

wjpalenstijn at users.sourceforge.net wjpalenstijn at users.sourceforge.net
Mon Sep 28 21:39:17 CEST 2009


Revision: 44448
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44448&view=rev
Author:   wjpalenstijn
Date:     2009-09-28 19:39:17 +0000 (Mon, 28 Sep 2009)

Log Message:
-----------
SCI: When merging palettes, map all unused colours to index 0.
This fixes the boots/belt of the hero sprite in QfG3 character generation.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gfx/palette.cpp

Modified: scummvm/trunk/engines/sci/gfx/palette.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/palette.cpp	2009-09-28 11:28:09 UTC (rev 44447)
+++ scummvm/trunk/engines/sci/gfx/palette.cpp	2009-09-28 19:39:17 UTC (rev 44448)
@@ -108,8 +108,9 @@
 
 	int count = 0;
 	for (uint i = 0; i < _size; ++i) {
-		if (_colors[i].refcount == PALENTRY_FREE)
-			continue;
+		if (_colors[i].refcount == PALENTRY_FREE) {
+			assert(_colors[i].parent_index == 0);
+		}
 
 		int pi = _colors[i].parent_index;
 		assert(pi >= 0);
@@ -243,8 +244,15 @@
 
 	for (uint i = 0; i < _size; ++i) {
 		PaletteEntry& entry = _colors[i];
-		if (entry.refcount == PALENTRY_FREE)
+		if (entry.refcount == PALENTRY_FREE) {
+			// Force all unused colours to index 0
+			entry.parent_index = 0;
+			if (_parent->_colors[0].refcount != PALENTRY_LOCKED)
+				_parent->_colors[0].refcount++;
+			if (_colors[i].r || _colors[i].g || _colors[i].b)
+				warning("Non-black unused colour in pic: index %d, %02X %02X %02X", i, _colors[i].r, _colors[i].g, _colors[i].b);
 			continue;
+		}
 
 		uint pi = _parent->findNearbyColor(entry.r, entry.g, entry.b);
 #ifdef DEBUG_MERGE


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