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

#include <game/framework/f_manager.hpp>

Description

Manages the execution of base operations.

Overview

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.

Global Base Searching

Bases can be searched globally based on various criteria:

For iterating the base tree manually, please refer to fBase_c.

Operation Management

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.

Implementation

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:

  • mConnectNode connects the base to the connect tree, which allows it to establish relationships with other bases. It is used during the connect operation.
  • mMainNode allows the base to be scheduled for the create, execute and delete operations.
  • mDrawNode allows the base to be scheduled for the draw operation.
  • mSearchNode adds the base to one of the eight search lists, allowing it to be indexed and searched for through the previously mentioned API.

Unused Content

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_csearchBaseByID (fBaseID_e id)
 Searches for a base with the given ID.
 
static fBase_csearchBaseByProfName (ProfileName profID, const fBase_c *parent)
 Searches for a base with a given profile name, optionally under a given parent.
 
static fBase_csearchBaseByGroupType (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.
 

Member Enumeration Documentation

◆ LOOP_PROC_e

The operation types.

Definition at line 74 of file f_manager.hpp.

◆ PROC_FLAGS_e

The operation disable flags, induced from LOOP_PROC_e.

Definition at line 79 of file f_manager.hpp.

Constructor & Destructor Documentation

◆ fManager_c()

fManager_c::fManager_c ( fBase_c * owner)
inlineprivate

Constructs a new manager.

Parameters
ownerThe manager's owner.

Definition at line 90 of file f_manager.hpp.

Member Function Documentation

◆ getSearchTableNum()

int fManager_c::getSearchTableNum ( )
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.

◆ mainLoop()

void fManager_c::mainLoop ( )
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.

◆ searchBaseByID()

fBase_c * fManager_c::searchBaseByID ( fBaseID_e id)
static

Searches for a base with the given ID.

[This calls fLiMgBa_c::searchNodeByID internally].

Definition at line 18 of file f_manager.cpp.

◆ searchBaseByProfName()

fBase_c * fManager_c::searchBaseByProfName ( ProfileName profID,
const fBase_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 26 of file f_manager.cpp.

◆ searchBaseByGroupType()

fBase_c * fManager_c::searchBaseByGroupType ( unsigned char groupType,
const fBase_c * parent )
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.

Member Data Documentation

◆ mConnectNode

fTrNdBa_c fManager_c::mConnectNode
private

The node in the connect tree.

Definition at line 118 of file f_manager.hpp.

◆ mMainNode

fLiNdPrio_c fManager_c::mMainNode
private

The node in the create, execute or delete list.

Definition at line 122 of file f_manager.hpp.

◆ mDrawNode

fLiNdPrio_c fManager_c::mDrawNode
private

The node in the draw list.

Definition at line 123 of file f_manager.hpp.

◆ mSearchNode

fLiNdBa_c fManager_c::mSearchNode
private

The node in the search lists.

Definition at line 124 of file f_manager.hpp.

◆ m_connectManage

fTrMgPTMF_c fManager_c::m_connectManage
staticprivate

A tree that connects all loaded bases.

Definition at line 126 of file f_manager.hpp.

◆ m_createManage

fLiMgPTMF_c fManager_c::m_createManage
staticprivate

A list of all the bases scheduled for creation.

Definition at line 127 of file f_manager.hpp.

◆ m_executeManage

fLiMgPTMF_c fManager_c::m_executeManage
staticprivate

A list of all the bases scheduled for execution.

Definition at line 128 of file f_manager.hpp.

◆ m_deleteManage

fLiMgPTMF_c fManager_c::m_deleteManage
staticprivate

A list of all the bases scheduled for deletion.

Definition at line 129 of file f_manager.hpp.

◆ m_drawManage

fLiMgPTMF_c fManager_c::m_drawManage
staticprivate

A list of all the bases scheduled for drawing.

Definition at line 130 of file f_manager.hpp.

◆ m_searchManage

fLiMgBa_c fManager_c::m_searchManage
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.

◆ m_StopProcInf

u32 fManager_c::m_StopProcInf
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.

◆ m_nowLoopProc

fManager_c::LOOP_PROC_e fManager_c::m_nowLoopProc
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.