From 6063a9cba32443234be31d77e3a7a57870c88007 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 28 Jun 2010 11:40:39 +0000 Subject: [PATCH] Bugfix to properly erase text messages when they expire svn-id: r50432 --- engines/m4/mads_views.cpp | 17 ++++++++--------- engines/m4/mads_views.h | 1 + 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/m4/mads_views.cpp b/engines/m4/mads_views.cpp index 7b0b1443a8e..1766603dc8a 100644 --- a/engines/m4/mads_views.cpp +++ b/engines/m4/mads_views.cpp @@ -313,7 +313,7 @@ int MadsTextDisplay::add(int xp, int yp, uint fontColour, int charSpacing, const void MadsTextDisplay::setDirtyAreas() { // Determine dirty areas for active text areas for (uint idx = 0, dirtyIdx = DIRTY_AREAS_TEXT_DISPLAY_IDX; dirtyIdx < DIRTY_AREAS_SIZE; ++idx, ++dirtyIdx) { - if ((_entries[idx].expire < 0) || !_entries[idx].active) + if ((_entries[idx].expire >= 0) || !_entries[idx].active) _owner._dirtyAreas[dirtyIdx].active = false; else { _owner._dirtyAreas[dirtyIdx].textActive = true; @@ -341,14 +341,6 @@ void MadsTextDisplay::draw(View *view, int yOffset) { _entries[idx].spacing); } } - - // Clear up any now text display entries that are to be expired - for (uint idx = 0; idx < _entries.size(); ++idx) { - if (_entries[idx].expire < 0) { - _entries[idx].active = false; - _entries[idx].expire = 0; - } - } } /** @@ -827,6 +819,7 @@ void MadsDirtyAreas::setTextDisplay(int dirtyIdx, const MadsTextDisplayEntry &te * @param count Number of entries to process */ void MadsDirtyAreas::merge(int startIndex, int count) { +return;//***DEBUG*** if (startIndex >= count) return; @@ -878,6 +871,11 @@ void MadsDirtyAreas::copy(M4Surface *dest, M4Surface *src, int yOffset, const Co } } +void MadsDirtyAreas::clear() { + for (uint i = 0; i < _entries.size(); ++i) + _entries[i].active = false; +} + /*--------------------------------------------------------------------------*/ MadsSequenceList::MadsSequenceList(MadsView &owner): _owner(owner) { @@ -1209,6 +1207,7 @@ MadsView::~MadsView() { void MadsView::refresh() { // Draw any sprites + _dirtyAreas.clear(); _spriteSlots.drawBackground(_yOffset); // Process dirty areas diff --git a/engines/m4/mads_views.h b/engines/m4/mads_views.h index fc001740d38..8bc507f20b8 100644 --- a/engines/m4/mads_views.h +++ b/engines/m4/mads_views.h @@ -294,6 +294,7 @@ public: bool intersects(int idx1, int idx2); void mergeAreas(int idx1, int idx2); void copy(M4Surface *dest, M4Surface *src, int yOffset, const Common::Point &posAdjust); + void clear(); }; enum SpriteAnimType {ANIMTYPE_CYCLED = 1, ANIMTYPE_REVERSIBLE = 2};