aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/dialogs.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-01-18 17:12:54 -0500
committerPaul Gilbert2016-01-18 17:12:54 -0500
commitd7420c9128fc9a5b5e38472d05444d82d48d8d13 (patch)
treefd654772816382859535d05d342f880c36d1bc71 /engines/mads/dialogs.cpp
parent1084c22a786f1d8a0215c1bb3e676f05f948162c (diff)
downloadscummvm-rg350-d7420c9128fc9a5b5e38472d05444d82d48d8d13.tar.gz
scummvm-rg350-d7420c9128fc9a5b5e38472d05444d82d48d8d13.tar.bz2
scummvm-rg350-d7420c9128fc9a5b5e38472d05444d82d48d8d13.zip
MADS: Extra conversation dialog setup
Diffstat (limited to 'engines/mads/dialogs.cpp')
-rw-r--r--engines/mads/dialogs.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp
index 14aa41eb30..d9a1e53964 100644
--- a/engines/mads/dialogs.cpp
+++ b/engines/mads/dialogs.cpp
@@ -151,6 +151,7 @@ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName,
_icon = nullptr;
_edgeSeries = nullptr;
_piecesPerCenter = 0;
+ _fontSpacing = 0;
_vm->_font->setColors(TEXTDIALOG_BLACK, TEXTDIALOG_BLACK, TEXTDIALOG_BLACK, TEXTDIALOG_BLACK);
_piecesPerCenter = 0;
@@ -165,6 +166,7 @@ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName,
_edgeSeries = new SpriteAsset(_vm, "box.ss", PALFLAG_RESERVED);
_vm->_font->setColors(TEXTDIALOG_BLACK, TEXTDIALOG_BLACK, TEXTDIALOG_BLACK, TEXTDIALOG_BLACK);
_piecesPerCenter = _edgeSeries->getFrame(EDGE_UPPER_CENTER)->w / _edgeSeries->getFrame(EDGE_BOTTOM)->w;
+ _fontSpacing = 0;
int maxLen = estimatePieces(maxTextChars);
init(maxLen);
@@ -183,9 +185,9 @@ void TextDialog::init(int maxTextChars) {
}
int TextDialog::estimatePieces(int maxLen) {
- int fontLen = (_font->maxWidth() + 1) * maxLen;
+ int fontLen = (_font->maxWidth() + _fontSpacing) * maxLen;
int pieces = ((fontLen - 1) / _edgeSeries->getFrame(EDGE_TOP)->w) + 1;
- int estimate = (maxLen - _piecesPerCenter) / 2;
+ int estimate = (pieces - _piecesPerCenter) / 2;
return estimate;
}