From f6cfd1d53b3ac47744c8393c49ecf51a99633fc4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 7 Apr 2014 23:48:43 -0400 Subject: MADS: Implement missing dirty rect merged area pointer --- engines/mads/screen.cpp | 2 ++ engines/mads/screen.h | 1 + engines/mads/user_interface.cpp | 14 ++++++++------ 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'engines') diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 683a56705a..78980fe2a7 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -34,6 +34,7 @@ MADSEngine *DirtyArea::_vm = nullptr; DirtyArea::DirtyArea() { _active = false; _textActive = false; + _mergedArea = nullptr; } void DirtyArea::setArea(int width, int height, int maxWidth, int maxHeight) { @@ -206,6 +207,7 @@ void DirtyAreas::mergeAreas(int idx1, int idx2) { da1._bounds2.bottom = da1._bounds.top + (da1._bounds.height() + 1) / 2 - 1; da2._active = false; + da2._mergedArea = &da1; da1._textActive = true; } diff --git a/engines/mads/screen.h b/engines/mads/screen.h index ed3de80576..57b53df895 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -74,6 +74,7 @@ public: Common::Rect _bounds2; bool _textActive; bool _active; + DirtyArea *_mergedArea; DirtyArea(); diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index d7f198f3ce..f51372e0dd 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -134,15 +134,17 @@ void UISlots::draw(bool updateFlag, bool delFlag) { userInterface._dirtyAreas.merge(1, userInterface._uiSlots.size()); for (uint idx = 0; idx < size(); ++idx) { - DirtyArea &dirtyArea = userInterface._dirtyAreas[idx]; + DirtyArea *dirtyArea = &userInterface._dirtyAreas[idx]; UISlot &slot = (*this)[idx]; if (slot._flags >= IMG_STATIC && !(slot._flags & 0x40)) { - if (!dirtyArea._active) { - error("Should never reach this point, even in original"); + if (!dirtyArea->_active) { + do { + dirtyArea = dirtyArea->_mergedArea; + } while (!dirtyArea->_active); } - if (dirtyArea._textActive) { + if (dirtyArea->_textActive) { SpriteAsset *asset = scene._sprites[slot._spritesIndex]; if (slot._segmentId == IMG_SPINNING_OBJECT) { @@ -655,7 +657,7 @@ void UserInterface::doBackgroundAnimation() { _noSegmentsActive = !_someSegmentsActive; _someSegmentsActive = false; - for (int idx = 0; idx < uiEntries.size(); ++idx) { + for (int idx = 0; idx < (int)uiEntries.size(); ++idx) { AnimUIEntry &uiEntry = uiEntries[idx]; if (uiEntry._counter < 0) { @@ -699,7 +701,7 @@ void UserInterface::doBackgroundAnimation() { } } - for (int idx = 0; idx < uiEntries.size(); ++idx) { + for (uint idx = 0; idx < uiEntries.size(); ++idx) { int imgScan = uiEntries[idx]._counter; if (imgScan >= 0) { _uiSlots.add(frameEntries[imgScan]); -- cgit v1.2.3