mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
SCUMM: Refine SMUSH Korean text shadow rendering to match the original version as close as possible
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user