diff options
author | Travis Howell | 2005-03-02 07:00:42 +0000 |
---|---|---|
committer | Travis Howell | 2005-03-02 07:00:42 +0000 |
commit | f097bcbf2bfc3ab5918c73716d15caddb16db140 (patch) | |
tree | 096bf6ff9f9d54e69a52e64ca64d3c229f892f2a /scumm | |
parent | 7dd05d6d103dc98980b23a10377c0dd364ef5828 (diff) | |
download | scummvm-rg350-f097bcbf2bfc3ab5918c73716d15caddb16db140.tar.gz scummvm-rg350-f097bcbf2bfc3ab5918c73716d15caddb16db140.tar.bz2 scummvm-rg350-f097bcbf2bfc3ab5918c73716d15caddb16db140.zip |
Fix string display in Buzzy games.
svn-id: r16968
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/intern.h | 1 | ||||
-rw-r--r-- | scumm/script_v7he.cpp | 22 |
2 files changed, 21 insertions, 2 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 5b6f1b7726..9d05fb4470 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -661,6 +661,7 @@ protected: virtual void redrawBGAreas(); + int getStringCharWidth(byte chr); virtual int setupStringArray(int size); void appendSubstring(int dst, int src, int len2, int len); diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp index f6b763f0d8..9549084f12 100644 --- a/scumm/script_v7he.cpp +++ b/scumm/script_v7he.cpp @@ -375,6 +375,24 @@ const char *ScummEngine_v70he::getOpcodeDesc(byte i) { return _opcodesv70he[i].desc; } +int ScummEngine_v70he::getStringCharWidth(byte chr) { + int charset = _string[0]._default.charset; + + byte *ptr = getResourceAddress(rtCharset, charset); + if (ptr == 0) + error("getStringCharWidth::charset %d not found!", charset); + ptr += 29; + + int spacing = 0; + + int offs = READ_LE_UINT32(ptr + chr * 4 + 4); + if (offs) { + spacing = ptr[offs] + (signed char)ptr[offs + 2]; + } + + return spacing; +} + int ScummEngine_v70he::setupStringArray(int size) { writeVar(0, 0); defineArray(0, kStringArray, 0, size + 1); @@ -752,7 +770,7 @@ void ScummEngine_v70he::o70_getStringWidth() { chr = readArray(0, 0, pos); if (chr == 0) break; - width += _charset->getCharWidth(chr); + width += getStringCharWidth(chr); pos++; } @@ -977,7 +995,7 @@ void ScummEngine_v70he::o70_getStringLenForWidth() { writeVar(0, array); while (pos <= len) { chr = readArray(0, 0, pos); - width += _charset->getCharWidth(chr); + width += getStringCharWidth(chr); if (width >= max) { push(pos); return; |