diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 60d36597b4a..96699bba458 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -331,8 +331,11 @@ int CharsetRenderer::getStringWidth(int arg, const byte *text) { int code = (_vm->_game.heversion >= 80) ? 127 : 64; 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; + if (_vm->_game.heversion >= 72) { if (chr == code) { 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) { curw++; } - } else { + } else if (chr != _vm->_newLineCharacter) { curw += getCharWidth(chr); } } else { diff --git a/engines/scumm/charset.h b/engines/scumm/charset.h index c5cf001a28c..2c52f819242 100644 --- a/engines/scumm/charset.h +++ b/engines/scumm/charset.h @@ -41,6 +41,16 @@ static inline bool checkSJISCode(byte c) { 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 { public: diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp index 8a2ef97f4b3..7d7953c29fa 100644 --- a/engines/scumm/string.cpp +++ b/engines/scumm/string.cpp @@ -180,7 +180,7 @@ void ScummEngine_v6::drawBlastTexts() { // Some localizations may override colors // 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)) { if (*buf == 'c') { 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 (_language == Common::JA_JPN && !checkSJISCode(c)) { 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; } } 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.platform == Common::kPlatformFMTowns && _language == Common::JA_JPN && checkSJISCode(lastChr))) { *dst++ = chr;