NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
|
#include <game/framework/f_manager.hpp>
Manages the execution of base operations.
fManager_c manages the execution of base operations (called "processes" by Nintendo) both at a local and a global scale. It also offers a small base search API.
Bases can be searched globally based on various criteria:
For iterating the base tree manually, please refer to fBase_c.
For further details regarding operations, see fBase_c.
At a global scale, fManager_c handles operation execution through multiple linked lists. Each list is dedicated to a specific operation, and contains all the bases for which the operation is scheduled for the current frame.
The mainLoop function goes through each list and carries out the associated operation on every base contained within, by calling the list's walkPack method. The execution order is as follows:
delete
create
execute
draw
connect
Finally, an operation can be disabled globally by setting the m_StopProcInf flag. Disabling all operations effectively halts the game, which can be useful for debugging.
Every instance of fManager_c is embedded inside a base, also known as its owner. The class contains various list/tree nodes that link the owner base to the respective list/trees:
connect
operation.create
, execute
and delete
operations.draw
operation.The aforementioned m_StopProcInf flag, while present and working, remains unchanged throughout the whole game. Since its default value has no effects, it ultimately winds up unused.
Definition at line 70 of file f_manager.hpp.
Static Public Member Functions | |
static void | mainLoop () |
Executes the currently enabled operations on all the bases in the respective lists. | |
static fBase_c * | searchBaseByID (fBaseID_e id) |
Searches for a base with the given ID. | |
static fBase_c * | searchBaseByProfName (ProfileName profID, const fBase_c *parent) |
Searches for a base with a given profile name, optionally under a given parent. | |
static fBase_c * | searchBaseByGroupType (unsigned char groupType, const fBase_c *parent) |
Searches for a base with a given group type, optionally under a given parent. | |
Private Types | |
enum | LOOP_PROC_e { NONE , CONNECT , CREATE , EXECUTE , DELETE , DRAW } |
The operation types. More... | |
enum | PROC_FLAGS_e { PROC_FLAG_NONE = GET_PROC_FLAG(NONE) , PROC_FLAG_CONNECT = GET_PROC_FLAG(CONNECT) , PROC_FLAG_CREATE = GET_PROC_FLAG(CREATE) , PROC_FLAG_EXECUTE = GET_PROC_FLAG(EXECUTE) , PROC_FLAG_DELETE = GET_PROC_FLAG(DELETE) , PROC_FLAG_DRAW = GET_PROC_FLAG(DRAW) } |
The operation disable flags, induced from LOOP_PROC_e. More... | |
Private Member Functions | |
fManager_c (fBase_c *owner) | |
Constructs a new manager. | |
int | getSearchTableNum () |
Gets the index of the search list the owning base was added to. See m_searchManage. | |
Private Attributes | |
fTrNdBa_c | mConnectNode |
The node in the connect tree. | |
fLiNdPrio_c | mMainNode |
The node in the create, execute or delete list. | |
fLiNdPrio_c | mDrawNode |
The node in the draw list. | |
fLiNdBa_c | mSearchNode |
The node in the search lists. | |
Static Private Attributes | |
static fTrMgPTMF_c | m_connectManage |
A tree that connects all loaded bases. | |
static fLiMgPTMF_c | m_createManage |
A list of all the bases scheduled for creation. | |
static fLiMgPTMF_c | m_executeManage |
A list of all the bases scheduled for execution. | |
static fLiMgPTMF_c | m_deleteManage |
A list of all the bases scheduled for deletion. | |
static fLiMgPTMF_c | m_drawManage |
A list of all the bases scheduled for drawing. | |
static fLiMgBa_c | m_searchManage [8] |
An array of lists used for base lookup. | |
static u32 | m_StopProcInf |
[Unused]. The operations which should be globally skipped this frame. | |
static LOOP_PROC_e | m_nowLoopProc |
The current operation being globally executed. See mainLoop. | |
|
private |
The operation types.
Definition at line 74 of file f_manager.hpp.
|
private |
The operation disable flags, induced from LOOP_PROC_e.
Definition at line 79 of file f_manager.hpp.
|
inlineprivate |
Constructs a new manager.
owner | The manager's owner. |
Definition at line 90 of file f_manager.hpp.
|
private |
Gets the index of the search list the owning base was added to. See m_searchManage.
Definition at line 14 of file f_manager.cpp.
|
static |
Executes the currently enabled operations on all the bases in the respective lists.
As this function indirectly executes most of the game-specific code, it can be considered as a de facto main
method.
Definition at line 56 of file f_manager.cpp.
Searches for a base with the given ID.
[This calls fLiMgBa_c::searchNodeByID internally].
Definition at line 18 of file f_manager.cpp.
|
static |
Searches for a base with a given profile name, optionally under a given parent.
[This calls fTrMgBa_c::searchNodeByProfName internally].
Definition at line 26 of file f_manager.cpp.
|
static |
Searches for a base with a given group type, optionally under a given parent.
[This calls fTrMgBa_c::searchNodeByGroupType internally].
Definition at line 41 of file f_manager.cpp.
|
private |
The node in the connect tree.
Definition at line 118 of file f_manager.hpp.
|
private |
The node in the create, execute or delete list.
Definition at line 122 of file f_manager.hpp.
|
private |
The node in the draw list.
Definition at line 123 of file f_manager.hpp.
|
private |
The node in the search lists.
Definition at line 124 of file f_manager.hpp.
|
staticprivate |
A tree that connects all loaded bases.
Definition at line 126 of file f_manager.hpp.
|
staticprivate |
A list of all the bases scheduled for creation.
Definition at line 127 of file f_manager.hpp.
|
staticprivate |
A list of all the bases scheduled for execution.
Definition at line 128 of file f_manager.hpp.
|
staticprivate |
A list of all the bases scheduled for deletion.
Definition at line 129 of file f_manager.hpp.
|
staticprivate |
A list of all the bases scheduled for drawing.
Definition at line 130 of file f_manager.hpp.
|
staticprivate |
An array of lists used for base lookup.
Bases are distributed across the lists in a round-robin fashion, allowing bases to be located more efficiently.
Definition at line 135 of file f_manager.hpp.
|
staticprivate |
[Unused]. The operations which should be globally skipped this frame.
Value is a combination of PROC_FLAGS_e.
Definition at line 139 of file f_manager.hpp.
|
staticprivate |
The current operation being globally executed. See mainLoop.
The list for this operation cannot be updated until the operation has finished executing.
Definition at line 144 of file f_manager.hpp.