NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
dBase_c Class Reference

#include <game/bases/d_base.hpp>

Inheritance diagram for dBase_c:
[legend]

Description

The minimum required implementation for a base.

Overview

From a technical standpoint, dBase_c does not add any particularly relevant components, which is useful for bases that don't need any additional functionality. A few overloaded functions from the fManager_c search API (searchBaseByProfName) and the fBase_c base creation API (createBase, createRoot) are provided for convenience.

Unused Content

Base Linking

The inherited owner set can be used by bases to link themselves to a specific base (called the owner base) anywhere in the connect tree, avoiding the parent/child relationship requirement. The owner base can then iterate through the set and interact with the linked bases. When the owner base is deleted, all the linked bases are unlinked automatically.

Several bases use this method to link themselves to dBgGm_c, which however does not use the set at all, leaving the feature unused.

Debug Strings

Bases store a pointer to a kind string (which roughly describes the group type) and to a profile name string. The former can be obtained by calling getKindString, while the latter can be obtained by calling dProf_getName with the profile name.

The preExecute function gets the kind string every frame and discards the result immediately.

Random Seed

The global variable g_basesRandomSeed stores the current random seed. Every base updates it every frame when its preDraw method is called, but no other code accesses it.

Callbacks

The initLoader function sets two unused callbacks related to the scrapped relocatable profile system. See fBase_c for more details.

Definition at line 41 of file d_base.hpp.

Public Member Functions

 dBase_c ()
 Constructs a new base.
 
virtual int preCreate ()
 pre method for the create operation.
 
virtual void postCreate (fBase_c::MAIN_STATE_e status)
 post method for the create operation.
 
virtual int preDelete ()
 pre method for the delete operation.
 
virtual void postDelete (fBase_c::MAIN_STATE_e status)
 post method for the delete operation.
 
virtual int preExecute ()
 pre method for the execute operation.
 
virtual void postExecute (fBase_c::MAIN_STATE_e status)
 post method for the execute operation.
 
virtual int preDraw ()
 pre method for the draw operation.
 
virtual void postDraw (fBase_c::MAIN_STATE_e status)
 post method for the draw operation.
 
virtual ~dBase_c ()
 Destroys the base.
 
virtual const char * getKindString () const
 Gets the base's kind string.
 
- Public Member Functions inherited from fBase_c
 fBase_c ()
 Constructs a new base.
 
void deleteRequest ()
 Requests deletion of the base.
 
fBase_cgetConnectParent () const
 Gets the base's parent.
 
fBase_cgetConnectChild () const
 Gets the base's first child.
 
fBase_cgetConnectBrNext () const
 Gets the base's next sibling.
 
bool checkChildProcessCreateState () const
 Checks if the base has at least one child in the CREATING state.
 
- Public Member Functions inherited from cOwnerSetMg_c
 cOwnerSetMg_c ()
 Constructs a new set container.
 
 ~cOwnerSetMg_c ()
 Destroys the set.
 
void add (cOwnerSetNd_c *nd, void *owner)
 Adds a node to the set.
 
void remove (cOwnerSetNd_c *nd, void *owner)
 Removes a node from the set.
 

Static Public Member Functions

static dBase_csearchBaseByProfName (ProfileName profile, const dBase_c *parent)
 Searches for a base with a given profile name, optionally under a given parent.
 
static void initLoader ()
 [Unused]. Sets the callbacks for the scrapped relocatable profile system.
 
static dBase_ccreateBase (ProfileName profName, dBase_c *parent, unsigned long param, u8 groupType)
 Creates a child base under the given parent.
 
static dBase_ccreateRoot (ProfileName profName, unsigned long param, u8 groupType)
 Creates a root base.
 
- Static Public Member Functions inherited from fBase_c
static void * operator new (size_t)
 new operator override for all bases.
 
static void operator delete (void *)
 delete operator override for all bases.
 
static fBase_ccreateChild (ProfileName profName, fBase_c *parent, unsigned long param, u8 groupType)
 Creates a child base under the given parent.
 
static fBase_ccreateRoot (ProfileName profName, unsigned long param, u8 groupType)
 Creates a root base.
 

Static Private Member Functions

static int loadAsyncCallback ()
 [Unused]. Module loading callback for the scrapped relocatable profile system.
 
static void unloadCallback ()
 [Unused]. Module unloading callback for the scrapped relocatable profile system.
 

Private Attributes

const char * mpKindString
 [Unused]. The base's kind string.
 
const char * mpNameString
 [Unused]. The base's profile name string.
 

Additional Inherited Members

- Public Types inherited from fBase_c
enum  LIFECYCLE_e {
  CREATING ,
  ACTIVE ,
  DELETING
}
 The possible lifecycle states. More...
 
enum  GROUP_TYPE_e {
  OTHER ,
  SCENE ,
  ACTOR
}
 The possible group types. More...
 
enum  MAIN_STATE_e {
  CANCELED ,
  ERROR ,
  SUCCESS ,
  WAITING
}
 The possible operation results. More...
 
enum  PACK_RESULT_e {
  NOT_READY ,
  SUCCEEDED ,
  FAILED
}
 The possible operation step results. More...
 
enum  PROC_DISABLE_e {
  ROOT_DISABLE_EXECUTE = BIT_FLAG(0) ,
  DISABLE_EXECUTE = BIT_FLAG(1) ,
  ROOT_DISABLE_DRAW = BIT_FLAG(2) ,
  DISABLE_DRAW = BIT_FLAG(3)
}
 Controls if the execute and draw operations should be skipped. More...
 
- Public Attributes inherited from fBase_c
fBaseID_e mUniqueID
 The base's unique identifier.
 
u32 mParam
 A bitfield that configures the base's behaviour. Its usage varies from profile to profile.
 
ProfileName mProfName
 The base's profile name.
 
- Protected Member Functions inherited from fBase_c
bool isProcControlFlag (u8 flag) const
 Checks if a flag is set in mProcControl.
 
void setProcControlFlag (u8 flag)
 Sets a flag in mProcControl.
 
void clearProcControlFlag (u8 flag)
 Clears a flag in mProcControl.
 
virtual int create ()
 do method for the create operation.
 
virtual int doDelete ()
 do method for the delete operation.
 
virtual int execute ()
 do method for the execute operation.
 
virtual int draw ()
 do method for the draw operation.
 
virtual void deleteReady ()
 Informs the base that it's about to be deleted.
 
virtual bool entryFrmHeap (unsigned long size, EGG::Heap *parentHeap)
 [Unused]. Creates a heap of the given size for the base.
 
virtual bool entryFrmHeapNonAdjust (unsigned long size, EGG::Heap *parentHeap)
 [Unused]. Creates a heap of the given size for the base.
 
virtual bool createHeap ()
 [Unused]. [Does nothing].
 
virtual ~fBase_c ()
 Destroys the base.
 
- Protected Attributes inherited from fBase_c
u8 mLifecycleState
 The base's lifecycle state. Value is a LIFECYCLE_e.
 
bool mDeleteRequested
 If deletion of the base was requested, but the delete operation has not been scheduled yet.
 
bool mDeferExecute
 If the create operation was completed, but scheduling the execute and draw operations isn't possible at this time.
 
bool mDeferRetryCreate
 If the create operation has not been completed, and rescheduling it isn't possible at this time.
 
u8 mGroupType
 The base's group type. Value is a GROUP_TYPE_e.
 
u8 mProcControl
 The operations to be skipped. Value is a PROC_DISABLE_e.
 
fManager_c mMng
 The base's process manager.
 
fBaHelper_cmpUnusedHelper
 [Unused]. See Unused Content.
 
fLiMgBa_c mUnusedList
 [Unused]. See Unused Content.
 
EGG::FrmHeapmHeap
 [Unused]. The base's dedicated heap.
 
- Static Protected Attributes inherited from fBase_c
static int(* sLoadAsyncCallback )()
 [Unused]. See Unused Content.
 
static void(* sUnloadCallback )()
 [Unused]. See Unused Content.
 

Constructor & Destructor Documentation

◆ dBase_c()

dBase_c::dBase_c ( )

Constructs a new base.

Definition at line 12 of file d_base.cpp.

◆ ~dBase_c()

dBase_c::~dBase_c ( )
virtual

Destroys the base.

Definition at line 16 of file d_base.cpp.

Member Function Documentation

◆ preCreate()

int dBase_c::preCreate ( )
virtual

pre method for the create operation.

Returns
A PACK_RESULT_e value.

Reimplemented from fBase_c.

Reimplemented in dBaseActor_c, dMdActor_c, dScene_c, and dWmActor_c.

Definition at line 37 of file d_base.cpp.

◆ postCreate()

void dBase_c::postCreate ( fBase_c::MAIN_STATE_e state)
virtual

post method for the create operation.

Reimplemented from fBase_c.

Reimplemented in dBaseActor_c, dMdActor_c, dScene_c, and dWmActor_c.

Definition at line 41 of file d_base.cpp.

◆ preDelete()

int dBase_c::preDelete ( )
virtual

pre method for the delete operation.

Returns
A PACK_RESULT_e value.

Reimplemented from fBase_c.

Reimplemented in dBaseActor_c, dMdActor_c, dScene_c, and dWmActor_c.

Definition at line 45 of file d_base.cpp.

◆ postDelete()

void dBase_c::postDelete ( fBase_c::MAIN_STATE_e state)
virtual

post method for the delete operation.

Reimplemented from fBase_c.

Reimplemented in dBaseActor_c, dMdActor_c, dScene_c, and dWmActor_c.

Definition at line 49 of file d_base.cpp.

◆ preExecute()

int dBase_c::preExecute ( )
virtual

pre method for the execute operation.

Returns
A PACK_RESULT_e value.

Reimplemented from fBase_c.

Reimplemented in dBaseActor_c, dMdActor_c, dScene_c, and dWmActor_c.

Definition at line 53 of file d_base.cpp.

◆ postExecute()

void dBase_c::postExecute ( fBase_c::MAIN_STATE_e state)
virtual

post method for the execute operation.

Reimplemented from fBase_c.

Reimplemented in dBaseActor_c, dMdActor_c, dScene_c, and dWmActor_c.

Definition at line 58 of file d_base.cpp.

◆ preDraw()

int dBase_c::preDraw ( )
virtual

pre method for the draw operation.

Returns
A PACK_RESULT_e value.

Reimplemented from fBase_c.

Reimplemented in dBaseActor_c, dMdActor_c, dScene_c, and dWmActor_c.

Definition at line 62 of file d_base.cpp.

◆ postDraw()

void dBase_c::postDraw ( fBase_c::MAIN_STATE_e state)
virtual

post method for the draw operation.

Reimplemented from fBase_c.

Reimplemented in dBaseActor_c, dMdActor_c, dScene_c, and dWmActor_c.

Definition at line 67 of file d_base.cpp.

◆ getKindString()

const char * dBase_c::getKindString ( ) const
virtual

Gets the base's kind string.

Definition at line 71 of file d_base.cpp.

◆ searchBaseByProfName()

dBase_c * dBase_c::searchBaseByProfName ( ProfileName profile,
const dBase_c * parent )
static

Searches for a base with a given profile name, optionally under a given parent.

[This calls fTrMgBa_c::searchNodeByProfName internally].

Definition at line 18 of file d_base.cpp.

◆ initLoader()

void dBase_c::initLoader ( )
static

[Unused]. Sets the callbacks for the scrapped relocatable profile system.

Definition at line 81 of file d_base.cpp.

◆ createBase()

dBase_c * dBase_c::createBase ( ProfileName profName,
dBase_c * parent,
unsigned long param,
u8 groupType )
static

Creates a child base under the given parent.

Parameters
profNameThe base's profile name.
parentThe base's parent. Must not be nullptr .
paramThe base's parameters.
groupTypeThe base's group type.
Returns
A pointer to the instantiated base, or nullptr .

Definition at line 86 of file d_base.cpp.

◆ createRoot()

dBase_c * dBase_c::createRoot ( ProfileName profName,
unsigned long param,
u8 groupType )
static

Creates a root base.

Parameters
profNameThe base's profile name.
paramThe base's parameters.
groupTypeThe base's group type.
Returns
A pointer to the instantiated base, or nullptr .

Definition at line 90 of file d_base.cpp.

◆ loadAsyncCallback()

int dBase_c::loadAsyncCallback ( )
staticprivate

[Unused]. Module loading callback for the scrapped relocatable profile system.

Unofficial name.
Returns
Always returns FAILED.

Definition at line 75 of file d_base.cpp.

◆ unloadCallback()

void dBase_c::unloadCallback ( )
staticprivate

[Unused]. Module unloading callback for the scrapped relocatable profile system.

Unofficial name.

Definition at line 79 of file d_base.cpp.

Member Data Documentation

◆ mpKindString

const char* dBase_c::mpKindString
private

[Unused]. The base's kind string.

Definition at line 77 of file d_base.hpp.

◆ mpNameString

const char* dBase_c::mpNameString
private

[Unused]. The base's profile name string.

Definition at line 78 of file d_base.hpp.