diff options
author | Martin Kiewitz | 2010-04-24 15:50:23 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-04-24 15:50:23 +0000 |
commit | eb048f48b8680aa1407eb4f2ac272526d53152dc (patch) | |
tree | ff38587689e5b60babdae351656340c7aee03760 /engines | |
parent | b6c92b90b6bed242bbea8521615ca971c81171ca (diff) | |
download | scummvm-rg350-eb048f48b8680aa1407eb4f2ac272526d53152dc.tar.gz scummvm-rg350-eb048f48b8680aa1407eb4f2ac272526d53152dc.tar.bz2 scummvm-rg350-eb048f48b8680aa1407eb4f2ac272526d53152dc.zip |
SCI: changing GetLongest() on kanji (again) hopefully it's now working as in sierra sci :P
svn-id: r48784
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/graphics/text16.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp index 27c3161169..3687bcfd69 100644 --- a/engines/sci/graphics/text16.cpp +++ b/engines/sci/graphics/text16.cpp @@ -212,15 +212,25 @@ int16 GfxText16::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgF curCharCount++; } if (maxChars == 0) { - // Text w/o space, supposingly kanji - we don't adjust back to last char here strangely. If we do, we don't - // get the same text cutting like in sierra sci + // Text w/o space, supposingly kanji maxChars = curCharCount; - // sierra checked the following character against a punctuation kanji table - uint16 nextChar = (*(const byte *)text++); - if (_font->isDoubleByte(nextChar)) { - nextChar |= (*(const byte *)text++) << 8; + uint16 nextChar; + // we remove the last char only, if maxWidth was actually equal width before adding the last char + // otherwise we won't get the same cutting as in sierra sci + if (maxWidth == (width - _font->getCharWidth(curChar))) { + maxChars--; + if (curChar > 0xFF) + maxChars--; + nextChar = curChar; + } else { + nextChar = (*(const byte *)text++); + if (_font->isDoubleByte(nextChar)) + nextChar |= (*(const byte *)text++) << 8; + } + // sierra checked the following character against a punctuation kanji table + if (nextChar > 0xFF) { // if the character is punctuation, we go back one character uint nonBreakingNr = 0; while (text16_punctuationSjis[nonBreakingNr]) { |