New Super Mario Bros. U Headers
Loading...
Searching...
No Matches
Actor.h
Go to the documentation of this file.
1#pragma once
2
3#include <actor/ActorBase.h>
4#include <actor/ActorCullRange.h>
5#include <collision/ActorCollisionCheck.h>
6#include <utility/Angle3.h>
7#include <utility/Direction.h>
8
9constexpr f32 ACTOR_DEFAULT_GRAVITY = -0.1875f;
11
13class BgCollision;
16class EatData;
17class PropelParts;
18
19typedef s32 EffectID;
20
21class Actor : public ActorBase // vtbl Address: 0x10000268
22{
23 // getRuntimeTypeInfoStatic()::typeInfo initialization guard variable Address: 0x101E9CBC
24 // getRuntimeTypeInfoStatic()::typeInfo Address: 0x101E9CC0
25 SEAD_RTTI_OVERRIDE(Actor, ActorBase)
26
27public:
36
46
47 /**
48 * @brief Flags to pass to `screenOutCheck` to skip checks or actions during the evaluation.
49 */
51 {
52 cScreenOutFlag_SkipNone = 0, ///< Perform all checks and delete the actor if they pass.
53 cScreenOutFlag_SkipDeletion = 1 << 1, ///< Skip deleting the actor if the checks do pass.
54 cScreenOutFlag_SkipCameraCheck = 1 << 2, ///< Skip checking if the actor is outside of the visible camera.
55 cScreenOutFlag_SkipRideCheck = 1 << 3, ///< Skip checking if the actor is riding another actor/platform.
56 cScreenOutFlag_SkipTottenCheck = 1 << 4 ///< Skip checking if Nabbit has passed to the right of the actor's visible range.
57 };
58
59public:
60 virtual void setPlayerNo(s8 id)
61 {
62 mPlayerNo = id;
63 }
64
66 {
67 return mPlayerNo;
68 }
69
70 // Address: 0x020002CC
71 virtual void removeCollisionCheck();
72 // Address: 0x02000328
73 virtual void reviveCollisionCheck();
74
76 {
77 return nullptr;
78 }
79
80 virtual void setCarryFall(Actor*, s32)
81 {
82 }
83
84 virtual bool isSpinLiftUpEnable()
85 {
86 return true;
87 }
88
89 virtual void setSpinLiftUpActor(Actor* player)
90 {
91 }
92
93 /**
94 * @brief Called by Group Controller when "activating" the target group.
95 */
96 virtual void groupActivate()
97 {
98 }
99
100 /**
101 * @brief Called by Group Controller when "deactivating" the target group.
102 */
103 virtual void groupDeactivate()
104 {
105 }
106
107 // Address: 0x02000394
108 bool checkCarried(s32* player_no);
109
111 {
112 return mComboCnt;
113 }
114
115 // Address: 0x02000418
117 // Address: 0x0200042C
119
120 // Address: 0x02000454
121 void slideComboSE(s32 combo_cnt, bool combo_type_2);
122
123 // Address: 0x020005A4
124 s32 searchNearPlayer(sead::Vector2f& out); // Returns -1 if no player found
125
126 // Address: 0x020005EC
127 DirType getPlayerDirLR(const sead::Vector3f& position);
128 // Address: 0x020006B4
129 DirType getPlayerDirUD(const sead::Vector3f& position);
130
132 {
133 return getPlayerDirLR(mPos);
134 }
135
137 {
138 return getPlayerDirUD(mPos);
139 }
140
141 /**
142 * @brief Checks if the actor is out of gameplay and optionally deletes it.
143 * @param flag Specify checks to skip, and whether to delete the actor if they all passed.
144 * @return Whether the actor is out of gameplay.
145 * @details The actor is considered "out of gameplay" if:
146 * * It has not been eaten.
147 * * It is not riding another actor/platform (unless skipped by flag).
148 * * Nabbit has passed to the **right** of the actor's visible range.
149 * * The actor is out of the zone bounds OR the actor is outside of the visible camera.
150 * @par Address: 0x020007A0
151 */
153
154 // Address: 0x02002AD8
155 virtual void allEnemyDeathEffSet(); // Spawn burst effect at instances where all enemies die (such as touching goal pole or defeating boss), called if profile flag bit 4, 5 or 7 is set
156 // Address: 0x02002ADC
157 virtual void waterSplashEffect(const sead::Vector3f& pos);
158 // Address: 0x02002AE0
159 virtual void yoganSplashEffect(const sead::Vector3f& pos);
160 // Address: 0x02000960
161 virtual void yoganWaveSplashEffect(const sead::Vector3f& pos);
162 // Address: 0x02002AE4
163 virtual void poisonSplashEffect(const sead::Vector3f& pos);
164
165 // Address: 0x02000970
167
168 // Address: 0x02000A70
169 bool checkEat() const;
170
171 /**
172 * @brief Schedule this actor for deletion on the next frame.
173 * @param manual_deleted Prevents respawning.
174 * @par Address: 0x02000774
175 */
176 void deleteActor(bool manual_deleted);
177
178public:
180 {
181 return mCollisionCheck;
182 }
183
185 {
186 return mCollisionCheck;
187 }
188
189 bool isExecEnable() const
190 {
191 return mIsExecEnable;
192 }
193
194 bool isDrawEnable() const
195 {
196 return mIsDrawEnable;
197 }
198
200 {
201 return mDirection;
202 }
203
204 void setDirection(DirType dir)
205 {
206 mDirection = dir;
207 }
208
209 u8 getLayer() const
210 {
211 return mLayer;
212 }
213
215 {
216 return mCollisionMask;
217 }
218
220 {
221 return mMaxSpeedF;
222 }
223
224 void setMaxSpeedF(f32 maxSpeedF)
225 {
226 mMaxSpeedF = maxSpeedF;
227 }
228
230 {
231 return mMaxFallSpeed;
232 }
233
234 void setMaxFallSpeed(f32 maxFallSpeed)
235 {
236 mMaxFallSpeed = maxFallSpeed;
237 }
238
239 /**
240 * @brief The current vertical acceleration.
241 */
243 {
244 return mGravity;
245 }
246
247 void setGravity(f32 gravity)
248 {
249 mGravity = gravity;
250 }
251
252 /**
253 * @brief The current horizontal acceleration.
254 */
255 f32 getPow() const
256 {
257 return mPow;
258 }
259
260 void setPow(f32 pow)
261 {
262 mPow = pow;
263 }
264
266 {
267 return mPos;
268 }
269
270 const sead::Vector3f& getPos() const
271 {
272 return mPos;
273 }
274
276 {
277 return reinterpret_cast<sead::Vector2f&>(mPos.x);
278 }
279
280 const sead::Vector2f& getPos2D() const
281 {
282 return reinterpret_cast<const sead::Vector2f&>(mPos.x);
283 }
284
286 {
287 return getPos() + mCenterOffset;
288 }
289
291 {
292 return getPos2D() + reinterpret_cast<const sead::Vector2f&>(mCenterOffset.x);
293 }
294
296 {
297 return mPos.x + mCenterOffset.x;
298 }
299
301 {
302 return mPos.y + mCenterOffset.y;
303 }
304
306 {
307 return mPos.z + mCenterOffset.z;
308 }
309
311 {
312 return mSpeed;
313 }
314
315 const sead::Vector3f& getSpeedVec() const
316 {
317 return mSpeed;
318 }
319
321 {
322 return mSpeedMax;
323 }
324
326 {
327 return mSpeedMax;
328 }
329
331 {
332 return mScale;
333 }
334
335 const sead::Vector3f& getScale() const
336 {
337 return mScale;
338 }
339
341 {
342 return mAngle;
343 }
344
345 const Angle3& getAngle() const
346 {
347 return mAngle;
348 }
349
351 {
352 return ActorKind(mActorKind);
353 }
354
355 void setKind(ActorKind kind)
356 {
357 mActorKind = kind;
358 }
359
361 {
362 return mManualDeletedFlag;
363 }
364
366 {
367 return CarryFlag(mCarryFlag);
368 }
369
371 {
372 return mSwitchFlag0;
373 }
374
376 {
377 return mSwitchFlag1;
378 }
379
381 {
382 return mProfFlag;
383 }
384
386 {
387 return mSpeedF;
388 }
389
390 void setSpeedF(f32 speedF)
391 {
392 mSpeedF = speedF;
393 }
394
396 {
397 return mAddSpeedF;
398 }
399
400 void setAddSpeedF(f32 speedF)
401 {
402 mAddSpeedF = speedF;
403 }
404
405protected:
406 // Address: 0x02000AC8
407 Actor(const ActorCreateParam& param);
408 // Address: 0x02000F18
410
411protected:
412 // Address: 0x02000FB8
413 void postCreate(MainState state) override;
414
415 // Address: 0x02000FE8
417 // Address: 0x020010BC
418 void postExecute(MainState state) override;
419
420 // Address: 0x020011A0
422
423 // Address: 0x02001254
424 virtual bool drawCullCheck_();
425
426 virtual void blockHitInit_()
427 {
428 }
429
430 // Address: 0x02001304
431 void splashEffect_(const sead::Vector3f& pos, EffectID effect_id, u8 wave_scale, const char* sound_label);
432
433 // Address: 0x020013D4
435
436 // Address: 0x020013E8
438 // Address: 0x02001430
439 void calcSpeedY_(f32 accel_y, f32 speed_max_y);
440 void calcSpeedY_() { calcSpeedY_(mGravity, mSpeedMax.y); }
441
442 void calcSpeedF_(f32 accelF, f32 max_speedF) { sead::Mathf::chase(&mSpeedF, max_speedF, accelF); }
443 void calcSpeedF_() { calcSpeedF_(mPow, mMaxSpeedF); }
444 // Address: 0x0200144C
445 void calcFallSpeed_(f32 accel_y, f32 max_fall_speed);
446 void calcFallSpeed_() { calcFallSpeed_(mGravity, mMaxFallSpeed); }
447
448 void posMove_(sead::Vector3f& delta)
449 {
450 mPos += delta;
451 }
452
453 void posMove_(sead::Vector2f& delta_xy, f32 delta_z)
454 {
455 getPos2D() += delta_xy;
456 mPos.z += delta_z;
457 }
458
459 void posMove_()
460 {
461 posMove_(mSpeed);
462 }
463
464 // Address: 0x02001A28
465 void carryFukidashiCheck_(s32 action);
466 // Address: 0x02001490
467 void carryFukidashiCheck_(s32 action, const sead::Vector2f& range);
468 // Address: 0x02001A64
469 void carryFukidashiCancel_(s32 action, s32 player_no);
470
471 // Address: 0x02001DC4
473 // Address: 0x0200222C
475
476 // Address: 0x02002594
478 // Address: 0x02002664
480
481 // Address: 0x0200272C
483
484 // Address: 0x02002390
485 bool setPressBreakIce_(const BgCollision* bg_collision);
486 // Address: 0x020024E0
487 bool setPressBreakBlockDRC_(const BgCollision* bg_collision);
488
489private:
491
492 // Address: 0x02001AF4
493 bool canPress_(const BgCollision* bg_collision);
494
495 // Address: 0x02001C08
496 bool checkPressLR_(const ActorBgCollisionCheck& bc, DirType direction);
497 // Address: 0x02002098
499 // Address: 0x02001F04
501
502 // Address: 0x02001B2C
503 bool canPressIfApproaching_(const BgCollision* bgcol_approaching_side, const BgCollision* bgcol_fixed_side);
504
505 // Address: 0x02000720
506 u32 calcTottenToSrcDir_(const sead::BoundBox2f& src_range) const;
507
508protected:
512 u8 mLayer; // Inited to ActorCreateParam::layer
514 f32 mSpeedF; // Horizontal speed
515 f32 mMaxSpeedF; // Maximum horizontal speed
516 f32 mMaxFallSpeed; // Maximum fall speed
517 f32 mGravity; // Vertical acceleration
518 f32 mPow; // Horizontal acceleration
525 sead::Vector2f mPosDelta; // At start of every frame
527 sead::Vector2f mVisibleAreaOffset; // Inited to ActorCreateInfo::spawn_range.offset
528 sead::Vector2f mVisibleAreaSize; // Inited to ActorCreateInfo::spawn_range.half_size * 2
530 ActorCullRange mCullLimit; // Inited to { 256.0 + ActorCreateInfo::cull_range.up,
531 // 256.0 + ActorCreateInfo::cull_range.down,
532 // 80.0 + ActorCreateInfo::cull_range.left,
533 // 80.0 + ActorCreateInfo::cull_range.right }
535 u8 mActorKind; // ActorKind
540 u8 mCarryFlag; // CarryFlag
543 u16 mCreateFlag; // Inited to ActorCreateInfo::flag
550 u32 mProfFlag; // Inited to Profile::mFlag
552 sead::Vector3f mPosPrev; // At frame start
554 sead::Vector3f mPosPrev2; // At frame end
558 u8* _270; // Inited to ActorCreateParam::_28
561
562 // Address: 0x10000B64
563 static const f32 cCullXLimit;
564 // Address: 0x10000B68
565 static const f32 cCullYLimit;
566};
567static_assert(sizeof(Actor) == 0x27C);
constexpr f32 ACTOR_DEFAULT_MAX_FALL_SPEED
Definition Actor.h:10
constexpr f32 ACTOR_DEFAULT_GRAVITY
Definition Actor.h:9
s32 EffectID
Definition Actor.h:19
Definition ActorBgCollisionCheck.h:59
Definition Actor.h:22
bool isDrawEnable() const
Definition Actor.h:194
virtual void waterSplashEffect(const sead::Vector3f &pos)
sead::Vector3f mPosPrev
Definition Actor.h:552
void setAddSpeedF(f32 speedF)
Definition Actor.h:400
void setSpeedF(f32 speedF)
Definition Actor.h:390
DirType getDirection() const
Definition Actor.h:199
s32 searchNearPlayer(sead::Vector2f &out)
virtual void allEnemyDeathEffSet()
virtual bool isSpinLiftUpEnable()
Definition Actor.h:84
void setMaxSpeedF(f32 maxSpeedF)
Definition Actor.h:224
u32 mBlockHitTimer
Definition Actor.h:544
Angle3 mAngle
Definition Actor.h:523
bool mIsExecEnable
Definition Actor.h:536
bool checkPressU_(const ActorBgCollisionCheck &bc)
sead::Vector2f mVisibleAreaSize
Definition Actor.h:528
void posMove_(sead::Vector2f &delta_xy, f32 delta_z)
Definition Actor.h:453
virtual bool drawCullCheck_()
sead::Vector3f mSpeedMax
Definition Actor.h:521
const sead::Vector3f & getSpeedMaxVec() const
Definition Actor.h:325
s8 mPlayerNo
Definition Actor.h:510
virtual void groupDeactivate()
Called by Group Controller when "deactivating" the target group.
Definition Actor.h:103
const Angle3 & getAngle() const
Definition Actor.h:345
void postExecute(MainState state) override
Callback invoked unconditionally after the execute phase completes. It executes even if preExecute() ...
u8 getLayer() const
Definition Actor.h:209
f32 getMaxFallSpeed() const
Definition Actor.h:229
s8 getPlayerNo() const
Definition Actor.h:65
const ActorCollisionCheck & getCollisionCheck() const
Definition Actor.h:184
u8 getSwitchFlag1() const
Definition Actor.h:375
void calcSpeedX_()
bool setPressBreakLR_(const ActorBgCollisionCheck &bc)
virtual void setPlayerNo(s8 id)
Definition Actor.h:60
virtual void groupActivate()
Called by Group Controller when "activating" the target group.
Definition Actor.h:96
PropelParts * mPropelParts
Definition Actor.h:557
sead::Vector2f mVisibleAreaOffset
Definition Actor.h:527
bool canPress_(const BgCollision *bg_collision)
s32 mComboCnt
Definition Actor.h:549
virtual void setCarryFall(Actor *, s32)
Definition Actor.h:80
bool setPressIceHeadBreak_(const ActorBgCollisionCheck &bc)
ChibiYoshiEatData * mChibiYoshiEatDataPtr
Definition Actor.h:556
EatData * mEatDataPtr
Definition Actor.h:555
const sead::Vector3f & getSpeedVec() const
Definition Actor.h:315
DirType mDirection
Definition Actor.h:509
f32 getPow() const
The current horizontal acceleration.
Definition Actor.h:255
bool preExecute() override
Callback invoked before the execute operation.
ActorCullRange mCullLimit
Definition Actor.h:530
virtual ActorBgCollisionCheck * getBgCheck()
Definition Actor.h:75
bool isEnablePressUD_(const ActorBgCollisionCheck &bc)
sead::Vector3f & getPos()
Definition Actor.h:265
u32 mProfFlag
Definition Actor.h:550
virtual void setSpinLiftUpActor(Actor *player)
Definition Actor.h:89
void setDirection(DirType dir)
Definition Actor.h:204
sead::Vector2f mSize
Definition Actor.h:529
DirType getPlayerDirLR()
Definition Actor.h:131
void carryFukidashiCheck_(s32 action)
sead::Vector2f getCenterPos2D() const
Definition Actor.h:290
bool setPressBreakIce_(const BgCollision *bg_collision)
ActorCollisionCheck mCollisionCheck
Definition Actor.h:526
s8 mControllerLytPlayerNo
Definition Actor.h:511
void calcSpeedF_()
Definition Actor.h:443
u16 mCreateFlag
Definition Actor.h:543
void posMove_()
Definition Actor.h:459
sead::Vector3f mCenterOffset
Definition Actor.h:551
void postCreate(MainState state) override
Callback invoked unconditionally after the create phase completes. It executes even if preCreate() by...
bool checkPressD_(const ActorBgCollisionCheck &bc)
bool mIsDrawEnable
Definition Actor.h:537
static const f32 cCullXLimit
Definition Actor.h:563
u8 mAreaNo
Definition Actor.h:534
sead::Vector3f & getSpeedVec()
Definition Actor.h:310
void calcFallSpeed_(f32 accel_y, f32 max_fall_speed)
sead::BitFlag8 getCollisionMask() const
Definition Actor.h:214
s32 getComboCnt() const
Definition Actor.h:110
sead::Vector2f & getPos2D()
Definition Actor.h:275
sead::Vector3f & getSpeedMaxVec()
Definition Actor.h:320
sead::Vector3f mPosPrevPostExec
Definition Actor.h:553
void carryFukidashiCancel_(s32 action, s32 player_no)
const sead::Vector2f & getPos2D() const
Definition Actor.h:280
f32 getGravity() const
The current vertical acceleration.
Definition Actor.h:242
u32 getProfFlag() const
Definition Actor.h:380
DirType getPlayerDirUD()
Definition Actor.h:136
f32 getAddSpeedF() const
Definition Actor.h:395
void setAreaNo_()
u8 mSwitchFlag1
Definition Actor.h:542
void splashEffect_(const sead::Vector3f &pos, EffectID effect_id, u8 wave_scale, const char *sound_label)
sead::Vector3f mPos
Definition Actor.h:519
bool setPressBreakBlockDRC_(const BgCollision *bg_collision)
void calcSpeedF_(f32 accelF, f32 max_speedF)
Definition Actor.h:442
virtual void yoganWaveSplashEffect(const sead::Vector3f &pos)
bool checkEat() const
bool isEnablePressLR_(const ActorBgCollisionCheck &bc)
bool canPressIfApproaching_(const BgCollision *bgcol_approaching_side, const BgCollision *bgcol_fixed_side)
ChibiYoshiAwaData * mChibiYoshiAwaDataPtr
Definition Actor.h:560
sead::Vector2f mPosDelta
Definition Actor.h:525
void deleteActor(bool manual_deleted)
Schedule this actor for deletion on the next frame.
bool checkCarried(s32 *player_no)
u8 _220
Definition Actor.h:546
Actor(const ActorCreateParam &param)
u8 mSwitchFlag0
Definition Actor.h:541
f32 mPow
Definition Actor.h:518
f32 mMaxSpeedF
Definition Actor.h:515
CarryFlag getCarryFlag() const
Definition Actor.h:365
bool setPressBreakUD_(const ActorBgCollisionCheck &bc)
f32 mAddSpeedF
Definition Actor.h:559
ActorKind getKind() const
Definition Actor.h:350
void slideComboSE(s32 combo_cnt, bool combo_type_2)
f32 getSpeedF() const
Definition Actor.h:385
virtual void yoganSplashEffect(const sead::Vector3f &pos)
DirType mCarryDirection
Definition Actor.h:547
static const f32 cCullYLimit
Definition Actor.h:565
void setPow(f32 pow)
Definition Actor.h:260
u8 getSwitchFlag0() const
Definition Actor.h:370
void setMaxFallSpeed(f32 maxFallSpeed)
Definition Actor.h:234
Angle3 mAnglePrev
Definition Actor.h:524
void setGravity(f32 gravity)
Definition Actor.h:247
u8 mLayer
Definition Actor.h:512
void calcSpeedY_()
Definition Actor.h:440
DirType getPlayerDirLR(const sead::Vector3f &position)
sead::Vector3f getCenterPos() const
Definition Actor.h:285
~Actor() override
f32 mSpeedF
Definition Actor.h:514
bool isExecEnable() const
Definition Actor.h:189
f32 getMaxSpeedF() const
Definition Actor.h:219
ActorCollisionCheck & getCollisionCheck()
Definition Actor.h:179
virtual void poisonSplashEffect(const sead::Vector3f &pos)
u8 mActorKind
Definition Actor.h:535
bool mManualDeletedFlag
Definition Actor.h:538
virtual void removeCollisionCheck()
void incComboCnt()
virtual void reviveCollisionCheck()
bool getManualDeletedFlag() const
Definition Actor.h:360
f32 mGravity
Definition Actor.h:517
void calcFallSpeed_()
Definition Actor.h:446
Actor * searchCarryFukidashiPlayer_(s32 action)
void carryFukidashiCheck_(s32 action, const sead::Vector2f &range)
Angle3 & getAngle()
Definition Actor.h:340
u32 mThrowPlayerNo
Definition Actor.h:548
f32 getCenterX() const
Definition Actor.h:295
CarryFlag
Definition Actor.h:38
@ cCarryFlag_Throw
Definition Actor.h:40
@ cCarryFlag_Release
Definition Actor.h:39
@ cCarryFlag_All
Definition Actor.h:44
@ cCarryFlag_ThrowHard
Definition Actor.h:41
@ cCarryFlag_None
Definition Actor.h:43
sead::Vector3f mScale
Definition Actor.h:522
sead::Vector3f mPosPrev2
Definition Actor.h:554
u8 * _270
Definition Actor.h:558
void clrComboCnt()
f32 getCenterY() const
Definition Actor.h:300
u32 calcTottenToSrcDir_(const sead::BoundBox2f &src_range) const
virtual void blockHitInit_()
Definition Actor.h:426
void calcSpeedY_(f32 accel_y, f32 speed_max_y)
void setKind(ActorKind kind)
Definition Actor.h:355
f32 getEffectZPos() const
sead::BitFlag8 mCollisionMask
Definition Actor.h:513
const sead::Vector3f & getScale() const
Definition Actor.h:335
f32 getCenterZ() const
Definition Actor.h:305
DirType mBlockHitDirection
Definition Actor.h:545
sead::Vector3f & getScale()
Definition Actor.h:330
void posMove_(sead::Vector3f &delta)
Definition Actor.h:448
u8 mCarryFlag
Definition Actor.h:540
sead::Vector3f mSpeed
Definition Actor.h:520
DirType getPlayerDirUD(const sead::Vector3f &position)
u8 _211
Definition Actor.h:539
const sead::Vector3f & getPos() const
Definition Actor.h:270
ScreenOutFlag
Flags to pass to screenOutCheck to skip checks or actions during the evaluation.
Definition Actor.h:51
@ cScreenOutFlag_SkipDeletion
Skip deleting the actor if the checks do pass.
Definition Actor.h:53
@ cScreenOutFlag_SkipRideCheck
Skip checking if the actor is riding another actor/platform.
Definition Actor.h:55
@ cScreenOutFlag_SkipNone
Perform all checks and delete the actor if they pass.
Definition Actor.h:52
@ cScreenOutFlag_SkipTottenCheck
Skip checking if Nabbit has passed to the right of the actor's visible range.
Definition Actor.h:56
@ cScreenOutFlag_SkipCameraCheck
Skip checking if the actor is outside of the visible camera.
Definition Actor.h:54
bool preDraw() override
Callback invoked before the draw operation.
bool screenOutCheck(ScreenOutFlag flag)
Checks if the actor is out of gameplay and optionally deletes it.
bool checkPressLR_(const ActorBgCollisionCheck &bc, DirType direction)
f32 mMaxFallSpeed
Definition Actor.h:516
Definition BgCollision.h:19
Defines parameters for interaction with bubbles from the blue Baby Yoshi.
Definition ChibiYoshiAwaData.h:14
Definition ChibiYoshiEatData.h:10
Definition EatData.h:10
Definition PropelParts.h:11