Trimming of excess spaces in drawString, only applies to SCUMM 4+ games. Cofirmed via disssembly.

svn-id: r26282
This commit is contained in:
Travis Howell 2007-03-23 23:22:18 +00:00
parent 661944a0f9
commit 00ea91c5d6

View file

@ -688,25 +688,28 @@ void ScummEngine::drawString(int a, const byte *msg) {
fontHeight = _charset->getFontHeight(); fontHeight = _charset->getFontHeight();
// trim from the right if (_game.version >= 4) {
byte *tmp = buf; // trim from the right
space = NULL; byte *tmp = buf;
while (*tmp) { space = NULL;
if (*tmp == ' ') { while (*tmp) {
if (!space) if (*tmp == ' ') {
space = tmp; if (!space)
} else { space = tmp;
space = NULL; } else {
space = NULL;
}
tmp++;
} }
tmp++; if (space)
*space = '\0';
} }
if (space)
*space = '\0';
if (_charset->_center) { if (_charset->_center) {
_charset->_left -= _charset->getStringWidth(a, buf) / 2; _charset->_left -= _charset->getStringWidth(a, buf) / 2;
} }
if (!buf[0]) { if (_game.version >= 5 && !buf[0]) {
buf[0] = ' '; buf[0] = ' ';
buf[1] = 0; buf[1] = 0;
} }
@ -798,7 +801,7 @@ void ScummEngine::drawString(int a, const byte *msg) {
_nextTop = _charset->_top; _nextTop = _charset->_top;
} }
_string[a].xpos = _charset->_str.right + 8; // Indy3: Fixes Grail Diary text positioning _string[a].xpos = _charset->_str.right;
} }
int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize) { int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize) {