aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/plane32.h
diff options
context:
space:
mode:
authorColin Snover2016-12-18 22:47:57 -0600
committerColin Snover2016-12-19 14:46:58 -0600
commitba619a08dd5a2076c361155690736043f01b4703 (patch)
tree76e8bc802662ea2eee1d972d90585362c86635dc /engines/sci/graphics/plane32.h
parent6412b323860e9eb351efd46c57ea65ebd56b2823 (diff)
downloadscummvm-rg350-ba619a08dd5a2076c361155690736043f01b4703.tar.gz
scummvm-rg350-ba619a08dd5a2076c361155690736043f01b4703.tar.bz2
scummvm-rg350-ba619a08dd5a2076c361155690736043f01b4703.zip
SCI32: Change plane and screen item sorting algorithm
SSCI's last resort comparison here was to compare the object IDs of planes & screen items, but this randomly breaks (at least) the "you have died" dialog at the end of Phant1, and text & buttons in Hoyle5, even in SSCI itself. This commit changes last resort comparison to use a monotonically increasing ID instead, which keeps objects with identical priority & z-index in creation order when compared. Fixes Trac#9585.
Diffstat (limited to 'engines/sci/graphics/plane32.h')
-rw-r--r--engines/sci/graphics/plane32.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/engines/sci/graphics/plane32.h b/engines/sci/graphics/plane32.h
index 964d20ca12..a34df1cc1a 100644
--- a/engines/sci/graphics/plane32.h
+++ b/engines/sci/graphics/plane32.h
@@ -110,6 +110,20 @@ private:
static uint16 _nextObjectId;
/**
+ * A serial used to identify the creation order of
+ * planes, to ensure a stable sort order for planes
+ * with identical priorities.
+ */
+ static uint32 _nextCreationId;
+
+ /**
+ * The creation order number, which ensures a stable
+ * sort when planes with identical priorities are added
+ * to the plane list.
+ */
+ uint32 _creationId;
+
+ /**
* For planes that are used to render picture data, the
* resource ID of the picture to be displayed. This
* value may also be one of the special
@@ -261,7 +275,9 @@ public:
}
if (_priority == other._priority) {
- return _object < other._object;
+ // This is different than SSCI; see ScreenItem::operator< for an
+ // explanation
+ return _creationId < other._creationId;
}
return false;