diff options
| author | Willem Jan Palenstijn | 2009-09-28 19:39:17 +0000 | 
|---|---|---|
| committer | Willem Jan Palenstijn | 2009-09-28 19:39:17 +0000 | 
| commit | f413356bed8399e93aa9cdfc48f574e157d9fcb1 (patch) | |
| tree | 0730c4cc8411e57a9603fbb5b8bf964802d0bb6c | |
| parent | ccc737a7149a0a87e8a5ad0467aa2eb58e29c8bc (diff) | |
| download | scummvm-rg350-f413356bed8399e93aa9cdfc48f574e157d9fcb1.tar.gz scummvm-rg350-f413356bed8399e93aa9cdfc48f574e157d9fcb1.tar.bz2 scummvm-rg350-f413356bed8399e93aa9cdfc48f574e157d9fcb1.zip | |
SCI: When merging palettes, map all unused colours to index 0.
This fixes the boots/belt of the hero sprite in QfG3 character generation.
svn-id: r44448
| -rw-r--r-- | engines/sci/gfx/palette.cpp | 14 | 
1 files changed, 11 insertions, 3 deletions
| diff --git a/engines/sci/gfx/palette.cpp b/engines/sci/gfx/palette.cpp index 14564eeebc..a3dc84325c 100644 --- a/engines/sci/gfx/palette.cpp +++ b/engines/sci/gfx/palette.cpp @@ -108,8 +108,9 @@ void Palette::unmerge() {  	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 @@ bool Palette::mergeInto(Palette *parent) {  	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 | 
