A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
Kinoko::Kart::KartScale Class Reference

#include <KartScale.hh>

Description

Mainly responsible for calculating scaling for the squish/unsquish animation.

Definition at line 9 of file KartScale.hh.

Inheritance diagram for Kinoko::Kart::KartScale:

Public Member Functions

 KartScale (const KartParam::Stats &stats)
void reset ()
void calc ()
void startCrush ()
void endCrush ()
void startShrink (s32 unk)
void endShrink (s32 unk)
const EGG::Vector3f & sizeScale () const
const EGG::Vector3f & pressScale () const

Private Types

enum class  CrushState {
  None = -1 ,
  Crush = 0 ,
  Uncrush = 1
}

Private Member Functions

void calcCrush ()
EGG::Vector3f getAnmScale (f32 frame) const

Private Attributes

s32 m_type
EGG::Vector3f m_scaleTransformOffset
EGG::Vector3f m_scaleTransformSlope
EGG::Vector3f m_sizeScale
bool m_scaleAnmActive
f32 m_anmFrame
std::array< f32, 4 > m_scaleTarget
CrushState m_crushState
 Specifies the current crush/uncrush state.
bool m_calcCrush
 Set while crush scaling is occurring.
f32 m_uncrushAnmFrame
 Current frame of the unsquish animation.
EGG::Vector3f m_pressScale

Static Private Attributes

static constexpr f32 CRUSH_SCALE = 0.3f
static constexpr std::array< f32, 4 > s_baseScaleStart
static constexpr std::array< f32, 4 > s_baseScaleTarget

Additional Inherited Members

Protected Member Functions inherited from Kinoko::Kart::KartObjectProxy
void apply (size_t idx)
void setPos (const EGG::Vector3f &pos)
void setRot (const EGG::Quatf &q)
void setInertiaScale (const EGG::Vector3f &scale)
KartAction * action ()
const KartAction * action () const
KartBody * body ()
const KartBody * body () const
KartCollide * collide ()
const KartCollide * collide () const
CollisionGroup * collisionGroup ()
const CollisionGroup * collisionGroup () const
KartMove * move ()
const KartMove * move () const
KartHalfPipe * halfPipe ()
const KartHalfPipe * halfPipe () const
KartScale * kartScale ()
const KartScale * kartScale () const
KartJump * jump ()
const KartJump * jump () const
KartParam * param ()
const KartParam * param () const
const BSP & bsp () const
KartPhysics * physics ()
const KartPhysics * physics () const
KartDynamics * dynamics ()
const KartDynamics * dynamics () const
KartState * state ()
const KartState * state () const
KartSub * sub ()
const KartSub * sub () const
KartSuspension * suspension (u16 suspIdx)
const KartSuspension * suspension (u16 suspIdx) const
KartSuspensionPhysics * suspensionPhysics (u16 suspIdx)
const KartSuspensionPhysics * suspensionPhysics (u16 suspIdx) const
KartTire * tire (u16 tireIdx)
const KartTire * tire (u16 tireIdx) const
WheelPhysics * tirePhysics (u16 tireIdx)
const WheelPhysics * tirePhysics (u16 tireIdx) const
CollisionData & collisionData ()
const CollisionData & collisionData () const
CollisionData & collisionData (u16 tireIdx)
const CollisionData & collisionData (u16 tireIdx) const
const System::KPad * inputs () const
Render::KartModel * model ()
const Render::KartModel * model () const
Field::ObjectCollisionKart * objectCollisionKart ()
const Field::ObjectCollisionKart * objectCollisionKart () const
Field::BoxColUnit * boxColUnit ()
const Field::BoxColUnit * boxColUnit () const
const EGG::Vector3f & scale () const
const EGG::Matrix34f & pose () const
EGG::Vector3f bodyFront () const
 Returns the third column of the rotation matrix, which is the facing vector.
EGG::Vector3f bodyForward () const
 Returns the first column of the rotation matrix, which is the "right" direction.
EGG::Vector3f bodyUp () const
 Returns the second column of the rotation matrix, which is the "up" direction.
const EGG::Vector3f & componentXAxis () const
const EGG::Vector3f & componentYAxis () const
const EGG::Vector3f & componentZAxis () const
const EGG::Vector3f & pos () const
const EGG::Vector3f & prevPos () const
const EGG::Quatf & fullRot () const
const EGG::Vector3f & extVel () const
const EGG::Vector3f & intVel () const
const EGG::Vector3f & velocity () const
f32 speed () const
f32 acceleration () const
f32 softSpeedLimit () const
const EGG::Quatf & mainRot () const
const EGG::Vector3f & angVel2 () const
bool isBike () const
u16 suspCount () const
u16 tireCount () const
bool hasFloorCollision (const WheelPhysics *wheelPhysics) const
std::pair< EGG::Vector3f, EGG::Vector3f > getCannonPosRot ()
f32 speedRatio () const
f32 speedRatioCapped () const
bool isInRespawn () const
Field::KCLTypeMask wallKclType () const
u32 wallKclVariant () const
Status & status ()
const Status & status () const
const EGG::Vector3f & wheelPos (u16 idx) const
const EGG::Vector3f & wheelEdgePos (u16 idx) const
f32 cameraDistY () const
s32 hopStickX () const
KartParam::Stats::DriftType vehicleType () const
static std::list< KartObjectProxy *, EGG::Allocator< KartObjectProxy * > > & proxyList ()

Member Enumeration Documentation

◆ CrushState

enum class Kinoko::Kart::KartScale::CrushState
strongprivate

Definition at line 31 of file KartScale.hh.

Constructor & Destructor Documentation

◆ KartScale()

Kinoko::Kart::KartScale::KartScale ( const KartParam::Stats & stats)
0x8056AD44

Definition at line 8 of file KartScale.cc.

◆ ~KartScale()

Kinoko::Kart::KartScale::~KartScale ( )
default0x8056B5A8

Member Function Documentation

◆ calc()

void Kinoko::Kart::KartScale::calc ( )
0x8056B218

Definition at line 45 of file KartScale.cc.

◆ calcCrush()

void Kinoko::Kart::KartScale::calcCrush ( )
private0x8056B45C

Definition at line 111 of file KartScale.cc.

◆ endCrush()

void Kinoko::Kart::KartScale::endCrush ( )
0x8056B094

Definition at line 81 of file KartScale.cc.

◆ endShrink()

void Kinoko::Kart::KartScale::endShrink ( s32 unk)
0x8056B168

Definition at line 100 of file KartScale.cc.

◆ getAnmScale()

EGG::Vector3f Kinoko::Kart::KartScale::getAnmScale ( f32 frame) const
nodiscardprivate0x8056ACF4

Definition at line 137 of file KartScale.cc.

◆ pressScale()

const EGG::Vector3f & Kinoko::Kart::KartScale::pressScale ( ) const
inlinenodiscard

Definition at line 26 of file KartScale.hh.

◆ reset()

void Kinoko::Kart::KartScale::reset ( )
0x8056AF10

Definition at line 31 of file KartScale.cc.

◆ sizeScale()

const EGG::Vector3f & Kinoko::Kart::KartScale::sizeScale ( ) const
inlinenodiscard

Definition at line 22 of file KartScale.hh.

◆ startCrush()

void Kinoko::Kart::KartScale::startCrush ( )
0x8056B060

Definition at line 73 of file KartScale.cc.

◆ startShrink()

void Kinoko::Kart::KartScale::startShrink ( s32 unk)
0x8056AFB4

Definition at line 89 of file KartScale.cc.

Member Data Documentation

◆ CRUSH_SCALE

f32 Kinoko::Kart::KartScale::CRUSH_SCALE = 0.3f
staticconstexprprivate

Definition at line 53 of file KartScale.hh.

◆ m_anmFrame

f32 Kinoko::Kart::KartScale::m_anmFrame
private

Definition at line 46 of file KartScale.hh.

◆ m_calcCrush

bool Kinoko::Kart::KartScale::m_calcCrush
private

Set while crush scaling is occurring.

Definition at line 49 of file KartScale.hh.

◆ m_crushState

CrushState Kinoko::Kart::KartScale::m_crushState
private

Specifies the current crush/uncrush state.

Definition at line 48 of file KartScale.hh.

◆ m_pressScale

EGG::Vector3f Kinoko::Kart::KartScale::m_pressScale
private

Definition at line 51 of file KartScale.hh.

◆ m_scaleAnmActive

bool Kinoko::Kart::KartScale::m_scaleAnmActive
private

Definition at line 45 of file KartScale.hh.

◆ m_scaleTarget

std::array<f32, 4> Kinoko::Kart::KartScale::m_scaleTarget
private

Definition at line 47 of file KartScale.hh.

◆ m_scaleTransformOffset

EGG::Vector3f Kinoko::Kart::KartScale::m_scaleTransformOffset
private

Definition at line 42 of file KartScale.hh.

◆ m_scaleTransformSlope

EGG::Vector3f Kinoko::Kart::KartScale::m_scaleTransformSlope
private

Definition at line 43 of file KartScale.hh.

◆ m_sizeScale

EGG::Vector3f Kinoko::Kart::KartScale::m_sizeScale
private

Definition at line 44 of file KartScale.hh.

◆ m_type

s32 Kinoko::Kart::KartScale::m_type
private

Definition at line 41 of file KartScale.hh.

◆ m_uncrushAnmFrame

f32 Kinoko::Kart::KartScale::m_uncrushAnmFrame
private

Current frame of the unsquish animation.

Definition at line 50 of file KartScale.hh.

◆ s_baseScaleStart

std::array<f32, 4> Kinoko::Kart::KartScale::s_baseScaleStart
staticconstexprprivate
Initial value:
= {{
0.5f,
1.0f,
1.0f,
2.0f,
}}

Definition at line 55 of file KartScale.hh.

◆ s_baseScaleTarget

std::array<f32, 4> Kinoko::Kart::KartScale::s_baseScaleTarget
staticconstexprprivate
Initial value:
= {{
1.0f,
0.5f,
2.0f,
1.0f,
}}

Definition at line 62 of file KartScale.hh.