NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_a_wm_dokan_route.hpp
1#pragma once
2#include <game/bases/d_heap_allocator.hpp>
3#include <game/mLib/m_3d/anm_chr.hpp>
4#include <game/mLib/m_3d/anm_tex_srt.hpp>
5#include <game/mLib/m_3d/mdl.hpp>
6#include <game/bases/d_wm_obj_actor.hpp>
7
8/**
9* @brief The actor for World Map pipes used in course unlock paths.
10* @details All instances of this actor are hardcoded and selected via the #Node parameter,
11* obtained via the bone name. Each index corresponds to a specific, predefined location on the World Map.
12* @ingroup bases
13* @paramtable
14*/
16public:
17 static const int NODE_COUNT = 6;
18
19 /// @brief The global configuration for the actor.
20 struct GlobalData_t {
21 float mScaleMultiplier; ///< The scale multiplier to be applied to all pipes.
22 struct {
23 mVec3_c mPosOffset; ///< The offset from the pipe's bone position.
24 float mAnmRate; ///< The animation speed multiplier.
25 s16 mInitialDelay; ///< The initial delay before the pipe begins moving, in frames.
26 s16 mAnimDuration; ///< The total duration of the animation, in frames. This also controls the pipe's length.
27 s16 mDecelDuration; ///< The duration of the animation's deceleration phase, in frames.
28 s16 mDirection; ///< The direction of the pipe. Value is a DIR_e.
29 } mNodeConfigs[NODE_COUNT]; ///< The configuration for each hardcoded pipe instance.
30 };
31
32 /// @brief The available animations for this actor.
33 enum ANIM_e {
34 cobDokanRoute,
35 ANIM_COUNT
36 };
37
38 ///< The pipe's facing direction.
39 enum DIR_e {
40 EAST,
41 WEST,
42 NORTH, ///< @unused
43 SOUTH
44 };
45
46 /// @brief The possible level exit types associated with the pipe.
48 EXIT_TYPE_SECRET, ///< The pipe is part of a secret exit unlock animation.
49 EXIT_TYPE_NORMAL, ///< The pipe is part of a regular exit unlock animation.
50 };
51
52 /// @brief The possible animation states.
53 enum STATE_e {
54 STATE_IDLE, ///< No animation plays.
55 STATE_WAIT_DELAY, ///< Initial delay before the pipe begins moving.
56 STATE_ANIM_START, ///< The sound effect is played and the pipe begins moving.
57 STATE_ANIM_PLAY, ///< The movement animation is playing.
58 STATE_ANIM_END ///< The movement animation is completed.
59 };
60
61 typedef void (daWmDokanRoute_c::*ProcFunc)();
62
63 daWmDokanRoute_c(); ///< @copydoc dWmObjActor_c::dWmObjActor_c
64 ~daWmDokanRoute_c(); ///< @copydoc dWmObjActor_c::~dWmObjActor_c
65
66 virtual int create();
67 virtual int execute();
68 virtual int draw();
69 virtual int doDelete();
70
71 virtual void processCutsceneCommand(int cutsceneCommandId, bool isFirstFrame);
72
73 void createModel(); ///< Initializes the resources for the actor.
74 void initState(); ///< Sets up the actor's initial state.
75 void initPosRot(); ///< Initializes the pipe position and rotation (and the associated texture animation).
76 void initAnim(); ///< Initializes the pipe's model animation, based on the associated level's completion status.
77
78 void calcModel(m3d::mdl_c &model); ///< Updates the model's transformation matrix.
79 void calcAnim(); ///< Updates the currently playing animation.
80
81 void init_exec(); ///< Process initialization function for the @ref dWmObjActor_c::PROC_TYPE_EXEC "exec" process type.
82 void mode_exec(); ///< Process function for the @ref dWmObjActor_c::PROC_TYPE_EXEC "exec" process type.
83
84 void onCourseUnlockInit(); ///< Initializes the course unlock cutscene animation.
85 void onCourseUnlock(); ///< Updates the course unlock cutscene animation.
86
87 /// @brief Computes the animation frame for a fully completed pipe animation.
88 /// @details This is used to initialize the pipe in its "already activated" state when
89 /// the associated course has been previously cleared.
90 /// @return The animation frame corresponding to the end of the animation.
91 float getEndFrame();
92
93 u8 GetNodeNum() const { return ACTOR_PARAM(Node); }
94
95 u32 mUnk188; ///< @unused
96 dHeapAllocator_c mAllocator; ///< The allocator.
97 nw4r::g3d::ResFile mResFile; ///< The resource file.
98 m3d::mdl_c mModel; ///< The model.
99 m3d::anmChr_c mChrAnim[ANIM_COUNT]; ///< The model animations.
100 m3d::anmTexSrt_c mSrtAnim[ANIM_COUNT]; ///< The texture animations.
101 u32 mUnk250; ///< @unused
102 PROC_TYPE_e mCurrProc; ///< The current process type. See dWmObjActor_c::PROC_TYPE_e.
103 int mStateTimer; ///< The timer for the current state.
104 STATE_e mState; ///< The current cutscene state. See STATE_e.
105 mVec3_c mInitialPos; ///< The initial position of the pipe.
106
107 static const u8 sExitTypes[NODE_COUNT]; ///< The exit type associated with each node. Values are EXIT_TYPE_e. @hideinitializer
108 static const char *sPointNames[NODE_COUNT]; ///< The point name associated with each node. @hideinitializer
109
110 ACTOR_PARAM_CONFIG(Node, 0, 8); ///< The index into the @ref GlobalData_t::mNodeConfigs "hardcoded node configuration table".
111};
dWmObjActor_c()
Constructs a new object.
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.
ACTOR_PARAM_CONFIG(Node, 0, 8)
The index into the hardcoded node configuration table.
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.
ANIM_e
The available animations for this actor.
void onCourseUnlockInit()
Initializes the course unlock cutscene animation.
STATE_e
The possible animation states.
@ 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_e
The possible level exit types associated with the pipe.
@ 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.
A three-dimensional floating point vector.
Definition m_vec.hpp:112
The global configuration for the actor.
s16 mDecelDuration
The duration of the animation's deceleration phase, in frames.
s16 mInitialDelay
The initial delay before the pipe begins moving, in frames.
s16 mAnimDuration
The total duration of the animation, in frames. This also controls the pipe's length.
s16 mDirection
The direction of the pipe. Value is a DIR_e.
struct daWmDokanRoute_c::GlobalData_t::@244041272362370322224364177340327141346100031017 mNodeConfigs[NODE_COUNT]
The configuration for each hardcoded pipe instance.
mVec3_c mPosOffset
The offset from the pipe's bone position.
float mScaleMultiplier
The scale multiplier to be applied to all pipes.
float mAnmRate
The animation speed multiplier.