aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/plane32.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/graphics/plane32.h')
-rw-r--r--engines/sci/graphics/plane32.h58
1 files changed, 29 insertions, 29 deletions
diff --git a/engines/sci/graphics/plane32.h b/engines/sci/graphics/plane32.h
index be6f71464a..d844919c9e 100644
--- a/engines/sci/graphics/plane32.h
+++ b/engines/sci/graphics/plane32.h
@@ -133,7 +133,7 @@ private:
* synchronised to another plane (which calls
* changePic).
*/
- bool _pictureChanged; // ?
+ bool _pictureChanged;
// TODO: Are these ever actually used?
int _field_34, _field_38; // probably a point or ratio
@@ -241,30 +241,28 @@ public:
*/
static void init();
- Plane(const Common::Rect &gameRect);
+ // NOTE: This constructor signature originally did not accept a
+ // picture ID, but some calls to construct planes with this signature
+ // immediately set the picture ID and then called setType again, so
+ // it made more sense to just make the picture ID a parameter instead.
+ Plane(const Common::Rect &gameRect, PlanePictureCodes pictureId = kPlanePicColored);
+
Plane(const reg_t object);
+
Plane(const Plane &other);
+
void operator=(const Plane &other);
+
inline bool operator<(const Plane &other) const {
- // TODO: In SCI engine, _object is actually a uint16 and can either
- // contain a MemID (a handle to MemoryMgr, similar to reg_t) or
- // a serial (Plane::_nextObjectId). These numbers can be compared
- // directly in the real engine and the lowest MemID wins, but in
- // ScummVM reg_t pointers are not comparable so we have to use a
- // different strategy when two planes generated by scripts conflict.
- // For now we just don't check if the priority is below 0, since
- // that priority is used to represent hidden planes and is guaranteed
- // to generate conflicts with script-generated planes. If there are
- // other future conflicts with script-generated planes then we need
- // to come up with a solution that works, similar to
- // reg_t::pointerComparisonWithInteger used by SCI16.
- //
- // For now, we check the object offsets, as this will likely work
- // like in the original SCI engine, without comparing objects.
- // 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) {
+ return _object < other._object;
+ }
+
+ return false;
}
/**
@@ -318,12 +316,6 @@ private:
inline void addPicInternal(const GuiResourceId pictureId, const Common::Point *position, const bool mirrorX);
/**
- * If the plane is a picture plane, re-adds all cels
- * from its picture resource to the plane.
- */
- void changePic();
-
- /**
* Marks all screen items to be deleted that are within
* this plane and match the given picture ID.
*/
@@ -352,6 +344,13 @@ public:
*/
void addPic(const GuiResourceId pictureId, const Common::Point &position, const bool mirrorX);
+ /**
+ * If the plane is a picture plane, re-adds all cels
+ * from its picture resource to the plane. Otherwise,
+ * just clears the _pictureChanged flag.
+ */
+ void changePic();
+
#pragma mark -
#pragma mark Plane - Rendering
private:
@@ -459,13 +458,14 @@ public:
void add(Plane *plane);
void clear();
- using PlaneListBase::erase;
+ iterator erase(iterator it);
void erase(Plane *plane);
inline void sort() {
Common::sort(begin(), end(), sortHelper);
}
+ void remove_at(size_type index);
};
-}
+} // End of namespace Sci
#endif