diff options
author | Benjamin Haisch | 2008-09-15 10:59:11 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2011-11-20 22:43:06 +0100 |
commit | aaded0f5465336a1f5f9ea264c1b0efd878187ef (patch) | |
tree | 0f3166718669baaaf39c8dc4e17b82309fb2635a | |
parent | 3eb449f236982ac201b30e0d4b939c7d324e8467 (diff) | |
download | scummvm-rg350-aaded0f5465336a1f5f9ea264c1b0efd878187ef.tar.gz scummvm-rg350-aaded0f5465336a1f5f9ea264c1b0efd878187ef.tar.bz2 scummvm-rg350-aaded0f5465336a1f5f9ea264c1b0efd878187ef.zip |
TOLTECS: Added Screen::getTextWidth
-rw-r--r-- | engines/toltecs/screen.cpp | 4 | ||||
-rw-r--r-- | engines/toltecs/screen.h | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp index a80c22add1..612aaff1e6 100644 --- a/engines/toltecs/screen.cpp +++ b/engines/toltecs/screen.cpp @@ -715,7 +715,7 @@ void Screen::updateTalkText(int16 slotIndex, int16 slotOffset) { } else break; } - + item->slotIndex = slotIndex; item->slotOffset = textData - _vm->_script->getSlotData(slotIndex); @@ -762,7 +762,7 @@ void Screen::updateTalkText(int16 slotIndex, int16 slotOffset) { } } } - + addTalkTextRect(font, x, y, length, width, item); debug(0, "## item->lineCount = %d", item->lineCount); diff --git a/engines/toltecs/screen.h b/engines/toltecs/screen.h index ec90d52a2c..655256bc51 100644 --- a/engines/toltecs/screen.h +++ b/engines/toltecs/screen.h @@ -103,6 +103,19 @@ public: byte *getCharData(byte ch) const { return _fontData + 0x298 + READ_LE_UINT16(&_fontData[0xE0 + (ch - 0x21) * 2]); } + int16 getTextWidth(byte *text) { + int16 width = 0; + while (*text && *text < 0xF0) { + byte ch = *text++; + if (ch <= 0x20) { + width += getWidth(); + } else { + width += getCharWidth(ch) + getSpacing() - 1; + } + } + return width; + } + protected: byte *_fontData; }; |