From 705c4b2c8dbc54108ee12d56a384ea9b31df3996 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 15 Nov 2019 18:04:30 +0100 Subject: PINK: Fix text color selection and added some debug output --- engines/pink/objects/actions/action_text.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'engines/pink') diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp index 448756b1d9..c12a8922ae 100644 --- a/engines/pink/objects/actions/action_text.cpp +++ b/engines/pink/objects/actions/action_text.cpp @@ -156,9 +156,9 @@ void ActionText::draw(Graphics::ManagedSurface *surface) { text.drawToPoint(surface, Common::Rect(0, 0, _xRight - _xLeft, _yBottom - _yTop), Common::Point(_xLeft, _yTop)); } -#define RED(rgb) ((rgb) & 0xFF) +#define BLUE(rgb) ((rgb) & 0xFF) #define GREEN(rgb) (((rgb) >> 8) & 0xFF) -#define BLUE(rgb) (((rgb) >> 16) & 0xFF) +#define RED(rgb) (((rgb) >> 16) & 0xFF) static uint findBestColor(byte *palette, uint32 rgb) { uint bestColor = 0; @@ -175,6 +175,9 @@ static uint findBestColor(byte *palette, uint32 rgb) { min = dist; } } + + debug(2, "for color %06x the best color is %02x%02x%02x", rgb, palette[bestColor * 3], palette[bestColor * 3 + 1], palette[bestColor * 3 + 2]); + return bestColor; } @@ -182,7 +185,9 @@ void ActionText::findColorsInPalette() { byte palette[256 * 3]; g_system->getPaletteManager()->grabPalette(palette, 0, 256); + debug(2, "textcolorindex: %06x", _textRGB); _textColorIndex = findBestColor(palette, _textRGB); + debug(2, "backgroundColorIndex: %06x", _backgroundRGB); _backgroundColorIndex = findBestColor(palette, _backgroundRGB); } -- cgit v1.2.3