diff options
-rw-r--r-- | include/pso/TMainTask.h | 2 | ||||
-rw-r--r-- | include/pso/TObject.h | 106 | ||||
-rw-r--r-- | include/pso/macros.h | 8 | ||||
-rw-r--r-- | src/pso/TObject.cpp | 26 |
4 files changed, 71 insertions, 71 deletions
diff --git a/include/pso/TMainTask.h b/include/pso/TMainTask.h index 3a6e59b..3bcd6e5 100644 --- a/include/pso/TMainTask.h +++ b/include/pso/TMainTask.h @@ -10,7 +10,7 @@ if (flags != old_flags) { \ TMainTask *child; \ u32 bit = 1; \ - FOREACH_NODE_NODECL_MULTI_ITER(TMainTask, main_task.get_down(), child, bit <<= 1) { \ + FOREACH_NODE_NODECL_MULTI_ITER(TMainTask, main_task.down(), child, bit <<= 1) { \ if (flags & bit) { \ child->one_prefix##_##suffix(); \ } else { \ diff --git a/include/pso/TObject.h b/include/pso/TObject.h index 9af0251..e259487 100644 --- a/include/pso/TObject.h +++ b/include/pso/TObject.h @@ -45,16 +45,16 @@ static inline void operator|=(object_flags &a, object_flags b) { a = a | b; }; class TObject { private: - const char *name; + const char *m_name; union { - object_flags flags; - u16 flags_u16; + object_flags m_flags; + u16 m_flags_u16; }; - u16 id; - TObject *prev; - TObject *next; - TObject *up; - TObject *down; + u16 m_id; + TObject *m_prev; + TObject *m_next; + TObject *m_up; + TObject *m_down; public: void disallow_rendering_shadows(); void allow_rendering_shadows(); @@ -73,23 +73,23 @@ public: void *operator new (size_t size) { return alloc(size); }; void operator delete(void *ptr) { free(ptr); }; - const char *get_name() { return this->name; }; - object_flags get_flags() { return this->flags; }; - u16 get_flags_u16() { return this->flags_u16; }; - u16 get_id() { return this->id; }; - TObject *get_prev() { return this->prev; }; - TObject *get_next() { return this->next; }; - TObject *get_up() { return this->up; }; - TObject *get_down() { return this->down; }; - - void set_name(const char *name) { this->name = name; }; - void set_obj_flags(object_flags flags) { this->flags = flags; }; - void set_flags_u16(u16 flags) { flags_u16 = flags; }; - void set_id(u16 id) { this->id = id; }; - void set_prev(TObject *node) { prev = node; }; - void set_next(TObject *node) { next = node; }; - void set_up(TObject *node) { up = node; }; - void set_down(TObject *node) { down = node; }; + const char *name() { return m_name; }; + object_flags flags() { return m_flags; }; + u16 flags_u16() { return m_flags_u16; }; + u16 id() { return m_id; }; + TObject *prev() { return m_prev; }; + TObject *next() { return m_next; }; + TObject *up() { return m_up; }; + TObject *down() { return m_down; }; + + void set_name(const char *name) { m_name = name; }; + void set_obj_flags(object_flags flags) { m_flags = flags; }; + void set_flags_u16(u16 flags) { m_flags_u16 = flags; }; + void set_id(u16 id) { m_id = id; }; + void set_prev(TObject *node) { m_prev = node; }; + void set_next(TObject *node) { m_next = node; }; + void set_up(TObject *node) { m_up = node; }; + void set_down(TObject *node) { m_down = node; }; void delete_children(); void queue_destruction_for_each_node(); @@ -114,63 +114,63 @@ public: private: void _delete_children() { - while (this->down != NULL) { - delete this->down; + while (m_down != NULL) { + delete m_down; } }; void add_parent(TObject *parent, bool set_parent) { if (set_parent) { - up = parent; + m_up = parent; } TObject *child; if (parent == NULL) { - this->prev = this; - this->next = NULL; + m_prev = this; + m_next = NULL; return; } - child = parent->down; + child = parent->m_down; if (child != NULL) { - this->prev = child->next; - this->next = NULL; - child->prev->next = this; - child->prev = this; + m_prev = child->m_next; + m_next = NULL; + child->m_prev->m_next = this; + child->m_prev = this; } else { - this->prev = this; - parent->down = this; - this->next = NULL; + m_prev = this; + parent->m_down = this; + m_next = NULL; } }; void remove_parent() { - if (this->up != NULL) { - if (this->prev == this) { - this->up->down = NULL; - } else if (this->up->down == this) { - this->up->down = this->prev; - this->prev->next = NULL; - if (this->next != NULL) { - this->next->prev = this->next; + if (m_up != NULL) { + if (m_prev == this) { + m_up->m_down = NULL; + } else if (m_up->m_down == this) { + m_up->m_down = m_prev; + m_prev->m_next = NULL; + if (m_next != NULL) { + m_next->m_prev = m_next; } } else { - this->prev->next = this->next; - if (this->next != NULL) { - this->next->prev = this->prev; + m_prev->m_next = m_next; + if (m_next != NULL) { + m_next->m_prev = m_prev; } else { - this->up->down->prev = this->prev; + m_up->m_down->m_prev = m_prev; } } } }; void set_flags(object_flags flags) { - this->flags |= flags; + m_flags |= flags; } void clear_flags(object_flags flags) { - flags_u16 &= ~static_cast<u16>(flags); + m_flags_u16 &= ~static_cast<u16>(flags); } u32 get_flags(object_flags flags) { - return this->flags & flags; + return m_flags & flags; }; }; diff --git a/include/pso/macros.h b/include/pso/macros.h index 64ce214..f10c911 100644 --- a/include/pso/macros.h +++ b/include/pso/macros.h @@ -27,10 +27,10 @@ o(tl_fade, TL_FADE) \ o(tl_fadeafter, TL_FADEAFTER) -#define FOREACH_NODE(type, first, varname) for (type *varname = (type *)(first); varname != NULL; varname = (type *)(varname->get_next())) -#define FOREACH_NODE_NODECL(type, first, varname) for (varname = (type *)(first); varname != NULL; varname = (type *)(varname->get_next())) +#define FOREACH_NODE(type, first, varname) for (type *varname = (type *)(first); varname != NULL; varname = (type *)(varname->next())) +#define FOREACH_NODE_NODECL(type, first, varname) for (varname = (type *)(first); varname != NULL; varname = (type *)(varname->next())) -#define FOREACH_NODE_MULTI_ITER(type, first, varname, ...) for (type *varname = (type *)(first); varname != NULL; varname = (type *)(varname->get_next()), __VA_ARGS__) -#define FOREACH_NODE_NODECL_MULTI_ITER(type, first, varname, ...) for (varname = (type *)(first); varname != NULL; varname = (type *)(varname->get_next()), __VA_ARGS__) +#define FOREACH_NODE_MULTI_ITER(type, first, varname, ...) for (type *varname = (type *)(first); varname != NULL; varname = (type *)(varname->next()), __VA_ARGS__) +#define FOREACH_NODE_NODECL_MULTI_ITER(type, first, varname, ...) for (varname = (type *)(first); varname != NULL; varname = (type *)(varname->next()), __VA_ARGS__) #endif diff --git a/src/pso/TObject.cpp b/src/pso/TObject.cpp index 3fa37d2..9c97146 100644 --- a/src/pso/TObject.cpp +++ b/src/pso/TObject.cpp @@ -42,7 +42,7 @@ void *TObject::alloc(size_t size) { bool TObject::all_parents_unqueued_for_destruction() { - for (TObject *parent = this; parent != NULL; parent = parent->up) { + for (TObject *parent = this; parent != NULL; parent = parent->m_up) { if (parent->get_flags(QUEUE_DESTRUCTION)) { return false; } @@ -54,7 +54,7 @@ int TObject::get_node_count() { // NOTE: The order of the variable declarations matter for matching. TObject *child; int node_count = 0; - FOREACH_NODE_NODECL(TObject, this->down, child) { + FOREACH_NODE_NODECL(TObject, this->m_down, child) { node_count += child->get_node_count() + 1; } return node_count; @@ -90,7 +90,7 @@ void TObject::empty_func() { } void TObject::render_nodes2() { - FOREACH_NODE(TObject, this->down, child) { + FOREACH_NODE(TObject, this->m_down, child) { if (child->get_flags(BIT_9)) { child->render(); child->clear_flag_9(); @@ -100,7 +100,7 @@ void TObject::render_nodes2() { } void TObject::render_shadows_for_each_node() { - FOREACH_NODE(TObject, this->down, child) { + FOREACH_NODE(TObject, this->m_down, child) { if (!child->get_flags(DISALLOW_RENDER_SHADOWS)) { child->render_shadows(); child->render_shadows_for_each_node(); @@ -109,7 +109,7 @@ void TObject::render_shadows_for_each_node() { } void TObject::render_nodes() { - FOREACH_NODE(TObject, this->down, child) { + FOREACH_NODE(TObject, this->m_down, child) { if (!child->get_flags(DISALLOW_RENDER)) { child->render(); child->render_nodes(); @@ -119,10 +119,10 @@ void TObject::render_nodes() { // Perfect match, needed to do some weird stuff to get it to match, see below. void TObject::run_tasks() { - TObject *child = this->down; - while (this->down != NULL && child != NULL) { + TObject *child = this->m_down; + while (this->m_down != NULL && child != NULL) { TObject *node = child; - child = child->next; + child = child->m_next; if (node->get_flags(DISALLOW_UPDATE)) { // Clearing flag 0 in the if statement is required to match. if (node->get_flags(QUEUE_DESTRUCTION) && (node->clear_flags(QUEUE_DESTRUCTION), !node->get_flags(DISALLOW_DESTRUCTION))) { @@ -149,7 +149,7 @@ void TObject::run_tasks() { } void TObject::queue_destruction_for_each_node() { - FOREACH_NODE(TObject, this->down, child) { + FOREACH_NODE(TObject, this->m_down, child) { child->queue_destruction(); child->queue_destruction_for_each_node(); } @@ -168,9 +168,9 @@ TObject::~TObject() { } TObject::TObject(TObject *parent) { - flags = NONE; - up = parent; - down = NULL; - name = TObject_name; + m_flags = NONE; + m_up = parent; + m_down = NULL; + m_name = TObject_name; add_parent(parent, false); } |