aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/screen_item32.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/graphics/screen_item32.h')
-rw-r--r--engines/sci/graphics/screen_item32.h26
1 files changed, 21 insertions, 5 deletions
diff --git a/engines/sci/graphics/screen_item32.h b/engines/sci/graphics/screen_item32.h
index eef2f488a5..2e44e418ce 100644
--- a/engines/sci/graphics/screen_item32.h
+++ b/engines/sci/graphics/screen_item32.h
@@ -236,6 +236,24 @@ public:
return false;
}
+ inline bool operator>(const ScreenItem &other) const {
+ if (_priority > other._priority) {
+ return true;
+ }
+
+ if (_priority == other._priority) {
+ if (_position.y + _z > other._position.y + other._z) {
+ return true;
+ }
+
+ if (_position.y + _z == other._position.y + other._z) {
+ return _object > other._object;
+ }
+ }
+
+ return false;
+ }
+
/**
* Calculates the dimensions and scaling parameters for
* the screen item, using the given plane as the parent
@@ -279,12 +297,10 @@ public:
typedef StablePointerArray<ScreenItem, 250> ScreenItemListBase;
class ScreenItemList : public ScreenItemListBase {
- inline static bool sortHelper(const ScreenItem *a, const ScreenItem *b) {
- return *a < *b;
- }
-public:
- ScreenItem *_unsorted[250];
+private:
+ size_type _unsorted[250];
+public:
ScreenItem *findByObject(const reg_t object) const;
void sort();
void unsort();