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

Description

Manages processes across the game, forming the core of the game engine.

Introduction

In New Super Mario Bros. Wii, almost all game logic exists within individual processes. Each process represents a distinct unit of game behavior and encapsulates specific functionalities.

Nintendo refers to these processes as bases. Each type of base is defined by a profile, which determines its behaviour (is it a Goomba, Mario, the HUD, or the abstract concept of a world map?) and establishes its priority relative to other base types. More details about profiles can be found here.

Processes follow a hierarchical tree structure:

  • Each process can have multiple siblings and children; this allows creating complex and intricate relationships between bases. An example is the Hammer Bro: all the hammers it throws are siblings of each other, and the Hammer Bro is their parent.
  • The root process for all bases is the current scene; this allows the game to clean up after itself by deleting all processes when switching between scenes. Further information on this topic can be found here.

Base Implementation

All bases are derived from the fBase_c class, which defines the core elements of a process to provide common behaviour across all bases (for more detailed information, please refer to the fBase_c documentation). Numerous subclasses supply additional features on top, allowing bases to implement complex behaviour relatively easily whilst avoiding duplicate code.

Hint
When creating a base, consider researching the existing subclasses to avoid unnecessary reimplementations.

The lifecycle of a base consists of multiple operations, whose behaviour can be overridden at any point in the class hierarchy. Each operation has an associated linked list, containing all bases for which said operation is scheduled for the current frame.

fBase_c defines four core operations:

  • create runs immediately after construction (generally only once), and can be used to set up the base or load resources for it.
  • execute serves as the base's own main loop, running every frame.
  • draw offers an alternative main loop specifically for rendering code. It also runs every frame.
  • delete runs immediately before destruction (generally only once), and can be used to deallocate resources or remove links to other bases.

The fManager_c class is responsible for managing the execution cycle of each base. It also offers various utilities for searching for bases meeting specific criteria.

Sub-categories

 fProfile
 A profile is a basic set of information needed to construct a base.

Classes

class  fBase_c
 The base class for all scenes, actors and various other processes. More...
class  fBaHelper_c
 [A helper class for fBase_c with unknown purpose]. More...
class  fLiMgBa_c
 A base list, made of fLiNdBa_c nodes. More...
class  fLiMgPTMF_c
 A base list made of fLiNdPrio_c nodes, with a reference to a process function. More...
class  fLiNdBa_c
 A base list node. More...
class  fLiNdPrio_c
 A base list node, with priority fields for reordering. More...
class  fManager_c
 Manages the execution of base operations. More...
class  fTrMgBa_c
 A base tree, made of fTrNdBa_c nodes. More...
class  fTrMgPTMF_c
 A base tree made of fTrNdBa_c nodes, with a reference to a process function. More...
class  fTrNdBa_c
 A base tree node. More...

Enumerations

enum  fBaseID_e {
  BASE_ID_NULL ,
  BASE_ID_FIRST ,
  BASE_ID_MAX = -1
}
 A unique identifier for each base. More...

Enumeration Type Documentation

◆ fBaseID_e

enum fBaseID_e

A unique identifier for each base.

Enumerator
BASE_ID_NULL 

Represents the null base.

BASE_ID_FIRST 

The starting identifier value.

BASE_ID_MAX 

The maximum identifier value.

Definition at line 6 of file f_base_id.hpp.