NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
ef_activitylist.h
1#ifndef NW4R_EF_ACTIVITY_LIST_H
2#define NW4R_EF_ACTIVITY_LIST_H
3#include <nw4r/types_nw4r.h>
4
5#include <nw4r/ut.h>
6
7namespace nw4r {
8namespace ef {
9
10inline u16 UtlistSize(const ut::List* pList) {
11 return pList->numObjects;
12}
13
14class ActivityList {
15public:
16 ut::List mActiveList; // at 0x0
17 ut::List mClosingList; // at 0xC
18 u16 mNumActive; // at 0x18
19
20public:
21 ActivityList() {
22 SetOffset(0);
23 }
24
25 explicit ActivityList(u16 offset) {
26 SetOffset(offset);
27 }
28
29 void SetOffset(u16 offset) {
30 ut::List_Init(&mActiveList, offset);
31 ut::List_Init(&mClosingList, offset);
32 mNumActive = 0;
33 }
34
35 void Initialize() {
36 mActiveList.headObject = NULL;
37 mActiveList.numObjects = 0;
38 mActiveList.tailObject = NULL;
39
40 mClosingList.headObject = NULL;
41 mClosingList.numObjects = 0;
42 mClosingList.tailObject = NULL;
43
44 mNumActive = 0;
45 }
46
47 ulong GetNumActive() const {
48 return mActiveList.numObjects;
49 }
50
51 void ToActive(void* pObject) {
52 ut::List_Append(&mActiveList, pObject);
53 mNumActive++;
54 }
55
56 void ToClosing(void* pObject) {
57 ut::List_Remove(&mActiveList, pObject);
58 ut::List_Append(&mClosingList, pObject);
59 }
60
61 void ToWait(void* /* pObject */) {
62 mNumActive--;
63 }
64
65 void ToFree(void* pObject) {
66 ut::List_Remove(&mClosingList, pObject);
67 }
68};
69
70} // namespace ef
71} // namespace nw4r
72
73#endif