aboutsummaryrefslogtreecommitdiff
path: root/engines/mads
diff options
context:
space:
mode:
Diffstat (limited to 'engines/mads')
-rw-r--r--engines/mads/conversations.cpp1
-rw-r--r--engines/mads/conversations.h2
-rw-r--r--engines/mads/dialogs.cpp6
-rw-r--r--engines/mads/dialogs.h1
4 files changed, 7 insertions, 3 deletions
diff --git a/engines/mads/conversations.cpp b/engines/mads/conversations.cpp
index e2f2fa2107..469aaedb81 100644
--- a/engines/mads/conversations.cpp
+++ b/engines/mads/conversations.cpp
@@ -48,6 +48,7 @@ GameConversations::GameConversations(MADSEngine *vm) : _vm(vm) {
_dialogNodeOffset = _dialogNodeSize = 0;
_dialog = nullptr;
_dialogAltFlag = false;
+ _personSpeaking = 0;
// Mark all conversation slots as empty
for (int idx = 0; idx < MAX_CONVERSATIONS; ++idx)
diff --git a/engines/mads/conversations.h b/engines/mads/conversations.h
index a56cef53da..7b7d3485ef 100644
--- a/engines/mads/conversations.h
+++ b/engines/mads/conversations.h
@@ -181,7 +181,7 @@ struct ScriptEntry {
/**
* Constructor
*/
- ScriptEntry() : _command(CMD_END) {}
+ ScriptEntry() : _command(CMD_END), _index(0) {}
/**
* Loads data from a passed stream into the parameters structure
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;
}
diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h
index 14e0932e05..7642b76a3c 100644
--- a/engines/mads/dialogs.h
+++ b/engines/mads/dialogs.h
@@ -129,6 +129,7 @@ protected:
SpriteAsset *_edgeSeries;
MSurface *_icon;
int _piecesPerCenter;
+ int _fontSpacing;
/**
* Calculate the bounds for the dialog