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 <game/framework/f_helper_unk.hpp>
7#include <game/framework/f_manager.hpp>
8#include <game/framework/f_list_mg.hpp>
9
119class fBase_c {
120public:
121
128
135
143
150
153 ROOT_DISABLE_EXECUTE = BIT_FLAG(0),
154 DISABLE_EXECUTE = BIT_FLAG(1),
155 ROOT_DISABLE_DRAW = BIT_FLAG(2),
156 DISABLE_DRAW = BIT_FLAG(3)
157 };
158
163 u32 mParam;
165
166protected:
168
172
177
182
185
187 bool isProcControlFlag(u8 flag) const { return (mProcControl & flag) != 0; }
189 void setProcControlFlag(u8 flag) { mProcControl |= flag; }
191 void clearProcControlFlag(u8 flag) { mProcControl &= ~flag; }
192
194
197
198 // [No p because of the string "fBase_c::mHeap"]
200
201public:
202 fBase_c();
203
207 static void *operator new(size_t);
208 static void operator delete(void *);
209
210protected:
213 virtual int create();
214
217 virtual int preCreate();
218
220 virtual void postCreate(MAIN_STATE_e state);
221
225 virtual int doDelete();
226
229 virtual int preDelete();
230
232 virtual void postDelete(MAIN_STATE_e state);
233
236 virtual int execute();
237
240 virtual int preExecute();
241
243 virtual void postExecute(MAIN_STATE_e state);
244
247 virtual int draw();
248
251 virtual int preDraw();
252
254 virtual void postDraw(MAIN_STATE_e state);
255
257 virtual void deleteReady();
258
267 virtual bool entryFrmHeap(unsigned long size, EGG::Heap *parentHeap);
268
277 virtual bool entryFrmHeapNonAdjust(unsigned long size, EGG::Heap *parentHeap);
278 virtual bool createHeap();
279
280 virtual ~fBase_c();
281
282public:
285 void deleteRequest();
286
287 fBase_c *getConnectParent() const;
288 fBase_c *getConnectChild() const;
289 fBase_c *getConnectBrNext() const;
290
293 bool checkChildProcessCreateState() const;
294
295private:
296 int createPack();
297 int deletePack();
298 int executePack();
299 int drawPack();
300
309 int commonPack(int (fBase_c::*doFunc)(), int (fBase_c::*preFunc)(), void (fBase_c::*postFunc)(MAIN_STATE_e));
310
320 int connectProc();
321
323 void runCreate();
324
328
329public:
339 static fBase_c *createChild(ProfileName profName, fBase_c *parent, unsigned long param, u8 groupType);
340
349 static fBase_c *createRoot(ProfileName profName, unsigned long param, u8 groupType);
350
351private:
360 static void setTmpCtData(ProfileName profName, fTrNdBa_c *connectParent, unsigned long param, u8 groupType);
361
371 static fBase_c *fBase_make(ProfileName profName, fTrNdBa_c *connectParent, unsigned long param, u8 groupType);
372
373protected:
374 static int (*sLoadAsyncCallback)();
375 static void (*sUnloadCallback)();
376
377private:
379 static u32 m_tmpCtParam;
383
384 friend class fManager_c;
385 friend class fLiNdBa_c;
386 friend class fTrMgBa_c;
387};
[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:119
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:183
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:137
@ ERROR
The operation could not be completed.
Definition f_base.hpp:139
@ SUCCESS
The operation was completed successfully.
Definition f_base.hpp:140
@ CANCELED
The operation was canceled early.
Definition f_base.hpp:138
@ WAITING
The operation is waiting for something and cannot be completed yet.
Definition f_base.hpp:141
static ProfileName m_tmpCtProfName
Temporary storage for the next constructed base's profile name. See mProfName.
Definition f_base.hpp:380
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:374
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:196
bool mDeferExecute
If the create operation was completed, but scheduling the execute and draw operations isn't possible ...
Definition f_base.hpp:176
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:378
EGG::FrmHeap * mHeap
[Unused]. The base's dedicated heap.
Definition f_base.hpp:199
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
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:130
@ SCENE
The base is a scene.
Definition f_base.hpp:132
@ OTHER
The base is a generic process.
Definition f_base.hpp:131
@ ACTOR
The base is an actor.
Definition f_base.hpp:133
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:193
static u8 m_tmpCtGroupType
Temporary storage for the next constructed base's group type. See mGroupType.
Definition f_base.hpp:381
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:379
ProfileName mProfName
The base's profile name.
Definition f_base.hpp:164
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:181
fBaHelper_c * mpUnusedHelper
[Unused]. See Unused Content.
Definition f_base.hpp:195
LIFECYCLE_e
The possible lifecycle states.
Definition f_base.hpp:123
@ CREATING
The base's create operation has yet to conclude.
Definition f_base.hpp:124
@ DELETING
The base's delete operation is about to run.
Definition f_base.hpp:126
@ ACTIVE
The base is in the main execution cycle.
Definition f_base.hpp:125
u32 mParam
A bitfield that configures the base's behaviour. Its usage varies from profile to profile.
Definition f_base.hpp:163
bool mDeleteRequested
If deletion of the base was requested, but the delete operation has not been scheduled yet.
Definition f_base.hpp:171
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:191
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:189
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:152
@ DISABLE_DRAW
Drawing is disabled.
Definition f_base.hpp:156
@ ROOT_DISABLE_EXECUTE
Execution is disabled, and this is a root base.
Definition f_base.hpp:153
@ DISABLE_EXECUTE
Execution is disabled.
Definition f_base.hpp:154
@ ROOT_DISABLE_DRAW
Drawing is disabled, and this is a root base.
Definition f_base.hpp:155
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:167
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:145
@ NOT_READY
The step could not completed at this time.
Definition f_base.hpp:146
@ SUCCEEDED
The step was completed successfully.
Definition f_base.hpp:147
@ FAILED
The step could not be completed.
Definition f_base.hpp:148
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:184
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:382
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:375
fBaseID_e mUniqueID
The base's unique identifier.
Definition f_base.hpp:162
bool isProcControlFlag(u8 flag) const
Checks if a flag is set in mProcControl.
Definition f_base.hpp:187
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:70
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