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

Description

Definition at line 25 of file KartAction.hh.

Inheritance diagram for Kart::KartAction:

Classes

struct  ActionParams
 Parameters specific to an action ID. More...
 
struct  RotationParams
 

Public Types

enum class  eFlags { Rotating = 3 }
 
typedef EGG::TBitFlag< u32, eFlags > Flags
 

Public Member Functions

void init ()
 
void calc ()
 
void calcVehicleSpeed ()
 
bool start (Action action)
 Starts an action.
 
void startRotation (size_t idx)
 Initializes rotation parameters.
 
void setHitDepth (const EGG::Vector3f &hitDepth)
 
const Flagsflags () const
 

Private Types

typedef void(KartAction::*) StartActionFunc()
 
typedef bool(KartAction::*) CalcActionFunc()
 
typedef void(KartAction::*) EndActionFunc(bool arg)
 

Private Member Functions

void end ()
 
bool calcCurrentAction ()
 Executes a frame of the current action.
 
void calcEndAction (bool endArg)
 
bool calcRotation ()
 
void calcUp ()
 
void applyStartSpeed ()
 
void setRotation (size_t idx)
 
void startStub ()
 
void startAction1 ()
 
bool calcStub ()
 
bool calcAction1 ()
 
void endStub (bool arg)
 
void endAction1 (bool arg)
 
- Private Member Functions inherited from Kart::KartObjectProxy
void setPos (const EGG::Vector3f &pos)
 
void setRot (const EGG::Quatf &q)
 
void setInertiaScale (const EGG::Vector3f &scale)
 
KartActionaction ()
 
const KartActionaction () const
 
KartBodybody ()
 
const KartBodybody () const
 
KartCollidecollide ()
 
const KartCollidecollide () const
 
CollisionGroupcollisionGroup ()
 
const CollisionGroupcollisionGroup () const
 
KartMovemove ()
 
const KartMovemove () const
 
KartHalfPipehalfPipe ()
 
const KartHalfPipehalfPipe () const
 
KartJumpjump ()
 
const KartJumpjump () const
 
KartParamparam ()
 
const KartParamparam () const
 
const BSPbsp () const
 
KartPhysicsphysics ()
 
const KartPhysicsphysics () const
 
KartDynamicsdynamics ()
 
const KartDynamicsdynamics () const
 
KartStatestate ()
 
const KartStatestate () const
 
KartSubsub ()
 
const KartSubsub () const
 
KartSuspensionsuspension (u16 suspIdx)
 
const KartSuspensionsuspension (u16 suspIdx) const
 
KartSuspensionPhysicssuspensionPhysics (u16 suspIdx)
 
const KartSuspensionPhysicssuspensionPhysics (u16 suspIdx) const
 
KartTiretire (u16 tireIdx)
 
const KartTiretire (u16 tireIdx) const
 
WheelPhysicstirePhysics (u16 tireIdx)
 
const WheelPhysicstirePhysics (u16 tireIdx) const
 
CollisionDatacollisionData ()
 
const CollisionDatacollisionData () const
 
CollisionDatacollisionData (u16 tireIdx)
 
const CollisionDatacollisionData (u16 tireIdx) const
 
const System::KPadinputs () const
 
Render::KartModelmodel ()
 
const Render::KartModelmodel () const
 
Field::ObjectCollisionKartobjectCollisionKart ()
 
const Field::ObjectCollisionKartobjectCollisionKart () const
 
Field::BoxColUnitboxColUnit ()
 
const Field::BoxColUnitboxColUnit () const
 
const EGG::Vector3fscale () const
 
const EGG::Matrix34fpose () 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::Vector3fcomponentXAxis () const
 
const EGG::Vector3fcomponentYAxis () const
 
const EGG::Vector3fcomponentZAxis () const
 
const EGG::Vector3fpos () const
 
const EGG::Vector3fprevPos () const
 
const EGG::QuatffullRot () const
 
const EGG::Vector3fextVel () const
 
const EGG::Vector3fintVel () const
 
const EGG::Vector3fvelocity () const
 
f32 speed () const
 
f32 acceleration () const
 
f32 softSpeedLimit () const
 
const EGG::QuatfmainRot () const
 
const EGG::Vector3fangVel2 () const
 
bool isBike () const
 
u16 suspCount () const
 
u16 tireCount () const
 
bool hasFloorCollision (const WheelPhysics *wheelPhysics) const
 
std::pair< EGG::Vector3f, EGG::Vector3fgetCannonPosRot ()
 
f32 speedRatio () const
 
f32 speedRatioCapped () const
 
bool isInRespawn () const
 
void apply (size_t idx)
 

Private Attributes

Action m_currentAction
 
f32 m_rotationDirection
 
EGG::Vector3f m_hitDepth
 
StartActionFunc m_onStart
 
CalcActionFunc m_onCalc
 
EndActionFunc m_onEnd
 
EGG::Quatf m_rotation
 
const ActionParamsm_actionParams
 
u32 m_frame
 
Flags m_flags
 
f32 m_currentAngle
 
f32 m_angleIncrement
 
f32 m_multiplier
 
f32 m_multiplierDecrement
 
f32 m_finalAngle
 
const RotationParamsm_rotationParams
 
EGG::Vector3f m_up
 
s16 m_priority
 

Static Private Attributes

static constexpr size_t MAX_ACTION = static_cast<size_t>(Action::Max)
 
static const std::array< ActionParams, MAX_ACTION > s_actionParams
 
static const std::array< RotationParams, 5 > s_rotationParams
 
static const std::array< StartActionFunc, MAX_ACTION > s_onStart
 
static const std::array< CalcActionFunc, MAX_ACTION > s_onCalc
 
static const std::array< EndActionFunc, MAX_ACTION > s_onEnd
 

Additional Inherited Members

- Static Private Member Functions inherited from Kart::KartObjectProxy
static std::list< KartObjectProxy * > & proxyList ()
 

Member Typedef Documentation

◆ CalcActionFunc

bool(KartAction::*) Kart::KartAction::CalcActionFunc()
private

Definition at line 64 of file KartAction.hh.

◆ EndActionFunc

void(KartAction::*) Kart::KartAction::EndActionFunc(bool arg)
private

Definition at line 65 of file KartAction.hh.

◆ Flags

Definition at line 30 of file KartAction.hh.

◆ StartActionFunc

void(KartAction::*) Kart::KartAction::StartActionFunc()
private

Definition at line 63 of file KartAction.hh.

Member Enumeration Documentation

◆ eFlags

enum class Kart::KartAction::eFlags
strong

Definition at line 27 of file KartAction.hh.

Constructor & Destructor Documentation

◆ KartAction()

Kart::KartAction::KartAction ( )
0x805672CC

Definition at line 12 of file KartAction.cc.

Member Function Documentation

◆ applyStartSpeed()

void Kart::KartAction::applyStartSpeed ( )
private0x80567C68

Definition at line 168 of file KartAction.cc.

◆ calc()

void Kart::KartAction::calc ( )
0x805673B0

Definition at line 27 of file KartAction.cc.

◆ calcAction1()

bool Kart::KartAction::calcAction1 ( )
private0x80568204

Definition at line 207 of file KartAction.cc.

◆ calcCurrentAction()

bool Kart::KartAction::calcCurrentAction ( )
private0x80567A54

Executes a frame of the current action.

Returns
Whether or not the action should end.

Definition at line 116 of file KartAction.cc.

◆ calcEndAction()

void Kart::KartAction::calcEndAction ( bool endArg)
private0x80567A88

Definition at line 122 of file KartAction.cc.

◆ calcRotation()

bool Kart::KartAction::calcRotation ( )
private0x80569DFC

Definition at line 134 of file KartAction.cc.

◆ calcStub()

bool Kart::KartAction::calcStub ( )
private

Definition at line 202 of file KartAction.cc.

◆ calcUp()

void Kart::KartAction::calcUp ( )
private0x80569E9C

Definition at line 162 of file KartAction.cc.

◆ calcVehicleSpeed()

void Kart::KartAction::calcVehicleSpeed ( )
0x80567CE4

Definition at line 38 of file KartAction.cc.

◆ end()

void Kart::KartAction::end ( )
private0x80567B98

Definition at line 104 of file KartAction.cc.

◆ endAction1()

void Kart::KartAction::endAction1 ( bool arg)
private0x8056837C

Definition at line 223 of file KartAction.cc.

◆ endStub()

void Kart::KartAction::endStub ( bool arg)
private

Definition at line 220 of file KartAction.cc.

◆ flags()

const KartAction::Flags & Kart::KartAction::flags ( ) const

Definition at line 99 of file KartAction.cc.

◆ init()

void Kart::KartAction::init ( )
0x8056739C

Definition at line 21 of file KartAction.cc.

◆ setHitDepth()

void Kart::KartAction::setHitDepth ( const EGG::Vector3f & hitDepth)

Definition at line 95 of file KartAction.cc.

◆ setRotation()

void Kart::KartAction::setRotation ( size_t idx)
private0x80569DB4

Definition at line 176 of file KartAction.cc.

◆ start()

bool Kart::KartAction::start ( Action action)
0x805675DC

Starts an action.

Parameters
actionThe action to start.
Returns
Whether or not the action was started.

Definition at line 46 of file KartAction.cc.

◆ startAction1()

void Kart::KartAction::startAction1 ( )
private0x80567FB4

Definition at line 194 of file KartAction.cc.

◆ startRotation()

void Kart::KartAction::startRotation ( size_t idx)
0x80567D3C

Initializes rotation parameters.

Warning
The parameter is supposed to be an enum, but we discard it. This results in the arguments being off-by-one. Beware of zero!
Parameters
idxThe index for the rotation parameters.

Definition at line 82 of file KartAction.cc.

◆ startStub()

void Kart::KartAction::startStub ( )
private

Definition at line 191 of file KartAction.cc.

Member Data Documentation

◆ m_actionParams

const ActionParams* Kart::KartAction::m_actionParams
private

Definition at line 107 of file KartAction.hh.

◆ m_angleIncrement

f32 Kart::KartAction::m_angleIncrement
private

Definition at line 111 of file KartAction.hh.

◆ m_currentAction

Action Kart::KartAction::m_currentAction
private

Definition at line 98 of file KartAction.hh.

◆ m_currentAngle

f32 Kart::KartAction::m_currentAngle
private

Definition at line 110 of file KartAction.hh.

◆ m_finalAngle

f32 Kart::KartAction::m_finalAngle
private

Definition at line 114 of file KartAction.hh.

◆ m_flags

Flags Kart::KartAction::m_flags
private

Definition at line 109 of file KartAction.hh.

◆ m_frame

u32 Kart::KartAction::m_frame
private

Definition at line 108 of file KartAction.hh.

◆ m_hitDepth

EGG::Vector3f Kart::KartAction::m_hitDepth
private

Definition at line 100 of file KartAction.hh.

◆ m_multiplier

f32 Kart::KartAction::m_multiplier
private

Definition at line 112 of file KartAction.hh.

◆ m_multiplierDecrement

f32 Kart::KartAction::m_multiplierDecrement
private

Definition at line 113 of file KartAction.hh.

◆ m_onCalc

CalcActionFunc Kart::KartAction::m_onCalc
private

Definition at line 103 of file KartAction.hh.

◆ m_onEnd

EndActionFunc Kart::KartAction::m_onEnd
private

Definition at line 104 of file KartAction.hh.

◆ m_onStart

StartActionFunc Kart::KartAction::m_onStart
private

Definition at line 102 of file KartAction.hh.

◆ m_priority

s16 Kart::KartAction::m_priority
private

Definition at line 117 of file KartAction.hh.

◆ m_rotation

EGG::Quatf Kart::KartAction::m_rotation
private

Definition at line 106 of file KartAction.hh.

◆ m_rotationDirection

f32 Kart::KartAction::m_rotationDirection
private

Definition at line 99 of file KartAction.hh.

◆ m_rotationParams

const RotationParams* Kart::KartAction::m_rotationParams
private

Definition at line 115 of file KartAction.hh.

◆ m_up

EGG::Vector3f Kart::KartAction::m_up
private

Definition at line 116 of file KartAction.hh.

◆ MAX_ACTION

size_t Kart::KartAction::MAX_ACTION = static_cast<size_t>(Action::Max)
staticconstexprprivate

Definition at line 119 of file KartAction.hh.

◆ s_actionParams

const std::array< KartAction::ActionParams, KartAction::MAX_ACTION > Kart::KartAction::s_actionParams
staticprivate
Initial value:
= {{
{0.98f, 0.98f, 1},
{0.98f, 0.98f, 2},
{0.96f, 0.96f, 4},
{0.0f, 0.96f, 4},
{0.0f, 0.98f, 4},
{0.0f, 0.96f, 4},
{0.0f, 0.96f, 4},
{0.0f, 0.0f, 6},
{0.0f, 0.99f, 6},
{0.98f, 0.98f, 3},
{0.98f, 0.98f, 3},
{1.0f, 1.0f, 5},
{0.0f, 0.0f, 3},
{0.0f, 0.0f, 3},
{0.0f, 0.0f, 3},
{0.98f, 0.98f, 3},
{0.0f, 0.0f, 3},
{0.98f, 0.98f, 3},
}}

Definition at line 121 of file KartAction.hh.

◆ s_onCalc

const std::array< KartAction::CalcActionFunc, KartAction::MAX_ACTION > Kart::KartAction::s_onCalc
staticprivate
Initial value:
= {{
&KartAction::calcStub,
&KartAction::calcAction1,
&KartAction::calcStub,
&KartAction::calcStub,
&KartAction::calcStub,
&KartAction::calcStub,
&KartAction::calcStub,
&KartAction::calcStub,
&KartAction::calcStub,
&KartAction::calcStub,
&KartAction::calcStub,
&KartAction::calcStub,
&KartAction::calcStub,
&KartAction::calcStub,
&KartAction::calcStub,
&KartAction::calcStub,
&KartAction::calcStub,
&KartAction::calcStub,
}}

Definition at line 125 of file KartAction.hh.

◆ s_onEnd

const std::array< KartAction::EndActionFunc, KartAction::MAX_ACTION > Kart::KartAction::s_onEnd
staticprivate
Initial value:
= {{
&KartAction::endStub,
&KartAction::endAction1,
&KartAction::endStub,
&KartAction::endStub,
&KartAction::endStub,
&KartAction::endStub,
&KartAction::endStub,
&KartAction::endStub,
&KartAction::endStub,
&KartAction::endStub,
&KartAction::endStub,
&KartAction::endStub,
&KartAction::endStub,
&KartAction::endStub,
&KartAction::endStub,
&KartAction::endStub,
&KartAction::endStub,
&KartAction::endStub,
}}

Definition at line 126 of file KartAction.hh.

◆ s_onStart

const std::array< KartAction::StartActionFunc, KartAction::MAX_ACTION > Kart::KartAction::s_onStart
staticprivate
Initial value:
= {{
&KartAction::startStub,
&KartAction::startAction1,
&KartAction::startStub,
&KartAction::startStub,
&KartAction::startStub,
&KartAction::startStub,
&KartAction::startStub,
&KartAction::startStub,
&KartAction::startStub,
&KartAction::startStub,
&KartAction::startStub,
&KartAction::startStub,
&KartAction::startStub,
&KartAction::startStub,
&KartAction::startStub,
&KartAction::startStub,
&KartAction::startStub,
&KartAction::startStub,
}}

Definition at line 124 of file KartAction.hh.

◆ s_rotationParams

const std::array< KartAction::RotationParams, 5 > Kart::KartAction::s_rotationParams
staticprivate
Initial value:
= {{
{10.0f, 1.5f, 0.9f, 0.005f, 0.6f, 360.0f},
{11.0f, 1.5f, 0.9f, 0.0028f, 0.7f, 720.0f},
{11.0f, 1.5f, 0.9f, 0.0028f, 0.8f, 1080.0f},
{7.0f, 1.5f, 0.9f, 0.005f, 0.6f, 450.0f},
{9.0f, 1.5f, 0.9f, 0.0028f, 0.7f, 810.0f},
}}

Definition at line 122 of file KartAction.hh.