NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
f_base.hpp
1#pragma once
2#include <types.h>
3#include <lib/egg/heap/eggFrmHeap.hpp>
6#include <dol/framework/f_helper_unk.hpp>
7#include <dol/framework/f_manager.hpp>
8#include <dol/framework/f_list_mg.hpp>
9
117class fBase_c {
118public:
119
125 };
126
131 ACTOR
132 };
133
139 WAITING
140 };
141
147 };
148
154 DISABLE_DRAW = 8
155 };
156
161 u32 mParam;
163
164protected:
166
170
175
180
183
185 bool isProcControlFlag(u8 flag) const { return (mProcControl & flag) != 0; }
187 void setProcControlFlag(u8 flag) { mProcControl |= flag; }
189 void clearProcControlFlag(u8 flag) { mProcControl &= ~flag; }
190
192
195
197
198public:
199 fBase_c();
200
204 static void *operator new(size_t);
205 static void operator delete(void *);
206
207protected:
210 virtual int create();
211
214 virtual int preCreate();
215
217 virtual void postCreate(MAIN_STATE_e state);
218
222 virtual int doDelete();
223
226 virtual int preDelete();
227
229 virtual void postDelete(MAIN_STATE_e state);
230
233 virtual int execute();
234
237 virtual int preExecute();
238
240 virtual void postExecute(MAIN_STATE_e state);
241
244 virtual int draw();
245
248 virtual int preDraw();
249
251 virtual void postDraw(MAIN_STATE_e state);
252
254 virtual void deleteReady();
255
264 virtual bool entryFrmHeap(unsigned long size, EGG::Heap *parentHeap);
265
274 virtual bool entryFrmHeapNonAdjust(unsigned long size, EGG::Heap *parentHeap);
275 virtual bool createHeap();
276
277 virtual ~fBase_c();
278
279public:
282 void deleteRequest();
283
284 fBase_c *getConnectParent() const;
285 fBase_c *getConnectChild() const;
286 fBase_c *getConnectBrNext() const;
287
290 bool checkChildProcessCreateState() const;
291
292private:
293 int createPack();
294 int deletePack();
295 int executePack();
296 int drawPack();
297
306 int commonPack(int (fBase_c::*doFunc)(), int (fBase_c::*preFunc)(), void (fBase_c::*postFunc)(MAIN_STATE_e));
307
317 int connectProc();
318
320 void runCreate();
321
325
326public:
336 static fBase_c *createChild(ProfileName profName, fBase_c *parent, unsigned long param, u8 groupType);
337
346 static fBase_c *createRoot(ProfileName profName, unsigned long param, u8 groupType);
347
348private:
357 static void setTmpCtData(ProfileName profName, fTrNdBa_c *connectParent, unsigned long param, u8 groupType);
358
368 static fBase_c *fBase_make(ProfileName profName, fTrNdBa_c *connectParent, unsigned long param, u8 groupType);
369
370protected:
371 static int (*sLoadAsyncCallback)();
372 static void (*sUnloadCallback)();
373
374private:
376 static u32 m_tmpCtParam;
380
381 friend class fManager_c;
382 friend class fLiNdBa_c;
383 friend class fTrMgBa_c;
384};
[Unused]. [A helper class for fBase_c with unknown purpose].
The base class for all scenes, actors and various other processes.
Definition f_base.hpp:117
int commonPack(int(fBase_c::*doFunc)(), int(fBase_c::*preFunc)(), void(fBase_c::*postFunc)(MAIN_STATE_e))
Executes an operation. See here for more details.
Definition f_base.cpp:66
u8 mGroupType
The base's group type. Value is a GROUP_TYPE_e.
Definition f_base.hpp:181
fBase_c * getChildProcessCreateState() const
Gets a child of the base in the CREATING state.
Definition f_base.cpp:465
MAIN_STATE_e
The possible operation results.
Definition f_base.hpp:135
@ ERROR
The operation could not be completed.
Definition f_base.hpp:137
@ SUCCESS
The operation was completed successfully.
Definition f_base.hpp:138
@ CANCELED
The operation was canceled early.
Definition f_base.hpp:136
@ WAITING
The operation is waiting for something and cannot be completed yet.
Definition f_base.hpp:139
static ProfileName m_tmpCtProfName
Temporary storage for the next constructed base's profile name. See mProfName.
Definition f_base.hpp:377
virtual int preCreate()
pre method for the create operation.
Definition f_base.cpp:92
static int(* sLoadAsyncCallback)()
[Unused]. See Unused Content.
Definition f_base.hpp:371
virtual int draw()
do method for the draw operation.
Definition f_base.cpp:188
virtual int preDelete()
pre method for the delete operation.
Definition f_base.cpp:126
fLiMgBa_c mUnusedList
[Unused]. See Unused Content.
Definition f_base.hpp:194
bool mDeferExecute
If the create operation was completed, but scheduling the execute and draw operations isn't possible ...
Definition f_base.hpp:174
static fBase_c * createChild(ProfileName profName, fBase_c *parent, unsigned long param, u8 groupType)
Creates a child base under the given parent.
Definition f_base.cpp:511
static fBaseID_e m_rootUniqueID
Unique ID counter for base construction. See mUniqueID.
Definition f_base.hpp:375
int createPack()
Executes the create operation. See commonPack.
Definition f_base.cpp:122
void runCreate()
Kickstarts the base's lifecycle by running the create operation.
Definition f_base.cpp:450
EGG::FrmHeap * mpHeap
[Unused]. The base's dedicated heap.
Definition f_base.hpp:196
virtual ~fBase_c()
Destroys the base.
Definition f_base.cpp:57
fBase_c * getConnectChild() const
Gets the base's first child.
Definition f_base.cpp:310
fBase_c * getConnectBrNext() const
Gets the base's next sibling.
Definition f_base.cpp:317
void deleteRequest()
Requests deletion of the base.
Definition f_base.cpp:289
int connectProc()
Executes the connect operation.
Definition f_base.cpp:212
virtual int create()
do method for the create operation.
Definition f_base.cpp:88
static fBase_c * fBase_make(ProfileName profName, fTrNdBa_c *connectParent, unsigned long param, u8 groupType)
Internal function for base construction.
Definition f_base.cpp:490
GROUP_TYPE_e
The possible group types.
Definition f_base.hpp:128
@ SCENE
The base is a scene.
Definition f_base.hpp:130
@ OTHER
The base is a generic process.
Definition f_base.hpp:129
@ ACTOR
The base is an actor.
Definition f_base.hpp:131
virtual int preExecute()
pre method for the execute operation.
Definition f_base.cpp:172
fManager_c mMng
The base's process manager.
Definition f_base.hpp:191
static u8 m_tmpCtGroupType
Temporary storage for the next constructed base's group type. See mGroupType.
Definition f_base.hpp:378
virtual bool entryFrmHeap(unsigned long size, EGG::Heap *parentHeap)
[Unused]. Creates a heap of the given size for the base.
Definition f_base.cpp:324
virtual bool createHeap()
[Unused]. [Does nothing].
Definition f_base.cpp:434
virtual void postCreate(MAIN_STATE_e state)
post method for the create operation.
Definition f_base.cpp:96
static u32 m_tmpCtParam
Temporary storage for the next constructed base's params. See mParam.
Definition f_base.hpp:376
ProfileName mProfName
The base's profile name.
Definition f_base.hpp:162
bool checkChildProcessCreateState() const
Checks if the base has at least one child in the CREATING state.
Definition f_base.cpp:479
bool mDeferRetryCreate
If the create operation has not been completed, and rescheduling it isn't possible at this time.
Definition f_base.hpp:179
fBaHelper_c * mpUnusedHelper
[Unused]. See Unused Content.
Definition f_base.hpp:193
LIFECYCLE_e
The possible lifecycle states.
Definition f_base.hpp:121
@ CREATING
The base's create operation has yet to conclude.
Definition f_base.hpp:122
@ DELETING
The base's delete operation is about to run.
Definition f_base.hpp:124
@ ACTIVE
The base is in the main execution cycle.
Definition f_base.hpp:123
u32 mParam
A bitfield that configures the base's behaviour. [Represents nybbles 5 to 12 of Reggie's spritedata].
Definition f_base.hpp:161
bool mDeleteRequested
If deletion of the base was requested, but the corresponding operation has not been scheduled yet.
Definition f_base.hpp:169
virtual void postExecute(MAIN_STATE_e state)
post method for the execute operation.
Definition f_base.cpp:180
virtual int preDraw()
pre method for the draw operation.
Definition f_base.cpp:192
void clearProcControlFlag(u8 flag)
Clears a flag in mProcControl.
Definition f_base.hpp:189
int deletePack()
Executes the delete operation. See commonPack.
Definition f_base.cpp:164
virtual int execute()
do method for the execute operation.
Definition f_base.cpp:168
void setProcControlFlag(u8 flag)
Sets a flag in mProcControl.
Definition f_base.hpp:187
int executePack()
Executes the execute operation. See commonPack.
Definition f_base.cpp:184
static fBase_c * createRoot(ProfileName profName, unsigned long param, u8 groupType)
Creates a root base.
Definition f_base.cpp:518
PROC_DISABLE_e
Controls if the execute and draw operations should be skipped.
Definition f_base.hpp:150
@ DISABLE_DRAW
Drawing is disabled.
Definition f_base.hpp:154
@ ROOT_DISABLE_EXECUTE
Execution is disabled, and this is a root base.
Definition f_base.hpp:151
@ DISABLE_EXECUTE
Execution is disabled.
Definition f_base.hpp:152
@ ROOT_DISABLE_DRAW
Drawing is disabled, and this is a root base.
Definition f_base.hpp:153
virtual bool entryFrmHeapNonAdjust(unsigned long size, EGG::Heap *parentHeap)
[Unused]. Creates a heap of the given size for the base.
Definition f_base.cpp:408
u8 mLifecycleState
The base's lifecycle state. Value is a LIFECYCLE_e.
Definition f_base.hpp:165
virtual void postDraw(MAIN_STATE_e state)
post method for the draw operation.
Definition f_base.cpp:200
virtual void postDelete(MAIN_STATE_e state)
post method for the delete operation.
Definition f_base.cpp:142
fBase_c * getConnectParent() const
Gets the base's parent.
Definition f_base.cpp:303
PACK_RESULT_e
The possible operation step results.
Definition f_base.hpp:143
@ NOT_READY
The step could not completed at this time.
Definition f_base.hpp:144
@ SUCCEEDED
The step was completed successfully.
Definition f_base.hpp:145
@ FAILED
The step could not be completed.
Definition f_base.hpp:146
int drawPack()
Executes the draw operation. See commonPack.
Definition f_base.cpp:204
u8 mProcControl
The operations to be skipped. Value is a PROC_DISABLE_e.
Definition f_base.hpp:182
static void setTmpCtData(ProfileName profName, fTrNdBa_c *connectParent, unsigned long param, u8 groupType)
Sets temporary data to be used for the next base's construction.
Definition f_base.cpp:483
virtual void deleteReady()
Informs the base that it's about to be deleted.
Definition f_base.cpp:208
static fTrNdBa_c * m_tmpCtConnectParent
Temporary storage for the next constructed base's parent connect node.
Definition f_base.hpp:379
virtual int doDelete()
do method for the delete operation.
Definition f_base.cpp:118
static void(* sUnloadCallback)()
[Unused]. See Unused Content.
Definition f_base.hpp:372
fBaseID_e mUniqueID
The base's unique identifier.
Definition f_base.hpp:160
bool isProcControlFlag(u8 flag) const
Checks if a flag is set in mProcControl.
Definition f_base.hpp:185
fBase_c()
Constructs a new base.
Definition f_base.cpp:15
A base list, made of fLiNdBa_c nodes.
Definition f_list_mg.hpp:13
A base list node.
Definition f_list_nd.hpp:11
Manages the execution of base operations.
Definition f_manager.hpp:68
A base tree, made of fTrNdBa_c nodes.
Definition f_tree_mg.hpp:11
A base tree node.
Definition f_tree_nd.hpp:12
fBaseID_e
A unique identifier for each base.
Definition f_base_id.hpp:6
u16 ProfileName
The name of a profile. Value is a fProfile::PROFILE_NAME_e.
Definition f_profile.hpp:32