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