Skip to content

Commit

Permalink
MADS: Extra conversation dialog setup
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Jan 18, 2016
1 parent 1084c22 commit d7420c9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions engines/mads/conversations.cpp
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion engines/mads/conversations.h
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions engines/mads/dialogs.cpp
Expand Up @@ -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;

Expand All @@ -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);
Expand All @@ -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;

This comment has been minimized.

Copy link
@bluegr

bluegr Jan 18, 2016

Member

_fontSpacing is always 0 here
(I understand that this is probably WIP code, just making a note)

int pieces = ((fontLen - 1) / _edgeSeries->getFrame(EDGE_TOP)->w) + 1;
int estimate = (maxLen - _piecesPerCenter) / 2;
int estimate = (pieces - _piecesPerCenter) / 2;

return estimate;
}
Expand Down
1 change: 1 addition & 0 deletions engines/mads/dialogs.h
Expand Up @@ -129,6 +129,7 @@ class TextDialog : protected Dialog {
SpriteAsset *_edgeSeries;
MSurface *_icon;
int _piecesPerCenter;
int _fontSpacing;

/**
* Calculate the bounds for the dialog
Expand Down

0 comments on commit d7420c9

Please sign in to comment.