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

#include <ObjectTwistedWay.hh>

Description

The wavy road in Bowser's Castle.

Behaves as a sine wave with a period of 120 frames and an amplitude which varies depending on your distance from the center.

Definition at line 10 of file ObjectTwistedWay.hh.

Inheritance diagram for Field::ObjectTwistedWay:

Public Member Functions

 ObjectTwistedWay (const System::MapdataGeoObj &params)
 
void init () override
 
void calc () override
 
u32 loadFlags () const override
 
void createCollision () override
 
void calcCollisionTransform () override
 
f32 getCollisionRadius () const override
 
bool checkPointPartial (const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfoPartial *pInfo, KCLTypeMask *pFlagsOut) override
 
bool checkPointPartialPush (const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfoPartial *pInfo, KCLTypeMask *pFlagsOut) override
 
bool checkPointFull (const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfo *pInfo, KCLTypeMask *pFlagsOut) override
 
bool checkPointFullPush (const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfo *pInfo, KCLTypeMask *pFlagsOut) override
 
bool checkSpherePartial (f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfoPartial *pInfo, KCLTypeMask *pFlagsOut, u32 timeOffset) override
 
bool checkSpherePartialPush (f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfoPartial *pInfo, KCLTypeMask *pFlagsOut, u32 timeOffset) override
 
bool checkSphereFull (f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfo *pInfo, KCLTypeMask *pFlagsOut, u32 timeOffset) override
 
bool checkSphereFullPush (f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfo *pInfo, KCLTypeMask *pFlagsOut, u32 timeOffset) override
 
bool checkPointCachedPartial (const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfoPartial *pInfo, KCLTypeMask *pFlagsOut) override
 
bool checkPointCachedPartialPush (const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfoPartial *pInfo, KCLTypeMask *pFlagsOut) override
 
bool checkPointCachedFull (const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfo *pInfo, KCLTypeMask *pFlagsOut) override
 
bool checkPointCachedFullPush (const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfo *pInfo, KCLTypeMask *pFlagsOut) override
 
bool checkSphereCachedPartial (f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfoPartial *pInfo, KCLTypeMask *pFlagsOut, u32 timeOffset) override
 
bool checkSphereCachedPartialPush (f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfoPartial *pInfo, KCLTypeMask *pFlagsOut, u32 timeOffset) override
 
bool checkSphereCachedFull (f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfo *pInfo, KCLTypeMask *pFlagsOut, u32 timeOffset) override
 
bool checkSphereCachedFullPush (f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfo *pInfo, KCLTypeMask *pFlagsOut, u32 timeOffset) override
 
- Public Member Functions inherited from Field::ObjectDrivable
 ObjectDrivable (const System::MapdataGeoObj &params)
 
void load () override
 
virtual void initCollision ()
 
virtual void loadAABB (f32 radius)
 
virtual void narrScLocal (f32, const EGG::Vector3f &, KCLTypeMask, u32)
 
- Public Member Functions inherited from Field::ObjectBase
 ObjectBase (const System::MapdataGeoObj &params)
 
 ObjectBase (const char *name, const EGG::Vector3f &pos, const EGG::Vector3f &rot, const EGG::Vector3f &scale)
 
virtual void calcModel ()
 
virtual const char * getResources () const
 
virtual void loadGraphics ()
 
virtual void loadAnims ()
 
virtual void loadRail ()
 
virtual const char * getName () const
 
virtual const char * getKclName () const
 
virtual void resize (f32 radius, f32 maxSpeed)
 
virtual void unregisterCollision ()
 
virtual void disableCollision () const
 
virtual void enableCollision () const
 
virtual const BoxColUnitgetUnit () const
 
const RailInterpolatorrailInterpolator () const
 
virtual const EGG::Vector3fgetPosition () const
 
virtual ObjectId id () const
 
const EGG::Vector3fpos () const
 
void setPos (const EGG::Vector3f &pos)
 
void setScale (const EGG::Vector3f &scale)
 
void setTransform (const EGG::Matrix34f &mat)
 
const EGG::Vector3fscale () const
 

Private Member Functions

bool checkSpherePartialImpl (f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfoPartial *pInfo, KCLTypeMask *pFlagsOut, u32 timeOffset)
 
bool checkSpherePartialPushImpl (f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfoPartial *pInfo, KCLTypeMask *pFlagsOut, u32 timeOffset)
 
bool checkSphereFullImpl (f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfo *pInfo, KCLTypeMask *pFlagsOut, u32 timeOffset)
 
bool checkSphereFullPushImpl (f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, CollisionInfo *pInfo, KCLTypeMask *pFlagsOut, u32 timeOffset)
 
template<typename T >
requires std::is_same_v<T, CollisionInfo> || std::is_same_v<T, CollisionInfoPartial>
bool checkSphereImpl (f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1, KCLTypeMask flags, T *pInfo, KCLTypeMask *pFlagsOut, u32 timeOffset, bool push)
 Helper function which contains frequently re-used code. Behavior branches depending on whether it is a full or partial check (call CollisionInfo::updateFloor) or push (push entry in the CollisionDirector).
 
template<typename T >
requires std::is_same_v<T, CollisionInfo> || std::is_same_v<T, CollisionInfoPartial>
bool checkWallCollision (f32 angle, f32 radius, u32 t, const EGG::Vector3f &relPos, T *pInfo, KCLTypeMask *pFlagsOut, bool push)
 
template<typename T >
requires std::is_same_v<T, CollisionInfo> || std::is_same_v<T, CollisionInfoPartial>
bool checkFloorCollision (f32 angle, f32 radius, const EGG::Vector3f &relPos, T *pInfo, KCLTypeMask *pFlagsOut, bool push)
 
bool checkPoleCollision (f32 radius, f32 angle, const EGG::Vector3f &relPos, EGG::Vector3f &v0, EGG::Vector3f &fnrm, f32 &dist)
 
f32 calcWave (f32 zPercent, u32 t)
 

Private Attributes

u32 m_introTimer
 

Static Private Attributes

static constexpr s32 PERIOD_LENGTH = 120
 Framecount of full oscillation.
 
static constexpr f32 WIDTH = 2000.0f
 
static constexpr f32 HALF_DEPTH = 7500.0f
 Half the length of the wavy road.
 

Additional Inherited Members

- Public Types inherited from Field::ObjectBase
enum class  eFlags {
  Position = 0 ,
  Rotation = 1 ,
  Matrix = 2 ,
  Scale = 3
}
 
typedef EGG::TBitFlag< u16, eFlags > Flags
 
- Protected Member Functions inherited from Field::ObjectBase
void calcTransform ()
 
void linkAnims (const std::span< const char * > &names, const std::span< Render::AnmType > types)
 
void setMatrixTangentTo (const EGG::Vector3f &up, const EGG::Vector3f &tangent)
 
void setMatrixFromOrthonormalBasisAndPos (const EGG::Vector3f &v)
 
- Static Protected Member Functions inherited from Field::ObjectBase
static f32 CheckPointAgainstLineSegment (const EGG::Vector3f &point, const EGG::Vector3f &a, const EGG::Vector3f &b)
 Calculates on what side of line segment ab point lies.
 
static EGG::Vector3f RotateXZByYaw (f32 angle, const EGG::Vector3f &v)
 Rotates a vector around the Y-axis and returns the XZ-plane portion of the vector.
 
static EGG::Vector3f RotateAxisAngle (f32 angle, const EGG::Vector3f &axis, const EGG::Vector3f &v1)
 
static void SetRotTangentHorizontal (EGG::Matrix34f &mat, const EGG::Vector3f &up, const EGG::Vector3f &tangent)
 
static EGG::Matrix34f OrthonormalBasis (const EGG::Vector3f &v)
 
static EGG::Matrix34f RailOrthonormalBasis (const RailInterpolator &railInterpolator)
 
static EGG::Vector3f Interpolate (f32 t, const EGG::Vector3f &v0, const EGG::Vector3f &v1)
 
- Protected Attributes inherited from Field::ObjectBase
Render::DrawMdlm_drawMdl
 
Abstract::g3d::ResFilem_resFile
 
ObjectId m_id
 
RailInterpolatorm_railInterpolator
 
BoxColUnitm_boxColUnit
 
Flags m_flags
 
EGG::Vector3f m_pos
 
EGG::Vector3f m_rot
 
EGG::Vector3f m_scale
 
EGG::Matrix34f m_transform
 
const System::MapdataGeoObjm_mapObj
 

Constructor & Destructor Documentation

◆ ObjectTwistedWay()

Field::ObjectTwistedWay::ObjectTwistedWay ( const System::MapdataGeoObj & params)
0x80813BD4

Definition at line 12 of file ObjectTwistedWay.cc.

Member Function Documentation

◆ calc()

void Field::ObjectTwistedWay::calc ( )
overridevirtual0x80813CFC

Reimplemented from Field::ObjectBase.

Definition at line 18 of file ObjectTwistedWay.cc.

◆ calcCollisionTransform()

void Field::ObjectTwistedWay::calcCollisionTransform ( )
inlineoverridevirtual0x80814908

Implements Field::ObjectBase.

Definition at line 31 of file ObjectTwistedWay.hh.

◆ calcWave()

f32 Field::ObjectTwistedWay::calcWave ( f32 zPercent,
u32 t )
nodiscardprivate

Definition at line 329 of file ObjectTwistedWay.cc.

◆ checkFloorCollision()

template<typename T >
requires std::is_same_v<T, CollisionInfo> || std::is_same_v<T, CollisionInfoPartial>
bool Field::ObjectTwistedWay::checkFloorCollision ( f32 angle,
f32 radius,
const EGG::Vector3f & relPos,
T * pInfo,
KCLTypeMask * pFlagsOut,
bool push )
nodiscardprivate

Definition at line 265 of file ObjectTwistedWay.cc.

◆ checkPointCachedFull()

bool Field::ObjectTwistedWay::checkPointCachedFull ( const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfo * pInfo,
KCLTypeMask * pFlagsOut )
nodiscardoverridevirtual0x80814888

Implements Field::ObjectDrivable.

Definition at line 88 of file ObjectTwistedWay.cc.

◆ checkPointCachedFullPush()

bool Field::ObjectTwistedWay::checkPointCachedFullPush ( const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfo * pInfo,
KCLTypeMask * pFlagsOut )
nodiscardoverridevirtual0x80814898

Implements Field::ObjectDrivable.

Definition at line 94 of file ObjectTwistedWay.cc.

◆ checkPointCachedPartial()

bool Field::ObjectTwistedWay::checkPointCachedPartial ( const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfoPartial * pInfo,
KCLTypeMask * pFlagsOut )
nodiscardoverridevirtual0x80814868

Implements Field::ObjectDrivable.

Definition at line 76 of file ObjectTwistedWay.cc.

◆ checkPointCachedPartialPush()

bool Field::ObjectTwistedWay::checkPointCachedPartialPush ( const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfoPartial * pInfo,
KCLTypeMask * pFlagsOut )
nodiscardoverridevirtual0x80814878

Implements Field::ObjectDrivable.

Definition at line 82 of file ObjectTwistedWay.cc.

◆ checkPointFull()

bool Field::ObjectTwistedWay::checkPointFull ( const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfo * pInfo,
KCLTypeMask * pFlagsOut )
nodiscardoverridevirtual0x808148D8

Implements Field::ObjectDrivable.

Definition at line 37 of file ObjectTwistedWay.cc.

◆ checkPointFullPush()

bool Field::ObjectTwistedWay::checkPointFullPush ( const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfo * pInfo,
KCLTypeMask * pFlagsOut )
nodiscardoverridevirtual0x808148E8

Implements Field::ObjectDrivable.

Definition at line 43 of file ObjectTwistedWay.cc.

◆ checkPointPartial()

bool Field::ObjectTwistedWay::checkPointPartial ( const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfoPartial * pInfo,
KCLTypeMask * pFlagsOut )
nodiscardoverridevirtual0x808148B8

Implements Field::ObjectDrivable.

Definition at line 25 of file ObjectTwistedWay.cc.

◆ checkPointPartialPush()

bool Field::ObjectTwistedWay::checkPointPartialPush ( const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfoPartial * pInfo,
KCLTypeMask * pFlagsOut )
nodiscardoverridevirtual0x808148C8

Implements Field::ObjectDrivable.

Definition at line 31 of file ObjectTwistedWay.cc.

◆ checkPoleCollision()

bool Field::ObjectTwistedWay::checkPoleCollision ( f32 radius,
f32 angle,
const EGG::Vector3f & relPos,
EGG::Vector3f & v0,
EGG::Vector3f & fnrm,
f32 & dist )
nodiscardprivate0x80814270

Definition at line 307 of file ObjectTwistedWay.cc.

◆ checkSphereCachedFull()

bool Field::ObjectTwistedWay::checkSphereCachedFull ( f32 radius,
const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfo * pInfo,
KCLTypeMask * pFlagsOut,
u32 timeOffset )
nodiscardoverridevirtual0x80814860

Implements Field::ObjectDrivable.

Definition at line 114 of file ObjectTwistedWay.cc.

◆ checkSphereCachedFullPush()

bool Field::ObjectTwistedWay::checkSphereCachedFullPush ( f32 radius,
const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfo * pInfo,
KCLTypeMask * pFlagsOut,
u32 timeOffset )
nodiscardoverridevirtual0x80814864

Implements Field::ObjectDrivable.

Definition at line 121 of file ObjectTwistedWay.cc.

◆ checkSphereCachedPartial()

bool Field::ObjectTwistedWay::checkSphereCachedPartial ( f32 radius,
const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfoPartial * pInfo,
KCLTypeMask * pFlagsOut,
u32 timeOffset )
nodiscardoverridevirtual0x80814858

Implements Field::ObjectDrivable.

Definition at line 100 of file ObjectTwistedWay.cc.

◆ checkSphereCachedPartialPush()

bool Field::ObjectTwistedWay::checkSphereCachedPartialPush ( f32 radius,
const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfoPartial * pInfo,
KCLTypeMask * pFlagsOut,
u32 timeOffset )
nodiscardoverridevirtual0x8081485C

Implements Field::ObjectDrivable.

Definition at line 107 of file ObjectTwistedWay.cc.

◆ checkSphereFull()

bool Field::ObjectTwistedWay::checkSphereFull ( f32 radius,
const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfo * pInfo,
KCLTypeMask * pFlagsOut,
u32 timeOffset )
nodiscardoverridevirtual0x808148B0

Implements Field::ObjectDrivable.

Definition at line 63 of file ObjectTwistedWay.cc.

◆ checkSphereFullImpl()

bool Field::ObjectTwistedWay::checkSphereFullImpl ( f32 radius,
const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfo * pInfo,
KCLTypeMask * pFlagsOut,
u32 timeOffset )
nodiscardprivate0x80815444

Definition at line 142 of file ObjectTwistedWay.cc.

◆ checkSphereFullPush()

bool Field::ObjectTwistedWay::checkSphereFullPush ( f32 radius,
const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfo * pInfo,
KCLTypeMask * pFlagsOut,
u32 timeOffset )
nodiscardoverridevirtual0x808148B4

Implements Field::ObjectDrivable.

Definition at line 69 of file ObjectTwistedWay.cc.

◆ checkSphereFullPushImpl()

bool Field::ObjectTwistedWay::checkSphereFullPushImpl ( f32 radius,
const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfo * pInfo,
KCLTypeMask * pFlagsOut,
u32 timeOffset )
nodiscardprivate0x80815D64

Definition at line 149 of file ObjectTwistedWay.cc.

◆ checkSphereImpl()

template<typename T >
requires std::is_same_v<T, CollisionInfo> || std::is_same_v<T, CollisionInfoPartial>
bool Field::ObjectTwistedWay::checkSphereImpl ( f32 radius,
const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
T * pInfo,
KCLTypeMask * pFlagsOut,
u32 timeOffset,
bool push )
nodiscardprivate

Helper function which contains frequently re-used code. Behavior branches depending on whether it is a full or partial check (call CollisionInfo::updateFloor) or push (push entry in the CollisionDirector).

Definition at line 160 of file ObjectTwistedWay.cc.

◆ checkSpherePartial()

bool Field::ObjectTwistedWay::checkSpherePartial ( f32 radius,
const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfoPartial * pInfo,
KCLTypeMask * pFlagsOut,
u32 timeOffset )
nodiscardoverridevirtual0x808148A8

Implements Field::ObjectDrivable.

Definition at line 49 of file ObjectTwistedWay.cc.

◆ checkSpherePartialImpl()

bool Field::ObjectTwistedWay::checkSpherePartialImpl ( f32 radius,
const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfoPartial * pInfo,
KCLTypeMask * pFlagsOut,
u32 timeOffset )
nodiscardprivate0x80814958

Definition at line 128 of file ObjectTwistedWay.cc.

◆ checkSpherePartialPush()

bool Field::ObjectTwistedWay::checkSpherePartialPush ( f32 radius,
const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfoPartial * pInfo,
KCLTypeMask * pFlagsOut,
u32 timeOffset )
nodiscardoverridevirtual0x808148AC

Implements Field::ObjectDrivable.

Definition at line 56 of file ObjectTwistedWay.cc.

◆ checkSpherePartialPushImpl()

bool Field::ObjectTwistedWay::checkSpherePartialPushImpl ( f32 radius,
const EGG::Vector3f & v0,
const EGG::Vector3f & v1,
KCLTypeMask flags,
CollisionInfoPartial * pInfo,
KCLTypeMask * pFlagsOut,
u32 timeOffset )
nodiscardprivate0x80814EA8

Definition at line 135 of file ObjectTwistedWay.cc.

◆ checkWallCollision()

template<typename T >
requires std::is_same_v<T, CollisionInfo> || std::is_same_v<T, CollisionInfoPartial>
bool Field::ObjectTwistedWay::checkWallCollision ( f32 angle,
f32 radius,
u32 t,
const EGG::Vector3f & relPos,
T * pInfo,
KCLTypeMask * pFlagsOut,
bool push )
nodiscardprivate

Definition at line 191 of file ObjectTwistedWay.cc.

◆ createCollision()

void Field::ObjectTwistedWay::createCollision ( )
inlineoverridevirtual0x8081490C

Implements Field::ObjectBase.

Definition at line 28 of file ObjectTwistedWay.hh.

◆ getCollisionRadius()

f32 Field::ObjectTwistedWay::getCollisionRadius ( ) const
inlinenodiscardoverridevirtual0x808148F8

Reimplemented from Field::ObjectDrivable.

Definition at line 34 of file ObjectTwistedWay.hh.

◆ init()

void Field::ObjectTwistedWay::init ( )
inlineoverridevirtual0x80813C40

Reimplemented from Field::ObjectBase.

Definition at line 16 of file ObjectTwistedWay.hh.

◆ loadFlags()

u32 Field::ObjectTwistedWay::loadFlags ( ) const
inlinenodiscardoverridevirtual0x80814910

Reimplemented from Field::ObjectBase.

Definition at line 23 of file ObjectTwistedWay.hh.

Member Data Documentation

◆ HALF_DEPTH

f32 Field::ObjectTwistedWay::HALF_DEPTH = 7500.0f
staticconstexprprivate

Half the length of the wavy road.

Definition at line 117 of file ObjectTwistedWay.hh.

◆ m_introTimer

u32 Field::ObjectTwistedWay::m_introTimer
private

Definition at line 113 of file ObjectTwistedWay.hh.

◆ PERIOD_LENGTH

s32 Field::ObjectTwistedWay::PERIOD_LENGTH = 120
staticconstexprprivate

Framecount of full oscillation.

Definition at line 115 of file ObjectTwistedWay.hh.

◆ WIDTH

f32 Field::ObjectTwistedWay::WIDTH = 2000.0f
staticconstexprprivate

Definition at line 116 of file ObjectTwistedWay.hh.