diff options
-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; }; |