[Scummvm-cvs-logs] scummvm master -> d7420c9128fc9a5b5e38472d05444d82d48d8d13

dreammaster dreammaster at scummvm.org
Mon Jan 18 23:13:30 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d7420c9128 MADS: Extra conversation dialog setup


Commit: d7420c9128fc9a5b5e38472d05444d82d48d8d13
    https://github.com/scummvm/scummvm/commit/d7420c9128fc9a5b5e38472d05444d82d48d8d13
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-01-18T17:12:54-05:00

Commit Message:
MADS: Extra conversation dialog setup

Changed paths:
    engines/mads/conversations.cpp
    engines/mads/conversations.h
    engines/mads/dialogs.cpp
    engines/mads/dialogs.h



diff --git a/engines/mads/conversations.cpp b/engines/mads/conversations.cpp
index e2f2fa2..469aaed 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 a56cef5..7b7d348 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 14aa41e..d9a1e53 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 14e0932..7642b76 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






More information about the Scummvm-git-logs mailing list