NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_a_en_shell.hpp
1#include <game/bases/d_enemy.hpp>
2#include <game/bases/d_a_en_carry.hpp>
3#include <game/bases/d_ef.hpp>
4#include <game/bases/d_en_fumi_check.hpp>
5#include <game/bases/d_heap_allocator.hpp>
6#include <game/mLib/m_effect.hpp>
7
8/**
9 * @brief Base implementation of a shell enemy.
10 * @statetable
11 * @paramtable
12 */
13class daEnShell_c : public daEnCarry_c {
14public:
15 /// Other actors can extend this enum to add new modes.
16 /// @unofficial
18 SHELL_MODE_BASE = 0,
19 SHELL_MODE_NOKO_WALK = 1,
20 SHELL_MODE_TOGEZO = 1,
21 SHELL_MODE_PAIPO
22 };
23
24 struct GlobalData_t {
25 s16 mSpinSpeed;
26 s16 mUnkSpeed;
27 float mSlideSpeedPowerup;
28 float mSlideSpeedNoPowerup;
29 };
30
31 daEnShell_c();
32 virtual ~daEnShell_c();
33
34 virtual void postExecute(fBase_c::MAIN_STATE_e status);
35 virtual bool ActorDrawCullCheck();
36 virtual void block_hit_init();
37 virtual void boyonBegin() {}
38 virtual bool isSpinLiftUpEnable() { return isState(StateID_Sleep) != 0; }
39 virtual void setSpinLiftUpActor(dActor_c *carryingActor);
40 virtual void setCarryFall(dActor_c *carryingActor, int collisionDelay);
41 virtual void setEatTongue(dActor_c *actor);
42 virtual bool setEatSpitOut(dActor_c *actor);
43 virtual bool EtcDamageCheck(dCc_c *self, dCc_c *other);
44 virtual void Normal_VsEnHitCheck(dCc_c *self, dCc_c *other);
45 virtual void Normal_VsPlHitCheck(dCc_c *self, dCc_c *other);
46 virtual void Normal_VsYoshiHitCheck(dCc_c *self, dCc_c *other);
47 virtual bool hitCallback_Spin(dCc_c *self, dCc_c *other);
48 virtual bool hitCallback_HipAttk(dCc_c *self, dCc_c *other);
49 virtual bool hitCallback_YoshiHipAttk(dCc_c *self, dCc_c *other);
50 virtual bool hitCallback_Shell(dCc_c *self, dCc_c *other);
51 virtual bool hitCallback_Ice(dCc_c *self, dCc_c *other);
52 virtual bool setDamage(dActor_c *actor);
53 virtual void returnState_Ice();
54 virtual bool checkComboClap(int max);
55 virtual void FumiJumpSet(dActor_c *actor);
56 virtual void FumiScoreSet(dActor_c *actor);
57 virtual void YoshiFumiScoreSet(dActor_c *actor) { daEnShell_c::FumiScoreSet(actor); }
58
59 STATE_VIRTUAL_FUNC_DECLARE(daEnShell_c, DieFall);
60 STATE_VIRTUAL_FUNC_DECLARE(daEnShell_c, Carry);
61 STATE_VIRTUAL_FUNC_DECLARE(daEnShell_c, Sleep); ///< Remaining stationary after being jumped on.
62 STATE_VIRTUAL_FUNC_DECLARE(daEnShell_c, Slide); ///< Sliding across the ground after being kicked.
63 STATE_VIRTUAL_FUNC_DECLARE(daEnShell_c, Wakeup); ///< Waking up from the sleep state.
64 STATE_VIRTUAL_FUNC_DECLARE(daEnShell_c, WakeupReverse); ///< Waking up after being flipped upside down.
65 STATE_VIRTUAL_FUNC_DECLARE(daEnShell_c, WakeupTurn); ///< Turning around after waking up.
66
67 virtual bool setPlayerDamage(dActor_c *actor) { return true; }
68 virtual bool checkSleep();
69 virtual void setEnemyTurn() {}
70 virtual bool specialFumiProc(dActor_c *actor) { return false; }
71 virtual bool specialFumiProc_Yoshi(dActor_c *actor) { return specialFumiProc(actor); }
72 virtual bool isFumiInvalid() const { return false; }
73 virtual void setAfterSleepState() {}
74 virtual bool turnProc() { return false; }
75 virtual void kickSE(int plrNo);
76 virtual void kickEffect(mVec3_c pos) { dEf::createEffect_change("Wm_mr_kickhit", 0, &pos, nullptr, nullptr); }
77 virtual bool isDieShell() { return true; }
78 virtual void calcShellEffectPos() {}
79 virtual void slideEffect() {}
80 virtual bool isBlockHitDeath() const { return false; }
81
82 /// @brief Loads the resources for the shell model and animation.
83 /// @param arcName The name of the resource archive to load from.
84 /// @param resPath The path within the archive to the model resource.
85 /// @param modelName The name of the model resource.
86 /// @param anmTexName The name of the texture animation resource (optional).
87 /// @param animFrame The frame of the texture animation to start at.
88 void createShell(const char *arcName, const char *resPath, const char *modelName, const char *anmTexName, float animFrame);
89 void calcShellMdl();
90 bool drawShell();
91 void setKickSlide(dCc_c *self, dActor_c *other);
92 bool isSlideTowards(dActor_c *actor); ///< @unofficial
93 bool checkMugenCombo(dActor_c *player); ///< Checks if the player is performing the staircase infinite jump trick.
94 bool cullCheck();
95 bool cullCheck_Shell();
96 void setSlideThrowSpeed(dActor_c *actor);
97 void setSlideKickSpeed(dActor_c *actor);
98 void slideSpin();
99 void setDeathInfo_CarryBgIn(dActor_c *);
100 void adjustCarryCc();
101 bool hasamiCheck();
102 void setDeathInfo_Hasami();
103
104 dHeapAllocator_c mAllocator;
105 nw4r::g3d::ResFile mResFile;
106 m3d::mdl_c mModel;
107 m3d::anmChr_c mAnim;
108 nw4r::g3d::ResAnmTexPat mResAnmTexPat;
109 m3d::anmTexPat_c mAnimTex;
110 sCcDatNewF mCcData;
111 sBcSensorPoint mSensorHead;
112 sBcSensorLine mSensorFootNormal;
113 sBcSensorLine mSensorWall;
114 sBcSensorLine mSensorFootSlide;
115 mEf::levelEffect_c mEffect;
116 int mYoshiKickable; ///< Whether the shell can be kicked in any state by Yoshi.
117 ShellMode_e mShellMode;
118 mVec3_c mSlideEffectPos;
119 mVec3_c mCarryPos;
120 int mIsCarryFall;
121 int mSlideAirAfterThrow;
122 mVec2_c mCcOffset;
123 mVec2_c mCcSize;
124
125 /// @brief The actor which the player who jumped on the shell is currently carrying.
126 /// @details This is used to prevent the carried actor from killing the shell.
128 int mJumpPlayerNoCarryHitTimer; ///< For how long the shell will ignore collisions with @ref mJumpPlayerCarryActorID "the carried item".
129
130 mAng mWakeupShakeAngle;
131 mAng3_c mWakeupShakeAngle3D;
132 u16 mSleepTimer; ///< How many frames longer the shell will remain asleep.
133 u16 mCarryTimer; ///< How many more frames the sleep timer will remain paused while being carried.
134 bool mIsFlipped; ///< Whether the shell is flipped upside down from a block hit.
135 int mCarriedBy;
136 int mIsMugenCombo;
137 float mMugenComboSpeed;
138 float mMugenComboPosX;
139
140 ACTOR_PARAM_CONFIG(MugenComboAllowed, 20, 1);
141
142 // Unofficial constants
143
144 static const u16 smc_SLEEP_TIMER = 511;
145 static const u16 smc_SLEEP_TIMER_SHAKE = 96;
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
Collider ("Collision Check") class - handles collisions between actors.
Definition d_cc.hpp:133
A carryable enemy. [As opposed to dEnemyCarry_c, this class is used a bit more widely....
virtual bool setEatSpitOut(dActor_c *actor)
Callback for when the actor is about to be spat out.
virtual void setEatTongue(dActor_c *actor)
Callback for when the actor is targeted by Yoshi's tongue.
u16 mSleepTimer
How many frames longer the shell will remain asleep.
virtual bool ActorDrawCullCheck()
Checks if the actor is out of view.
virtual void postExecute(fBase_c::MAIN_STATE_e status)
post method for the execute operation.
virtual bool isSpinLiftUpEnable()
Returns whether the actor can be carried.
bool mIsFlipped
Whether the shell is flipped upside down from a block hit.
fBaseID_e mJumpPlayerCarryActorID
The actor which the player who jumped on the shell is currently carrying.
u16 mCarryTimer
How many more frames the sleep timer will remain paused while being carried.
int mYoshiKickable
Whether the shell can be kicked in any state by Yoshi.
int mJumpPlayerNoCarryHitTimer
For how long the shell will ignore collisions with the carried item.
static sFStateVirtualID_c< daEnShell_c > StateID_Sleep
Remaining stationary after being jumped on.
void createShell(const char *arcName, const char *resPath, const char *modelName, const char *anmTexName, float animFrame)
Loads the resources for the shell model and animation.
virtual void setCarryFall(dActor_c *carryingActor, int collisionDelay)
Callback for when the actor is dropped by the carrying actor.
bool isSlideTowards(dActor_c *actor)
virtual void setSpinLiftUpActor(dActor_c *carryingActor)
Callback for when the actor is picked up by another actor.
virtual void block_hit_init()
Callback for when a block directly beneath the actor is hit.
bool checkMugenCombo(dActor_c *player)
Checks if the player is performing the staircase infinite jump trick.
MAIN_STATE_e
The possible operation results.
Definition f_base.hpp:36
A three-dimensional short angle vector.
Definition m_angle.hpp:68
A two-dimensional floating point vector.
Definition m_vec.hpp:26
A three-dimensional floating point vector.
Definition m_vec.hpp:122
fBaseID_e
A unique identifier for each base.
Definition f_base_id.hpp:6
#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