diff options
author | Paul Gilbert | 2015-07-14 20:24:37 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-07-14 20:24:37 -0400 |
commit | 40dee7d9668423908998cf2d823eec15a39a1f3d (patch) | |
tree | 4ed403c07fbcd09a0b27e5cd5bf08d6df6784a08 /engines/sherlock/tattoo | |
parent | c92b020284169060099e7189972be707d42fa74f (diff) | |
download | scummvm-rg350-40dee7d9668423908998cf2d823eec15a39a1f3d.tar.gz scummvm-rg350-40dee7d9668423908998cf2d823eec15a39a1f3d.tar.bz2 scummvm-rg350-40dee7d9668423908998cf2d823eec15a39a1f3d.zip |
SHERLOCK: RT: Fix display of talk windows with multiple options
Diffstat (limited to 'engines/sherlock/tattoo')
-rw-r--r-- | engines/sherlock/tattoo/widget_talk.cpp | 52 |
1 files changed, 6 insertions, 46 deletions
diff --git a/engines/sherlock/tattoo/widget_talk.cpp b/engines/sherlock/tattoo/widget_talk.cpp index 55f7df3eee..276c83717f 100644 --- a/engines/sherlock/tattoo/widget_talk.cpp +++ b/engines/sherlock/tattoo/widget_talk.cpp @@ -45,7 +45,6 @@ WidgetTalk::WidgetTalk(SherlockEngine *vm) : WidgetBase(vm) { void WidgetTalk::getTalkWindowSize() { TattooTalk &talk = *(TattooTalk *)_vm->_talk; - Common::StringArray lines; const char *const NUM_STR = "19."; int width, height; @@ -68,9 +67,6 @@ void WidgetTalk::getTalkWindowSize() { if (talk._statements[idx]._talkMap != -1) { splitLines(talk._statements[idx]._statement, statementLines, width, 999); numLines += statementLines.size(); - - for (uint sIdx = 0; sIdx < statementLines.size(); ++sIdx) - lines.push_back(statementLines[sIdx]); } } @@ -93,12 +89,7 @@ void WidgetTalk::getTalkWindowSize() { // Form the background for the new window makeInfoArea(); - - int yp = 5; - for (int lineNum = 0; yp < (_bounds.height() - _surface.fontHeight() / 2); ++lineNum) { - _surface.writeString(lines[lineNum], Common::Point(_surface.widestChar(), yp), INFO_TOP); - yp += _surface.fontHeight() + 1; - } + render(HL_CHANGED_HIGHLIGHTS); } void WidgetTalk::load() { @@ -543,43 +534,12 @@ void WidgetTalk::setStatementLines() { // Get the next statement text to process Common::String str = talk._statements[statementNum]._statement; - // Process the statement - Common::String line; - do { - line = ""; - - // Find out how much of the statement will fit on the line - int width = 0; - const char *ch = str.c_str(); - const char *space = nullptr; - - while (width < xSize && *ch) { - width += _surface.charWidth(*ch); - - // Keep track of where spaces are - if (*ch == ' ') - space = ch; - ++ch; - } - - // If the line was too wide to fit on a single line, go back to the last space and split it there. - // But if there isn't (and this shouldn't ever happen), just split the line right at that point - if (width > xSize) { - if (space) { - line = Common::String(str.c_str(), space); - str = Common::String(space + 1); - } else { - line = Common::String(str.c_str(), ch); - str = Common::String(ch); - } - } else { - line = str; - str = ""; - } + Common::StringArray statementLines; + splitLines(str, statementLines, xSize, 999); - // Add the line in - _statementLines.push_back(StatementLine(line, statementNum)); - } while (!line.empty()); + // Add the lines in + for (uint idx = 0; idx < statementLines.size(); ++idx) + _statementLines.push_back(StatementLine(statementLines[idx], statementNum)); } } } |