NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_a_wm_sand_pillar.hpp
1#pragma once
2#include <game/bases/d_effect.hpp>
4#include <game/bases/d_heap_allocator.hpp>
5#include <game/mLib/m_3d/anm_chr.hpp>
6#include <game/mLib/m_3d/anm_tex_srt.hpp>
7#include <game/mLib/m_3d/mdl.hpp>
8#include <game/bases/d_wm_obj_actor.hpp>
9
10/// @brief The sand pillar world map actor.
11/// @ingroup bases
12/// @paramtable
13/// @statetable
15public:
16 enum NodeType_e {
17 NODE_0,
18 NODE_1,
19 NODE_2,
20 NODE_COUNT
21 };
22
23 /// @brief The global configuration for the actor.
24 struct GlobalData_t {
25 float mStepInitialScale[NODE_COUNT]; ///< The initial scale step when moving.
26 float mStepAccel[NODE_COUNT]; ///< The rate at which the scale step approaches mStepMaxScale.
27 float mStepMaxScale[NODE_COUNT]; ///< The maximum scale step.
28 float mPosY[NODE_COUNT]; ///< The base Y coordinate for the actor.
29 float mBottomHeight[NODE_COUNT]; ///< The height of the pillar when resting at the bottom.
30 float mTopHeight[NODE_COUNT]; ///< The height of the pillar when extended at the top.
31 float mPulseBottomHeight[NODE_COUNT]; ///< The height of the pillar when resting during a pulse.
32 float mPulseTopHeight[NODE_COUNT]; ///< The height of the pillar when extended during a pulse.
33 int mPulseCount[NODE_COUNT]; ///< The number of pulses before rising all the way to mTopScaleY.
34 int mBottomWaitTime[NODE_COUNT]; ///< The wait time at the bottom, in frames.
35 int mTopWaitTime[NODE_COUNT]; ///< The wait time at the top, in frames.
36 };
37
38 daWmSandPillar_c(); ///< @copydoc dWmObjActor_c::dWmObjActor_c
39 ~daWmSandPillar_c(); ///< @copydoc dWmObjActor_c::~dWmObjActor_c
40
41 virtual int create();
42 virtual int execute();
43 virtual int draw();
44
45 virtual void finalUpdate();
46
47 virtual void processCutsceneCommand(int cutsceneCommandId, bool isFirstFrame);
48
49 void createModel(); ///< Initializes the resources for the actor.
50 void createEffect(); ///< Creates the sand effects.
51
52 void calcModel(); ///< Updates the model's transformation matrix.
53 void calcScaleStep(); ///< Updates the movement scale step.
54
55 int getNodeIdx() { return ACTOR_PARAM(Node); }
56
57 u32 mUnk188; ///< @unused
58 dHeapAllocator_c mAllocator; ///< The allocator.
59 nw4r::g3d::ResFile mResFile; ///< The resource file.
60 m3d::mdl_c mModel; ///< The model.
61 m3d::anmChr_c mChrAnim; ///< The model animation.
62 nw4r::g3d::ResAnmTexSrt mResAnmTexSrt; ///< The texture animation resource.
63 m3d::anmTexSrt_c mSrtAnim; ///< The texture animation.
64
65 mVec3_c mInitialPos; ///< The actor's initial position.
66 dEf::dLevelEffect_c mEffect1;
67 dEf::dLevelEffect_c mEffect2;
68
70
71 BOOL mIsPulsing; ///< Whether the pillar is doing a regular pulse.
72 int mWaitTimer; ///< The countdown timer for the Wait states.
73 float mScaleStep; ///< The current scale step.
74 float mTargetScaleStep; ///< The target scale step.
75 int mRemainingPulses; ///< The remaining pulse cycles before the pillar moves all the way to the top.
76 float mStepAccel; ///< The rate at which the scale step approaches mTargetScaleStep.
77 BOOL mHasCourseCond; ///< Whether the actor is linked to a specific course.
78
79 STATE_FUNC_DECLARE(daWmSandPillar_c, Ready); ///< Initial state.
80 STATE_FUNC_DECLARE(daWmSandPillar_c, BottomWait); ///< Waiting at the bottom before pulsing.
81 STATE_FUNC_DECLARE(daWmSandPillar_c, MoveReady); ///< Pulsing up and down before rising to full height.
82 STATE_FUNC_DECLARE(daWmSandPillar_c, MoveUp); ///< Rising to the top scale.
83 STATE_FUNC_DECLARE(daWmSandPillar_c, TopWait); ///< Waiting at the top before retracting.
84 STATE_FUNC_DECLARE(daWmSandPillar_c, MoveDown); ///< Retracting back to the bottom scale.
85 STATE_FUNC_DECLARE(daWmSandPillar_c, BottomWaitForever); ///< Waiting indefinitely at the bottom.
86 STATE_FUNC_DECLARE(daWmSandPillar_c, TopWaitForever); ///< Waiting indefinitely at the top.
87 STATE_FUNC_DECLARE(daWmSandPillar_c, TopWaitFromTheStart); ///< Initializing directly at the top before waiting indefinitely.
88
89 ACTOR_PARAM_CONFIG(Node, 0, 8); ///< The index into the @ref GlobalData_t "hardcoded node configuration".
90};
dWmObjActor_c()
Constructs a new object.
ACTOR_PARAM_CONFIG(Node, 0, 8)
The index into the hardcoded node configuration.
dHeapAllocator_c mAllocator
The allocator.
virtual void finalUpdate()
Code to be executed after all actors' execute operation has run.
void calcModel()
Updates the model's transformation matrix.
int mWaitTimer
The countdown timer for the Wait states.
sFStateMgr_c< daWmSandPillar_c, sStateMethodUsr_FI_c > mStateMgr
The state manager.
void createEffect()
Creates the sand effects.
m3d::mdl_c mModel
The model.
nw4r::g3d::ResAnmTexSrt mResAnmTexSrt
The texture animation resource.
virtual void processCutsceneCommand(int cutsceneCommandId, bool isFirstFrame)
Contains the actor-specific logic for processing the current world map cutscene.
float mStepAccel
The rate at which the scale step approaches mTargetScaleStep.
m3d::anmChr_c mChrAnim
The model animation.
void calcScaleStep()
Updates the movement scale step.
~daWmSandPillar_c()
Destroys the object.
virtual int create()
do method for the create operation.
m3d::anmTexSrt_c mSrtAnim
The texture animation.
virtual int execute()
do method for the execute operation.
BOOL mIsPulsing
Whether the pillar is doing a regular pulse.
void createModel()
Initializes the resources for the actor.
BOOL mHasCourseCond
Whether the actor is linked to a specific course.
float mTargetScaleStep
The target scale step.
daWmSandPillar_c()
Constructs a new object.
mVec3_c mInitialPos
The actor's initial position.
nw4r::g3d::ResFile mResFile
The resource file.
float mScaleStep
The current scale step.
virtual int draw()
do method for the draw operation.
int mRemainingPulses
The remaining pulse cycles before the pillar moves all the way to the top.
A three-dimensional floating point vector.
Definition m_vec.hpp:122
A wrapper for sStateMgr_c that uses sFStateFct_c and sStateIDChk_c.
#define STATE_FUNC_DECLARE(class, name)
Declares a state.
Definition s_State.hpp:12
The global configuration for the actor.
float mPosY[NODE_COUNT]
The base Y coordinate for the actor.
int mPulseCount[NODE_COUNT]
The number of pulses before rising all the way to mTopScaleY.
int mTopWaitTime[NODE_COUNT]
The wait time at the top, in frames.
int mBottomWaitTime[NODE_COUNT]
The wait time at the bottom, in frames.
float mTopHeight[NODE_COUNT]
The height of the pillar when extended at the top.
float mStepMaxScale[NODE_COUNT]
The maximum scale step.
float mBottomHeight[NODE_COUNT]
The height of the pillar when resting at the bottom.
float mStepInitialScale[NODE_COUNT]
The initial scale step when moving.
float mPulseTopHeight[NODE_COUNT]
The height of the pillar when extended during a pulse.
float mStepAccel[NODE_COUNT]
The rate at which the scale step approaches mStepMaxScale.
float mPulseBottomHeight[NODE_COUNT]
The height of the pillar when resting during a pulse.