diff options
author | wonst719 | 2014-07-24 09:45:45 +0900 |
---|---|---|
committer | wonst719 | 2014-07-24 09:45:45 +0900 |
commit | 4b13c33b0a3887f400b26fef8f818d1f8689ba4e (patch) | |
tree | bbf1d2ccb50677a44cbb69fbfdeeb242e37394ec /engines/scumm/smush/smush_font.cpp | |
parent | cbe54f71ddc8d3c559862b9cae7ac5d4d2b5fbfe (diff) | |
download | scummvm-rg350-4b13c33b0a3887f400b26fef8f818d1f8689ba4e.tar.gz scummvm-rg350-4b13c33b0a3887f400b26fef8f818d1f8689ba4e.tar.bz2 scummvm-rg350-4b13c33b0a3887f400b26fef8f818d1f8689ba4e.zip |
SCUMM: Refine SMUSH Korean text shadow rendering to match the original version as close as possible
Diffstat (limited to 'engines/scumm/smush/smush_font.cpp')
-rw-r--r-- | engines/scumm/smush/smush_font.cpp | 66 |
1 files changed, 53 insertions, 13 deletions
diff --git a/engines/scumm/smush/smush_font.cpp b/engines/scumm/smush/smush_font.cpp index 4c04901b42..0eaf534746 100644 --- a/engines/scumm/smush/smush_font.cpp +++ b/engines/scumm/smush/smush_font.cpp @@ -115,9 +115,7 @@ int SmushFont::drawChar(byte *buffer, int dst_width, int x, int y, byte chr) { int SmushFont::draw2byte(byte *buffer, int dst_width, int x, int y, int idx) { int w = _vm->_2byteWidth; int h = _vm->_2byteHeight; - - byte *src = _vm->get2byteCharPtr(idx); - byte *dst = buffer + dst_width * (y + (_vm->_game.id == GID_CMI ? 7 : (_vm->_game.id == GID_DIG ? 2 : 0))) + x; + const byte *src = _vm->get2byteCharPtr(idx); byte bits = 0; char color = (_color != -1) ? _color : 1; @@ -128,18 +126,60 @@ int SmushFont::draw2byte(byte *buffer, int dst_width, int x, int y, int idx) { if (_vm->_game.id == GID_FT) color = 1; - for (int j = 0; j < h; j++) { - for (int i = 0; i < w; i++) { - if ((i % 8) == 0) - bits = *src++; - if (bits & revBitMask(i % 8)) { - dst[i + 1] = 0; - dst[dst_width + i] = 0; - dst[dst_width + i + 1] = 0; - dst[i] = color; + enum ShadowMode { + kNone, + kNormalShadowMode, + kKoreanV7ShadowMode, + kKoreanV8ShadowMode, + }; + + ShadowMode shadowMode = kNone; + + if (_vm->_language == Common::KO_KOR) { + if (_vm->_game.version == 8) + shadowMode = kKoreanV8ShadowMode; + else + shadowMode = kKoreanV7ShadowMode; + } + + int shadowOffsetXTable[4] = {-1, 0, 1, 0}; + int shadowOffsetYTable[4] = {0, 1, 0, 0}; + int shadowOffsetColorTable[4] = {0, 0, 0, color}; + + int shadowIdx = 3; + if (shadowMode == kKoreanV8ShadowMode) + shadowIdx = 0; + else if (shadowMode == kKoreanV7ShadowMode) + shadowIdx = 2; + + const byte *origSrc = src; + + for (; shadowIdx < 4; shadowIdx++) { + int offX = x + shadowOffsetXTable[shadowIdx]; + int offY = y + shadowOffsetYTable[shadowIdx]; + byte drawColor = shadowOffsetColorTable[shadowIdx]; + + src = origSrc; + + byte *dst = buffer + dst_width * (offY + (_vm->_game.id == GID_CMI ? 7 : (_vm->_game.id == GID_DIG ? 2 : 0))) + offX; + + for (int j = 0; j < h; j++) { + for (int i = 0; i < w; i++) { + if (offX + i < 0) + continue; + if ((i % 8) == 0) + bits = *src++; + if (bits & revBitMask(i % 8)) { + if (shadowMode == kNormalShadowMode) { + dst[i + 1] = 0; + dst[dst_width + i] = 0; + dst[dst_width + i + 1] = 0; + } + dst[i] = drawColor; + } } + dst += dst_width; } - dst += dst_width; } return w + 1; } |