diff options
author | lolbot-iichan | 2019-01-20 18:40:41 +0300 |
---|---|---|
committer | Filippos Karapetis | 2020-01-11 18:05:39 +0200 |
commit | 259a7e89e649108ba4286e181b9041c6c6ffca9b (patch) | |
tree | e9115e030c8980ba9f5ab417a3c90f1a0639ba9c | |
parent | 2de4a1b5d30e0f182806dc2697c9a3a325571f3a (diff) | |
download | scummvm-rg350-259a7e89e649108ba4286e181b9041c6c6ffca9b.tar.gz scummvm-rg350-259a7e89e649108ba4286e181b9041c6c6ffca9b.tar.bz2 scummvm-rg350-259a7e89e649108ba4286e181b9041c6c6ffca9b.zip |
WINTERMUTE: Add FoxTail color token for bitmap fonts
Some FoxTail versions have bitmap fonts with white letters and COLOR properties.
Alpha value of subframe can be used to recolor white letters to desired color.
-rw-r--r-- | engines/wintermute/base/font/base_font_bitmap.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/engines/wintermute/base/font/base_font_bitmap.cpp b/engines/wintermute/base/font/base_font_bitmap.cpp index fd36de4915..08917f21b6 100644 --- a/engines/wintermute/base/font/base_font_bitmap.cpp +++ b/engines/wintermute/base/font/base_font_bitmap.cpp @@ -273,7 +273,7 @@ void BaseFontBitmap::drawChar(byte c, int x, int y) { } } if (!handled && _subframe) { - _subframe->_surface->displayTrans(x, y, rect); + _subframe->_surface->displayTrans(x, y, rect, _subframe->_alpha); } } @@ -317,6 +317,9 @@ TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF(SPRITE) TOKEN_DEF(WIDTHS_FRAME) TOKEN_DEF(PAINT_WHOLE_CELL) +#ifdef ENABLE_FOXTAIL +TOKEN_DEF(COLOR) +#endif TOKEN_DEF_END ////////////////////////////////////////////////////////////////////// bool BaseFontBitmap::loadBuffer(char *buffer) { @@ -337,6 +340,9 @@ bool BaseFontBitmap::loadBuffer(char *buffer) { TOKEN_TABLE(SPRITE) TOKEN_TABLE(WIDTHS_FRAME) TOKEN_TABLE(PAINT_WHOLE_CELL) +#ifdef ENABLE_FOXTAIL + TOKEN_TABLE(COLOR) +#endif TOKEN_TABLE_END char *params; @@ -355,6 +361,10 @@ bool BaseFontBitmap::loadBuffer(char *buffer) { int i; int r = 255, g = 255, b = 255; bool custoTrans = false; +#ifdef ENABLE_FOXTAIL + int ar = 255, ag = 255, ab = 255; + bool custoAlpha = false; +#endif char *surfaceFile = nullptr; char *spriteFile = nullptr; @@ -378,6 +388,13 @@ bool BaseFontBitmap::loadBuffer(char *buffer) { custoTrans = true; break; +#ifdef ENABLE_FOXTAIL + case TOKEN_COLOR: + parser.scanStr(params, "%d,%d,%d", &ar, &ag, &ab); + custoAlpha = true; + break; +#endif + case TOKEN_WIDTHS: parser.scanStr(params, "%D", widths, &num); for (i = 0; lastWidth < NUM_CHARACTERS && num > 0; lastWidth++, num--, i++) { @@ -455,6 +472,11 @@ bool BaseFontBitmap::loadBuffer(char *buffer) { } else { _subframe->setSurface(surfaceFile); } +#ifdef ENABLE_FOXTAIL + if (custoAlpha) { + _subframe->_alpha = BYTETORGBA(ar, ag, ab, 255); + } +#endif } |