diff options
author | Gregory Montoir | 2007-04-15 20:36:44 +0000 |
---|---|---|
committer | Gregory Montoir | 2007-04-15 20:36:44 +0000 |
commit | 642fa67da9c271244de373431166f23449ec8543 (patch) | |
tree | dbd138e5ebd40f8fa55ed67c049e6e8f0b6eea4a /engines/scumm/charset.cpp | |
parent | f8067d54e53084c9fd7ef848fd855967d0641465 (diff) | |
download | scummvm-rg350-642fa67da9c271244de373431166f23449ec8543.tar.gz scummvm-rg350-642fa67da9c271244de373431166f23449ec8543.tar.bz2 scummvm-rg350-642fa67da9c271244de373431166f23449ec8543.zip |
Added code for decodeParseString.SO_PRINT_WRAP and rewrote the CHARSET_1 function in order to match the original V8 interpreter. This should fix bugs #1036707 and #1662610 (subtitles word wrapping issues).
svn-id: r26516
Diffstat (limited to 'engines/scumm/charset.cpp')
-rw-r--r-- | engines/scumm/charset.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 654a7fd6c3..92642faaa5 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -348,6 +348,44 @@ int CharsetRenderer::getStringWidth(int arg, const byte *text) { return width; } +int CharsetRenderer::getStringHeight(const byte *text) { + int pos = 0; + int height = 0; + byte chr; + int oldID = getCurID(); + + while ((chr = text[pos++]) != 0) { + if (chr == '\n' || chr == '\r') + break; + if (chr == '@') + continue; + if (chr == 255 || (_vm->_game.version <= 6 && chr == 254)) { + chr = text[pos++]; + if (chr == 3) { // 'WAIT' + height += getFontHeight(); + break; + } + if (chr == 10 || chr == 21 || chr == 12 || chr == 13) { + pos += 2; + continue; + } + if (chr == 9 || chr == 1 || chr == 2) { // 'Newline' + height += getFontHeight(); + continue; + } + if (chr == 14) { + int set = text[pos] | (text[pos + 1] << 8); + pos += 2; + setCurID(set); + continue; + } + } + } + + setCurID(oldID); + return height + getFontHeight(); +} + void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) { int lastspace = -1; int curw = 1; |