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

#include <game/bases/d_actorcreate_manager.hpp>

Description

Manager for map actor creation.

Decompilation Note
Map actors are the equivalent of sprites in Reggie terminology.

Definition at line 34 of file d_actorcreate_manager.hpp.

Public Member Functions

void ActorCreateInfoClear ()
 Resets all temporary data for map actor spawning.
bool ScroolAreaInCheck (int boundsEdge, int areaEdge, int boundMin, int boundMax, int areaMin, int areaMax)
 Checks whether an actor should be spawned based on the camera's current scroll position.
bool ScroolAreaInLoopCheck (int boundsEdge, int areaEdge, int boundMin, int boundMax, int areaMin, int areaMax)
 Checks whether an actor should be spawned due to being close to a screen edge (for looping stages).
void setMapActorCreate ()
 Initializes map actors on first area load.
void setMapActorCreate_next ()
 Initializes map actors on area reload.
void MapActorInital_set ()
 Triggers actor creation on first area load.
void MapActorInital_next ()
 Triggers actor creation on area reload.
bool GlobalActorCheck (sMapActorData *data)
 Checks whether the profile associated to the map actor is allowed to ignore screen bounds on spawn.
void processGroupId (sMapActorData *data, u8 file, u32 mapActorIdx)
 Adds a group-based map actor to the group manager.
bool GroupIdCheck (ulong param)
 Checks whether the provided actor parameters contain a group ID definition.
void MapActorInitialCreate (sMapActorData *levelData, u16 *deleteVal, u8 *spawnFlags, int mapActorCount, bool isAreaReload)
 Manages actor spawning when entering a level or area.
void MapActorScroolCreateCheck ()
 Checks for screen scrolling and zoom changes to trigger spawning of nearby actors.
void MapActorScrollCreate (sMapActorCreateBounds *createBounds, int isScreenScroll)
 Performs spawning of nearby actors as they enter the screen via scrolling or zoom changes.
void incZposCount ()
 Updates the Z-position index for the next spawned actor.
float addZposCount ()
 Gets the Z position for the next spawned actor.
void incZposCount_layer2 ()
 Updates the Z-position index for the next spawned actor on layer 2.
float addZposCount_layer2 ()
 Gets the Z position for the next spawned actor on layer 2.
void incMapObjZposCount ()
 Updates the Z-position index for the next spawned non-enemy actor.
float addMapObjZposCount ()
 Gets the Z position for the next spawned non-enemy actor.
void incMapObjZposCount_layer2 ()
 Updates the Z-position index for the next spawned non-enemy actor on layer 2.
float addMapObjZposCount_layer2 ()
 Gets the Z position for the next spawned non-enemy actor on layer 2.
dActor_cmapActorSpawn (sMapActorData *data, dActorData_c *info, u8 *spawnFlags, u16 *deleteVal, u8 areaNo)
 Spawns an actor from the corresponding map actor data.

Public Attributes

int mZPosCount
 The Z position index for the next spawned actor.
int mZPosCountLayer2
 The Z position index for the next spawned actor on layer 2.
int mMapObjZPosCount
 The Z position index for the next spawned non-enemy actor.
int mMapObjZPosCountLayer2
 The Z position index for the next spawned non-enemy actor on layer 2.
u16 mDeleteVals [MAX_MAP_ACTOR_COUNT]
 A value that each map actor can write to when it is deleted.
u8 mSpawnFlags [MAX_MAP_ACTOR_COUNT]
 Flags indicating each map actor' spawn status. See dActor_c::ACTOR_SPAWN_FLAG_e.
u16 mYoshiColor
 The color of the next spawned Yoshi (egg).
bool mIsEndingDemo
 Whether an end-of-level cutscene is active.
bool mIsGoalPoleDemo
 Whether a goal flagpole cutscene is active.
int mScreenLeftPos
 The screen's left edge.
int mScreenTopPos
 The screen's top edge.
int mPrevScrollBoundaryTileX
 The previous scroll boundary on the X axis, used to check if the screen has scrolled.
int mPrevScrollBoundaryTileY
 The previous scroll boundary on the Y axis, used to check if the screen has scrolled.

Static Public Attributes

static const ProfileName l_GoAheadEnemy []
 The profiles allowed to spawn outside of the screen.
static dActorCreateMng_cm_instance
 The static instance of the map actor creation manager.

Member Function Documentation

◆ ActorCreateInfoClear()

void dActorCreateMng_c::ActorCreateInfoClear ( )

Resets all temporary data for map actor spawning.

Definition at line 20 of file d_actorcreate_manager.cpp.

◆ ScroolAreaInCheck()

bool dActorCreateMng_c::ScroolAreaInCheck ( int boundsEdge,
int areaEdge,
int boundMin,
int boundMax,
int areaMin,
int areaMax )

Checks whether an actor should be spawned based on the camera's current scroll position.

This check succeeds if the actor spawn area's edge lies exactly on the screen boundary's edge and the area overlaps with the boundary on the perpendicular axis.

Parameters
boundsEdgeThe coordinate of the screen boundary edge (on the axis of movement), in tiles.
areaEdgeThe coordinate of the actor's corresponding spawn area edge, in tiles.
boundMinThe minimum coordinate of the boundary on the perpendicular axis, in tiles.
boundMaxThe maximum coordinate of the boundary on the perpendicular axis, in tiles.
areaMinThe minimum coordinate of the spawn area on the perpendicular axis, in tiles.
areaMaxThe maximum coordinate of the spawn area on the perpendicular axis, in tiles.
Returns
true if the actor should be spawned, false otherwise.

Definition at line 30 of file d_actorcreate_manager.cpp.

◆ ScroolAreaInLoopCheck()

bool dActorCreateMng_c::ScroolAreaInLoopCheck ( int boundsEdge,
int areaEdge,
int boundMin,
int boundMax,
int areaMin,
int areaMax )

Checks whether an actor should be spawned due to being close to a screen edge (for looping stages).

Note
In the current implementation, this is a direct wrapper for ScroolAreaInCheck().

Definition at line 37 of file d_actorcreate_manager.cpp.

◆ setMapActorCreate()

void dActorCreateMng_c::setMapActorCreate ( )

Initializes map actors on first area load.

Definition at line 41 of file d_actorcreate_manager.cpp.

◆ setMapActorCreate_next()

void dActorCreateMng_c::setMapActorCreate_next ( )

Initializes map actors on area reload.

Definition at line 58 of file d_actorcreate_manager.cpp.

◆ MapActorInital_set()

void dActorCreateMng_c::MapActorInital_set ( )

Triggers actor creation on first area load.

Definition at line 78 of file d_actorcreate_manager.cpp.

◆ MapActorInital_next()

void dActorCreateMng_c::MapActorInital_next ( )

Triggers actor creation on area reload.

Definition at line 89 of file d_actorcreate_manager.cpp.

◆ GlobalActorCheck()

bool dActorCreateMng_c::GlobalActorCheck ( sMapActorData * data)

Checks whether the profile associated to the map actor is allowed to ignore screen bounds on spawn.

Returns
true if the actor is in the "global" whitelist.

Definition at line 101 of file d_actorcreate_manager.cpp.

◆ processGroupId()

void dActorCreateMng_c::processGroupId ( sMapActorData * data,
u8 file,
u32 mapActorIdx )

Adds a group-based map actor to the group manager.

Parameters
dataThe map actor to be added.
fileThe course file the map actor is in.
mapActorIdxThe index of the map actor in the level data.

Definition at line 117 of file d_actorcreate_manager.cpp.

◆ GroupIdCheck()

bool dActorCreateMng_c::GroupIdCheck ( ulong param)

Checks whether the provided actor parameters contain a group ID definition.

Returns
true if the actor does NOT use groups, false otherwise.

Definition at line 121 of file d_actorcreate_manager.cpp.

◆ MapActorInitialCreate()

void dActorCreateMng_c::MapActorInitialCreate ( sMapActorData * levelData,
u16 * deleteVal,
u8 * spawnFlags,
int mapActorCount,
bool isAreaReload )

Manages actor spawning when entering a level or area.

Parameters
levelDataThe map actor data for the file/area.
deleteValA pointer to the delete value array for the file/area.
spawnFlagsA pointer to the spawn flags array for the file/area.
mapActorCountThe amount of map actors to process.
isAreaReloadWhether the area is being reloaded (e.g. next goto that points to the same area).

Definition at line 125 of file d_actorcreate_manager.cpp.

◆ MapActorScroolCreateCheck()

void dActorCreateMng_c::MapActorScroolCreateCheck ( )

Checks for screen scrolling and zoom changes to trigger spawning of nearby actors.

Definition at line 234 of file d_actorcreate_manager.cpp.

◆ MapActorScrollCreate()

void dActorCreateMng_c::MapActorScrollCreate ( sMapActorCreateBounds * createBounds,
int isScreenScroll )

Performs spawning of nearby actors as they enter the screen via scrolling or zoom changes.

Parameters
createBoundsThe boundary data required to perform the screen-based checks.
isScreenScrollWhether the actor spawning is triggered by screen scrolling (1) or zoom changes (0).

Definition at line 352 of file d_actorcreate_manager.cpp.

◆ incZposCount()

void dActorCreateMng_c::incZposCount ( )

Updates the Z-position index for the next spawned actor.

Definition at line 450 of file d_actorcreate_manager.cpp.

◆ addZposCount()

float dActorCreateMng_c::addZposCount ( )

Gets the Z position for the next spawned actor.

Definition at line 457 of file d_actorcreate_manager.cpp.

◆ incZposCount_layer2()

void dActorCreateMng_c::incZposCount_layer2 ( )

Updates the Z-position index for the next spawned actor on layer 2.

Definition at line 463 of file d_actorcreate_manager.cpp.

◆ addZposCount_layer2()

float dActorCreateMng_c::addZposCount_layer2 ( )

Gets the Z position for the next spawned actor on layer 2.

Definition at line 470 of file d_actorcreate_manager.cpp.

◆ incMapObjZposCount()

void dActorCreateMng_c::incMapObjZposCount ( )

Updates the Z-position index for the next spawned non-enemy actor.

Definition at line 476 of file d_actorcreate_manager.cpp.

◆ addMapObjZposCount()

float dActorCreateMng_c::addMapObjZposCount ( )

Gets the Z position for the next spawned non-enemy actor.

Definition at line 483 of file d_actorcreate_manager.cpp.

◆ incMapObjZposCount_layer2()

void dActorCreateMng_c::incMapObjZposCount_layer2 ( )

Updates the Z-position index for the next spawned non-enemy actor on layer 2.

Definition at line 489 of file d_actorcreate_manager.cpp.

◆ addMapObjZposCount_layer2()

float dActorCreateMng_c::addMapObjZposCount_layer2 ( )

Gets the Z position for the next spawned non-enemy actor on layer 2.

Definition at line 496 of file d_actorcreate_manager.cpp.

◆ mapActorSpawn()

dActor_c * dActorCreateMng_c::mapActorSpawn ( sMapActorData * data,
dActorData_c * info,
u8 * spawnFlags,
u16 * deleteVal,
u8 areaNo )

Spawns an actor from the corresponding map actor data.

Parameters
dataThe map actor data.
infoThe map actor info.
spawnFlagsA pointer to the actor's spawn flags.
deleteValA pointer to the actor's delete value, or nullptr .
areaNoThe zone the actor will be linked to.
Returns
The spawned actor, or nullptr if it's a dummy actor or the actor creation fails.

Definition at line 502 of file d_actorcreate_manager.cpp.

Member Data Documentation

◆ mZPosCount

int dActorCreateMng_c::mZPosCount

The Z position index for the next spawned actor.

Definition at line 120 of file d_actorcreate_manager.hpp.

◆ mZPosCountLayer2

int dActorCreateMng_c::mZPosCountLayer2

The Z position index for the next spawned actor on layer 2.

Definition at line 121 of file d_actorcreate_manager.hpp.

◆ mMapObjZPosCount

int dActorCreateMng_c::mMapObjZPosCount

The Z position index for the next spawned non-enemy actor.

Definition at line 122 of file d_actorcreate_manager.hpp.

◆ mMapObjZPosCountLayer2

int dActorCreateMng_c::mMapObjZPosCountLayer2

The Z position index for the next spawned non-enemy actor on layer 2.

Definition at line 123 of file d_actorcreate_manager.hpp.

◆ mDeleteVals

u16 dActorCreateMng_c::mDeleteVals[MAX_MAP_ACTOR_COUNT]

A value that each map actor can write to when it is deleted.

Definition at line 125 of file d_actorcreate_manager.hpp.

◆ mSpawnFlags

u8 dActorCreateMng_c::mSpawnFlags[MAX_MAP_ACTOR_COUNT]

Flags indicating each map actor' spawn status. See dActor_c::ACTOR_SPAWN_FLAG_e.

Definition at line 126 of file d_actorcreate_manager.hpp.

◆ mYoshiColor

u16 dActorCreateMng_c::mYoshiColor

The color of the next spawned Yoshi (egg).

Definition at line 127 of file d_actorcreate_manager.hpp.

◆ mIsEndingDemo

bool dActorCreateMng_c::mIsEndingDemo

Whether an end-of-level cutscene is active.

Definition at line 129 of file d_actorcreate_manager.hpp.

◆ mIsGoalPoleDemo

bool dActorCreateMng_c::mIsGoalPoleDemo

Whether a goal flagpole cutscene is active.

Definition at line 130 of file d_actorcreate_manager.hpp.

◆ mScreenLeftPos

int dActorCreateMng_c::mScreenLeftPos

The screen's left edge.

Definition at line 132 of file d_actorcreate_manager.hpp.

◆ mScreenTopPos

int dActorCreateMng_c::mScreenTopPos

The screen's top edge.

Definition at line 133 of file d_actorcreate_manager.hpp.

◆ mPrevScrollBoundaryTileX

int dActorCreateMng_c::mPrevScrollBoundaryTileX

The previous scroll boundary on the X axis, used to check if the screen has scrolled.

Definition at line 134 of file d_actorcreate_manager.hpp.

◆ mPrevScrollBoundaryTileY

int dActorCreateMng_c::mPrevScrollBoundaryTileY

The previous scroll boundary on the Y axis, used to check if the screen has scrolled.

Definition at line 135 of file d_actorcreate_manager.hpp.

◆ l_GoAheadEnemy

const ProfileName dActorCreateMng_c::l_GoAheadEnemy
static
Initial value:
= {
fProfile::EN_PUKUCOIN,
fProfile::EN_KARON,
fProfile::EN_BIGKARON,
fProfile::EN_KARON_HEAD,
fProfile::WAKI_KERONPA,
fProfile::PROFILE_NULL
}

The profiles allowed to spawn outside of the screen.

Definition at line 11 of file d_actorcreate_manager.hpp.

◆ m_instance

dActorCreateMng_c * dActorCreateMng_c::m_instance
static

The static instance of the map actor creation manager.

Definition at line 138 of file d_actorcreate_manager.hpp.