From c85c5030dfd61b2d181b1cec071b9532e4acc8aa Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 10 Aug 2009 01:33:18 +0000 Subject: Fix text color in character speeches in Kyra1 amiga. svn-id: r43194 --- engines/kyra/text.cpp | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++- engines/kyra/text.h | 4 +++ 2 files changed, 99 insertions(+), 1 deletion(-) (limited to 'engines/kyra') diff --git a/engines/kyra/text.cpp b/engines/kyra/text.cpp index 4d511eae01..baad69eaa7 100644 --- a/engines/kyra/text.cpp +++ b/engines/kyra/text.cpp @@ -200,6 +200,10 @@ void TextDisplayer::printTalkTextMessage(const char *text, int x, int y, uint8 c _screen->copyRegion(_talkCoords.x, _talkMessageY, _talkCoords.x, _talkCoords.y, _talkCoords.w, _talkMessageH, srcPage, dstPage, Screen::CR_NO_P_CHECK); int curPage = _screen->_curPage; _screen->_curPage = srcPage; + + if (_vm->gameFlags().platform == Common::kPlatformAmiga) + setTextColor(color); + for (int i = 0; i < lineCount; ++i) { top = i * 10 + _talkMessageY; char *msg = &_talkSubstrings[i * TALK_SUBSTRING_LEN]; @@ -248,7 +252,7 @@ void TextDisplayer::printText(const char *str, int x, int y, uint8 c0, uint8 c1, } void TextDisplayer::printCharacterText(const char *text, int8 charNum, int charX) { - uint8 colorTable[] = {0x0F, 0x9, 0x0C9, 0x80, 0x5, 0x81, 0x0E, 0xD8, 0x55, 0x3A, 0x3a}; + uint8 colorTable[] = {0x0F, 0x09, 0xC9, 0x80, 0x5, 0x81, 0x0E, 0xD8, 0x55, 0x3A, 0x3a}; int top, left, x1, x2, w, x; char *msg; @@ -259,6 +263,9 @@ void TextDisplayer::printCharacterText(const char *text, int8 charNum, int charX x = charX; calcWidestLineBounds(x1, x2, w, x); + if (_vm->gameFlags().platform == Common::kPlatformAmiga) + setTextColor(color); + for (int i = 0; i < lineCount; ++i) { top = i * 10 + _talkMessageY; msg = &_talkSubstrings[i * TALK_SUBSTRING_LEN]; @@ -266,4 +273,91 @@ void TextDisplayer::printCharacterText(const char *text, int8 charNum, int charX printText(msg, left, top, color, 0xC, 0); } } + +void TextDisplayer::setTextColor(uint8 color) { + byte r, g, b; + + switch (color) { + case 4: + // 0x09E + r = 0; + g = 36; + b = 56; + break; + + case 5: + // 0xFF5 + r = 60; + g = 60; + b = 20; + break; + + case 27: + // 0x5FF + r = 20; + g = 60; + b = 60; + break; + + case 34: + // 0x8E5 + r = 32; + g = 56; + b = 20; + break; + + case 58: + // 0x9FB + r = 36; + g = 60; + b = 44; + break; + + case 85: + // 0x7CF + r = 28; + g = 48; + b = 60; + break; + + case 114: + case 117: + // 0xFAF + r = 60; + g = 40; + b = 60; + break; + + case 128: + case 129: + // 0xFCC + r = 60; + g = 48; + b = 48; + break; + + case 201: + // 0xFD8 + r = 60; + g = 52; + b = 32; + break; + + case 216: + // 0xFC6 + r = 60; + g = 48; + b = 24; + break; + + default: + // 0xEEE + r = 56; + g = 56; + b = 56; + } + + _screen->setPaletteIndex(0x10, r, g, b); +} + } // end of namespace Kyra diff --git a/engines/kyra/text.h b/engines/kyra/text.h index d45e5f9242..9f1682ed9e 100644 --- a/engines/kyra/text.h +++ b/engines/kyra/text.h @@ -66,6 +66,9 @@ protected: uint16 y, x, w; }; + // TODO: AMIGA and LoK specific, move to a better location + void setTextColor(uint8 color); + enum { TALK_SUBSTRING_LEN = 80, TALK_SUBSTRING_NUM = 6 @@ -76,6 +79,7 @@ protected: TalkCoords _talkCoords; bool _talkMessagePrinted; }; + } // end of namespace Kyra #endif -- cgit v1.2.3