summaryrefslogtreecommitdiff
path: root/include/pso
diff options
context:
space:
mode:
Diffstat (limited to 'include/pso')
-rw-r--r--include/pso/TObject.h42
1 files changed, 37 insertions, 5 deletions
diff --git a/include/pso/TObject.h b/include/pso/TObject.h
index 4db9ae9..0ea2ec4 100644
--- a/include/pso/TObject.h
+++ b/include/pso/TObject.h
@@ -13,10 +13,41 @@ extern TMainTask main_task;
extern TObject global_obj1;
extern TObject global_obj2;
+
+enum object_flags {
+ NONE = 0,
+ QUEUE_DESTRUCTION = 1,
+ CHILD_QUEUE_DESTRUCTION = 2,
+ BIT_2 = 4,
+ BIT_3 = 8,
+ DISALLOW_UPDATE = 0x0F,
+ DISALLOW_RENDER = 0x10,
+ DISALLOW_DESTRUCTION = 0x20,
+ BIT_8 = 0x100,
+ BIT_9 = 0x200,
+ BIT_10 = 0x400,
+ BIT_11 = 0x800,
+ BIT_12 = 0x1000,
+ BIT_13 = 0x2000,
+ BIT_14 = 0x4000,
+ BIT_15 = 0x8000,
+ ALL_BITS = 0xFFFF
+};
+static inline object_flags operator^(object_flags a, object_flags b) { return static_cast<object_flags>(static_cast<u16>(a) ^ static_cast<u16>(b)); };
+static inline object_flags operator&(object_flags a, object_flags b) { return static_cast<object_flags>(static_cast<u16>(a) & static_cast<u16>(b)); };
+static inline object_flags operator|(object_flags a, object_flags b) { return static_cast<object_flags>(static_cast<u16>(a) | static_cast<u16>(b)); };
+static inline object_flags operator~(object_flags a) { return static_cast<object_flags>(~static_cast<u16>(a)); }
+static inline void operator^=(object_flags &a, object_flags b) { a = a ^ b; };
+static inline void operator&=(object_flags &a, object_flags b) { a = a & b; };
+static inline void operator|=(object_flags &a, object_flags b) { a = a | b; };
+
class TObject {
public:
const char *name;
- u16 flags;
+ union {
+ object_flags flags;
+ u16 flags_u16;
+ };
u16 id;
TObject *prev;
TObject *next;
@@ -108,16 +139,17 @@ private:
}
};
- void set_flags(u16 flags) {
+ void set_flags(object_flags flags) {
this->flags |= flags;
}
- void clear_flags(u16 flags) {
- this->flags &= ~flags;
+ void clear_flags(object_flags flags) {
+ flags_u16 &= ~static_cast<u16>(flags);
}
- u32 get_flags(u16 flags) {
+ u32 get_flags(object_flags flags) {
return this->flags & flags;
};
};
+
#endif