NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_base.hpp
1#pragma once
2#include <game/framework/f_base.hpp>
4
5/**
6 * @brief The minimum required implementation for a base.
7 * @ingroup bases
8 * @details
9 * ## Overview
10 * From a technical standpoint, dBase_c does not add any particularly relevant components, which is useful
11 * for bases that don't need any additional functionality. A few overloaded functions from the fManager_c
12 * search API (::searchBaseByProfName) and the fBase_c base creation API (::createBase, ::createRoot) are
13 * provided for convenience.
14 *
15 * ## Unused Content
16 * ### Base Linking
17 * The @ref cOwnerSetMg_c "inherited owner set" can be used by bases to link themselves to a specific base
18 * (called the owner base) anywhere in the @ref fManager_c::m_connectManage "connect tree", avoiding the
19 * parent/child relationship requirement. The owner base can then iterate through the set and interact with
20 * the linked bases. When the owner base is deleted, all the linked bases are unlinked automatically.
21 *
22 * Several bases use this method to link themselves to dBgGm_c, which however does not use the set at all,
23 * leaving the feature unused.
24 *
25 * ### Debug Strings
26 * Bases store a pointer to a @ref mpKindString "kind string" (which roughly describes the
27 * @ref fBase_c::GROUP_TYPE_e "group type") and to a @ref mpNameString "profile name string". The former
28 * can be obtained by calling ::getKindString, while the latter can be obtained by calling ::dProf_getName
29 * with the profile name.
30 *
31 * The ::preExecute function gets the kind string every frame and discards the result immediately.
32 *
33 * ### Random Seed
34 * The global variable ::g_basesRandomSeed stores the current random seed. Every base updates it every
35 * frame when its ::preDraw method is called, but no other code accesses it.
36 *
37 * ### Callbacks
38 * The ::initLoader function sets two unused callbacks related to the scrapped relocatable profile system.
39 * See fBase_c for more details.
40 */
41class dBase_c : public fBase_c, public cOwnerSetMg_c {
42public:
43 /// @copydoc fBase_c::fBase_c
44 dBase_c();
45
46 virtual int preCreate();
47 virtual void postCreate(fBase_c::MAIN_STATE_e status);
48
49 virtual int preDelete();
50 virtual void postDelete(fBase_c::MAIN_STATE_e status);
51
52 virtual int preExecute();
53 virtual void postExecute(fBase_c::MAIN_STATE_e status);
54
55 virtual int preDraw();
56 virtual void postDraw(fBase_c::MAIN_STATE_e status);
57
58 /// @copydoc fBase_c::~fBase_c
59 virtual ~dBase_c();
60
61 /// @brief Gets the base's kind string.
62 virtual const char *getKindString() const;
63
64 /// @copydoc fManager_c::searchBaseByProfName
65 static dBase_c *searchBaseByProfName(ProfileName profile, const dBase_c* parent);
66
67 /// @unused Sets the callbacks for the scrapped relocatable profile system.
68 static void initLoader();
69
70 /// @copydoc fBase_c::createChild
71 static dBase_c *createBase(ProfileName profName, dBase_c *parent, unsigned long param, u8 groupType);
72
73 /// @copydoc fBase_c::createRoot
74 static dBase_c *createRoot(ProfileName profName, unsigned long param, u8 groupType);
75
76private:
77 const char* mpKindString; ///< @unused The base's kind string.
78 const char* mpNameString; ///< @unused The base's profile name string.
79
80 /// @unused Module loading callback for the scrapped relocatable profile system.
81 /// @unofficial
82 /// @return Always returns @ref fBase_c::PACK_RESULT_e::FAILED "FAILED".
83 static int loadAsyncCallback();
84
85 /// @unused Module unloading callback for the scrapped relocatable profile system.
86 /// @unofficial
87 static void unloadCallback();
88};
cOwnerSetMg_c()
Constructs a new set container.
dBase_c()
Constructs a new base.
Definition d_base.cpp:12
static void initLoader()
[Unused]. Sets the callbacks for the scrapped relocatable profile system.
Definition d_base.cpp:81
virtual int preDelete()
pre method for the delete operation.
Definition d_base.cpp:45
virtual ~dBase_c()
Destroys the base.
Definition d_base.cpp:16
virtual void postExecute(fBase_c::MAIN_STATE_e status)
post method for the execute operation.
Definition d_base.cpp:58
const char * mpKindString
[Unused]. The base's kind string.
Definition d_base.hpp:77
virtual void postDraw(fBase_c::MAIN_STATE_e status)
post method for the draw operation.
Definition d_base.cpp:67
virtual void postCreate(fBase_c::MAIN_STATE_e status)
post method for the create operation.
Definition d_base.cpp:41
const char * mpNameString
[Unused]. The base's profile name string.
Definition d_base.hpp:78
virtual const char * getKindString() const
Gets the base's kind string.
Definition d_base.cpp:71
virtual int preDraw()
pre method for the draw operation.
Definition d_base.cpp:62
static dBase_c * createRoot(ProfileName profName, unsigned long param, u8 groupType)
Creates a root base.
Definition d_base.cpp:90
virtual void postDelete(fBase_c::MAIN_STATE_e status)
post method for the delete operation.
Definition d_base.cpp:49
virtual int preExecute()
pre method for the execute operation.
Definition d_base.cpp:53
virtual int preCreate()
pre method for the create operation.
Definition d_base.cpp:37
static dBase_c * createBase(ProfileName profName, dBase_c *parent, unsigned long param, u8 groupType)
Creates a child base under the given parent.
Definition d_base.cpp:86
static void unloadCallback()
[Unused]. Module unloading callback for the scrapped relocatable profile system.
Definition d_base.cpp:79
static int loadAsyncCallback()
[Unused]. Module loading callback for the scrapped relocatable profile system.
Definition d_base.cpp:75
static dBase_c * searchBaseByProfName(ProfileName profile, const dBase_c *parent)
Searches for a base with a given profile name, optionally under a given parent.
Definition d_base.cpp:18
MAIN_STATE_e
The possible operation results.
Definition f_base.hpp:137
fBase_c()
Constructs a new base.
Definition f_base.cpp:15
u16 ProfileName
The name of a profile. Value is a fProfile::PROFILE_NAME_e.
Definition f_profile.hpp:32