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 struct GlobalData_t {
16 s16 mSpinSpeed;
17 s16 mUnkSpeed;
18 float mSlideSpeedPowerup;
19 float mSlideSpeedNoPowerup;
20 };
21
22 daEnShell_c();
23 virtual ~daEnShell_c();
24
25 virtual void postExecute(fBase_c::MAIN_STATE_e status);
26 virtual bool ActorDrawCullCheck();
27 virtual void block_hit_init();
28 virtual void boyonBegin() {}
29 virtual bool isSpinLiftUpEnable() { return isState(StateID_Sleep) != 0; }
30 virtual void setSpinLiftUpActor(dActor_c *carryingActor);
31 virtual void setCarryFall(dActor_c *carryingActor, int collisionDelay);
32 virtual void setEatTongue(dActor_c *actor);
33 virtual bool setEatSpitOut(dActor_c *actor);
34 virtual bool EtcDamageCheck(dCc_c *self, dCc_c *other);
35 virtual void Normal_VsEnHitCheck(dCc_c *self, dCc_c *other);
36 virtual void Normal_VsPlHitCheck(dCc_c *self, dCc_c *other);
37 virtual void Normal_VsYoshiHitCheck(dCc_c *self, dCc_c *other);
38 virtual bool hitCallback_Spin(dCc_c *self, dCc_c *other);
39 virtual bool hitCallback_HipAttk(dCc_c *self, dCc_c *other);
40 virtual bool hitCallback_YoshiHipAttk(dCc_c *self, dCc_c *other);
41 virtual bool hitCallback_Shell(dCc_c *self, dCc_c *other);
42 virtual bool hitCallback_Ice(dCc_c *self, dCc_c *other);
43 virtual bool setDamage(dActor_c *actor);
44 virtual void returnState_Ice();
45 virtual bool checkComboClap(int max);
46 virtual void FumiJumpSet(dActor_c *actor);
47 virtual void FumiScoreSet(dActor_c *actor);
48 virtual void YoshiFumiScoreSet(dActor_c *actor) { daEnShell_c::FumiScoreSet(actor); }
49
50 STATE_VIRTUAL_FUNC_DECLARE(daEnShell_c, DieFall);
51 STATE_VIRTUAL_FUNC_DECLARE(daEnShell_c, Carry);
52 STATE_VIRTUAL_FUNC_DECLARE(daEnShell_c, Sleep); ///< Remaining stationary after being jumped on.
53 STATE_VIRTUAL_FUNC_DECLARE(daEnShell_c, Slide); ///< Sliding across the ground after being kicked.
54 STATE_VIRTUAL_FUNC_DECLARE(daEnShell_c, Wakeup); ///< Waking up from the sleep state.
55 STATE_VIRTUAL_FUNC_DECLARE(daEnShell_c, WakeupReverse); ///< Waking up after being flipped upside down.
56 STATE_VIRTUAL_FUNC_DECLARE(daEnShell_c, WakeupTurn); ///< Turning around after waking up.
57
58 virtual bool setPlayerDamage(dActor_c *actor) { return true; }
59 virtual bool checkSleep();
60 virtual void setEnemyTurn() {}
61 virtual bool specialFumiProc(dActor_c *actor) { return false; }
62 virtual bool specialFumiProc_Yoshi(dActor_c *actor) { return specialFumiProc(actor); }
63 virtual bool isFumiInvalid() const { return false; }
64 virtual void setAfterSleepState() {}
65 virtual bool turnProc() { return false; }
66 virtual void kickSE(int plrNo);
67 virtual void kickEffect(mVec3_c pos) { dEf::createEffect_change("Wm_mr_kickhit", 0, &pos, nullptr, nullptr); }
68 virtual bool isDieShell() { return true; }
69 virtual void calcShellEffectPos() {}
70 virtual void slideEffect() {}
71 virtual bool isBlockHitDeath() const { return false; }
72
73 /// @brief Loads the resources for the shell model and animation.
74 /// @param arcName The name of the resource archive to load from.
75 /// @param resPath The path within the archive to the model resource.
76 /// @param modelName The name of the model resource.
77 /// @param anmTexName The name of the texture animation resource (optional).
78 /// @param animFrame The frame of the texture animation to start at.
79 void createShell(const char *arcName, const char *resPath, const char *modelName, const char *anmTexName, float animFrame);
80 void calcShellMdl();
81 bool drawShell();
82 void setKickSlide(dCc_c *self, dActor_c *other);
83 bool isSlideTowards(dActor_c *actor); ///< @unofficial
84 bool checkMugenCombo(dActor_c *player); ///< Checks if the player is performing the staircase infinite jump trick.
85 bool cullCheck();
86 bool cullCheck_Shell();
87 void setSlideThrowSpeed(dActor_c *actor);
88 void setSlideKickSpeed(dActor_c *actor);
89 void slideSpin();
90 void setDeathInfo_CarryBgIn(dActor_c *);
91 void adjustCarryCc();
92 bool hasamiCheck();
93 void setDeathInfo_Hasami();
94
95 dHeapAllocator_c mAllocator;
96 nw4r::g3d::ResFile mResFile;
97 m3d::mdl_c mModel;
98 m3d::anmChr_c mAnim;
99 nw4r::g3d::ResAnmTexPat mResAnmTexPat;
100 m3d::anmTexPat_c mAnimTex;
101 u8 mPad1[0x24];
102 sBcSensorPoint mSensorHead;
103 sBcSensorLine mSensorFootNormal;
104 sBcSensorLine mSensorWall;
105 sBcSensorLine mSensorFootSlide;
106 mEf::levelEffect_c mEffect;
107 int mYoshiKickable; ///< Whether the shell can be kicked in any state by Yoshi.
108 int mUseBaseIceBehaviour;
109 u8 mPad2[0xc];
110 mVec3_c mCarryPos;
111 int mIsCarryFall;
112 int mSlideAirAfterThrow;
113 mVec2_c mCcOffset;
114 mVec2_c mCcSize;
115
116 /// @brief The actor which the player who jumped on the shell is currently carrying.
117 /// @details This is used to prevent the carried actor from killing the shell.
119 int mJumpPlayerNoCarryHitTimer; ///< For how long the shell will ignore collisions with @ref mJumpPlayerCarryActorID "the carried item".
120
121 mAng mWakeupShakeAngle;
122 mAng3_c mWakeupShakeAngle3D;
123 u16 mSleepTimer; ///< How many frames longer the shell will remain asleep.
124 u16 mCarryTimer; ///< How many more frames the sleep timer will remain paused while being carried.
125 bool mIsFlipped; ///< Whether the shell is flipped upside down from a block hit.
126 int mCarriedBy;
127 int mIsMugenCombo;
128 float mMugenComboSpeed;
129 float mMugenComboPosX;
130
131 ACTOR_PARAM_CONFIG(MugenComboAllowed, 20, 1);
132
133 // Unofficial constants
134
135 static const u16 smc_SLEEP_TIMER = 511;
136 static const u16 smc_SLEEP_TIMER_SHAKE = 96;
137};
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:118
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