diff options
Diffstat (limited to 'engines/mads')
-rw-r--r-- | engines/mads/dialogs.cpp | 13 | ||||
-rw-r--r-- | engines/mads/font.cpp | 2 | ||||
-rw-r--r-- | engines/mads/nebular/dialogs_nebular.cpp | 18 |
3 files changed, 21 insertions, 12 deletions
diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 13342f14f1..d5e8ad5ba9 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -43,6 +43,8 @@ void Dialog::save(MSurface *s) { s->copyTo(_savedSurface, Common::Rect(_position.x, _position.y, _position.x + _width, _position.y + _height), Common::Point()); + + _vm->_screen.copyRectToScreen(getBounds()); } void Dialog::restore(MSurface *s) { @@ -50,6 +52,8 @@ void Dialog::restore(MSurface *s) { _savedSurface->copyTo(s, _position); delete _savedSurface; _savedSurface = nullptr; + + _vm->_screen.copyRectToScreen(getBounds()); } } @@ -76,8 +80,6 @@ void Dialog::draw() { drawContent(Common::Rect(_position.x + 2, _position.y + 2, _position.x + _width - 2, _position.y + _height - 2), 0, TEXTDIALOG_CONTENT1, TEXTDIALOG_CONTENT2); - - _vm->_screen.copyRectToScreen(bounds); } void Dialog::drawContent(const Common::Rect &r, int seed, byte color1, byte color2) { @@ -273,7 +275,7 @@ void TextDialog::draw() { // Draw the text lines int lineYp = _position.y + 5; - for (int lineNum = 0; lineNum < _numLines; ++lineNum) { + for (int lineNum = 0; lineNum <= _numLines; ++lineNum) { if (_lineXp[lineNum] == -1) { // Draw a line across the entire dialog _vm->_screen.hLine(_position.x + 2, @@ -326,9 +328,14 @@ void TextDialog::show() { draw(); _vm->_events->showCursor(); + // Wait for mouse click do { _vm->_events->waitForNextFrame(); } while (!_vm->shouldQuit() && !_vm->_events->_mouseReleased); + + // Allow the mouse release to be gobbled up + if (!_vm->shouldQuit()) + _vm->_events->waitForNextFrame(); } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index 294139c3dd..ba10099184 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -141,7 +141,7 @@ int Font::writeString(MSurface *surface, const Common::String &msg, const Common if (width > 0) xEnd = MIN((int)surface->w, pt.x + width); else - xEnd = surface->w - pt.x; + xEnd = surface->w; int x = pt.x; int y = pt.y; diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 3be3db33b3..ff25696f5d 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -125,9 +125,9 @@ bool DialogsNebular::show(int msgId) { Common::String dialogText; bool result = true; bool centerFlag = false; - bool underlineFlag; - bool commandFlag; - bool crFlag; + bool underlineFlag = false; + bool commandFlag = false; + bool crFlag = false; TextDialog *dialog = nullptr; _dialogWidth = 17; _capitalizationMode = kUppercase; @@ -136,11 +136,6 @@ bool DialogsNebular::show(int msgId) { for (uint idx = 0; idx < msg.size(); ++idx) { Common::String srcLine = msg[idx]; const char *srcP = srcLine.c_str(); - dialogText = ""; - commandFlag = false; - underlineFlag = false; - centerFlag = false; - crFlag = false; // Loop through the text of the line while (srcP < srcLine.c_str() + srcLine.size()) { @@ -226,6 +221,13 @@ bool DialogsNebular::show(int msgId) { } else { dialog->wordWrap(dialogText); } + + // Reset line processing flags in preparation for next line + dialogText = ""; + commandFlag = false; + underlineFlag = false; + centerFlag = false; + crFlag = false; } if (!centerFlag) |