diff options
author | Paul Gilbert | 2016-12-16 20:46:52 -0500 |
---|---|---|
committer | Paul Gilbert | 2016-12-16 20:46:52 -0500 |
commit | cbee771bad0bed004f01c36add9f0bdafb9b753c (patch) | |
tree | a73669f3dd2ea887bf6187210ec577e04f6f874d /engines/titanic/pet_control | |
parent | 2900c631900e320155e7a18135b1060d65482315 (diff) | |
download | scummvm-rg350-cbee771bad0bed004f01c36add9f0bdafb9b753c.tar.gz scummvm-rg350-cbee771bad0bed004f01c36add9f0bdafb9b753c.tar.bz2 scummvm-rg350-cbee771bad0bed004f01c36add9f0bdafb9b753c.zip |
TITANIC: Fix remapping conversation log colors when changing class
Diffstat (limited to 'engines/titanic/pet_control')
-rw-r--r-- | engines/titanic/pet_control/pet_text.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 7bb0bad16e..05038d2fd0 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -249,20 +249,21 @@ void CPetText::setColor(byte r, byte g, byte b) { } void CPetText::remapColors(uint count, uint *srcColors, uint *destColors) { - if (_lineCount >= 0) { - for (int lineNum = 0; lineNum <= _lineCount; ++lineNum) { - // Get the rgb values - uint r = _array[lineNum]._rgb[1]; - uint g = _array[lineNum]._rgb[2]; - uint b = _array[lineNum]._rgb[3]; - uint color = r | (g << 8) | (b << 16); - - for (uint index = 0; index < count; ++index) { - if (color == srcColors[index]) { - // Found a match, so replace the color - setLineColor(lineNum, destColors[lineNum]); - break; - } + for (int lineNum = 0; lineNum <= _lineCount; ++lineNum) { + if (_array[lineNum]._rgb.empty()) + continue; + + // Get the rgb values + uint r = _array[lineNum]._rgb[1]; + uint g = _array[lineNum]._rgb[2]; + uint b = _array[lineNum]._rgb[3]; + uint color = r | (g << 8) | (b << 16); + + for (uint index = 0; index < count; ++index) { + if (color == srcColors[index]) { + // Found a match, so replace the color + setLineColor(lineNum, destColors[lineNum]); + break; } } } |