diff options
Diffstat (limited to 'engines/sci/graphics/text16.cpp')
-rw-r--r-- | engines/sci/graphics/text16.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp index b5dd9aee0b..903136c29d 100644 --- a/engines/sci/graphics/text16.cpp +++ b/engines/sci/graphics/text16.cpp @@ -200,7 +200,7 @@ int16 GfxText16::GetLongest(const char *&textPtr, int16 maxWidth, GuiResourceId if (!_font) return 0; - while (1) { + for (;;) { curChar = (*(const byte *)textPtr); if (_font->isDoubleByte(curChar)) { curChar |= (*(const byte *)(textPtr + 1)) << 8; @@ -300,7 +300,7 @@ int16 GfxText16::GetLongest(const char *&textPtr, int16 maxWidth, GuiResourceId punctuationTable = text16_shiftJIS_punctuation_SCI01; } - while (1) { + for (;;) { // Look up if character shouldn't be the first on a new line nonBreakingPos = 0; while (punctuationTable[nonBreakingPos]) { @@ -383,15 +383,15 @@ void GfxText16::Width(const char *text, int16 from, int16 len, GuiResourceId org return; } -void GfxText16::StringWidth(const char *str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight) { - Width(str, 0, (int16)strlen(str), orgFontId, textWidth, textHeight, true); +void GfxText16::StringWidth(const Common::String &str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight) { + Width(str.c_str(), 0, str.size(), orgFontId, textWidth, textHeight, true); } -void GfxText16::ShowString(const char *str, GuiResourceId orgFontId, int16 orgPenColor) { - Show(str, 0, (int16)strlen(str), orgFontId, orgPenColor); +void GfxText16::ShowString(const Common::String &str, GuiResourceId orgFontId, int16 orgPenColor) { + Show(str.c_str(), 0, str.size(), orgFontId, orgPenColor); } -void GfxText16::DrawString(const char *str, GuiResourceId orgFontId, int16 orgPenColor) { - Draw(str, 0, (int16)strlen(str), orgFontId, orgPenColor); +void GfxText16::DrawString(const Common::String &str, GuiResourceId orgFontId, int16 orgPenColor) { + Draw(str.c_str(), 0, str.size(), orgFontId, orgPenColor); } int16 GfxText16::Size(Common::Rect &rect, const char *text, uint16 languageSplitter, GuiResourceId fontId, int16 maxWidth) { @@ -580,20 +580,21 @@ void GfxText16::Box(const char *text, uint16 languageSplitter, bool show, const } } -void GfxText16::DrawString(const char *text) { +void GfxText16::DrawString(const Common::String &text) { GuiResourceId previousFontId = GetFontId(); int16 previousPenColor = _ports->_curPort->penClr; - Draw(text, 0, strlen(text), previousFontId, previousPenColor); + Draw(text.c_str(), 0, text.size(), previousFontId, previousPenColor); SetFont(previousFontId); _ports->penColor(previousPenColor); } // we need to have a separate status drawing code // In KQ4 the IV char is actually 0xA, which would otherwise get considered as linebreak and not printed -void GfxText16::DrawStatus(const char *text) { +void GfxText16::DrawStatus(const Common::String &str) { uint16 curChar, charWidth; - uint16 textLen = strlen(text); + const byte *text = (const byte *)str.c_str(); + uint16 textLen = str.size(); Common::Rect rect; GetFont(); @@ -603,7 +604,7 @@ void GfxText16::DrawStatus(const char *text) { rect.top = _ports->_curPort->curTop; rect.bottom = rect.top + _ports->_curPort->fontHeight; while (textLen--) { - curChar = (*(const byte *)text++); + curChar = *text++; switch (curChar) { case 0: break; |