Handle newlines in blast text (fixes last remaining part of bug #902415)

svn-id: r18408
This commit is contained in:
Max Horn 2005-06-17 20:23:12 +00:00
parent e3b40b5c24
commit b03de44db4
2 changed files with 24 additions and 19 deletions

View File

@ -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

View File

@ -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->printChar(c);
_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);
}
} while (c && c != '\n');
_charset->_top += _charset->getFontHeight();
} while (c);
_blastTextQueue[i].rect = _charset->_str;