A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
KartMove.hh
1#pragma once
2
3#include "game/kart/KartBoost.hh"
4#include "game/kart/KartBurnout.hh"
5#include "game/kart/KartHalfPipe.hh"
6#include "game/kart/KartObjectProxy.hh"
7#include "game/kart/KartParam.hh"
8#include "game/kart/KartReject.hh"
9#include "game/kart/KartState.hh"
10
11#include "game/field/CourseColMgr.hh"
12
13#include <egg/core/BitFlag.hh>
14
15namespace Kart {
16
19class KartMove : protected KartObjectProxy {
20public:
21 enum class ePadType {
22 BoostPanel = 0,
23 BoostRamp = 1,
24 JumpPad = 2,
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 virtual void calcWheelie() {}
43 virtual void setTurnParams();
44 virtual void init(bool b1, bool b2);
45 virtual void clear();
46
48 [[nodiscard]] virtual f32 leanRot() const {
49 return 0.0f;
50 }
51
52 void setInitialPhysicsValues(const EGG::Vector3f &position, const EGG::Vector3f &angles);
53 void resetDriftManual();
54
55 void calc();
56 void calcRespawnStart();
57 void calcInRespawn();
58 void calcRespawnBoost();
59 void calcTop();
60 void calcAirtimeTop();
61 void calcSpecialFloor();
62 void calcDirs();
63 void calcStickyRoad();
64 void calcOffroad();
65 void calcRisingWater();
66 void calcBoost();
67 void calcRampBoost();
69 void calcSsmt();
70 bool calcPreDrift();
71 void calcAutoDrift();
72 void calcManualDrift();
73 void startManualDrift();
74 void clearDrift();
75 void clearJumpPad();
76 void clearRampBoost();
77 void clearZipperBoost();
78 void clearBoost();
79 void clearSsmt();
80 void clearOffroadInvincibility();
81 void clearRejectRoad();
82 void releaseMt();
84 void calcRotation();
85 void calcVehicleSpeed();
86 void calcDeceleration();
87 [[nodiscard]] f32 calcVehicleAcceleration() const;
88 void calcAcceleration();
89 [[nodiscard]] f32 calcWallCollisionSpeedFactor(f32 &f1);
90 void calcWallCollisionStart(f32 param_2);
92 void calcDive();
93 void calcSsmtStart();
94 void calcHopPhysics();
95 void calcRejectRoad();
96 bool calcZipperCollision(f32 radius, f32 scale, EGG::Vector3f &pos, EGG::Vector3f &upLocal,
97 const EGG::Vector3f &prevPos, Field::CollisionInfo *colInfo,
98 Field::KCLTypeMask *maskOut, Field::KCLTypeMask flags) const;
99 f32 calcSlerpRate(f32 scale, const EGG::Quatf &from, const EGG::Quatf &to) const;
100 void applyForce(f32 force, const EGG::Vector3f &hitDir, bool stop);
101 virtual void calcVehicleRotation(f32 turn);
102 virtual void hop();
103 virtual void onHop() {}
104 virtual void onWallCollision() {}
105 virtual void calcMtCharge();
106 virtual void initOob();
107
111 [[nodiscard]] virtual f32 getWheelieSoftSpeedLimitBonus() const {
112 return 0.0f;
113 }
114
116 virtual bool canWheelie() const {
117 return false;
118 }
119
121 virtual bool canHop() const {
122 const auto &status = KartObjectProxy::status();
123
125 return false;
126 }
127
128 if (status.onBit(eStatus::InAction)) {
129 return false;
130 }
131
132 return true;
133 }
134
139 bool canStartDrift() const {
140 return m_speed >= MINIMUM_DRIFT_THRESOLD * m_baseSpeed;
141 }
142
143 void tryStartBoostPanel();
144 void tryStartBoostRamp();
145 void tryStartJumpPad();
146 void tryEndJumpPad();
147 void cancelJumpPad();
148
149 void activateBoost(KartBoost::Type type, s16 frames);
150 void applyStartBoost(s16 frames);
151 void activateMushroom();
152 void activateZipperBoost();
153 void setOffroadInvincibility(s16 timer);
155 void calcMushroomBoost();
156 void calcZipperBoost();
157 void landTrick();
158 void activateCrush(u16 timer);
159 void calcCrushed();
160 void calcScale();
161
163 void activateShrink() {
164 applyShrink(300);
165 }
166
167 void applyShrink(u16 timer);
168 void calcShock();
169 void deactivateShock(bool resetSpeed);
170
171 void enterCannon();
172 void calcCannon();
173 void calcRotCannon(const EGG::Vector3f &forward);
174 void exitCannon();
175
176 void triggerRespawn();
177
179 void setSpeed(f32 val) {
180 m_speed = val;
181 }
182
183 void setSmoothedUp(const EGG::Vector3f &v) {
184 m_smoothedUp = v;
185 }
186
187 void setUp(const EGG::Vector3f &v) {
188 m_up = v;
189 }
190
191 void setDir(const EGG::Vector3f &v) {
192 m_dir = v;
193 }
194
195 void setVel1Dir(const EGG::Vector3f &v) {
196 m_vel1Dir = v;
197 }
198
199 void setFloorCollisionCount(u16 count) {
200 m_floorCollisionCount = count;
201 }
202
203 void setKCLWheelSpeedFactor(f32 val) {
205 }
206
207 void setKCLWheelRotFactor(f32 val) {
209 }
210
212 void setKartSpeedLimit() {
213 constexpr f32 LIMIT = 120.0f;
214 m_hardSpeedLimit = LIMIT;
215 }
216
218 void setScale(const EGG::Vector3f &v) {
219 m_scale = v;
220 }
221
222 void setPadType(PadType type) {
223 m_padType = type;
224 }
226
228 [[nodiscard]] DriftState driftState() const {
229 return m_driftState;
230 }
231
232 [[nodiscard]] u16 mtCharge() const {
233 return m_mtCharge;
234 }
235
236 [[nodiscard]] f32 kclSpeedFactor() const {
237 return m_kclSpeedFactor;
238 }
239
240 [[nodiscard]] f32 kclRotFactor() const {
241 return m_kclRotFactor;
242 }
243
247 [[nodiscard]] s32 getAppliedHopStickX() const {
248 return canStartDrift() ? m_hopStickX : 0;
249 }
250
251 [[nodiscard]] f32 softSpeedLimit() const {
252 return m_softSpeedLimit;
253 }
254
255 [[nodiscard]] f32 speed() const {
256 return m_speed;
257 }
258
259 [[nodiscard]] f32 acceleration() const {
260 return m_acceleration;
261 }
262
263 [[nodiscard]] const EGG::Vector3f &scale() const {
264 return m_scale;
265 }
266
267 [[nodiscard]] f32 hardSpeedLimit() const {
268 return m_hardSpeedLimit;
269 }
270
271 [[nodiscard]] const EGG::Vector3f &smoothedUp() const {
272 return m_smoothedUp;
273 }
274
275 [[nodiscard]] const EGG::Vector3f &up() const {
276 return m_up;
277 }
278
279 [[nodiscard]] f32 totalScale() const {
280 return m_totalScale;
281 }
282
283 [[nodiscard]] f32 hitboxScale() const {
284 return m_hitboxScale;
285 }
286
287 [[nodiscard]] const EGG::Vector3f &dir() const {
288 return m_dir;
289 }
290
291 [[nodiscard]] const EGG::Vector3f &lastDir() const {
292 return m_lastDir;
293 }
294
295 [[nodiscard]] const EGG::Vector3f &vel1Dir() const {
296 return m_vel1Dir;
297 }
298
299 [[nodiscard]] const EGG::Vector3f &smoothedForward() const {
300 return m_smoothedForward;
301 }
302
303 [[nodiscard]] f32 speedRatioCapped() const {
304 return m_speedRatioCapped;
305 }
306
307 [[nodiscard]] f32 speedRatio() const {
308 return m_speedRatio;
309 }
310
311 [[nodiscard]] u16 floorCollisionCount() const {
313 }
314
315 [[nodiscard]] s32 hopStickX() const {
316 return m_hopStickX;
317 }
318
319 [[nodiscard]] f32 hopPosY() const {
320 return m_hopPosY;
321 }
322
323 [[nodiscard]] s16 respawnTimer() const {
324 return m_respawnTimer;
325 }
326
327 [[nodiscard]] s16 respawnPostLandTimer() const {
329 }
330
331 [[nodiscard]] PadType &padType() {
332 return m_padType;
333 }
334
335 [[nodiscard]] KartJump *jump() const {
336 return m_jump;
337 }
338
339 [[nodiscard]] KartHalfPipe *halfPipe() const {
340 return m_halfPipe;
341 }
342
343 [[nodiscard]] KartScale *kartScale() const {
344 return m_kartScale;
345 }
346
347 [[nodiscard]] KartBurnout &burnout() {
348 return m_burnout;
349 }
351
352protected:
353 enum class eFlags {
354 Respawned = 0,
355 DriftReset = 1,
356 SsmtCharged = 2,
357 LaunchBoost = 4,
358 SsmtLeeway = 5,
359 TrickableSurface = 6,
360 WallBounce = 8,
361 };
362 typedef EGG::TBitFlag<u16, eFlags> Flags;
363
365 enum class DrivingDirection {
366 Forwards = 0,
367 Braking = 1,
369 Backwards = 3,
370 };
371
373 f32 minSpeed;
374 f32 maxSpeed;
375 f32 velY;
376 };
377
380 f32 hopVelY;
381 f32 stabilizationFactor;
382 f32 _8;
383 f32 boostRotFactor;
384 };
385
396 EGG::Vector3f m_landingDir;
397 EGG::Vector3f m_dir;
399 EGG::Vector3f m_vel1Dir;
400 EGG::Vector3f m_smoothedForward;
401 EGG::Vector3f m_dirDiff;
402 bool m_hasLandingDir;
404 f32 m_landingAngle;
418 f32 m_standStillBoostRot;
419 DriftState m_driftState;
423 KartBoost m_boost;
424 s16 m_zipperBoostTimer;
425 s16 m_zipperBoostMax;
426 KartReject m_reject;
435 f32 m_hitboxScale;
436 f32 m_shockSpeedMultiplier;
438 f32 m_invScale;
439 u16 m_shockTimer;
441 u32 m_nonZipperAirtime;
443 f32 m_jumpPadMaxSpeed;
444 f32 m_jumpPadBoostMultiplier;
445 f32 m_jumpPadSoftSpeedLimit;
446 const JumpPadProperties *m_jumpPadProperties;
447 u16 m_rampBoost;
448 f32 m_autoDriftAngle;
449 s16 m_autoDriftStartFrameCounter;
450 f32 m_cannonEntryOfsLength;
451 EGG::Vector3f m_cannonEntryPos;
452 EGG::Vector3f m_cannonEntryOfs;
453 EGG::Vector3f m_cannonOrthog;
454 EGG::Vector3f m_cannonProgress;
461 s16 m_respawnTimer;
465 PadType m_padType;
466 Flags m_flags;
467 KartJump *m_jump;
473
474 static constexpr f32 MINIMUM_DRIFT_THRESOLD = 0.55f;
475};
476
481class KartMoveBike : public KartMove {
482public:
485 f32 leanRotShallowFactor;
486 f32 leanRotIncRace;
487 f32 leanRotCapRace;
488 f32 driftStickXFactor;
489 f32 leanRotMaxDrift;
490 f32 leanRotMinDrift;
491 f32 leanRotIncCountdown;
492 f32 leanRotCapCountdown;
493 f32 leanRotIncSSMT;
494 f32 leanRotCapSSMT;
495 f32 leanRotDecayFactor;
496 u16 maxWheelieFrames;
497 };
498
499 KartMoveBike();
501
502 virtual void startWheelie();
503 virtual void cancelWheelie();
504
505 void createSubsystems(const KartParam::Stats &stats) override;
506 void calcVehicleRotation(f32 /*turn*/) override;
507 void calcWheelie() override;
508 void onHop() override;
509 void onWallCollision() override;
510 void calcMtCharge() override;
511 void initOob() override;
512 void setTurnParams() override;
513 void init(bool b1, bool b2) override;
514 void clear() override;
515
519 [[nodiscard]] f32 getWheelieSoftSpeedLimitBonus() const override {
520 constexpr f32 WHEELIE_SPEED_BONUS = 0.15f;
521 return status().onBit(eStatus::Wheelie) ? WHEELIE_SPEED_BONUS : 0.0f;
522 }
523
525 [[nodiscard]] f32 wheelieRotFactor() const {
526 constexpr f32 WHEELIE_ROTATION_FACTOR = 0.2f;
527
528 return status().onBit(eStatus::Wheelie) ? WHEELIE_ROTATION_FACTOR : 1.0f;
529 }
530
531 void tryStartWheelie();
532
535 [[nodiscard]] f32 leanRot() const override {
536 return m_leanRot;
537 }
538
541 [[nodiscard]] bool canWheelie() const override {
542 constexpr f32 WHEELIE_THRESHOLD = 0.3f;
543
544 return m_speedRatioCapped >= WHEELIE_THRESHOLD && m_speed >= 0.0f;
545 }
546
548
549private:
558 s16 m_autoHardStickXFrames;
560};
561
562} // namespace Kart
constexpr bool onBit(Es... es) const
Checks if any of the corresponding bits for the provided enum values are on.
Definition BitFlag.hh:379
constexpr bool offAnyBit(Es... es) const
Checks if any of the corresponding bits for the provided enum values are off.
Definition BitFlag.hh:434
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
Responsible for reacting to player inputs and moving the bike.
Definition KartMove.hh:481
f32 m_leanRot
Z-axis rotation of the bike from leaning.
Definition KartMove.hh:550
f32 m_leanRotCap
The maximum leaning rotation.
Definition KartMove.hh:551
void calcWheelie() override
STAGE 1+ - Every frame, checks player input for wheelies and computes wheelie rotation.
Definition KartMove.cc:2667
void calcMtCharge() override
Every frame during a drift, calculates MT charge based on player input.
Definition KartMove.cc:2745
virtual void startWheelie()
STAGE 1+ - Sets the wheelie bit flag and some wheelie-related variables.
Definition KartMove.cc:2481
f32 m_wheelieRotDec
The wheelie rotation decrementor, used after a wheelie has ended.
Definition KartMove.hh:557
u32 m_wheelieFrames
Tracks wheelie duration and cancels the wheelie after 180 frames.
Definition KartMove.hh:555
f32 m_wheelieRot
X-axis rotation from wheeling.
Definition KartMove.hh:553
const TurningParameters * m_turningParams
Inside/outside drifting bike turn info.
Definition KartMove.hh:559
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:2622
f32 m_maxWheelieRot
The maximum wheelie rotation.
Definition KartMove.hh:554
void tryStartWheelie()
STAGE 1+ - Every frame, checks player input to see if we should start or stop a wheelie.
Definition KartMove.cc:2780
void onWallCollision() override
Called when you collide with a wall. All it does for bikes is cancel wheelies.
Definition KartMove.cc:2738
void onHop() override
Virtual function that just cancels wheelies when you hop.
Definition KartMove.cc:2728
f32 getWheelieSoftSpeedLimitBonus() const override
Returns what % to raise the speed cap when wheeling.
Definition KartMove.hh:519
bool canWheelie() const override
Checks if the kart is going fast enough to wheelie.
Definition KartMove.hh:541
void calcVehicleRotation(f32) override
Every frame, calculates rotation, EV, and angular velocity for the bike.
Definition KartMove.cc:2512
s16 m_wheelieCooldown
The number of frames before another wheelie can start.
Definition KartMove.hh:556
f32 m_leanRotInc
The incrementor for leaning rotation.
Definition KartMove.hh:552
virtual void cancelWheelie()
Clears the wheelie bit flag and resets the rotation decrement.
Definition KartMove.cc:2496
Responsible for reacting to player inputs and moving the kart.
Definition KartMove.hh:19
f32 m_baseSpeed
The speed associated with the current character/vehicle stats.
Definition KartMove.hh:386
void calcRotation()
Every frame, calculates kart rotation based on player input.
Definition KartMove.cc:1191
s16 m_ssmtLeewayTimer
Frames to forgive letting go of A before clearing SSMT charge.
Definition KartMove.hh:429
s32 m_hopFrame
A timer that can prevent subsequent hops until reset.
Definition KartMove.hh:414
void calcDisableBackwardsAccel()
Computes the current cooldown duration between braking and reversing.
Definition KartMove.cc:765
EGG::Vector3f m_hopUp
The up vector when hopping.
Definition KartMove.hh:415
u16 m_mushroomBoostTimer
Number of frames until the mushroom boost runs out.
Definition KartMove.hh:437
void calcSpecialFloor()
Every frame, calculates any boost resulting from a boost panel.
Definition KartMove.cc:516
void calcWallCollisionStart(f32 param_2)
If we started to collide with a wall this frame, applies rotation.
Definition KartMove.cc:1613
KartHalfPipe * m_halfPipe
Pertains to zipper physics.
Definition KartMove.hh:468
f32 m_kclRotFactor
Float between 0-1 that scales the player's turning radius on offroad.
Definition KartMove.hh:409
f32 m_outsideDriftBonus
Added to angular velocity when outside drifting.
Definition KartMove.hh:422
void tryStartBoostRamp()
Sets offroad invincibility and enables the ramp boost bitfield flag.
Definition KartMove.cc:2001
void calcDeceleration()
Definition KartMove.cc:1380
u16 m_smtCharge
A value between 0 and 300 representing current SMT charge.
Definition KartMove.hh:421
f32 m_speedRatio
The ratio between current speed and the player's base speed stat.
Definition KartMove.hh:407
@ DriftReset
Set when a wall bonk should cancel your drift.
@ SsmtCharged
Set after holding a stand-still mini-turbo for 75 frames.
@ TrickableSurface
Set when driving on a trickable surface.
@ SsmtLeeway
If set, activates SSMT when not pressing A or B.
@ WallBounce
Set when our speed loss from wall collision is > 30.0f.
@ Respawned
Set when Lakitu lets go of the player, cleared when landing.
void tryStartJumpPad()
Applies calculations to start interacting with a jump pad.
Definition KartMove.cc:2019
f32 m_jumpPadMinSpeed
Snaps the player to a minimum speed when first touching a jump pad.
Definition KartMove.hh:442
f32 m_hopPosY
Relative position as the result of a hop. Starts at 0.
Definition KartMove.hh:456
DrivingDirection m_drivingDirection
Current state of driver's direction.
Definition KartMove.hh:463
u16 m_crushTimer
Number of frames until player will be uncrushed.
Definition KartMove.hh:440
bool calcPreDrift()
Each frame, checks for hop or slipdrift. Computes drift direction based on player input.
Definition KartMove.cc:839
f32 m_speed
Current speed, restricted to the soft speed limit.
Definition KartMove.hh:388
s16 m_offroadInvincibility
How many frames until the player is affected by offroad.
Definition KartMove.hh:427
void calcAirtimeTop()
Calculates rotation of the bike due to excessive airtime.
Definition KartMove.cc:491
void startManualDrift()
Called when the player lands from a drift hop, or to start a slipdrift.
Definition KartMove.cc:1090
void controlOutsideDriftAngle()
Every frame, handles mini-turbo charging and outside drifting bike rotation.
Definition KartMove.cc:1158
f32 m_softSpeedLimit
Base speed + boosts + wheelies, restricted to the hard speed limit.
Definition KartMove.hh:387
virtual void hop()
Initializes hop information, resets upwards EV and clears upwards force.
Definition KartMove.cc:1961
void calcStandstillBoostRot()
STAGE Computes the x-component of angular velocity based on the kart's speed.
Definition KartMove.cc:1680
EGG::Vector3f m_outsideDriftLastDir
Used to compute the next m_outsideDriftAngle.
Definition KartMove.hh:405
void calcManualDrift()
Each frame, handles hopping, drifting, and mini-turbos.
Definition KartMove.cc:1008
virtual void calcMtCharge()
Every frame during a drift, calculates MT/SMT charge based on player input.
Definition KartMove.cc:1896
void calcSsmt()
Calculates standstill mini-turbo components, if applicable.
Definition KartMove.cc:782
void calcAcceleration()
Every frame, applies acceleration to the kart's internal velocity.
Definition KartMove.cc:1428
f32 m_processedSpeed
Offset 0x28. It's only ever just a copy of m_speed.
Definition KartMove.hh:390
void releaseMt()
Stops charging a mini-turbo, and applies boost if charged.
Definition KartMove.cc:1132
f32 m_kclSpeedFactor
Float between 0-1 that scales the player's speed on offroad.
Definition KartMove.hh:408
f32 m_weightedTurn
Magnitude+direction of stick input, factoring in the kart's stats.
Definition KartMove.hh:432
void calcVehicleSpeed()
Every frame, computes speed based on acceleration and any active boosts.
Definition KartMove.cc:1288
f32 m_lastSpeed
Last frame's speed, cached to calculate angular velocity.
Definition KartMove.hh:389
s16 m_ssmtDisableAccelTimer
Counter that tracks delay before starting to reverse.
Definition KartMove.hh:430
void calcOffroadInvincibility()
Checks a timer to see if we are still ignoring offroad slowdown.
Definition KartMove.cc:2179
KartBurnout m_burnout
Manages the state of start boost burnout.
Definition KartMove.hh:470
f32 calcVehicleAcceleration() const
Every frame, computes acceleration based off the character/vehicle stats.
Definition KartMove.cc:1394
void calcAutoDrift()
Each frame, handles automatic transmission drifting.
Definition KartMove.cc:953
f32 m_realTurn
The "true" turn magnitude. Equal to m_weightedTurn unless drifting.
Definition KartMove.hh:431
const DriftingParameters * m_driftingParams
Drift-type-specific parameters.
Definition KartMove.hh:471
void clearDrift()
Definition KartMove.cc:892
void calc()
Each frame, calculates the kart's movement.
Definition KartMove.cc:290
EGG::Vector3f m_up
Vector perpendicular to the floor, pointing upwards.
Definition KartMove.hh:395
s16 m_ssmtCharge
Increments every frame up to 75 when charging stand-still MT.
Definition KartMove.hh:428
f32 m_speedDragMultiplier
After 5 frames of airtime, this causes speed to slowly decay.
Definition KartMove.hh:393
u16 m_mtCharge
A value between 0 and 270 representing current MT charge.
Definition KartMove.hh:420
void calcSsmtStart()
Calculates whether we are starting a standstill mini-turbo.
Definition KartMove.cc:1781
s16 m_respawnPostLandTimer
Counts up to 4 if not accelerating after respawn landing.
Definition KartMove.hh:460
virtual f32 getWheelieSoftSpeedLimitBonus() const
Returns the % speed boost from wheelies. For karts, this is always 0.
Definition KartMove.hh:111
f32 m_kclWheelRotFactor
The slowest rotation multiplier of each wheel's floor collision.
Definition KartMove.hh:411
void resetDriftManual()
Clears drift state. Called when touching ground and drift is canceled.
Definition KartMove.cc:881
f32 m_totalScale
[Unused] Always 1.0f
Definition KartMove.hh:434
f32 m_acceleration
Captures the acceleration from player input and boosts.
Definition KartMove.hh:392
virtual void calcVehicleRotation(f32 turn)
Every frame, calculates rotation, EV, and angular velocity for the kart.
Definition KartMove.cc:1847
s16 m_respawnPreLandTimer
Counts down from 4 when pressing A before landing from respawn.
Definition KartMove.hh:459
virtual void calcTurn()
Each frame, looks at player input and kart stats. Saves turn-related info.
Definition KartMove.cc:70
f32 m_divingRot
Induces x-axis angular velocity based on up/down stick input.
Definition KartMove.hh:417
f32 m_outsideDriftAngle
The facing angle of an outward-drifting vehicle.
Definition KartMove.hh:403
EGG::Vector3f m_lastDir
m_speed from the previous frame but with signed magnitude.
Definition KartMove.hh:398
EGG::Vector3f m_smoothedUp
A smoothed up vector, mostly used after significant airtime.
Definition KartMove.hh:394
bool canStartDrift() const
Definition KartMove.hh:139
s32 getAppliedHopStickX() const
Factors in vehicle speed to retrieve our hop direction and magnitude.
Definition KartMove.hh:247
u16 m_floorCollisionCount
The number of tires colliding with the floor.
Definition KartMove.hh:412
void calcDive()
Responds to player input to handle up/down kart tilt mid-air.
Definition KartMove.cc:1720
void calcOffroad()
Each frame, computes rotation and speed scalars from the floor KCL.
Definition KartMove.cc:674
s16 m_bumpTimer
Set when a Reaction::SmallBump collision occurs.
Definition KartMove.hh:462
KartScale * m_kartScale
Manages scaling due to TF stompers and MH cars.
Definition KartMove.hh:469
DrivingDirection
The direction the player is currently driving in.
Definition KartMove.hh:365
@ WaitingForBackwards
Holding reverse but waiting on a 15 frame delay.
s16 m_timeInRespawn
The number of frames elapsed after position snap from respawn.
Definition KartMove.hh:458
s32 m_hopStickX
A ternary for the direction of our hop, 0 if still neutral hopping.
Definition KartMove.hh:413
s16 m_backwardsAllowCounter
Tracks the 15f delay before reversing.
Definition KartMove.hh:464
f32 calcWallCollisionSpeedFactor(f32 &f1)
Every frame, computes a speed scalar if we are colliding with a wall.
Definition KartMove.cc:1580
void calcMushroomBoost()
Checks a timer to see if we are still boosting from a mushroom.
Definition KartMove.cc:2195
f32 m_hopGravity
Always main gravity (-1.3f).
Definition KartMove.hh:457
f32 m_hopVelY
Relative velocity due to a hop. Starts at 10 and decreases with gravity.
Definition KartMove.hh:455
f32 m_hardSpeedLimit
Absolute speed cap. It's 120, unless you're in a bullet (140).
Definition KartMove.hh:391
void setInitialPhysicsValues(const EGG::Vector3f &position, const EGG::Vector3f &angles)
Initializes the kart's position and rotation. Calls tire suspension initializers.
Definition KartMove.cc:252
f32 m_rawTurn
Float in range [-1, 1]. Represents stick magnitude + direction.
Definition KartMove.hh:472
void setOffroadInvincibility(s16 timer)
Ignores offroad KCL collision for a set amount of time.
Definition KartMove.cc:2168
f32 m_speedRatioCapped
m_speedRatio but capped at 1.0f.
Definition KartMove.hh:406
EGG::Vector3f m_scale
Normally the unit vector, but may vary due to crush animations.
Definition KartMove.hh:433
f32 m_kclWheelSpeedFactor
The slowest speed multiplier of each wheel's floor collision.
Definition KartMove.hh:410
EGG::Vector3f m_hopDir
Used for outward drift. Tracks the forward vector of our rotation.
Definition KartMove.hh:416
Base class for most kart-related objects.
Pertains to handling reject road.
Definition KartReject.hh:12
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).
@ HopStart
Set if m_bDriftInput was toggled on this frame.
@ TouchingGround
Set when any part of the vehicle is colliding with floor KCL.
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:21
A 3D float vector.
Definition Vector.hh:88
Represents turning information which differs only between inside/outside drift.
Definition KartMove.hh:484
Houses parameters that vary between the drift type (inward bike, outward bike, kart).
Definition KartMove.hh:379
Various character/vehicle-related handling and speed stats.
Definition KartParam.hh:79