summaryrefslogtreecommitdiff
path: root/include/pso
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-02-08 13:13:04 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-02-08 13:13:04 -0400
commit21778cb0c7a64e0712bbfcadb5993965f70d4b49 (patch)
treee237800f4e87d73bef0307b3dd017b54e4dddf5c /include/pso
parentf251a13351647a754431fb049ca8046f2a4df868 (diff)
TObject: Add, and make use of `enum object_flags`
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