SCUMM: (DIG/CJK) - fix blast text rendering and positioning
- fix getStringWidth() - fix string translation - skip special newline character when drawing text
This commit is contained in:
parent
09a9f4b158
commit
afef3d71cb
3 changed files with 18 additions and 5 deletions
|
@ -331,8 +331,11 @@ int CharsetRenderer::getStringWidth(int arg, const byte *text) {
|
||||||
int code = (_vm->_game.heversion >= 80) ? 127 : 64;
|
int code = (_vm->_game.heversion >= 80) ? 127 : 64;
|
||||||
|
|
||||||
while ((chr = text[pos++]) != 0) {
|
while ((chr = text[pos++]) != 0) {
|
||||||
if (chr == '\n' || chr == '\r' || chr == _vm->_newLineCharacter)
|
if (_vm->_game.version == 7 && chr == _vm->_newLineCharacter)
|
||||||
|
continue;
|
||||||
|
else if (chr == '\n' || chr == '\r' || chr == _vm->_newLineCharacter)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (_vm->_game.heversion >= 72) {
|
if (_vm->_game.heversion >= 72) {
|
||||||
if (chr == code) {
|
if (chr == code) {
|
||||||
chr = text[pos++];
|
chr = text[pos++];
|
||||||
|
@ -488,7 +491,7 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) {
|
||||||
if (_vm->_language == Common::KO_KOR || _vm->_language == Common::ZH_TWN) {
|
if (_vm->_language == Common::KO_KOR || _vm->_language == Common::ZH_TWN) {
|
||||||
curw++;
|
curw++;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (chr != _vm->_newLineCharacter) {
|
||||||
curw += getCharWidth(chr);
|
curw += getCharWidth(chr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -41,6 +41,16 @@ static inline bool checkSJISCode(byte c) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool is2ByteCharacter(Common::Language lang, byte c) {
|
||||||
|
if (lang == Common::JA_JPN)
|
||||||
|
return (c >= 0x80 && c <= 0x9F) || (c >= 0xE0 && c <= 0xFD);
|
||||||
|
else if (lang == Common::KO_KOR)
|
||||||
|
return (c >= 0xB0 && c <= 0xD0);
|
||||||
|
else if (lang == Common::ZH_TWN || lang == Common::ZH_CNA)
|
||||||
|
return (c >= 0x80);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
class CharsetRenderer {
|
class CharsetRenderer {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ void ScummEngine_v6::drawBlastTexts() {
|
||||||
|
|
||||||
// Some localizations may override colors
|
// Some localizations may override colors
|
||||||
// See credits in Chinese COMI
|
// See credits in Chinese COMI
|
||||||
if (_game.id == GID_CMI && _language == Common::ZH_TWN &&
|
if (_game.id == GID_CMI && _language == Common::ZH_TWN &&
|
||||||
c == '^' && (buf == _blastTextQueue[i].text + 1)) {
|
c == '^' && (buf == _blastTextQueue[i].text + 1)) {
|
||||||
if (*buf == 'c') {
|
if (*buf == 'c') {
|
||||||
int color = buf[3] - '0' + 10 *(buf[2] - '0');
|
int color = buf[3] - '0' + 10 *(buf[2] - '0');
|
||||||
|
@ -191,7 +191,7 @@ void ScummEngine_v6::drawBlastTexts() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c != 0 && c != 0xFF && c != '\n') {
|
if (c != 0 && c != 0xFF && c != '\n' && c != _newLineCharacter) {
|
||||||
if (c & 0x80 && _useCJKMode) {
|
if (c & 0x80 && _useCJKMode) {
|
||||||
if (_language == Common::JA_JPN && !checkSJISCode(c)) {
|
if (_language == Common::JA_JPN && !checkSJISCode(c)) {
|
||||||
c = 0x20; //not in S-JIS
|
c = 0x20; //not in S-JIS
|
||||||
|
@ -1302,7 +1302,7 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize)
|
||||||
num += (_game.version == 8) ? 4 : 2;
|
num += (_game.version == 8) ? 4 : 2;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((chr != '@') || (_game.id == GID_CMI && _language == Common::ZH_TWN) ||
|
if ((chr != '@') || (_game.version >= 7 && is2ByteCharacter(_language, lastChr)) ||
|
||||||
(_game.id == GID_LOOM && _game.platform == Common::kPlatformPCEngine && _language == Common::JA_JPN) ||
|
(_game.id == GID_LOOM && _game.platform == Common::kPlatformPCEngine && _language == Common::JA_JPN) ||
|
||||||
(_game.platform == Common::kPlatformFMTowns && _language == Common::JA_JPN && checkSJISCode(lastChr))) {
|
(_game.platform == Common::kPlatformFMTowns && _language == Common::JA_JPN && checkSJISCode(lastChr))) {
|
||||||
*dst++ = chr;
|
*dst++ = chr;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue