A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
KartMove.hh
Go to the documentation of this file.
1#pragma once
2
10
12
13#include <egg/core/BitFlag.hh>
14
15namespace Kinoko::Kart {
16
19class KartMove : protected KartObjectProxy {
20public:
21 enum class ePadType {
22 BoostPanel = 0,
23 BoostRamp = 1,
25 };
26
27 enum class DriftState {
28 NotDrifting = 0,
29 ChargingMt = 1,
30 ChargedMt = 2,
31 ChargingSmt = 2,
32 ChargedSmt = 3,
33 };
34
36
37 KartMove();
38 virtual ~KartMove();
39
40 virtual void createSubsystems(const KartParam::Stats &stats);
41 virtual void calcTurn();
42
43 virtual void calcWheelie() {}
44
45 virtual void setTurnParams();
46 virtual void init(bool b1, bool b2);
47 virtual void clear();
48
50 [[nodiscard]] virtual f32 leanRot() const {
51 return 0.0f;
52 }
53
54 void setInitialPhysicsValues(const EGG::Vector3f &position, const EGG::Vector3f &angles);
55 void resetDriftManual();
56
57 void calc();
58 void calcRespawnStart();
59 void calcInRespawn();
60 void calcRespawnBoost();
61 void calcTop();
62 void calcAirtimeTop();
63 void calcSpecialFloor();
64 void calcDirs();
65 void calcStickyRoad();
66 void calcOffroad();
67 void calcRisingWater();
68 void calcBoost();
69 void calcRampBoost();
71 void calcSsmt();
72 bool calcPreDrift();
73 void calcAutoDrift();
74 void calcManualDrift();
75 void startManualDrift();
76 void clearDrift();
77 void clearJumpPad();
78 void clearRampBoost();
79 void clearZipperBoost();
80 void clearBoost();
81 void clearSsmt();
83 void clearRejectRoad();
84 void releaseMt();
86 void calcRotation();
87 void calcVehicleSpeed();
88 void calcDeceleration();
89 [[nodiscard]] f32 calcVehicleAcceleration() const;
90 void calcAcceleration();
91 [[nodiscard]] f32 calcWallCollisionSpeedFactor(f32 &f1);
92 void calcWallCollisionStart(f32 param_2);
94 void calcDive();
95 void calcSsmtStart();
96 void calcHopPhysics();
97 void calcRejectRoad();
100 Field::KCLTypeMask *maskOut, Field::KCLTypeMask flags) const;
101 f32 calcSlerpRate(f32 scale, const EGG::Quatf &from, const EGG::Quatf &to) const;
102 void applyForce(f32 force, const EGG::Vector3f &hitDir, bool stop);
103 virtual void calcVehicleRotation(f32 turn);
104 virtual void hop();
105
106 virtual void onHop() {}
107
108 virtual void onWallCollision() {}
109
110 virtual void calcMtCharge();
111 virtual void initOob();
112
116 [[nodiscard]] virtual f32 getWheelieSoftSpeedLimitBonus() const {
117 return 0.0f;
118 }
119
121 virtual bool canWheelie() const {
122 return false;
123 }
124
126 virtual bool canHop() const {
127 const auto &status = KartObjectProxy::status();
128
130 return false;
131 }
132
134 return false;
135 }
136
137 return true;
138 }
139
144 bool canStartDrift() const {
146 }
147
148 void tryStartBoostPanel();
149 void tryStartBoostRamp();
150 void tryStartJumpPad();
151 void tryEndJumpPad();
152 void cancelJumpPad();
153
154 void activateBoost(KartBoost::Type type, s16 frames);
155 void applyStartBoost(s16 frames);
156 void activateMushroom();
157 void activateZipperBoost();
158 void setOffroadInvincibility(s16 timer);
160 void calcMushroomBoost();
161 void calcZipperBoost();
162 void landTrick();
163 void activateCrush(u16 timer);
164 void calcCrushed();
165 void calcScale();
166
169 applyShrink(300);
170 }
171
172 void applyShrink(u16 timer);
173 void calcShock();
174 void deactivateShock(bool resetSpeed);
175
176 void enterCannon();
177 void calcCannon();
178 void calcRotCannon(const EGG::Vector3f &forward);
179 void exitCannon();
180
181 void triggerRespawn();
182
184 void setSpeed(f32 val) {
185 m_speed = val;
186 }
187
189 m_smoothedUp = v;
190 }
191
192 void setUp(const EGG::Vector3f &v) {
193 m_up = v;
194 }
195
196 void setDir(const EGG::Vector3f &v) {
197 m_dir = v;
198 }
199
200 void setVel1Dir(const EGG::Vector3f &v) {
201 m_vel1Dir = v;
202 }
203
205 m_floorCollisionCount = count;
206 }
207
211
214 }
215
218 constexpr f32 LIMIT = 120.0f;
219 m_hardSpeedLimit = LIMIT;
220 }
221
223 void setScale(const EGG::Vector3f &v) {
224 m_scale = v;
225 }
226
227 void setPadType(PadType type) {
228 m_padType = type;
229 }
230
232
234 [[nodiscard]] DriftState driftState() const {
235 return m_driftState;
236 }
237
238 [[nodiscard]] u16 mtCharge() const {
239 return m_mtCharge;
240 }
241
242 [[nodiscard]] f32 kclSpeedFactor() const {
243 return m_kclSpeedFactor;
244 }
245
246 [[nodiscard]] f32 kclRotFactor() const {
247 return m_kclRotFactor;
248 }
249
253 [[nodiscard]] s32 getAppliedHopStickX() const {
254 return canStartDrift() ? m_hopStickX : 0;
255 }
256
257 [[nodiscard]] f32 softSpeedLimit() const {
258 return m_softSpeedLimit;
259 }
260
261 [[nodiscard]] f32 speed() const {
262 return m_speed;
263 }
264
265 [[nodiscard]] f32 acceleration() const {
266 return m_acceleration;
267 }
268
269 [[nodiscard]] const EGG::Vector3f &scale() const {
270 return m_scale;
271 }
272
273 [[nodiscard]] f32 hardSpeedLimit() const {
274 return m_hardSpeedLimit;
275 }
276
277 [[nodiscard]] const EGG::Vector3f &smoothedUp() const {
278 return m_smoothedUp;
279 }
280
281 [[nodiscard]] const EGG::Vector3f &up() const {
282 return m_up;
283 }
284
285 [[nodiscard]] f32 totalScale() const {
286 return m_totalScale;
287 }
288
289 [[nodiscard]] f32 hitboxScale() const {
290 return m_hitboxScale;
291 }
292
293 [[nodiscard]] const EGG::Vector3f &dir() const {
294 return m_dir;
295 }
296
297 [[nodiscard]] const EGG::Vector3f &lastDir() const {
298 return m_lastDir;
299 }
300
301 [[nodiscard]] const EGG::Vector3f &vel1Dir() const {
302 return m_vel1Dir;
303 }
304
305 [[nodiscard]] const EGG::Vector3f &smoothedForward() const {
306 return m_smoothedForward;
307 }
308
309 [[nodiscard]] f32 speedRatioCapped() const {
310 return m_speedRatioCapped;
311 }
312
313 [[nodiscard]] f32 speedRatio() const {
314 return m_speedRatio;
315 }
316
317 [[nodiscard]] u16 floorCollisionCount() const {
319 }
320
321 [[nodiscard]] s32 hopStickX() const {
322 return m_hopStickX;
323 }
324
325 [[nodiscard]] f32 hopPosY() const {
326 return m_hopPosY;
327 }
328
329 [[nodiscard]] s16 respawnTimer() const {
330 return m_respawnTimer;
331 }
332
333 [[nodiscard]] s16 respawnPostLandTimer() const {
335 }
336
337 [[nodiscard]] PadType &padType() {
338 return m_padType;
339 }
340
341 [[nodiscard]] KartJump *jump() const {
342 return m_jump;
343 }
344
345 [[nodiscard]] KartHalfPipe *halfPipe() const {
346 return m_halfPipe;
347 }
348
349 [[nodiscard]] KartScale *kartScale() const {
350 return m_kartScale;
351 }
352
353 [[nodiscard]] KartBurnout &burnout() {
354 return m_burnout;
355 }
356
358
359protected:
360 enum class eFlags {
361 Respawned = 0,
362 DriftReset = 1,
363 SsmtCharged = 2,
364 LaunchBoost = 4,
365 SsmtLeeway = 5,
366 TrickableSurface = 6,
367 WallBounce = 8,
368 };
370
372 enum class DrivingDirection {
373 Forwards = 0,
374 Braking = 1,
375 WaitingForBackwards = 2,
376 Backwards = 3,
377 };
378
384
392
480
481 static constexpr f32 MINIMUM_DRIFT_THRESOLD = 0.55f;
482};
483
488class KartMoveBike : public KartMove {
489public:
505
506 KartMoveBike();
508
509 virtual void startWheelie();
510 virtual void cancelWheelie();
511
512 void createSubsystems(const KartParam::Stats &stats) override;
513 void calcVehicleRotation(f32 /*turn*/) override;
514 void calcWheelie() override;
515 void onHop() override;
516 void onWallCollision() override;
517 void calcMtCharge() override;
518 void initOob() override;
519 void setTurnParams() override;
520 void init(bool b1, bool b2) override;
521 void clear() override;
522
526 [[nodiscard]] f32 getWheelieSoftSpeedLimitBonus() const override {
527 constexpr f32 WHEELIE_SPEED_BONUS = 0.15f;
528 return status().onBit(eStatus::Wheelie) ? WHEELIE_SPEED_BONUS : 0.0f;
529 }
530
532 [[nodiscard]] f32 wheelieRotFactor() const {
533 constexpr f32 WHEELIE_ROTATION_FACTOR = 0.2f;
534
535 return status().onBit(eStatus::Wheelie) ? WHEELIE_ROTATION_FACTOR : 1.0f;
536 }
537
538 void tryStartWheelie();
539
542 [[nodiscard]] f32 leanRot() const override {
543 return m_leanRot;
544 }
545
548 [[nodiscard]] bool canWheelie() const override {
549 constexpr f32 WHEELIE_THRESHOLD = 0.3f;
550
551 return m_speedRatioCapped >= WHEELIE_THRESHOLD && m_speed >= 0.0f;
552 }
553
555
556private:
567};
568
569} // namespace Kinoko::Kart
constexpr bool onBit(Es... es) const
Checks if any of the corresponding bits for the provided enum values are on.
Definition BitFlag.hh:391
constexpr bool offAnyBit(Es... es) const
Checks if any of the corresponding bits for the provided enum values are off.
Definition BitFlag.hh:446
State management for boosts (start boost, mushrooms, mini-turbos).
Definition KartBoost.hh:9
Calculates the duration of burnout and rotation induced when holding acceleration too long during the...
Handles the physics and boosts associated with zippers.
Manages trick inputs and state.
Definition KartJump.hh:30
void createSubsystems(const KartParam::Stats &stats) override
Definition KartMove.cc:2505
f32 m_wheelieRot
X-axis rotation from wheeling.
Definition KartMove.hh:560
const TurningParameters * m_turningParams
Inside/outside drifting bike turn info.
Definition KartMove.hh:566
void init(bool b1, bool b2) override
Definition KartMove.cc:2648
virtual void startWheelie()
STAGE 1+ - Sets the wheelie bit flag and some wheelie-related variables.
Definition KartMove.cc:2483
f32 m_wheelieRotDec
The wheelie rotation decrementor, used after a wheelie has ended.
Definition KartMove.hh:564
virtual void cancelWheelie()
Clears the wheelie bit flag and resets the rotation decrement.
Definition KartMove.cc:2498
void tryStartWheelie()
STAGE 1+ - Every frame, checks player input to see if we should start or stop a wheelie.
Definition KartMove.cc:2782
f32 m_leanRotInc
The incrementor for leaning rotation.
Definition KartMove.hh:559
void onWallCollision() override
Called when you collide with a wall. All it does for bikes is cancel wheelies.
Definition KartMove.cc:2740
void calcMtCharge() override
Every frame during a drift, calculates MT charge based on player input.
Definition KartMove.cc:2747
f32 leanRot() const override
Definition KartMove.hh:542
f32 m_maxWheelieRot
The maximum wheelie rotation.
Definition KartMove.hh:561
void onHop() override
Virtual function that just cancels wheelies when you hop.
Definition KartMove.cc:2730
void setTurnParams() override
On init, sets the bike's lean rotation cap and increment.In addition to setting the lean rotation cap...
Definition KartMove.cc:2624
f32 getWheelieSoftSpeedLimitBonus() const override
Returns what % to raise the speed cap when wheeling.
Definition KartMove.hh:526
u32 m_wheelieFrames
Tracks wheelie duration and cancels the wheelie after 180 frames.
Definition KartMove.hh:562
bool canWheelie() const override
Checks if the kart is going fast enough to wheelie.
Definition KartMove.hh:548
f32 m_leanRot
Z-axis rotation of the bike from leaning.
Definition KartMove.hh:557
s16 m_wheelieCooldown
The number of frames before another wheelie can start.
Definition KartMove.hh:563
void calcWheelie() override
STAGE 1+ - Every frame, checks player input for wheelies and computes wheelie rotation.
Definition KartMove.cc:2669
void calcVehicleRotation(f32) override
Every frame, calculates rotation, EV, and angular velocity for the bike.
Definition KartMove.cc:2514
f32 m_leanRotCap
The maximum leaning rotation.
Definition KartMove.hh:558
void initOob() override
Definition KartMove.cc:2775
u16 m_floorCollisionCount
The number of tires colliding with the floor.
Definition KartMove.hh:419
f32 m_processedSpeed
Offset 0x28. It's only ever just a copy of m_speed.
Definition KartMove.hh:397
const EGG::Vector3f & vel1Dir() const
Definition KartMove.hh:301
void setKCLWheelRotFactor(f32 val)
Definition KartMove.hh:212
bool calcPreDrift()
Each frame, checks for hop or slipdrift. Computes drift direction based on player input.
Definition KartMove.cc:845
u16 floorCollisionCount() const
Definition KartMove.hh:317
DriftState m_driftState
Definition KartMove.hh:426
void calcWallCollisionStart(f32 param_2)
If we started to collide with a wall this frame, applies rotation.
Definition KartMove.cc:1618
void deactivateShock(bool resetSpeed)
Definition KartMove.cc:2329
s32 m_hopStickX
A ternary for the direction of our hop, 0 if still neutral hopping.
Definition KartMove.hh:420
s16 m_offroadInvincibility
How many frames until the player is affected by offroad.
Definition KartMove.hh:434
const JumpPadProperties * m_jumpPadProperties
Definition KartMove.hh:453
EGG::Vector3f m_scale
Normally the unit vector, but may vary due to crush animations.
Definition KartMove.hh:440
virtual void onWallCollision()
Definition KartMove.hh:108
EGG::Vector3f m_smoothedForward
Definition KartMove.hh:407
f32 m_kclWheelSpeedFactor
The slowest speed multiplier of each wheel's floor collision.
Definition KartMove.hh:417
f32 m_divingRot
Induces x-axis angular velocity based on up/down stick input.
Definition KartMove.hh:424
f32 m_speed
Current speed, restricted to the soft speed limit.
Definition KartMove.hh:395
void calcDisableBackwardsAccel()
Computes the current cooldown duration between braking and reversing.
Definition KartMove.cc:771
void calcStandstillBoostRot()
STAGE Computes the x-component of angular velocity based on the kart's speed.
Definition KartMove.cc:1685
f32 speedRatio() const
Definition KartMove.hh:313
f32 m_lastSpeed
Last frame's speed, cached to calculate angular velocity.
Definition KartMove.hh:396
void calc()
Each frame, calculates the kart's movement.
Definition KartMove.cc:296
f32 m_outsideDriftBonus
Added to angular velocity when outside drifting.
Definition KartMove.hh:429
virtual f32 leanRot() const
Definition KartMove.hh:50
f32 m_hopPosY
Relative position as the result of a hop. Starts at 0.
Definition KartMove.hh:463
EGG::Vector3f m_smoothedUp
A smoothed up vector, mostly used after significant airtime.
Definition KartMove.hh:401
DrivingDirection m_drivingDirection
Current state of driver's direction.
Definition KartMove.hh:470
f32 calcWallCollisionSpeedFactor(f32 &f1)
Every frame, computes a speed scalar if we are colliding with a wall.
Definition KartMove.cc:1585
void calcOffroad()
Each frame, computes rotation and speed scalars from the floor KCL.
Definition KartMove.cc:680
s16 m_backwardsAllowCounter
Tracks the 15f delay before reversing.
Definition KartMove.hh:471
virtual bool canHop() const
Definition KartMove.hh:126
f32 m_outsideDriftAngle
The facing angle of an outward-drifting vehicle.
Definition KartMove.hh:410
void calcSsmt()
Calculates standstill mini-turbo components, if applicable.
Definition KartMove.cc:788
f32 kclSpeedFactor() const
Definition KartMove.hh:242
s16 m_bumpTimer
Set when a SmallBump collision occurs.
Definition KartMove.hh:469
KartJump * jump() const
Definition KartMove.hh:341
f32 m_acceleration
Captures the acceleration from player input and boosts.
Definition KartMove.hh:399
s16 m_ssmtLeewayTimer
Frames to forgive letting go of A before clearing SSMT charge.
Definition KartMove.hh:436
void applyForce(f32 force, const EGG::Vector3f &hitDir, bool stop)
Definition KartMove.cc:1834
KartBurnout & burnout()
Definition KartMove.hh:353
s32 getAppliedHopStickX() const
Factors in vehicle speed to retrieve our hop direction and magnitude.
Definition KartMove.hh:253
virtual void onHop()
Definition KartMove.hh:106
void calcManualDrift()
Each frame, handles hopping, drifting, and mini-turbos.
Definition KartMove.cc:1014
void setInitialPhysicsValues(const EGG::Vector3f &position, const EGG::Vector3f &angles)
Initializes the kart's position and rotation. Calls tire suspension initializers.
Definition KartMove.cc:258
EGG::Vector3f m_lastDir
m_speed from the previous frame but with signed magnitude.
Definition KartMove.hh:405
void calcVehicleSpeed()
Every frame, computes speed based on acceleration and any active boosts.
Definition KartMove.cc:1294
f32 m_weightedTurn
Magnitude+direction of stick input, factoring in the kart's stats.
Definition KartMove.hh:439
void setKCLWheelSpeedFactor(f32 val)
Definition KartMove.hh:208
s32 m_hopFrame
A timer that can prevent subsequent hops until reset.
Definition KartMove.hh:421
void calcSpecialFloor()
Every frame, calculates any boost resulting from a boost panel.
Definition KartMove.cc:522
virtual void init(bool b1, bool b2)
Definition KartMove.cc:143
void calcDive()
Responds to player input to handle up/down kart tilt mid-air.
Definition KartMove.cc:1726
s16 respawnPostLandTimer() const
Definition KartMove.hh:333
const EGG::Vector3f & lastDir() const
Definition KartMove.hh:297
f32 m_softSpeedLimit
Base speed + boosts + wheelies, restricted to the hard speed limit.
Definition KartMove.hh:394
f32 kclRotFactor() const
Definition KartMove.hh:246
s16 m_timeInRespawn
The number of frames elapsed after position snap from respawn.
Definition KartMove.hh:465
EGG::Vector3f m_cannonProgress
Definition KartMove.hh:461
u16 m_smtCharge
A value between 0 and 300 representing current SMT charge.
Definition KartMove.hh:428
f32 m_kclWheelRotFactor
The slowest rotation multiplier of each wheel's floor collision.
Definition KartMove.hh:418
KartBurnout m_burnout
Manages the state of start boost burnout.
Definition KartMove.hh:477
EGG::Vector3f m_outsideDriftLastDir
Used to compute the next m_outsideDriftAngle.
Definition KartMove.hh:412
f32 totalScale() const
Definition KartMove.hh:285
void applyShrink(u16 timer)
Definition KartMove.cc:2296
void activateCrush(u16 timer)
Definition KartMove.cc:2261
void calcAutoDrift()
Each frame, handles automatic transmission drifting.
Definition KartMove.cc:959
EGG::TBitFlag< u32, ePadType > PadType
Definition KartMove.hh:35
void applyStartBoost(s16 frames)
Definition KartMove.cc:2125
void startManualDrift()
Called when the player lands from a drift hop, or to start a slipdrift.
Definition KartMove.cc:1096
void calcSsmtStart()
Calculates whether we are starting a standstill mini-turbo.
Definition KartMove.cc:1787
void clearOffroadInvincibility()
Definition KartMove.cc:947
const EGG::Vector3f & smoothedUp() const
Definition KartMove.hh:277
f32 m_speedDragMultiplier
After 5 frames of airtime, this causes speed to slowly decay.
Definition KartMove.hh:400
EGG::Vector3f m_dirDiff
Definition KartMove.hh:408
void controlOutsideDriftAngle()
Every frame, handles mini-turbo charging and outside drifting bike rotation.
Definition KartMove.cc:1164
f32 softSpeedLimit() const
Definition KartMove.hh:257
f32 m_jumpPadMinSpeed
Snaps the player to a minimum speed when first touching a jump pad.
Definition KartMove.hh:449
f32 m_totalScale
[Unused] Always 1.0f
Definition KartMove.hh:441
EGG::Vector3f m_cannonEntryOfs
Definition KartMove.hh:459
s32 hopStickX() const
Definition KartMove.hh:321
virtual bool canWheelie() const
Definition KartMove.hh:121
EGG::Vector3f m_hopDir
Used for outward drift. Tracks the forward vector of our rotation.
Definition KartMove.hh:423
const EGG::Vector3f & scale() const
Definition KartMove.hh:269
f32 calcSlerpRate(f32 scale, const EGG::Quatf &from, const EGG::Quatf &to) const
Definition KartMove.cc:1827
s16 m_ssmtCharge
Increments every frame up to 75 when charging stand-still MT.
Definition KartMove.hh:435
virtual void hop()
Initializes hop information, resets upwards EV and clears upwards force.
Definition KartMove.cc:1963
void setUp(const EGG::Vector3f &v)
Definition KartMove.hh:192
u16 m_mtCharge
A value between 0 and 270 representing current MT charge.
Definition KartMove.hh:427
virtual void calcMtCharge()
Every frame during a drift, calculates MT/SMT charge based on player input.
Definition KartMove.cc:1898
void setPadType(PadType type)
Definition KartMove.hh:227
void activateBoost(KartBoost::Type type, s16 frames)
Definition KartMove.cc:2118
u16 m_mushroomBoostTimer
Number of frames until the mushroom boost runs out.
Definition KartMove.hh:444
f32 m_kclRotFactor
Float between 0-1 that scales the player's turning radius on offroad.
Definition KartMove.hh:416
bool canStartDrift() const
Definition KartMove.hh:144
bool calcZipperCollision(f32 radius, f32 scale, EGG::Vector3f &pos, EGG::Vector3f &upLocal, const EGG::Vector3f &prevPos, Field::CollisionInfo *colInfo, Field::KCLTypeMask *maskOut, Field::KCLTypeMask flags) const
Definition KartMove.cc:1816
void calcAcceleration()
Every frame, applies acceleration to the kart's internal velocity.
Definition KartMove.cc:1433
void setSpeed(f32 val)
Definition KartMove.hh:184
f32 m_rawTurn
Float in range [-1, 1]. Represents stick magnitude + direction.
Definition KartMove.hh:479
s16 m_respawnPostLandTimer
Counts up to 4 if not accelerating after respawn landing.
Definition KartMove.hh:467
virtual f32 getWheelieSoftSpeedLimitBonus() const
Returns the % speed boost from wheelies. For karts, this is always 0.
Definition KartMove.hh:116
void calcRotCannon(const EGG::Vector3f &forward)
Definition KartMove.cc:2438
void releaseMt()
Stops charging a mini-turbo, and applies boost if charged.
Definition KartMove.cc:1138
u16 m_crushTimer
Number of frames until player will be uncrushed.
Definition KartMove.hh:447
EGG::Vector3f m_cannonOrthog
Definition KartMove.hh:460
f32 m_speedRatio
The ratio between current speed and the player's base speed stat.
Definition KartMove.hh:414
void calcAirtimeTop()
Calculates rotation of the bike due to excessive airtime.
Definition KartMove.cc:497
EGG::Vector3f m_up
Vector perpendicular to the floor, pointing upwards.
Definition KartMove.hh:402
virtual void initOob()
Definition KartMove.cc:1951
f32 hitboxScale() const
Definition KartMove.hh:289
f32 speedRatioCapped() const
Definition KartMove.hh:309
DriftState driftState() const
Definition KartMove.hh:234
void setScale(const EGG::Vector3f &v)
Definition KartMove.hh:223
f32 m_hopVelY
Relative velocity due to a hop. Starts at 10 and decreases with gravity.
Definition KartMove.hh:462
KartScale * m_kartScale
Manages scaling due to TF stompers and MH cars.
Definition KartMove.hh:476
f32 m_speedRatioCapped
m_speedRatio but capped at 1.0f.
Definition KartMove.hh:413
void setSmoothedUp(const EGG::Vector3f &v)
Definition KartMove.hh:188
void calcRotation()
Every frame, calculates kart rotation based on player input.
Definition KartMove.cc:1197
KartHalfPipe * m_halfPipe
Pertains to zipper physics.
Definition KartMove.hh:475
EGG::Vector3f m_cannonEntryPos
Definition KartMove.hh:458
f32 m_hopGravity
Always main gravity (-1.3f).
Definition KartMove.hh:464
const EGG::Vector3f & dir() const
Definition KartMove.hh:293
void calcOffroadInvincibility()
Checks a timer to see if we are still ignoring offroad slowdown.
Definition KartMove.cc:2181
f32 m_kclSpeedFactor
Float between 0-1 that scales the player's speed on offroad.
Definition KartMove.hh:415
virtual void createSubsystems(const KartParam::Stats &stats)
Definition KartMove.cc:67
f32 calcVehicleAcceleration() const
Every frame, computes acceleration based off the character/vehicle stats.
Definition KartMove.cc:1399
f32 acceleration() const
Definition KartMove.hh:265
s16 m_ssmtDisableAccelTimer
Counter that tracks delay before starting to reverse.
Definition KartMove.hh:437
virtual void clear()
Definition KartMove.cc:238
virtual void calcTurn()
Each frame, looks at player input and kart stats. Saves turn-related info.
Definition KartMove.cc:76
KartScale * kartScale() const
Definition KartMove.hh:349
void calcMushroomBoost()
Checks a timer to see if we are still boosting from a mushroom.
Definition KartMove.cc:2197
s16 m_respawnPreLandTimer
Counts down from 4 when pressing A before landing from respawn.
Definition KartMove.hh:466
virtual void calcVehicleRotation(f32 turn)
Every frame, calculates rotation, EV, and angular velocity for the kart.
Definition KartMove.cc:1853
void resetDriftManual()
Clears drift state. Called when touching ground and drift is canceled.
Definition KartMove.cc:887
void tryStartBoostRamp()
Sets offroad invincibility and enables the ramp boost bitfield flag.
Definition KartMove.cc:2003
void setDir(const EGG::Vector3f &v)
Definition KartMove.hh:196
void setOffroadInvincibility(s16 timer)
Ignores offroad KCL collision for a set amount of time.
Definition KartMove.cc:2170
EGG::TBitFlag< u16, eFlags > Flags
Definition KartMove.hh:369
s16 respawnTimer() const
Definition KartMove.hh:329
void tryStartJumpPad()
Applies calculations to start interacting with a jump pad.
Definition KartMove.cc:2021
static constexpr f32 MINIMUM_DRIFT_THRESOLD
Definition KartMove.hh:481
void setVel1Dir(const EGG::Vector3f &v)
Definition KartMove.hh:200
virtual void setTurnParams()
Definition KartMove.cc:124
KartHalfPipe * halfPipe() const
Definition KartMove.hh:345
void setFloorCollisionCount(u16 count)
Definition KartMove.hh:204
EGG::Vector3f m_vel1Dir
Definition KartMove.hh:406
f32 hardSpeedLimit() const
Definition KartMove.hh:273
const EGG::Vector3f & smoothedForward() const
Definition KartMove.hh:305
virtual void calcWheelie()
Definition KartMove.hh:43
EGG::Vector3f m_dir
Definition KartMove.hh:404
DrivingDirection
The direction the player is currently driving in.
Definition KartMove.hh:372
f32 m_hardSpeedLimit
Absolute speed cap. It's 120, unless you're in a bullet (140).
Definition KartMove.hh:398
f32 m_realTurn
The "true" turn magnitude. Equal to m_weightedTurn unless drifting.
Definition KartMove.hh:438
const DriftingParameters * m_driftingParams
Drift-type-specific parameters.
Definition KartMove.hh:478
f32 m_baseSpeed
The speed associated with the current character/vehicle stats.
Definition KartMove.hh:393
const EGG::Vector3f & up() const
Definition KartMove.hh:281
EGG::Vector3f m_landingDir
Definition KartMove.hh:403
EGG::Vector3f m_hopUp
The up vector when hopping.
Definition KartMove.hh:422
const EGG::Vector3f & prevPos() const
const EGG::Vector3f & pos() const
Pertains to handling reject road.
Definition KartReject.hh:14
Mainly responsible for calculating scaling for the squish/unsquish animation.
Definition KartScale.hh:9
Pertains to kart-related functionality.
@ Wheelie
Set while we are in a wheelie (even during the countdown).
Definition Status.hh:40
@ HopStart
Set if m_bDriftInput was toggled on this frame.
Definition Status.hh:20
@ TouchingGround
Set when any part of the vehicle is colliding with floor KCL.
Definition Status.hh:30
float f32
Definition Memory.hh:21
int16_t s16
Definition Memory.hh:12
uint16_t u16
Definition Memory.hh:17
int32_t s32
Definition Memory.hh:13
uint32_t u32
Definition Memory.hh:18
A quaternion, used to represent 3D rotation.
Definition Quat.hh:12
Wrapper around an integral type with an enum corresponding to its bits.
Definition BitFlag.hh:23
A 3D float vector.
Definition Vector.hh:108
Stores information pertaining to a collision.
Represents turning information which differs only between inside/outside drift.
Definition KartMove.hh:491
Houses parameters that vary between the drift type (inward bike, outward bike, kart).
Definition KartMove.hh:386
Various character/vehicle-related handling and speed stats.
Definition KartParam.hh:84