NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_a_en_noko.hpp
1#include <game/bases/d_a_en_shell.hpp>
2#include <game/mLib/m_effect.hpp>
3#include <lib/MSL/string.h>
4
5/**
6 * @brief Koopa Troopa
7 * @statetable
8 * @paramtable
9 */
10class daEnNoko_c : public daEnShell_c {
11public:
12 class nodeCallback_c : public m3d::mdl_c::callback_c {
13 public:
14 nodeCallback_c(daEnNoko_c *owner) : mpOwner(owner) {}
15 virtual void timingB(ulong nodeId, nw4r::g3d::WorldMtxManip *manip, nw4r::g3d::ResMdl resMdl);
16
17 daEnNoko_c *mpOwner;
18 };
19
21 NOKO_GREEN, ///< Green Koopas don't turn around on ledges.
22 NOKO_RED ///< Red Koopas turn around on ledges.
23 };
24
25 enum SPAWN_MODE_e {
26 SPAWN_MODE_WALK,
27 SPAWN_MODE_SLEEP,
28 };
29
31 BGM_anim_walkA_1,
32 BGM_anim_walkA_2, ///< Actually uses the same animation as BGM_anim_walkA_1.
33 BGM_anim_walkA_3,
34 DANCE_MOVE_COUNT,
35 };
36
37 daEnNoko_c() : mMdlCallback(this) {}
38
39 int create() override;
40 int doDelete() override;
41 int execute() override;
42 int preExecute() override;
43 int draw() override;
44 void finalUpdate() override { calcMdl(); }
45 bool createIceActor() override;
46 void beginFunsui() override;
47 void endFunsui() override;
48
49 STATE_FUNC_DECLARE(daEnNoko_c, BlockAppear); ///< Spawning from a block.
50 STATE_FUNC_DECLARE(daEnNoko_c, Walk); ///< Walking on the ground.
51 STATE_FUNC_DECLARE(daEnNoko_c, Turn); ///< Turning around while walking.
52 STATE_FUNC_DECLARE(daEnNoko_c, WindTurn); ///< Being turned around by the wind.
53 STATE_FUNC_DECLARE(daEnNoko_c, SpitOut_Ready); ///< About to be spit out by Yoshi.
54 STATE_FUNC_DECLARE(daEnNoko_c, BgmDance); ///< Doing a dance move to the background music.
55 STATE_FUNC_DECLARE(daEnNoko_c, BgmDanceEd); ///< Returning from a dance move to walking.
56 STATE_VIRTUAL_FUNC_DECLARE(daEnNoko_c, Wakeup);
57 STATE_VIRTUAL_FUNC_DECLARE(daEnNoko_c, WakeupTurn);
58
59 bool setPlayerDamage(dActor_c *actor) override;
60 bool checkSleep() override;
61 bool turnProc() override;
62 void calcShellEffectPos() override;
63
64 void setEnemyTurn() override {
65 if (isState(StateID_Walk)) {
67 }
68 }
69
70 virtual void checkWaterEntry() { WaterCheck(mPos, 1.0f); }
71
72 void setAfterSleepState() override { changeState(StateID_Walk); }
73
74 void slideEffect() override {
75 if (!mNokoType) {
76 mEffect.createEffect("Wm_en_shellgreentail", 0, &mSlideEffectPos, nullptr, nullptr);
77 } else {
78 mEffect.createEffect("Wm_en_shellredtail", 0, &mSlideEffectPos, nullptr, nullptr);
79 }
80 }
81
82 virtual void doTurn(int *dir, s16 *turnSpeed);
83 virtual bool isWalking() { return true; }
84 virtual void turnAround();
85 virtual void calcMdl();
86 virtual bool canDance();
87 virtual void danceWithMove(int move);
88 virtual void walkTurn();
89
90 /// @brief Initializes the state of the Koopa after creation.
91 virtual void setInitialState();
92
93 /// @brief Subclasses can override this function to create additional models.
94 virtual void createModelExtra() {}
95 virtual void vf328() {}
96
97 /// @brief Subclasses can override this function to delete additional resources.
98 virtual void deleteResExtra() {}
99
100 virtual mVec3_c getPos() { return mVec3_c(mPos.x, mPos.y, mPos.z); }
101
102 BOOL isFunsui() const override { return mIsFunsui; }
103
104 void createModel();
105 void updateAmiLine();
106 void setZPos();
107 bool checkRyusa(); ///< Checks if the actor is inside quicksand.
108 void ryusaEffect(); ///< Creates the quicksand effect.
109 bool playerDamageTurn(dActor_c *); ///< Returns whether the Koopa should turn around after damaging the player.
110 void setNokoBc(); ///< Reverts the collision to a regular Koopa.
111 float getWindStrength();
112 void setMoveAnimation(const char *name, m3d::playMode_e mode, float frame);
113 void setBaseAnimation(const char *name, m3d::playMode_e mode, float frame);
114 bool checkLedge(); ///< Checks if there is a ledge in front of the Koopa.
115 void landEffect();
116
117 u8 mPad0[4];
118
119 dHeapAllocator_c mNokoAllocator; ///< The allocator used for the resources of this actor.
120 nw4r::g3d::ResFile mNokoResFile; ///< The resource file containing the resources of this actor.
121 m3d::mdl_c mNokoModel; ///< The model of the Koopa.
122 m3d::anmChr_c mWalkAnim; ///< The walk animation of the Koopa.
123 nw4r::g3d::ResAnmTexPat mNokoResAnmTex; ///< The animated texture resource of the Koopa.
124 m3d::anmTexPat_c mNokoAnimTex; ///< The animated texture of the Koopa.
125
126 BOOL mIsFunsui; ///< Whether the Koopa is being blown upwards by a fountain.
127 s16 mHeadAngle;
128 u8 mNokoType; ///< Is a NOKO_TYPE_e.
129 mVec3_c mCreatePos; ///< The position where the Koopa was spawned.
130 float mXSpeedBeforeFunsui; ///< The horizontal speed of the Koopa before being blown by a fountain.
131 u8 mPad1[8];
132 float mBaseZPos;
133 u32 m_8c8;
134 int mDanceTimer; ///< Timer for starting and ending the dance.
135 mAng mBgmDanceRotSpeed; ///< The rotation speed for turning toward the target rotation for a dance.
136 u32 mDanceMove; ///< The dance move to perform.
137 mEf::levelOneEffect_c mQuicksandEffect;
138 nodeCallback_c mMdlCallback;
139
140 ACTOR_PARAM_CONFIG(NokoType, 0, 1); ///< See NOKO_TYPE_e.
141 ACTOR_PARAM_CONFIG(SpawnMode, 4, 1); ///< See SPAWN_MODE_e.
142 ACTOR_PARAM_CONFIG(SubLayer, 16, 1); ///< The sublayer to spawn on.
143 ACTOR_PARAM_CONFIG(BlockHitPlayer, 24, 2); ///< The player number that hit the block from which this Koopa spawned.
144 ACTOR_PARAM_CONFIG(BlockAppear, 28, 1); ///< Whether the Koopa should spawn from a block.
145 ACTOR_PARAM_CONFIG(SpitOut, 29, 1); ///< Whether this Koopa was spat out by Yoshi.
146};
bool isState(const sStateIDIf_c &other) const
Checks if the actor is currently in the given state.
The minimum required implementation for a stage actor.
Definition d_actor.hpp:15
dActor_c()
Constructs a new actor.
Definition d_actor.cpp:46
mVec3_c mPos
The actor's position.
void WaterCheck(mVec3_c &pos, float h)
Definition d_enemy.cpp:729
virtual void changeState(const sStateIDIf_c &newState)
Changes the actor's state to the given state.
Koopa Troopa.
static sFStateID_c< daEnNoko_c > StateID_Walk
Walking on the ground.
int mDanceTimer
Timer for starting and ending the dance.
@ BGM_anim_walkA_2
Actually uses the same animation as BGM_anim_walkA_1.
nw4r::g3d::ResAnmTexPat mNokoResAnmTex
The animated texture resource of the Koopa.
bool checkRyusa()
Checks if the actor is inside quicksand.
mVec3_c mCreatePos
The position where the Koopa was spawned.
float mXSpeedBeforeFunsui
The horizontal speed of the Koopa before being blown by a fountain.
ACTOR_PARAM_CONFIG(SpawnMode, 4, 1)
See SPAWN_MODE_e.
m3d::anmChr_c mWalkAnim
The walk animation of the Koopa.
@ NOKO_GREEN
Green Koopas don't turn around on ledges.
@ NOKO_RED
Red Koopas turn around on ledges.
u8 mNokoType
Is a NOKO_TYPE_e.
void ryusaEffect()
Creates the quicksand effect.
int execute() override
do method for the execute operation.
m3d::mdl_c mNokoModel
The model of the Koopa.
int preExecute() override
pre method for the execute operation.
ACTOR_PARAM_CONFIG(BlockAppear, 28, 1)
Whether the Koopa should spawn from a block.
void finalUpdate() override
Code to be executed after all actors' execute operation has run.
m3d::anmTexPat_c mNokoAnimTex
The animated texture of the Koopa.
ACTOR_PARAM_CONFIG(SubLayer, 16, 1)
The sublayer to spawn on.
int draw() override
do method for the draw operation.
virtual void deleteResExtra()
Subclasses can override this function to delete additional resources.
BOOL mIsFunsui
Whether the Koopa is being blown upwards by a fountain.
u32 mDanceMove
The dance move to perform.
ACTOR_PARAM_CONFIG(SpitOut, 29, 1)
Whether this Koopa was spat out by Yoshi.
virtual void createModelExtra()
Subclasses can override this function to create additional models.
bool playerDamageTurn(dActor_c *)
Returns whether the Koopa should turn around after damaging the player.
bool checkLedge()
Checks if there is a ledge in front of the Koopa.
ACTOR_PARAM_CONFIG(BlockHitPlayer, 24, 2)
The player number that hit the block from which this Koopa spawned.
dHeapAllocator_c mNokoAllocator
The allocator used for the resources of this actor.
static sFStateID_c< daEnNoko_c > StateID_Turn
Turning around while walking.
void setNokoBc()
Reverts the collision to a regular Koopa.
virtual void setInitialState()
Initializes the state of the Koopa after creation.
int doDelete() override
do method for the delete operation.
nw4r::g3d::ResFile mNokoResFile
The resource file containing the resources of this actor.
ACTOR_PARAM_CONFIG(NokoType, 0, 1)
See NOKO_TYPE_e.
int create() override
do method for the create operation.
mAng mBgmDanceRotSpeed
The rotation speed for turning toward the target rotation for a dance.
A three-dimensional floating point vector.
Definition m_vec.hpp:122
playMode_e
Definition banm.hpp:7
#define STATE_FUNC_DECLARE(class, name)
Declares a state.
Definition s_State.hpp:12
#define STATE_VIRTUAL_FUNC_DECLARE(class, name)
Declares a virtual state.
Definition s_State.hpp:22
A one-dimensional short angle vector.
Definition m_angle.hpp:12