aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/graphics/plane32.cpp15
-rw-r--r--engines/sci/graphics/plane32.h14
-rw-r--r--engines/sci/graphics/screen_item32.h11
3 files changed, 35 insertions, 5 deletions
diff --git a/engines/sci/graphics/plane32.cpp b/engines/sci/graphics/plane32.cpp
index 7d1487bd7c..0a0b0ad561 100644
--- a/engines/sci/graphics/plane32.cpp
+++ b/engines/sci/graphics/plane32.cpp
@@ -447,7 +447,20 @@ void Plane::calcLists(Plane &visiblePlane, const PlaneList &planeList, DrawList
if (j < _screenItemList.size() && sli) {
if (!sli->_updated && !sli->_deleted && !sli->_created) {
ScreenItem *item = dli->screenItem;
- if (sli->_priority > item->_priority /* TODO: || (sli->_priority == item->_priority && sli->_object > item->_object)*/) {
+
+ bool isAbove = false;
+ if (sli->_priority > item->_priority) {
+ isAbove = true;
+ }
+ else if (sli->_priority == item->_priority) {
+ if (sli->_object.isNumber() && item->_object.isNumber()) {
+ isAbove = sli->_object > item->_object;
+ } else if (sli->_object.isNumber()) {
+ isAbove = true;
+ }
+ }
+
+ if (isAbove) {
if (dli->rect.intersects(sli->_screenRect)) {
drawList.add(sli, dli->rect.findIntersectingRect(sli->_screenRect));
}
diff --git a/engines/sci/graphics/plane32.h b/engines/sci/graphics/plane32.h
index 65df19d924..c9b9d6a099 100644
--- a/engines/sci/graphics/plane32.h
+++ b/engines/sci/graphics/plane32.h
@@ -272,7 +272,19 @@ public:
// However, this whole comparison is quite ugly, and if it still
// fails, we should try to change it to something equivalent, to avoid
// adding loads of workarounds just for this
- return _priority < other._priority || (_priority == other._priority && _priority > -1 && _object.getOffset() < other._object.getOffset());
+ if (_priority < other._priority) {
+ return true;
+ }
+
+ if (_priority == other._priority) {
+ if (_object.isNumber() && other._object.isNumber()) {
+ return _object < other._object;
+ } else if (other._object.isNumber()) {
+ return true;
+ }
+ }
+
+ return false;
}
/**
diff --git a/engines/sci/graphics/screen_item32.h b/engines/sci/graphics/screen_item32.h
index e054cf32f3..1c4d87d24c 100644
--- a/engines/sci/graphics/screen_item32.h
+++ b/engines/sci/graphics/screen_item32.h
@@ -228,9 +228,14 @@ public:
}
if (_position.y + _z == other._position.y + other._z) {
- return false;
- // TODO: Failure in SQ6 room 220
-// return _object < other._object;
+ // TODO: Failure in SQ6 room 220 when using SCI logic
+ // to compare pointer and numeric memory handles
+
+ if (_object.isNumber() && other._object.isNumber()) {
+ return _object < other._object;
+ } else if (other._object.isNumber()) {
+ return true;
+ }
}
}