aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-07-17 19:26:47 -0400
committerPaul Gilbert2015-07-17 19:26:47 -0400
commit95b1288329b12dce9d96a1a97a28f1bc457d605f (patch)
treed766361f8331e09202d5805a9a67977942184b0b
parent9044e70bb95e78f75c86ae1f4508c9f5bba65a88 (diff)
downloadscummvm-rg350-95b1288329b12dce9d96a1a97a28f1bc457d605f.tar.gz
scummvm-rg350-95b1288329b12dce9d96a1a97a28f1bc457d605f.tar.bz2
scummvm-rg350-95b1288329b12dce9d96a1a97a28f1bc457d605f.zip
SHERLOCK: RT: Simplify and fix size calculation in getTalkWindowSize
-rw-r--r--engines/sherlock/tattoo/widget_talk.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/engines/sherlock/tattoo/widget_talk.cpp b/engines/sherlock/tattoo/widget_talk.cpp
index b563ee8ac3..3db8ff460c 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;
- const char *const NUM_STR = "19.";
int width, height;
// See how many statements are going to be available
@@ -55,24 +54,15 @@ void WidgetTalk::getTalkWindowSize() {
++numStatements;
}
- // Figure out the width, allowing room for both the text and the statement numbers on the side
width = SHERLOCK_SCREEN_WIDTH * 2 / 3;
- int n = (numStatements < 10) ? 1 : 0;
- width -= _surface.stringWidth(NUM_STR + n) + _surface.widestChar() / 2 + 9;
- // Now that we have a width, split up the text into individual lines
- int numLines = 0;
- for (uint idx = 0; idx < talk._statements.size(); ++idx) {
- Common::StringArray statementLines;
- if (talk._statements[idx]._talkMap != -1) {
- splitLines(talk._statements[idx]._statement, statementLines, width, 999);
- numLines += statementLines.size();
- }
- }
+ // Split up the questions into separate strings for each line
+ _bounds = Common::Rect(width, 1);
+ setStatementLines();
// Make sure that the window does not get too big
- if (numLines < 7) {
- height = (_surface.fontHeight() + 1) * numLines + 9;
+ if (_statementLines.size() < 7) {
+ height = (_surface.fontHeight() + 1) * _statementLines.size() + 9;
_scroll = false;
} else {
// Set up the height to a constrained amount, and add extra width for the scrollbar