diff options
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/graphics/plane32.cpp | 3 | ||||
-rw-r--r-- | engines/sci/graphics/screen_item32.h | 16 |
2 files changed, 17 insertions, 2 deletions
diff --git a/engines/sci/graphics/plane32.cpp b/engines/sci/graphics/plane32.cpp index 47d41bc752..50a34656de 100644 --- a/engines/sci/graphics/plane32.cpp +++ b/engines/sci/graphics/plane32.cpp @@ -518,8 +518,7 @@ void Plane::calcLists(Plane &visiblePlane, const PlaneList &planeList, DrawList ) { const ScreenItem *drawnItem = drawListEntry->screenItem; - if ( - (newItem->_priority > drawnItem->_priority || (newItem->_priority == drawnItem->_priority && newItem->_creationId > drawnItem->_creationId)) && + if (newItem->hasPriorityAbove(*drawnItem) && drawListEntry->rect.intersects(newItem->_screenRect) ) { mergeToDrawList(j, drawListEntry->rect.findIntersectingRect(newItem->_screenRect), drawList); diff --git a/engines/sci/graphics/screen_item32.h b/engines/sci/graphics/screen_item32.h index c2c4e43358..ef29609da6 100644 --- a/engines/sci/graphics/screen_item32.h +++ b/engines/sci/graphics/screen_item32.h @@ -275,6 +275,8 @@ public: // these insertion IDs instead. They are more stable and cause // objects with identical priority and z-index to be rendered in // the order that they were created. + // + // This also applies to ScreenItem::hasPriorityAbove. return _creationId < other._creationId; } } @@ -302,6 +304,20 @@ public: return false; } + inline bool hasPriorityAbove(const ScreenItem &other) const { + if (_priority > other._priority) { + return true; + } + + if (_priority == other._priority) { + // This is different than SSCI; see ScreenItem::operator< for an + // explanation + return _creationId > other._creationId; + } + + return false; + } + /** * Calculates the dimensions and scaling parameters for * the screen item, using the given plane as the parent |