New Super Mario Bros. U Headers
Loading...
Searching...
No Matches
ActorCollision.h
Go to the documentation of this file.
1#pragma once
2
3#include <actor/Actor.h>
4#include <collision/ActorBgCollisionObjCheck.h>
5#include <collision/BgCollisionCheckParam.h>
6
7// vtbl Address: 0x1000084C
8class ActorCollision : public Actor
9{
10 // getRuntimeTypeInfoStatic()::typeInfo initialization guard variable Address: 0x101E9CD4
11 // getRuntimeTypeInfoStatic()::typeInfo Address: 0x101E9CD8
12 SEAD_RTTI_OVERRIDE(ActorCollision, Actor)
13
14protected:
23
30
32 {
35 cQuakeType_Small // Used in NSMB2, but NSMBU no longer uses it
36 };
37
38protected:
39 friend BgCheckFlag operator|(const BgCheckFlag& lhs, const BgCheckFlag& rhs)
40 {
41 return (BgCheckFlag)((u32)lhs | (u32)rhs);
42 }
43
44 friend BgCheckFlag& operator|=(BgCheckFlag& lhs, const BgCheckFlag& rhs)
45 {
46 lhs = lhs | rhs;
47 return lhs;
48 }
49
50protected:
51 // Address: 0x02002FB8
52 ActorCollision(const ActorCreateParam& param);
53
54 // Address: 0x0200354C
55 void postCreate(MainState state) override;
56
57 // Address: 0x020035FC
59 // Address: 0x020036D8
60 void postExecute(MainState state) override;
61
62 // Address: 0x02003724
63 Result doDelete() override;
64
65public:
66 virtual void setWaterFunsui(bool enable)
67 {
68 mIsWaterFunsui = enable;
69 }
70
71 // Address: Deleted
72 virtual bool isWaterFunsui() const
73 {
74 return mIsWaterFunsui;
75 }
76
77 virtual void beginFunsui()
78 {
79 }
80
81 virtual void endFunsui(f32 speed_y)
82 {
83 }
84
85 virtual bool isFunsui() const
86 {
87 return false;
88 }
89
90 // Address: Deleted
91 virtual void vf134(f32 speed)
92 {
93 mSpeed.y = speed;
94 }
95
97 {
98 return &mBgCheckObj;
99 }
100
101protected:
102 /**
103 * @brief Determines whether @c setQuake_() should be called.
104 * @details Returns @c false by default.
105 * @par Address: 0x02004008
106 */
107 virtual bool isQuakeEnable_();
108 // Address: 0x0200375C
109 virtual void setQuake_(QuakeType type);
110
111 // Address: 0x02003760
112 virtual void setSmokeDamage_(Actor* actor);
113
114 virtual bool setTouchDrcDamage_(const sead::Vector3f& pos)
115 {
116 return false;
117 }
118
119public:
120 virtual void setFunsuiPos(sead::Vector2f dst)
121 {
122 getPos2D() = dst;
123 }
124
125 virtual void setFunsuiSpeedY(f32 speed)
126 {
127 mSpeed.y = speed;
128 }
129
130protected:
131 virtual bool smokeDamageEnable_Yogan_(f32 surface_pos_y)
132 {
133 return true;
134 }
135
136 virtual bool smokeDamageEnable_Poison_(f32 surface_pos_y)
137 {
138 return false;
139 }
140
141 virtual void getBox_(sead::BoundBox2f& box)
142 {
143 box.set(
144 mPos.x - 16.0f, mPos.y,
145 mPos.x + 16.0f, mPos.y + 32.0f
146 );
147 }
148
149 // Address: 0x020037F4
151 // Address: 0x02003764
152 bool bgCheckFoot_() const; // Must call checkBg() of mBgCheckObj before calling this, or just use bgCheck_()
153 // Address: 0x02003770
154 bool bgCheckWall_() const; // ^^^
155
156 // Address: 0x02003878
157 void clampMoveDistance_(BgCollision& bg_collision);
158
159 // Address: 0x020038D8
160 bool isHitBgCollision_(const BgCollision& bg_collision) const;
161
162 // Address: 0x020039AC
164 // Address: 0x020039F0
166 // Address: 0x02003AE4
167 void posMove_();
168 // Address: 0x02003A70
170 // Address: 0x02003C10
172
173 // Address: 0x02003C58
174 WaterType checkWater_(f32* surface_pos_y);
175 // Address: 0x02003120
177
178 // Address: 0x02003C9C
180
181 // Address: 0x02003E58
182 void checkSnapToGround_(f32 y_check_distance, const ActorBgCollisionCheck::Sensor& foot_sensor);
183 // Address: 0x02003EA0
184 void snapToGround_(f32 y_check_distance, const ActorBgCollisionCheck::Sensor& foot_sensor, bool extended, bool force);
185
186 // Address: 0x02003EA4
188
189 bool checkForSuitableGround_(const sead::Vector2f& offset) const
190 {
191 BgCollisionCheckParam param = { 0 };
192 param.layer = mLayer;
193 param.collision_mask = mCollisionMask;
194
195 BasicBgCollisionCheck tile_check(param);
196
197 const sead::Vector2f& a = getPos2D();
198 sead::Vector2f b(a + offset);
199
200 return tile_check.checkArea(nullptr, a, b, 1 << cDirType_Down);
201 }
202
203private:
204 // Address: 0x0200339C
206
207 // Address: 0x02003148
208 WaterType checkEnterWater_(f32* surface_pos_y, const sead::Vector3f& check_pos);
209 // Address: 0x020030F4
211
212 // Address: 0x02003590
214
215 // Address: 0x02003A34
216 f32 chaseZero_(f32 value, f32 step) const;
217
218 // Address: 0x02003BDC
219 bool isJump_() const;
220
221 // Address: 0x02003D14
222 void snapToGroundImpl_(f32 y_check_distance, const ActorBgCollisionCheck::Sensor& foot_sensor, bool extended, bool force);
223
224protected:
225 //u32 _27c[4 / sizeof(u32)]; // Alignment???
235 f32 mWaterSpeedMaxY; // Maximum ascension speed
247};
248static_assert(sizeof(ActorCollision) == 0x17A0);
Definition ActorCollision.h:9
void clampMoveDistance_(BgCollision &bg_collision)
virtual bool setTouchDrcDamage_(const sead::Vector3f &pos)
Definition ActorCollision.h:114
WaterType checkWater_(f32 *surface_pos_y)
bool mNoWaterCalc
Definition ActorCollision.h:241
bool mIsSubmerged
Definition ActorCollision.h:240
ActorBgCollisionObjCheck mBgCheckObj
Definition ActorCollision.h:226
bool isJump_() const
bool preExecute() override
Callback invoked before the execute operation.
virtual bool isFunsui() const
Definition ActorCollision.h:85
bool isHitBgCollision_(const BgCollision &bg_collision) const
void snapToGround_(f32 y_check_distance, const ActorBgCollisionCheck::Sensor &foot_sensor, bool extended, bool force)
f32 mWaterSpeedMaxY
Definition ActorCollision.h:235
f32 mJumpSpeedF
Definition ActorCollision.h:227
virtual void vf134(f32 speed)
Definition ActorCollision.h:91
BgCheckFlag bgCheck_()
bool mIsWaterFunsui
Definition ActorCollision.h:244
friend BgCheckFlag & operator|=(BgCheckFlag &lhs, const BgCheckFlag &rhs)
Definition ActorCollision.h:44
virtual void endFunsui(f32 speed_y)
Definition ActorCollision.h:81
virtual void setFunsuiPos(sead::Vector2f dst)
Definition ActorCollision.h:120
f32 _1774
Definition ActorCollision.h:232
f32 mWaterGravity
Definition ActorCollision.h:237
u8 mWaterCalcType
Definition ActorCollision.h:242
sead::Vector2f mBgSpeedPrev
Definition ActorCollision.h:234
WaterType checkEnterWater_(f32 *surface_pos_y, const sead::Vector3f &check_pos)
virtual void setSmokeDamage_(Actor *actor)
WaterType mWaterTypeOverride
Definition ActorCollision.h:231
void registerInGamescene_()
virtual void getBox_(sead::BoundBox2f &box)
Definition ActorCollision.h:141
void enterWater_()
QuakeType
Definition ActorCollision.h:32
@ cQuakeType_Big
Definition ActorCollision.h:34
@ cQuakeType_Normal
Definition ActorCollision.h:33
@ cQuakeType_Small
Definition ActorCollision.h:35
bool checkForSuitableGround_(const sead::Vector2f &offset) const
Definition ActorCollision.h:189
u32 mJumpFrame
Definition ActorCollision.h:246
u8 mNoLavaSplashTimer
Definition ActorCollision.h:243
virtual void setQuake_(QuakeType type)
virtual bool smokeDamageEnable_Yogan_(f32 surface_pos_y)
Definition ActorCollision.h:131
f32 chaseZero_(f32 value, f32 step) const
bool mIsInQuicksand
Definition ActorCollision.h:239
void clampWaterSpeedY_()
bool bgCheckWall_() const
virtual bool smokeDamageEnable_Poison_(f32 surface_pos_y)
Definition ActorCollision.h:136
bool mCheckWaterNeeded
Definition ActorCollision.h:238
void snapToGroundImpl_(f32 y_check_distance, const ActorBgCollisionCheck::Sensor &foot_sensor, bool extended, bool force)
ActorCollision(const ActorCreateParam &param)
void postExecute(MainState state) override
Callback invoked unconditionally after the execute phase completes. It executes even if preExecute() ...
virtual bool isWaterFunsui() const
Definition ActorCollision.h:72
void calcSpeedY_()
friend BgCheckFlag operator|(const BgCheckFlag &lhs, const BgCheckFlag &rhs)
Definition ActorCollision.h:39
bool mUseWaterTypeOverride
Definition ActorCollision.h:230
WaterCalcType
Definition ActorCollision.h:25
@ cWaterCalcType_ForceOut
Definition ActorCollision.h:28
@ cWaterCalcType_EnablePreCheck
Definition ActorCollision.h:27
@ cWaterCalcType_Normal
Definition ActorCollision.h:26
void postCreate(MainState state) override
Callback invoked unconditionally after the create phase completes. It executes even if preCreate() by...
Result doDelete() override
Main deletion callback for the actor.
void posMoveCalcJump_()
void calcJumpSpeedF_()
void calcFallSpeed_()
sead::Vector3f * mWaterCheckPos
Definition ActorCollision.h:229
bool mIsOnGround
Definition ActorCollision.h:245
f32 mJumpAccelF
Definition ActorCollision.h:228
virtual void setWaterFunsui(bool enable)
Definition ActorCollision.h:66
virtual bool isQuakeEnable_()
Determines whether setQuake_() should be called.
bool hasamareBgCheck_()
virtual void setFunsuiSpeedY(f32 speed)
Definition ActorCollision.h:125
virtual void beginFunsui()
Definition ActorCollision.h:77
f32 mWaterMaxFallSpeed
Definition ActorCollision.h:236
void checkSnapToGround_(f32 y_check_distance, const ActorBgCollisionCheck::Sensor &foot_sensor)
ActorBgCollisionCheck * getBgCheck() override
Definition ActorCollision.h:96
bool bgCheckFoot_() const
sead::Vector2f mBgSpeed
Definition ActorCollision.h:233
void calcBgSpeed_()