diff options
author | Max Horn | 2005-06-17 20:23:12 +0000 |
---|---|---|
committer | Max Horn | 2005-06-17 20:23:12 +0000 |
commit | b03de44db456d6ea4c578a3b6c8c423e41cda0d7 (patch) | |
tree | 61b59df96fce107188fee6f7003e35d187714a8d | |
parent | e3b40b5c24b676ed67c39891dff2b41ee9300f98 (diff) | |
download | scummvm-rg350-b03de44db456d6ea4c578a3b6c8c423e41cda0d7.tar.gz scummvm-rg350-b03de44db456d6ea4c578a3b6c8c423e41cda0d7.tar.bz2 scummvm-rg350-b03de44db456d6ea4c578a3b6c8c423e41cda0d7.zip |
Handle newlines in blast text (fixes last remaining part of bug #902415)
svn-id: r18408
-rw-r--r-- | scumm/charset.cpp | 2 | ||||
-rw-r--r-- | scumm/string.cpp | 39 |
2 files changed, 23 insertions, 18 deletions
diff --git a/scumm/charset.cpp b/scumm/charset.cpp index da909900a4..8ff53a2b51 100644 --- a/scumm/charset.cpp +++ b/scumm/charset.cpp @@ -311,7 +311,7 @@ int CharsetRenderer::getStringWidth(int arg, const byte *text) { break; } else if (chr == '@') continue; - if (chr == 0xD) + if (chr == '\n' || chr == '\r') break; if (chr == 254 || chr == 255) { //process in LE diff --git a/scumm/string.cpp b/scumm/string.cpp index 620f3f3391..8cba88263a 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -796,32 +796,37 @@ void ScummEngine_v6::drawBlastTexts() { buf = _blastTextQueue[i].text; _charset->_top = _blastTextQueue[i].ypos + _screenTop; - _charset->_left = _blastTextQueue[i].xpos; _charset->_right = _screenWidth - 1; _charset->_center = _blastTextQueue[i].center; _charset->setColor(_blastTextQueue[i].color); _charset->_disableOffsX = _charset->_firstChar = true; _charset->setCurID(_blastTextQueue[i].charset); - // Center text if necessary - if (_charset->_center) { - _charset->_left -= _charset->getStringWidth(0, buf) / 2; - if (_charset->_left < 0) - _charset->_left = 0; - } - do { - c = *buf++; - if (c != 0 && c != 0xFF) { - if (c & 0x80 && _useCJKMode) { - if (_language == Common::JA_JPN && !checkSJISCode(c)) { - c = 0x20; //not in S-JIS - } else { - c += *buf++ * 256; + _charset->_left = _blastTextQueue[i].xpos; + + // Center text if necessary + if (_charset->_center) { + _charset->_left -= _charset->getStringWidth(0, buf) / 2; + if (_charset->_left < 0) + _charset->_left = 0; + } + + do { + c = *buf++; + if (c != 0 && c != 0xFF && c != '\n') { + if (c & 0x80 && _useCJKMode) { + if (_language == Common::JA_JPN && !checkSJISCode(c)) { + c = 0x20; //not in S-JIS + } else { + c += *buf++ * 256; + } } + _charset->printChar(c); } - _charset->printChar(c); - } + } while (c && c != '\n'); + + _charset->_top += _charset->getFontHeight(); } while (c); _blastTextQueue[i].rect = _charset->_str; |