1#include <game/sLib/s_GlobalData.hpp>
2#include <game/bases/d_a_wm_sand_pillar.hpp>
3#include <game/bases/d_wm_lib.hpp>
4#include <game/bases/d_cs_seq_manager.hpp>
6#include <game/bases/d_a_wm_map.hpp>
22 .mStepInitialScale = { 0.01f, 0.01f, 0.01f },
23 .mStepAccel = { 0.001f, 0.003f, 0.003f },
24 .mStepMaxScale = { 0.03f, 0.05f, 0.05f },
25 .mPosY = { -320.0f, -200.0f, -200.0f },
26 .mBottomHeight = { 0.5f, 0.2f, 0.2f },
27 .mTopHeight = { 2.0f, 1.4f, 1.6f },
28 .mPulseBottomHeight = { 0.4f, 0.1f, 0.1f },
29 .mPulseTopHeight = { 1.1f, 1.8f, 1.8f },
30 .mPulseCount = { 3, 1, 1 },
31 .mBottomWaitTime = { 100, 10, 40 },
32 .mTopWaitTime = { 100, 100, 100 }
44 mPos.y = GLOBAL_DATA.mPosY[getNodeIdx()];
52 mPos.y = GLOBAL_DATA.mPosY[getNodeIdx()];
88 nw4r::g3d::ResMdl resMdl =
mResFile.GetResMdl(
"cobSandpillar");
90 nw4r::g3d::ScnMdl::BUFFER_RESMATMISC | nw4r::g3d::ScnMdl::BUFFER_RESTEXSRT | nw4r::g3d::ScnMdl::ANM_TEXPAT);
92 nw4r::g3d::ResAnmChr resAnmChr =
mResFile.GetResAnmChr(
"cobSandpillar");
121void daWmSandPillar_c::initializeState_Ready() {
122 if (getNodeIdx() == NODE_1 || getNodeIdx() == NODE_2) {
129void daWmSandPillar_c::executeState_Ready() {
132 int course = dWmLib::GetCourseNoFromPointName(
"W205");
133 if (dWmLib::IsCourseClear(world, course)) {
134 if (dWmLib::IsCourseFirstClear(world, course)) {
147void daWmSandPillar_c::finalizeState_Ready() {}
153void daWmSandPillar_c::initializeState_BottomWait() {
154 mWaitTimer = GLOBAL_DATA.mBottomWaitTime[getNodeIdx()];
155 mScale.y = GLOBAL_DATA.mBottomHeight[getNodeIdx()];
157 nw4r::g3d::ResAnmChr resAnmChr =
mResFile.GetResAnmChr(
"cobSandpillar");
165void daWmSandPillar_c::executeState_BottomWait() {
176void daWmSandPillar_c::finalizeState_BottomWait() {}
182void daWmSandPillar_c::initializeState_BottomWaitForever() {
183 mScale.y = GLOBAL_DATA.mBottomHeight[getNodeIdx()];
185 nw4r::g3d::ResAnmChr resAnmChr =
mResFile.GetResAnmChr(
"cobSandpillar");
193void daWmSandPillar_c::executeState_BottomWaitForever() {}
195void daWmSandPillar_c::finalizeState_BottomWaitForever() {}
201void daWmSandPillar_c::initializeState_MoveReady() {
203 mScaleStep = -GLOBAL_DATA.mStepInitialScale[getNodeIdx()];
204 mScale.y = GLOBAL_DATA.mBottomHeight[getNodeIdx()];
205 mStepAccel = GLOBAL_DATA.mStepAccel[getNodeIdx()];
211void daWmSandPillar_c::executeState_MoveReady() {
212 float pulseBottomHeight = GLOBAL_DATA.mPulseBottomHeight[getNodeIdx()];
213 float pulseTopHeight = GLOBAL_DATA.mPulseTopHeight[getNodeIdx()];
216 float prevScaleY =
mScale.y;
223 if (prevStep > 0.0f) {
225 }
else if (prevStep < 0.0f) {
230 if (prevScaleY < pulseTopHeight && mScale.y >= pulseTopHeight) {
234 }
else if (prevScaleY > pulseBottomHeight &&
mScale.y <= pulseBottomHeight) {
245void daWmSandPillar_c::finalizeState_MoveReady() {}
251void daWmSandPillar_c::initializeState_MoveUp() {
253 mStepAccel = GLOBAL_DATA.mStepAccel[getNodeIdx()];
255 mStepAccel = GLOBAL_DATA.mStepAccel[getNodeIdx()];
262void daWmSandPillar_c::executeState_MoveUp() {
263 float topHeight = GLOBAL_DATA.mTopHeight[getNodeIdx()];
264 float pulseTopHeight = GLOBAL_DATA.mPulseTopHeight[getNodeIdx()];
275 if (topHeight >= pulseTopHeight) {
276 if (
mScale.y >= topHeight) {
281 if (
mScale.y <= topHeight) {
289void daWmSandPillar_c::finalizeState_MoveUp() {}
295void daWmSandPillar_c::initializeState_TopWait() {
297 mWaitTimer = GLOBAL_DATA.mTopWaitTime[getNodeIdx()];
300void daWmSandPillar_c::executeState_TopWait() {
307void daWmSandPillar_c::finalizeState_TopWait() {}
313void daWmSandPillar_c::initializeState_TopWaitForever() {
316 mWaitTimer = GLOBAL_DATA.mTopWaitTime[getNodeIdx()];
319void daWmSandPillar_c::executeState_TopWaitForever() {}
321void daWmSandPillar_c::finalizeState_TopWaitForever() {}
327void daWmSandPillar_c::initializeState_MoveDown() {
333void daWmSandPillar_c::executeState_MoveDown() {
334 float bottomHeight = GLOBAL_DATA.mBottomHeight[getNodeIdx()];
337 if (
mScale.y <= bottomHeight) {
343void daWmSandPillar_c::finalizeState_MoveDown() {}
349void daWmSandPillar_c::initializeState_TopWaitFromTheStart() {
350 nw4r::g3d::ResAnmChr resAnmChr =
mResFile.GetResAnmChr(
"cobSandpillar");
354 mScale.y = GLOBAL_DATA.mTopHeight[getNodeIdx()];
357void daWmSandPillar_c::executeState_TopWaitFromTheStart() {
361void daWmSandPillar_c::finalizeState_TopWaitFromTheStart() {}
364 if (cutsceneCommandId != dCsSeqMng_c::CUTSCENE_CMD_NONE && !isStaff()) {
371 ulong nodeId = m3d::getNodeID(
mModel.getResMdl(),
"ef_cobSandpillar");
372 mModel.getNodeWorldMtxMultVecZero(nodeId, efPos);
374 mEffect1.createEffect(
"Wm_cs_sandpillar01", 0, &efPos,
nullptr,
nullptr);
375 mEffect2.createEffect(
"Wm_cs_sandpillar02", 0, &efPos,
nullptr,
nullptr);
mMtx_c mMatrix
The actor's partial transformation matrix. See makeMtx() for details.
mVec3_c mScale
The actor's scale (defaults to 1).
mVec3_c mPos
The actor's position.
mAng3_c mAngle
The actor's rotation (for 2D actors).
static dResMng_c * m_instance
The instance of this class.
mSphere_c mClipSphere
A sphere representing the actor's visible area.
static u8 GetCurrentWorld()
The sand pillar world map actor.
dHeapAllocator_c mAllocator
The allocator.
static sFStateID_c< daWmSandPillar_c > StateID_MoveDown
Retracting back to the bottom scale.
static sFStateID_c< daWmSandPillar_c > StateID_TopWaitFromTheStart
Initializing directly at the top before waiting indefinitely.
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.
static sFStateID_c< daWmSandPillar_c > StateID_BottomWait
Waiting at the bottom before pulsing.
virtual void processCutsceneCommand(int cutsceneCommandId, bool isFirstFrame)
Contains the actor-specific logic for processing the current world map cutscene.
static sFStateID_c< daWmSandPillar_c > StateID_Ready
Initial state.
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.
static sFStateID_c< daWmSandPillar_c > StateID_MoveReady
Pulsing up and down before rising to full height.
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.
static sFStateID_c< daWmSandPillar_c > StateID_TopWait
Waiting at the top before retracting.
virtual int draw()
do method for the draw operation.
static sFStateID_c< daWmSandPillar_c > StateID_MoveUp
Rising to the top scale.
int mRemainingPulses
The remaining pulse cycles before the pillar moves all the way to the top.
static sFStateID_c< daWmSandPillar_c > StateID_TopWaitForever
Waiting indefinitely at the top.
static sFStateID_c< daWmSandPillar_c > StateID_BottomWaitForever
Waiting indefinitely at the bottom.
@ SUCCEEDED
The step was completed successfully.
A three-dimensional short angle vector.
A three-dimensional floating point vector.
static const T::GlobalData_t mData
#define ACTOR_PROFILE(profName, className, properties)
Creates an actor profile, using the profile number as the execute and draw order value.
@ FORWARD_LOOP
Play the animation forward in a loop.
@ GAME_HEAP_DEFAULT
The default game heap (alias of MEM1 or MEM2).
EGG::ExpHeap * g_gameHeaps[GAME_HEAP_COUNT]
The game heaps.
#define STATE_DEFINE(class, name)
Defines a state.
The global configuration for the actor.