86 .changeBit(currentState.accelerate() && !lastState.accelerate(),
92 .changeBit(currentState.drift() && !lastState.drift(),
158 bool softWallCollision =
false;
160 if (
collide()->numSoftWallCollisions() > 0) {
161 if (
collide()->numFloorOnlyCollisions() == 0) {
162 softWallCollision =
true;
169 if (avgSoftWallColHeight - avgFloorOnlyColHeight >= 40.0f) {
172 softWallCollision =
true;
177 u16 wheelCollisions = 0;
178 u16 effectiveSoftWallCount = 0;
180 bool trickable =
false;
182 for (
u16 tireIdx = 0; tireIdx <
tireCount(); ++tireIdx) {
185 m_top += colData.floorNrm;
186 trickable = trickable || colData.bTrickable;
190 if (softWallCollision && colData.bSoftWall) {
191 ++effectiveSoftWallCount;
192 wallNrm += colData.noBounceWallNrm;
196 if (wheelCollisions > 0) {
214 bool bodySoftWallCollision =
false;
215 if (softWallCollision && colData.
bSoftWall) {
216 bodySoftWallCollision =
true;
217 ++effectiveSoftWallCount;
237 if (!wasWallCollision) {
258 collide()->colPerpendicularity() >= 1.0f)) {
263 if (wallNrm.
length() < 0.05f) {
278 if (effectiveSoftWallCount > 0 || hwg) {
290 if (bodySoftWallCollision || hwg ||
isBike()) {
303 if (wheelCollisions < 1 && !colData.
bFloor) {
304 if (wasTouchingGround) {
334 if (!wasTouchingGround) {
353 constexpr f32 START_BOOST_DELTA_ONE = 0.02f;
354 constexpr f32 START_BOOST_DELTA_TWO = 0.002f;
355 constexpr f32 START_BOOST_FALLOFF = 0.96f;
@ COL_TYPE_SPECIAL_WALL
Various other wall types, determined by variant.
constexpr TBitFlagExt< N, E > & changeBit(bool on, Es... es)
Changes the state of the corresponding bits for the provided enum values.
constexpr bool offBit(Es... es) const
Checks if all of the corresponding bits for the provided enum values are off.
constexpr bool onBit(Es... es) const
Checks if any of the corresponding bits for the provided enum values are on.
constexpr TBitFlagExt< N, E > & makeAllZero()
Resets all the bits to zero across the entire bitfield array.
constexpr TBitFlagExt< N, E > & resetBit(Es... es)
Resets the corresponding bits for the provided enum values.
constexpr TBitFlagExt< N, E > & setBit(Es... es)
Sets the corresponding bits for the provided enum values.
bool start(Action action)
Starts an action.
f32 sumHitboxBottomHeightSoftWall() const
u16 numSoftWallCollisions() const
void calcBoundingRadius()
f32 sumHitboxBottomHeightFloorOnly() const
u16 numFloorOnlyCollisions() const
void setForceUpright(bool isSet)
void applyStartBoost(s16 frames)
CollisionData & collisionData()
Field::KCLTypeMask wallKclType() const
KartDynamics * dynamics()
KartHalfPipe * halfPipe()
bool hasFloorCollision(const WheelPhysics *wheelPhysics) const
WheelPhysics * tirePhysics(u16 tireIdx)
const System::KPad * inputs() const
u32 wallKclVariant() const
f32 m_startBoostCharge
0-1 representation of start boost charge. Burnout if >0.95f.
f32 m_stickY
One of 15 discrete stick values from [-1.0, 1.0].
void calc()
Every frame, resets the input state and saves collision-related bit flags.
void resetEjection()
Resets certain bitfields pertaining to ejections (reject road, half pipe zippers, etc....
size_t m_startBoostIdx
Used to map m_startBoostCharge to a start boost duration.
EGG::Vector3f m_softWallSpeed
void handleStartBoost(size_t idx)
Applies the relevant start boost duration.
void calcStartBoost()
STAGE 1 - Each frame, calculates the start boost charge.
void calcInput()
Each frame, read input and save related bit flags. Also handles start boosts.
void calcHandleStartBoost()
On countdown end, calculates and applies our start boost charge.
s16 m_halfPipeInvisibilityTimer
s16 m_wallBonkTimer
2f counter that stunts your speed after hitting a wall.
static constexpr std::array< StartBoostEntry, 6 > START_BOOST_ENTRIES
void calcCollisions()
Each frame, checks for collision and saves relevant bit flags.
f32 m_stickX
One of 15 discrete stick values from [-1.0, 1.0].
const RaceInputState & currentState() const
const RaceInputState & lastState() const
static RaceManager * Instance()
Pertains to kart-related functionality.
@ HopStart
Set if m_bDriftInput was toggled on this frame.
@ RejectRoad
Collision which causes a change in the player's pos and rot.
@ HalfPipeRamp
Set while colliding with zipper KCL.
@ SoftWallPush
Tracks whether we are being pushed by a soft wall or HWG.
@ HWG
Set when "Horizontal Wall Glitch" is active.
@ SoftWallSuspension
Changes wheel physics after touching a soft wall.
@ Hop
Set while we are in a drift hop. Clears when we land.
@ SoftWallUnlockRotation
Set when we are in "Barrel Roll" state.
@ JumpPadDisableYsusForce
@ StickLeft
Set on left stick input. Mutually exclusive to m_bStickRight.
@ JumpPadMushroomCollision
@ VehicleBodyFloorCollision
Set if the vehicle body is colliding with the floor.
@ ChargeStartBoost
Like m_bAccelerate but during countdown.
@ RejectRoadTrigger
e.g. DK Summit ending, and Maple Treeway side walls.
@ GroundStart
Set first frame landing from airtime.
@ AllWheelsCollision
Set when all wheels are touching floor collision.
@ Accelerate
Accel button is pressed.
@ StickRight
Set on right stick input. Mutually exclusive to m_bStickLeft.
@ ActionMidZipper
Set when we enter an action while mid-air from a zipper.
@ DriftInput
A "fake" button, normally set if you meet the speed requirement to hop.
@ AirtimeOver20
Set after 20 frames of airtime, resets on landing.
@ OverZipper
Set while mid-air from a zipper.
@ AccelerateStart
Set if m_bAccelerate was toggled on this frame.
@ Burnout
Set during a burnout on race start.
@ WallCollisionStart
Set if we have just started colliding with a wall.
@ AnyWheelCollision
Set when any wheel is touching floor collision.
@ AutoDrift
True if auto transmission, false if manual.
@ Wall3Collision
Set when colliding with wall KCL COL_TYPE_WALL_2.
@ TouchingGround
Set when any part of the vehicle is colliding with floor KCL.
@ ZipperInvisibleWall
Set when colliding with invisible wall above a zipper.
@ BeforeRespawn
Set on respawn collision, cleared on position snap.
@ WallCollision
Set if we are colliding with a wall.
static const Vector3f zero
constexpr f32 dot(const Vector3f &rhs) const
The dot product between two vectors.
constexpr f32 length() const
The square root of the vector's dot product.
constexpr f32 normalise()
Normalizes the vector and returns the original length.
Information about the current collision and its properties.
bool bWall3
Set if colliding with COL_TYPE_WALL_2.
bool bWall
Set if colliding with KCL which satisfies KCL_TYPE_WALL.
bool bFloor
Set if colliding with KCL which satisfies KCL_TYPE_FLOOR.