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

#include <game/bases/d_a_wm_cloud.hpp>

Inheritance diagram for daWmCloud_c:
[legend]

Description

The actor for the decorative clouds used in the World 7 map.

The actor represents an animated cloud model composed of multiple bones.

Each bone listed in sGroupNodeNames is treated as an independent visual group, and is culled individually every frame. This allows the model to be partially rendered, improving performance.

The bone indices are resolved during initialization via initGroupNodeIds. Then on every frame the actor:

  • Computes each bone’s world position.
  • Builds a bounding sphere, using the radius from GlobalData_t::mGroupNodeRadii.
  • Tests the sphere against the camera frustum.
  • Toggles visibility of the bone depending on the test result.

Animation playback is synchronized with background music using mpBgmSync, which adjusts animation rate dynamically.

Definition at line 25 of file d_a_wm_cloud.hpp.

Classes

struct  GlobalData_t
 The global configuration for the actor. More...

Public Types

enum  ANIM_e {
  CS_W7_Cloud ,
  ANIM_COUNT
}
 The available animations for this actor. More...
typedef void(daWmCloud_c::* ProcFunc) ()
Public Types inherited from dWmObjActor_c
enum  PROC_TYPE_e {
  PROC_TYPE_EXEC ,
  PROC_COUNT
}
Public Types inherited from dBaseActor_c
enum  ACTOR_KIND_e {
  ACTOR_MAP_GENERIC ,
  ACTOR_MAP_DEMO ,
  ACTOR_MAP_OBJECT ,
  ACTOR_MAP_ENEMY ,
  ACTOR_MAP_PLAYER ,
  ACTOR_MAP_STOP ,
  ACTOR_UNK_6 ,
  ACTOR_MENU_PLAYER ,
  ACTOR_GENERIC
}
 An identifier that represents the actor's kind. More...
Public Types inherited from fBase_c
enum  LIFECYCLE_e {
  CREATING ,
  ACTIVE ,
  DELETING
}
 The possible lifecycle states. More...
enum  GROUP_TYPE_e {
  OTHER ,
  SCENE ,
  ACTOR ,
  ENEMY
}
 The possible group types. More...
enum  MAIN_STATE_e {
  CANCELED ,
  ERROR ,
  SUCCESS ,
  WAITING
}
 The possible operation results. More...
enum  PACK_RESULT_e {
  NOT_READY ,
  SUCCEEDED ,
  FAILED
}
 The possible operation step results. More...
enum  PROC_DISABLE_e {
  ROOT_DISABLE_EXECUTE = BIT_FLAG(0) ,
  DISABLE_EXECUTE = BIT_FLAG(1) ,
  ROOT_DISABLE_DRAW = BIT_FLAG(2) ,
  DISABLE_DRAW = BIT_FLAG(3)
}
 Controls if the execute and draw operations should be skipped. More...

Public Member Functions

 daWmCloud_c ()
 Constructs a new object.
 ~daWmCloud_c ()
 Destroys the object.
virtual int create ()
 do method for the create operation.
virtual int execute ()
 do method for the execute operation.
virtual int draw ()
 do method for the draw operation.
virtual int doDelete ()
 do method for the delete operation.
virtual void processCutsceneCommand (int cutsceneCommandId, bool isFirstFrame)
 Contains the actor-specific logic for processing the current world map cutscene.
void createModel ()
 Initializes the resources for the actor.
void initState ()
 Sets up the actor's initial state.
void initGroupNodeIds ()
 Initializes the bone index values from the model bone names.
void calcModel ()
 Updates the model's transformation matrix.
void calcCulling ()
 Performs per-node culling based on the camera frustum.
void init_exec ()
 Process initialization function for the exec process type.
void mode_exec ()
 Process function for the exec process type.
Public Member Functions inherited from dWmObjActor_c
 dWmObjActor_c ()
 Constructs a new object.
 ~dWmObjActor_c ()
 Destroys the object.
virtual int GetActorType ()
 Gets the actor kind. See ACTOR_KIND_e.
virtual void vf74 ()
virtual bool vf78 ()
int GetOpenStatus ()
int GetClearStatus ()
int GetCurrentPlayResultStatus ()
bool IsCourseOmoteClear ()
bool IsCourseUraClear ()
bool IsCourseOtasukeClear ()
bool IsCourseClear ()
bool IsCourseFirstOmoteClear ()
bool IsCourseFirstUraClear ()
bool IsCourseFailed ()
bool IsCourseFirstClear ()
bool IsCourseOtasukeClearSimple ()
bool IsCourseOmoteClearSimple ()
bool IsCourseUraClearSimple ()
bool IsCourseUraOtasukeClearSimple ()
 ACTOR_PARAM_CONFIG (CourseNo, 0, 8)
 The level number associated to the object.
 ACTOR_PARAM_CONFIG (PathNode, 8, 8)
 The path node associated to the object.
Public Member Functions inherited from dWmDemoActor_c
 dWmDemoActor_c ()
 Constructs a new actor.
virtual ~dWmDemoActor_c ()
 Destroys the actor.
virtual bool checkCutEnd ()
virtual void setCutEnd ()
virtual void clearCutEnd ()
bool isStaff ()
void InitJumpParam (const mVec3_c &startPos, const mVec3_c &targetPos, int numFrames, float jumpSpeed, float maxYSpeed)
void __initJumpParam1 (const mVec3_c &startPos, const mVec3_c &targetPos, int numFrames, float jumpSpeed, float maxYSpeed)
void __initJumpParam2 (const mVec3_c &startPos, const mVec3_c &targetPos, int numFrames, float jumpSpeed, float maxYSpeed)
void initJumpBase (mVec3_c pos, int numFrames, float jumpSpeed)
bool procJumpBase ()
void _initDemoJumpBaseCore (const mVec3_c &pos, int delay, int frames, float jumpSpeed, float startScale, float targetScale, const short &angY)
void _initDemoJumpBase (const mVec3_c &pos, int delay, int frames, float jumpSpeed, float startScale, float targetScale, const mVec3_c &dir)
bool _procDemoJumpBase ()
void setDirection (const mVec3_c &dir)
void rotDirectionY (short angle, bool is3D)
void rotDirectionX (short angle, bool is3D)
bool checkArriveTargetXYZ (const mVec3_c &startPos, const mVec3_c &targetPos)
bool checkArriveTargetXZ (const mVec3_c &startPos, const mVec3_c &targetPos)
void CreateShadowModel (const char *arc, const char *path, const char *mdlName, bool param4)
void CalcShadow (float yOffs, float scaleX, float scaleY, float scaleZ)
void CalcShadow (float yOffs, float scale)
void DrawShadow (bool param1)
float GetBgPosY (const mVec3_c &startPos, const mVec3_c &targetPos, int directionType)
void CsSPosSimple (int directionType, float yTarget)
void clearSpeedAll ()
void adjustHeightBase (const mVec3_c &startPos, const mVec3_c &targetPos, int directionType)
bool isCutsceneCommandPlaying (const int *cmdList, int cmdCount)
Public Member Functions inherited from dWmActor_c
 dWmActor_c ()
 Constructs a new actor.
Public Member Functions inherited from dBaseActor_c
 dBaseActor_c ()
 Constructs a new actor.
void calcSpeed ()
 Updates the actor's speed (3D actors). See here for details.
void calcSpeedXY ()
 Updates the actor's speed (2D actors). See here for details.
void calcSpeedX ()
 Updates the actor's X speed. See here for details.
void calcFallSpeed ()
 Updates the actor's falling speed. See here for details.
void calcSpeedY ()
 Updates the actor's Y speed. See here for details.
void calcSpeedF ()
 Updates the actor's forward speed. See here for details.
void makeMtx ()
 Generates a partial transformation matrix for the actor and stores it in mMatrix.
mVec3_c getCenterPos () const
 Gets the actor's centered position.
void posMove (mVec3_c &delta)
 Moves the actor by the given delta.
void posMove ()
 Moves the actor by its speed.
int GetProfNameActorNum (ProfileName profile)
 Counts the instances of the given actor profile.
float getCenterX () const
float getCenterY () const
float getCenterZ () const
Public Member Functions inherited from dBase_c
 dBase_c ()
 Constructs a new base.
virtual ~dBase_c ()
 Destroys the base.
virtual const char * getKindString () const
 Gets the base's kind string.
Public Member Functions inherited from fBase_c
 fBase_c ()
 Constructs a new base.
void deleteRequest ()
 Requests deletion of the base.
fBase_cgetConnectParent () const
 Gets the base's parent.
fBase_cgetConnectChild () const
 Gets the base's first child.
fBase_cgetConnectBrNext () const
 Gets the base's next sibling.
bool checkChildProcessCreateState () const
 Checks if the base has at least one child in the CREATING state.
Public Member Functions inherited from cOwnerSetMg_c
 cOwnerSetMg_c ()
 Constructs a new set container.
 ~cOwnerSetMg_c ()
 Destroys the set.
void add (cOwnerSetNd_c *nd, void *owner)
 Adds a node to the set.
void remove (cOwnerSetNd_c *nd, void *owner)
 Removes a node from the set.

Static Public Member Functions

static void hideNode (nw4r::g3d::ResNode node)
static void showNode (nw4r::g3d::ResNode node)
Static Public Member Functions inherited from dWmDemoActor_c
static dWmDemoActor_cGetChildDemoActor (dBaseActor_c *prev, dWmDemoActor_c *&next)
Static Public Member Functions inherited from dBaseActor_c
static void draw2DActorOnLyt1 ()
 Calls draw2D() on every actor.
static void draw2DActorOnLyt2 ()
 Calls draw2D_lyt2() on every actor.
static dBaseActor_cconstruct (ProfileName profName, unsigned long param, const mVec3_c *position, const mAng3_c *rotation)
 Creates an actor without a parent.
static dBaseActor_cconstruct (ProfileName profName, dBase_c *parent, unsigned long param, const mVec3_c *position, const mAng3_c *rotation)
 Creates a child actor with the given parent.
Static Public Member Functions inherited from dBase_c
static dBase_csearchBaseByProfName (ProfileName profile, const dBase_c *parent)
 Searches for a base with a given profile name, optionally under a given parent.
static void initLoader ()
 Sets the callbacks for the scrapped relocatable profile system.
static dBase_ccreateBase (ProfileName profName, dBase_c *parent, unsigned long param, u8 groupType)
 Creates a child base under the given parent.
static dBase_ccreateRoot (ProfileName profName, unsigned long param, u8 groupType)
 Creates a root base.
Static Public Member Functions inherited from fBase_c
static void * operator new (size_t)
 new operator override for all bases.
static void operator delete (void *)
 delete operator override for all bases.
static fBase_ccreateChild (ProfileName profName, fBase_c *parent, unsigned long param, u8 groupType)
 Creates a child base under the given parent.
static fBase_ccreateRoot (ProfileName profName, unsigned long param, u8 groupType)
 Creates a root base.

Public Attributes

u32 mUnk188
dHeapAllocator_c mAllocator
 The allocator.
nw4r::g3d::ResFile mResFile
 The resource file.
m3d::smdl_c mModel
 The model.
m3d::anmChr_c mChrAnim [ANIM_COUNT]
 The model animations.
u32 mUnk250
PROC_TYPE_e mCurrProc
 The current process type. See dWmObjActor_c::PROC_TYPE_e.
int mGroupNodeIds [NODE_COUNT]
 The bone indices, resolved from sGroupNodeNames.
mSphere_c mCurrNodeClipSphere
 The sphere currently in use during per-node culling checks.
dWmBgmSync_cmpBgmSync
 The background music synchronization helper.
Public Attributes inherited from dWmObjActor_c
int mResNodeIdx
 The index of the model's root resource node.
Public Attributes inherited from dBaseActor_c
mMtx_c mMatrix
 The actor's partial transformation matrix. See makeMtx() for details.
mVec3_c mPos
 The actor's position.
mVec3_c mLastPos
 The actor's position in the previous frame.
mVec3_c mPosDelta
 The actor's position delta since the previous frame.
mVec3_c mCenterOffs
 The offset from the position to the center of the actor (defaults to 0).
mVec3_c mScale
 The actor's scale (defaults to 1).
mVec3_c mSpeed
 The actor's speed.
mVec3_c mSpeedMax
 The actor's maximum speed.
mAng3_c mAngle
 The actor's rotation (for 2D actors).
mAng3_c mAngle3D
 The actor's rotation (for 3D actors).
float mSpeedF
 The actor's horizontal speed.
float mMaxSpeedF
 The actor's maximum horizontal speed.
float mAccelY
 The actor's vertical acceleration.
float mMaxFallSpeed
 The actor's maximum fall speed.
float mAccelF
 The actor's horizontal acceleration.
u32 mActorProperties
 The actor's properties. See fProfile::fActorProfile_c::mActorProperties.
bool mVisible
 Whether the actor should be visible or not. Defaults to true .
Public Attributes inherited from fBase_c
fBaseID_e mUniqueID
 The base's unique identifier.
u32 mParam
 A bitfield that configures the base's behaviour. Its usage varies from profile to profile.
ProfileName mProfName
 The base's profile name.

Static Public Attributes

static const int NODE_COUNT = 20
static const char * sGroupNodeNames [NODE_COUNT]
 The bone names used for the culling mechanism.

Additional Inherited Members

Protected Member Functions inherited from dWmActor_c
virtual int preCreate ()
 pre method for the create operation.
virtual void postCreate (fBase_c::MAIN_STATE_e status)
 post method for the create operation.
virtual int preDelete ()
 pre method for the delete operation.
virtual void postDelete (fBase_c::MAIN_STATE_e status)
 post method for the delete operation.
virtual int preExecute ()
 pre method for the execute operation.
virtual void postExecute (fBase_c::MAIN_STATE_e status)
 post method for the execute operation.
virtual int preDraw ()
 pre method for the draw operation.
virtual void postDraw (fBase_c::MAIN_STATE_e status)
 post method for the draw operation.
virtual ~dWmActor_c ()
 Destroys the actor.
Protected Member Functions inherited from dBaseActor_c
virtual ~dBaseActor_c ()
 Destroys the actor.
virtual void draw2D ()
 Alternate drawing function used to draw 3D models in front of 2D graphics (first draw pass).
virtual void draw2D_lyt2 ()
 Alternate drawing function used to draw 3D models in front of 2D graphics (second draw pass).
virtual void finalUpdate ()
 Code to be executed after all actors' execute operation has run.
Protected Member Functions inherited from fBase_c
bool isProcControlFlag (u8 flag) const
 Checks if a flag is set in mProcControl.
void setProcControlFlag (u8 flag)
 Sets a flag in mProcControl.
void clearProcControlFlag (u8 flag)
 Clears a flag in mProcControl.
virtual void deleteReady ()
 Informs the base that it's about to be deleted.
virtual bool entryFrmHeap (unsigned long size, EGG::Heap *parentHeap)
 Creates a heap of the given size for the base.
virtual bool entryFrmHeapNonAdjust (unsigned long size, EGG::Heap *parentHeap)
 Creates a heap of the given size for the base.
virtual bool createHeap ()
 [Does nothing].
virtual ~fBase_c ()
 Destroys the base.
Static Protected Member Functions inherited from dWmActor_c
static dWmActor_cconstruct (ProfileName profName, unsigned long param, const mVec3_c *position, const mAng3_c *rotation)
 Creates a world map actor without a parent. See dBaseActor_c::construct.
static dWmActor_cconstruct (ProfileName profName, dBase_c *base, unsigned long param, const mVec3_c *position, const mAng3_c *rotation)
 Creates a child world map actor with the given parent. See dBaseActor_c::construct.
static void setSoftLight_Map (m3d::bmdl_c &mdl)
 Sets the soft light effect for map actors.
static void setSoftLight_MapObj (m3d::bmdl_c &mdl)
 Sets the soft light effect for map objects.
static void setSoftLight_Enemy (m3d::bmdl_c &mdl)
 Sets the soft light effect for enemies.
static void setSoftLight_Boss (m3d::bmdl_c &mdl)
 Sets the soft light effect for bosses.
Protected Attributes inherited from dWmDemoActor_c
bool m_00
bool mIsCutEnd
mHeapAllocator_c mHeapAllocator
m3d::smdl_c mModel
dWmSVMdl_cmSvMdl
mVec3_c mTargetPos
float mScaleCurr
float mScaleDelta
float mScaleTarget
int mScaleDelay
Protected Attributes inherited from dWmActor_c
mSphere_c mClipSphere
 A sphere representing the actor's visible area.
Protected Attributes inherited from dBase_c
const char * mpKindString
 The base's kind string.
const char * mpNameString
 The base's profile name string.
Protected Attributes inherited from fBase_c
u8 mLifecycleState
 The base's lifecycle state. Value is a LIFECYCLE_e.
bool mDeleteRequested
 If deletion of the base was requested, but the delete operation has not been scheduled yet.
bool mDeferExecute
 If the create operation was completed, but scheduling the execute and draw operations isn't possible at this time.
bool mDeferRetryCreate
 If the create operation has not been completed, and rescheduling it isn't possible at this time.
u8 mGroupType
 The base's group type. Value is a GROUP_TYPE_e.
u8 mProcControl
 The operations to be skipped. Value is a PROC_DISABLE_e.
fManager_c mMng
 The base's process manager.
fBaHelper_cmpUnusedHelper
 See Unused Content.
fLiMgBa_c mUnusedList
 See Unused Content.
EGG::FrmHeap * mHeap
 The base's dedicated heap.
Static Protected Attributes inherited from fBase_c
static int(* sLoadAsyncCallback )()
 See Unused Content.
static void(* sUnloadCallback )()
 See Unused Content.

Member Typedef Documentation

◆ ProcFunc

typedef void(daWmCloud_c::* daWmCloud_c::ProcFunc) ()

Definition at line 42 of file d_a_wm_cloud.hpp.

Member Enumeration Documentation

◆ ANIM_e

The available animations for this actor.

Definition at line 37 of file d_a_wm_cloud.hpp.

Constructor & Destructor Documentation

◆ daWmCloud_c()

daWmCloud_c::daWmCloud_c ( )

Constructs a new object.

Definition at line 66 of file d_a_wm_cloud.cpp.

◆ ~daWmCloud_c()

daWmCloud_c::~daWmCloud_c ( )

Destroys the object.

Definition at line 68 of file d_a_wm_cloud.cpp.

Member Function Documentation

◆ create()

int daWmCloud_c::create ( )
virtual

do method for the create operation.

Returns
A PACK_RESULT_e value.

Reimplemented from dWmDemoActor_c.

Definition at line 74 of file d_a_wm_cloud.cpp.

◆ execute()

int daWmCloud_c::execute ( )
virtual

do method for the execute operation.

Returns
A PACK_RESULT_e value.

Implements dWmDemoActor_c.

Definition at line 90 of file d_a_wm_cloud.cpp.

◆ draw()

int daWmCloud_c::draw ( )
virtual

do method for the draw operation.

Returns
A PACK_RESULT_e value.

Reimplemented from dWmDemoActor_c.

Definition at line 115 of file d_a_wm_cloud.cpp.

◆ doDelete()

int daWmCloud_c::doDelete ( )
virtual

do method for the delete operation.

This method was renamed due to conflict with the delete C++ keyword.

Returns
A PACK_RESULT_e value.

Reimplemented from dWmDemoActor_c.

Definition at line 120 of file d_a_wm_cloud.cpp.

◆ processCutsceneCommand()

void daWmCloud_c::processCutsceneCommand ( int cutsceneCommandId,
bool isFirstFrame )
virtual

Contains the actor-specific logic for processing the current world map cutscene.

Parameters
cutsceneCommandIdThe cutscene type.
isFirstFrametrue on the first frame the cutscene is executing, false on subsequent frames.

Reimplemented from dWmDemoActor_c.

Definition at line 178 of file d_a_wm_cloud.cpp.

◆ createModel()

void daWmCloud_c::createModel ( )

Initializes the resources for the actor.

Definition at line 124 of file d_a_wm_cloud.cpp.

◆ initState()

void daWmCloud_c::initState ( )

Sets up the actor's initial state.

Definition at line 162 of file d_a_wm_cloud.cpp.

◆ initGroupNodeIds()

void daWmCloud_c::initGroupNodeIds ( )

Initializes the bone index values from the model bone names.

Definition at line 184 of file d_a_wm_cloud.cpp.

◆ calcModel()

void daWmCloud_c::calcModel ( )

Updates the model's transformation matrix.

Definition at line 152 of file d_a_wm_cloud.cpp.

◆ calcCulling()

void daWmCloud_c::calcCulling ( )

Performs per-node culling based on the camera frustum.

Definition at line 194 of file d_a_wm_cloud.cpp.

◆ init_exec()

void daWmCloud_c::init_exec ( )

Process initialization function for the exec process type.

Definition at line 172 of file d_a_wm_cloud.cpp.

◆ mode_exec()

void daWmCloud_c::mode_exec ( )

Process function for the exec process type.

Definition at line 176 of file d_a_wm_cloud.cpp.

◆ hideNode()

void daWmCloud_c::hideNode ( nw4r::g3d::ResNode node)
inlinestatic

Definition at line 64 of file d_a_wm_cloud.hpp.

◆ showNode()

void daWmCloud_c::showNode ( nw4r::g3d::ResNode node)
inlinestatic

Definition at line 70 of file d_a_wm_cloud.hpp.

Member Data Documentation

◆ NODE_COUNT

const int daWmCloud_c::NODE_COUNT = 20
static

Definition at line 27 of file d_a_wm_cloud.hpp.

◆ mUnk188

u32 daWmCloud_c::mUnk188

Definition at line 76 of file d_a_wm_cloud.hpp.

◆ mAllocator

dHeapAllocator_c daWmCloud_c::mAllocator

The allocator.

Definition at line 77 of file d_a_wm_cloud.hpp.

◆ mResFile

nw4r::g3d::ResFile daWmCloud_c::mResFile

The resource file.

Definition at line 78 of file d_a_wm_cloud.hpp.

◆ mModel

m3d::smdl_c daWmCloud_c::mModel

The model.

Definition at line 79 of file d_a_wm_cloud.hpp.

◆ mChrAnim

m3d::anmChr_c daWmCloud_c::mChrAnim[ANIM_COUNT]

The model animations.

Definition at line 80 of file d_a_wm_cloud.hpp.

◆ mUnk250

u32 daWmCloud_c::mUnk250

Definition at line 81 of file d_a_wm_cloud.hpp.

◆ mCurrProc

PROC_TYPE_e daWmCloud_c::mCurrProc

The current process type. See dWmObjActor_c::PROC_TYPE_e.

Definition at line 82 of file d_a_wm_cloud.hpp.

◆ mGroupNodeIds

int daWmCloud_c::mGroupNodeIds[NODE_COUNT]

The bone indices, resolved from sGroupNodeNames.

A value of -1 indicates an unused or missing node.

Definition at line 86 of file d_a_wm_cloud.hpp.

◆ mCurrNodeClipSphere

mSphere_c daWmCloud_c::mCurrNodeClipSphere

The sphere currently in use during per-node culling checks.

Definition at line 87 of file d_a_wm_cloud.hpp.

◆ mpBgmSync

dWmBgmSync_c* daWmCloud_c::mpBgmSync

The background music synchronization helper.

Definition at line 88 of file d_a_wm_cloud.hpp.

◆ sGroupNodeNames

const char * daWmCloud_c::sGroupNodeNames
static

The bone names used for the culling mechanism.

Entries may be null, indicating unused slots.

Definition at line 8 of file d_a_wm_cloud.hpp.