From 7543bd444d46b2a8d4a2c79967c0a8d45a0874d1 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Thu, 13 Jul 2017 17:03:34 -0500 Subject: SCI32: Move priority comparison of ScreenItems into its own function Rendering bugs in ScummVM are often caused by buggy game scripts relying on the last ditch sort, which is not the same in ScummVM as in SSCI (since the SSCI last ditch sort relies on a different memory architecture and is super buggy). However, these bugs do not show up very frequently these days, so it is easy to forget all the places that need to be checked when debugging a rendering problem that appears to be caused by sorting failure. This commit breaks out the last ditch comparison formerly in Plane::calcLists to hopefully make it more visible to future programmers. Refs Trac#9957. --- engines/sci/graphics/plane32.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'engines/sci/graphics/plane32.cpp') 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); -- cgit v1.2.3