NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
f_manager.hpp
1#pragma once
3#include <game/framework/f_list_mg_ptmf.hpp>
4#include <game/framework/f_list_mg.hpp>
5#include <game/framework/f_list_nd.hpp>
6#include <game/framework/f_list_nd_prio.hpp>
7#include <game/framework/f_tree_mg_ptmf.hpp>
8#include <game/framework/f_tree_nd.hpp>
10
11#define GET_PROC_FLAG(proc) BIT_FLAG((proc)-1)
12
13class fBase_c;
14
15/// @brief Manages the execution of base operations.
16/// @ingroup framework
18private:
19
20 /// @brief The operation types.
22 NONE, CONNECT, CREATE, EXECUTE, DELETE, DRAW
23 };
24
25 /// @brief The operation disable flags, induced from ::LOOP_PROC_e.
27 PROC_FLAG_NONE = GET_PROC_FLAG(NONE),
28 PROC_FLAG_CONNECT = GET_PROC_FLAG(CONNECT),
29 PROC_FLAG_CREATE = GET_PROC_FLAG(CREATE),
30 PROC_FLAG_EXECUTE = GET_PROC_FLAG(EXECUTE),
31 PROC_FLAG_DELETE = GET_PROC_FLAG(DELETE),
32 PROC_FLAG_DRAW = GET_PROC_FLAG(DRAW)
33 };
34
35 /// @brief Constructs a new manager.
36 /// @param owner The manager's owner.
37 fManager_c(fBase_c *owner) :
38 mConnectNode(owner),
39 mMainNode(owner),
40 mDrawNode(owner),
41 mSearchNode(owner) {}
42
43 /// @brief Gets the index of the search list the owning base was added to. See ::m_searchManage.
45
46public:
47 /// @brief Executes the currently enabled operations on all the bases in the respective lists.
48 /// @details As this function indirectly executes most of the game-specific code, it can be
49 /// considered as a de facto @p main method.
50 static void mainLoop();
51
52 /// @brief Searches for a base with the given ID.
53 /// @details [This calls fLiMgBa_c::searchNodeByID internally].
55
56 /// @brief Searches for a base with a given profile name, optionally under a given parent.
57 /// @details [This calls fTrMgBa_c::searchNodeByProfName internally].
58 static fBase_c *searchBaseByProfName(ProfileName profID, const fBase_c *parent);
59
60 /// @brief Searches for a base with a given group type, optionally under a given parent.
61 /// @details [This calls fTrMgBa_c::searchNodeByGroupType internally].
62 static fBase_c *searchBaseByGroupType(unsigned char groupType, const fBase_c *parent);
63
64private:
65 fTrNdBa_c mConnectNode; ///< The node in the @ref ::m_connectManage "connect tree".
66
67 /// @brief The node in the @ref ::m_createManage "create", @ref ::m_executeManage "execute" or
68 /// @ref ::m_deleteManage "delete" list.
70 fLiNdPrio_c mDrawNode; ///< The node in the @ref ::m_drawManage "draw list".
71 fLiNdBa_c mSearchNode; ///< The node in the @ref ::m_searchManage "search lists".
72
73 static fTrMgPTMF_c m_connectManage; ///< A tree that connects all loaded bases.
74 static fLiMgPTMF_c m_createManage; ///< A list of all the bases scheduled for creation.
75 static fLiMgPTMF_c m_executeManage; ///< A list of all the bases scheduled for execution.
76 static fLiMgPTMF_c m_deleteManage; ///< A list of all the bases scheduled for deletion.
77 static fLiMgPTMF_c m_drawManage; ///< A list of all the bases scheduled for drawing.
78
79 /// @brief An array of lists used for base lookup.
80 /// @details Bases are distributed across the lists in a round-robin fashion, allowing bases to be
81 /// located more efficiently.
83
84 /// @brief The operations which should be globally skipped this frame.
85 /// @unused
86 /// @details Value is a combination of ::PROC_FLAGS_e.
87 static u32 m_StopProcInf;
88
89 /// @brief The current operation being globally executed. See ::mainLoop.
90 /// @details The list for this operation cannot be updated until the operation has finished executing.
91 /// @hideinitializer
93
94 friend class fBase_c;
95};
The base class for all scenes, actors and various other processes.
Definition f_base.hpp:12
A base list, made of fLiNdBa_c nodes.
Definition f_list_mg.hpp:13
A base list made of fLiNdPrio_c nodes, with a reference to a process function.
A base list node.
Definition f_list_nd.hpp:11
A base list node, with priority fields for reordering.
static fLiMgPTMF_c m_drawManage
A list of all the bases scheduled for drawing.
Definition f_manager.hpp:77
static fTrMgPTMF_c m_connectManage
A tree that connects all loaded bases.
Definition f_manager.hpp:73
static fLiMgBa_c m_searchManage[8]
An array of lists used for base lookup.
Definition f_manager.hpp:82
static LOOP_PROC_e m_nowLoopProc
The current operation being globally executed. See mainLoop.
Definition f_manager.hpp:92
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.
Definition f_manager.cpp:41
LOOP_PROC_e
The operation types.
Definition f_manager.hpp:21
PROC_FLAGS_e
The operation disable flags, induced from LOOP_PROC_e.
Definition f_manager.hpp:26
static fLiMgPTMF_c m_executeManage
A list of all the bases scheduled for execution.
Definition f_manager.hpp:75
static u32 m_StopProcInf
The operations which should be globally skipped this frame.
Definition f_manager.hpp:87
int getSearchTableNum()
Gets the index of the search list the owning base was added to. See m_searchManage.
Definition f_manager.cpp:14
static fLiMgPTMF_c m_deleteManage
A list of all the bases scheduled for deletion.
Definition f_manager.hpp:76
fLiNdPrio_c mDrawNode
The node in the draw list.
Definition f_manager.hpp:70
static void mainLoop()
Executes the currently enabled operations on all the bases in the respective lists.
Definition f_manager.cpp:56
fTrNdBa_c mConnectNode
The node in the connect tree.
Definition f_manager.hpp:65
static fLiMgPTMF_c m_createManage
A list of all the bases scheduled for creation.
Definition f_manager.hpp:74
fLiNdBa_c mSearchNode
The node in the search lists.
Definition f_manager.hpp:71
fLiNdPrio_c mMainNode
The node in the create, execute or delete list.
Definition f_manager.hpp:69
static fBase_c * searchBaseByID(fBaseID_e id)
Searches for a base with the given ID.
Definition f_manager.cpp:18
static fBase_c * searchBaseByProfName(ProfileName profID, const fBase_c *parent)
Searches for a base with a given profile name, optionally under a given parent.
Definition f_manager.cpp:26
fManager_c(fBase_c *owner)
Constructs a new manager.
Definition f_manager.hpp:37
A base tree made of fTrNdBa_c nodes, with a reference to a process function.
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