aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorColin Snover2017-10-02 21:32:03 -0500
committerColin Snover2017-10-02 21:35:21 -0500
commit8985f8f447a04d2a46b509fdf225cd87c00c9ba9 (patch)
treedf9cbba1d5ad5fbb3b87d166d7269ab31bd521d5 /engines/sci
parent2c79c257a3b0b8a5aa9d3b4a508ec4784e3e3da9 (diff)
downloadscummvm-rg350-8985f8f447a04d2a46b509fdf225cd87c00c9ba9.tar.gz
scummvm-rg350-8985f8f447a04d2a46b509fdf225cd87c00c9ba9.tar.bz2
scummvm-rg350-8985f8f447a04d2a46b509fdf225cd87c00c9ba9.zip
SCI32: Always sort kernel-generated screen items above script-generated screen items in last-ditch sort
Fixes Trac#10257. Fixes Trac#10261.
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/graphics/screen_item32.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/engines/sci/graphics/screen_item32.h b/engines/sci/graphics/screen_item32.h
index ef29609da6..cdde2d3965 100644
--- a/engines/sci/graphics/screen_item32.h
+++ b/engines/sci/graphics/screen_item32.h
@@ -256,6 +256,16 @@ public:
}
if (_position.y + _z == other._position.y + other._z) {
+ // Synthetic object IDs (numeric IDs) are used for screen items
+ // generated by the kernel, like the screen items generated by
+ // plane pics. In SSCI, these synthetic IDs started at 20000 so
+ // would deterministically always sort higher than any
+ // script-generated view in SSCI at the same position and
+ // priority.
+ if (other._object.isNumber() && !_object.isNumber()) {
+ return true;
+ }
+
// SSCI's last resort comparison here is to compare the _object
// IDs, but this is wrong and randomly breaks (at least):
//
@@ -295,6 +305,10 @@ public:
}
if (_position.y + _z == other._position.y + other._z) {
+ if (_object.isNumber() && !other._object.isNumber()) {
+ return true;
+ }
+
// This is different than SSCI; see ScreenItem::operator< for an
// explanation
return _creationId > other._creationId;
@@ -310,6 +324,10 @@ public:
}
if (_priority == other._priority) {
+ if (_object.isNumber() && !other._object.isNumber()) {
+ return true;
+ }
+
// This is different than SSCI; see ScreenItem::operator< for an
// explanation
return _creationId > other._creationId;