2#include <game/bases/d_cs_seq_manager.hpp>
3#include <game/bases/d_a_wm_dokan_route.hpp>
4#include <game/bases/d_s_world_map_static.hpp>
5#include <game/bases/d_wm_lib.hpp>
6#include <game/bases/d_info.hpp>
7#include <game/bases/d_wm_se_manager.hpp>
8#include <game/sLib/s_GlobalData.hpp>
25 {
mVec3_c(0.0f, 0.0f, 0.0f), 1.0f, 60, 98, 30, daWmDokanRoute_c::EAST},
26 {
mVec3_c(0.0f, 0.0f, 0.0f), 1.0f, 30, 75, 15, daWmDokanRoute_c::SOUTH},
27 {
mVec3_c(0.0f, 0.0f, 0.0f), 1.0f, 90, 160, 15, daWmDokanRoute_c::WEST},
28 {
mVec3_c(0.0f, 0.0f, 0.0f), 1.0f, 120, 155, 15, daWmDokanRoute_c::SOUTH},
29 {
mVec3_c(0.0f, 0.0f, 0.0f), 1.0f, 110, 150, 15, daWmDokanRoute_c::SOUTH},
30 {
mVec3_c(0.0f, 0.0f, 0.0f), 1.0f, 155, 175, 15, daWmDokanRoute_c::SOUTH}
59 static const ProcFunc Proc_tbl[PROC_COUNT] = {
83 nw4r::g3d::ResMdl resMdl =
mResFile.GetResMdl(
"cobDokanRoute");
84 mModel.create(resMdl, &
mAllocator, nw4r::g3d::ScnMdl::ANM_TEXSRT | nw4r::g3d::ScnMdl::BUFFER_RESMATMISC, 1);
86 static const char *resAnmNames[ANIM_COUNT] = {
94 for (
int i = 0; i < ANIM_COUNT; i++) {
95 nw4r::g3d::ResAnmChr resAnmChr =
mResFile.GetResAnmChr(resAnmNames[i]);
97 mChrAnim[i].mPlayMode = playModes[i];
101 nw4r::g3d::ResAnmTexSrt resAnmTexSrt =
mResFile.GetResAnmTexSrt(resAnmNames[i]);
103 mSrtAnim[i].setPlayMode(playModes[i], 0);
132 float scale = GLOBAL_DATA.mScaleMultiplier;
133 mScale.set(scale, scale, scale);
144 if (cutsceneCommandId == dCsSeqMng_c::CUTSCENE_CMD_NONE) {
149 if (cutsceneCommandId == dCsSeqMng_c::CUTSCENE_CMD_COURSE_UNLOCK) {
154 if (cutsceneCommandId == dCsSeqMng_c::CUTSCENE_CMD_COURSE_UNLOCK) {
162 u8 nodeNum = GetNodeNum();
164 s16 pipeDir = GLOBAL_DATA.mNodeConfigs[nodeNum].mDirection;
194 s16 angle = rot.xzAng();
198 mSrtAnim[cobDokanRoute].setFrame(frame, 0);
202 u8 nodeNum = GetNodeNum();
203 int courseNo = dWmLib::GetCourseNoFromPointName(
sPointNames[nodeNum]);
204 dInfo_c *info = dInfo_c::getInstance();
209 if (dWmLib::IsCourseOmoteClear(dScWMap_c::m_WorldNo, courseNo) &&
210 !dWmLib::IsCourseFirstOmoteClear(dScWMap_c::m_WorldNo, courseNo, info->mCurrentCourseNode)
217 if (dWmLib::IsCourseUraClear(dScWMap_c::m_WorldNo, courseNo) &&
218 !dWmLib::IsCourseFirstUraClear(dScWMap_c::m_WorldNo, courseNo, info->mCurrentCourseNode)
228 mChrAnim[cobDokanRoute].setFrame(frame);
229 mChrAnim[cobDokanRoute].setRate(0.0f);
233 u8 nodeNum = GetNodeNum();
234 int courseNo = dWmLib::GetCourseNoFromPointName(
sPointNames[nodeNum]);
235 dInfo_c *info = dInfo_c::getInstance();
238 if (
sExitTypes[nodeNum] !=
EXIT_TYPE_SECRET && dWmLib::IsCourseFirstOmoteClear(dScWMap_c::m_WorldNo, courseNo, info->mCurrentCourseNode) ||
239 sExitTypes[nodeNum] ==
EXIT_TYPE_SECRET && dWmLib::IsCourseFirstUraClear(dScWMap_c::m_WorldNo, courseNo, info->mCurrentCourseNode)) {
240 mStateTimer = GLOBAL_DATA.mNodeConfigs[nodeNum].mInitialDelay;
246 u8 nodeNum = GetNodeNum();
262 dWmSeManager_c::m_pInstance->playSound(dWmSeManager_c::WM_SE_OBJ_CS_DOKAN,
mPos, 1);
263 mChrAnim[cobDokanRoute].setRate(GLOBAL_DATA.mNodeConfigs[nodeNum].mAnmRate);
264 mStateTimer = GLOBAL_DATA.mNodeConfigs[nodeNum].mAnimDuration - GLOBAL_DATA.mNodeConfigs[nodeNum].mInitialDelay;
273 if (
mStateTimer <= GLOBAL_DATA.mNodeConfigs[nodeNum].mDecelDuration) {
274 float decelFrames = (float) GLOBAL_DATA.mNodeConfigs[nodeNum].mDecelDuration -
mStateTimer;
275 float decelPercent = decelFrames / GLOBAL_DATA.mNodeConfigs[nodeNum].mDecelDuration;
276 float rate = (1.0f - decelPercent) * GLOBAL_DATA.mNodeConfigs[nodeNum].mAnmRate;
277 mChrAnim[cobDokanRoute].setRate(rate);
285 mChrAnim[cobDokanRoute].setRate(0.0f);
295 u8 nodeNum = GetNodeNum();
296 float movementDuration = GLOBAL_DATA.mNodeConfigs[nodeNum].mAnimDuration - GLOBAL_DATA.mNodeConfigs[nodeNum].mInitialDelay;
297 float frame = (movementDuration - GLOBAL_DATA.mNodeConfigs[nodeNum].mDecelDuration) * GLOBAL_DATA.mNodeConfigs[nodeNum].mAnmRate;
300 for (
int i = 0; i < GLOBAL_DATA.mNodeConfigs[nodeNum].mDecelDuration; i++) {
301 float decelPercent = i / (float) GLOBAL_DATA.mNodeConfigs[nodeNum].mDecelDuration;
302 frame += (1.0f - decelPercent) * GLOBAL_DATA.mNodeConfigs[nodeNum].mAnmRate;
mAng3_c mAngle3D
The actor's rotation (for 3D actors).
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.
static void setSoftLight_Map(m3d::bmdl_c &mdl)
Sets the soft light effect for map actors.
mSphere_c mClipSphere
A sphere representing the actor's visible area.
The actor for World Map pipes used in course unlock paths.
virtual int execute()
do method for the execute operation.
virtual int doDelete()
do method for the delete operation.
mVec3_c mInitialPos
The initial position of the pipe.
void init_exec()
Process initialization function for the exec process type.
void createModel()
Initializes the resources for the actor.
nw4r::g3d::ResFile mResFile
The resource file.
m3d::anmTexSrt_c mSrtAnim[ANIM_COUNT]
The texture animations.
STATE_e mState
The current cutscene state. See STATE_e.
void calcAnim()
Updates the currently playing animation.
m3d::mdl_c mModel
The model.
PROC_TYPE_e mCurrProc
The current process type. See dWmObjActor_c::PROC_TYPE_e.
dHeapAllocator_c mAllocator
The allocator.
virtual int draw()
do method for the draw operation.
virtual int create()
do method for the create operation.
void initState()
Sets up the actor's initial state.
void calcModel(m3d::mdl_c &model)
Updates the model's transformation matrix.
~daWmDokanRoute_c()
Destroys the object.
float getEndFrame()
Computes the animation frame for a fully completed pipe animation.
static const u8 sExitTypes[NODE_COUNT]
The exit type associated with each node. Values are EXIT_TYPE_e.
void initPosRot()
Initializes the pipe position and rotation (and the associated texture animation).
void onCourseUnlock()
Updates the course unlock cutscene animation.
m3d::anmChr_c mChrAnim[ANIM_COUNT]
The model animations.
void mode_exec()
Process function for the exec process type.
void onCourseUnlockInit()
Initializes the course unlock cutscene animation.
@ STATE_ANIM_PLAY
The movement animation is playing.
@ STATE_ANIM_START
The sound effect is played and the pipe begins moving.
@ STATE_IDLE
No animation plays.
@ STATE_ANIM_END
The movement animation is completed.
@ STATE_WAIT_DELAY
Initial delay before the pipe begins moving.
@ EXIT_TYPE_SECRET
The pipe is part of a secret exit unlock animation.
@ EXIT_TYPE_NORMAL
The pipe is part of a regular exit unlock animation.
virtual void processCutsceneCommand(int cutsceneCommandId, bool isFirstFrame)
Contains the actor-specific logic for processing the current world map cutscene.
void initAnim()
Initializes the pipe's model animation, based on the associated level's completion status.
daWmDokanRoute_c()
Constructs a new object.
int mStateTimer
The timer for the current state.
static const char * sPointNames[NODE_COUNT]
The point name associated with each node.
@ SUCCEEDED
The step was completed successfully.
A three-dimensional short angle vector.
A three-dimensional floating point vector.
static mVec3_c Ex
The unit vector for the X axis.
static mVec3_c Ez
The unit vector for the Z axis.
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_ONCE
Play the animation forward once.
@ GAME_HEAP_DEFAULT
The default game heap (alias of MEM1 or MEM2).
EGG::ExpHeap * g_gameHeaps[GAME_HEAP_COUNT]
The game heaps.
The global configuration for the actor.