diff options
author | md5 | 2011-03-13 17:50:40 +0200 |
---|---|---|
committer | md5 | 2011-03-13 23:34:05 +0200 |
commit | 5a7c2e0df54b2987cf60adc536a822fdb23bd58d (patch) | |
tree | f8ee364819d07cfcc48092f90b61f3d143c5d45d | |
parent | 0360b4ac95e08d6350f63b0801557ebed9a90796 (diff) | |
download | scummvm-rg350-5a7c2e0df54b2987cf60adc536a822fdb23bd58d.tar.gz scummvm-rg350-5a7c2e0df54b2987cf60adc536a822fdb23bd58d.tar.bz2 scummvm-rg350-5a7c2e0df54b2987cf60adc536a822fdb23bd58d.zip |
SCI: Fixed regression of rev b1055a3c86. Japanese games should work again
-rw-r--r-- | engines/sci/graphics/text16.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp index d7a92042eb..6269a58492 100644 --- a/engines/sci/graphics/text16.cpp +++ b/engines/sci/graphics/text16.cpp @@ -204,21 +204,24 @@ int16 GfxText16::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgF maxChars = curCharCount; // return count up to (but not including) breaking space break; } - if (width + _font->getCharWidth(curChar) > maxWidth) + // Sometimes this can go off the screen, like for example bug #3040161. + // However, we only perform this for non-Japanese games, as these require + // special handling, done after this loop. + if (width + _font->getCharWidth(curChar) > maxWidth && g_sci->getLanguage() != Common::JA_JPN) break; width += _font->getCharWidth(curChar); curCharCount++; } + + // Text without spaces, probably Kanji/Japanese if (maxChars == 0) { - // Text w/o space, supposingly kanji maxChars = curCharCount; 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 pc98 sci. Note: changing the while() instead will NOT - // WORK. it would break all sorts of regular sci games. + // as in sierra pc98 sci. if (maxWidth == (width - _font->getCharWidth(curChar))) { maxChars--; if (curChar > 0xFF) |