aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/charset.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2008-04-28 15:21:36 +0000
committerEugene Sandulenko2008-04-28 15:21:36 +0000
commit0ca949db2af91c3a070e2dc95e46ba6161e6c594 (patch)
tree6b2e0599d3af07664c3695df9a346248fe9a6f90 /engines/scumm/charset.cpp
parentfc6fe46951f999d7fc14bf4bedcce7bfe728a77d (diff)
downloadscummvm-rg350-0ca949db2af91c3a070e2dc95e46ba6161e6c594.tar.gz
scummvm-rg350-0ca949db2af91c3a070e2dc95e46ba6161e6c594.tar.bz2
scummvm-rg350-0ca949db2af91c3a070e2dc95e46ba6161e6c594.zip
Fix Kanji text positioning in DIG. Constants based on disassembly, but
it can bring some regressions to subtitles. svn-id: r31757
Diffstat (limited to 'engines/scumm/charset.cpp')
-rw-r--r--engines/scumm/charset.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index bf3f7ed66e..d0a43dd519 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -49,6 +49,7 @@ void ScummEngine::loadCJKFont() {
Common::File fp;
_useCJKMode = false;
_textSurfaceMultiplier = 1;
+ _newLineCharacter = 0xfe;
if (_game.version <= 5 && _game.platform == Common::kPlatformFMTowns && _language == Common::JA_JPN) { // FM-TOWNS v3 / v5 Kanji
int numChar = 256 * 32;
@@ -95,15 +96,17 @@ void ScummEngine::loadCJKFont() {
fp.seek(2, SEEK_CUR);
_2byteWidth = fp.readByte();
_2byteHeight = fp.readByte();
+ _newLineCharacter = 0xff;
break;
case Common::JA_JPN:
_2byteWidth = 16;
_2byteHeight = 16;
+ _newLineCharacter = 0xfe;
break;
case Common::ZH_TWN:
_2byteWidth = 16;
_2byteHeight = 15;
- // 0xFE -> 0x21. also compared with 0x0d. perhaps a newline
+ _newLineCharacter = 0x21;
break;
default:
break;
@@ -352,7 +355,7 @@ 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')
+ if (chr == '\n' || chr == '\r' || chr == _vm->_newLineCharacter)
break;
if (_vm->_game.heversion >= 72) {
if (chr == code) {
@@ -479,6 +482,9 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) {
if (chr == ' ')
lastspace = pos - 1;
+ if (chr == _vm->_newLineCharacter)
+ lastspace = pos - 1;
+
if ((chr & 0x80) && _vm->_useCJKMode) {
pos++;
curw += _vm->_2byteWidth;