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

#include <KPadController.hh>

Description

Represents a set of controller inputs.

Definition at line 36 of file KPadController.hh.

Public Member Functions

void reset ()
 
bool isValid () const
 Checks if the input state is valid.
 
bool isButtonsValid () const
 Checks if there are any invalid buttons.
 
bool isStickValid (f32 stick) const
 Checks if the stick values are within the domain of the physics engine.
 
bool isTrickValid () const
 Checks if the trick input is valid.
 
bool accelerate () const
 
bool brake () const
 
bool item () const
 
bool drift () const
 
bool trickUp () const
 
bool trickDown () const
 

Public Attributes

u16 buttons
 
u16 buttonsRaw
 
EGG::Vector2f stick
 
u8 stickXRaw
 
u8 stickYRaw
 
Trick trick
 
u8 trickRaw
 

Constructor & Destructor Documentation

◆ RaceInputState()

Kinoko::System::RaceInputState::RaceInputState ( )

Definition at line 106 of file KPadController.cc.

◆ ~RaceInputState()

virtual Kinoko::System::RaceInputState::~RaceInputState ( )
inlinevirtual

Definition at line 38 of file KPadController.hh.

Member Function Documentation

◆ accelerate()

bool Kinoko::System::RaceInputState::accelerate ( ) const
inlinenodiscard

Definition at line 69 of file KPadController.hh.

◆ brake()

bool Kinoko::System::RaceInputState::brake ( ) const
inlinenodiscard

Definition at line 73 of file KPadController.hh.

◆ drift()

bool Kinoko::System::RaceInputState::drift ( ) const
inlinenodiscard

Definition at line 81 of file KPadController.hh.

◆ isButtonsValid()

bool Kinoko::System::RaceInputState::isButtonsValid ( ) const
inlinenodiscard

Checks if there are any invalid buttons.

Validation with the previous input state doesn't happen because it doesn't exist. Therefore, we cannot check here if e.g. the drift button is pressed when it shouldn't be.

Returns
If no invalid buttons are present.

Definition at line 48 of file KPadController.hh.

◆ isStickValid()

bool Kinoko::System::RaceInputState::isStickValid ( f32 stick) const
nodiscard

Checks if the stick values are within the domain of the physics engine.

The set of valid stick values is \(\{\frac{x-7}{7}|0\leq x\leq 14,\in\mathbb{Z}\}\). It's possible for the stick input to be 8/7 with x = 15, but only with ghost controllers.

Returns
If the stick values are valid.

Definition at line 143 of file KPadController.cc.

◆ isTrickValid()

bool Kinoko::System::RaceInputState::isTrickValid ( ) const
inlinenodiscard

Checks if the trick input is valid.

Returns
If the trick input is valid.

Definition at line 56 of file KPadController.hh.

◆ isValid()

bool Kinoko::System::RaceInputState::isValid ( ) const
nodiscard

Checks if the input state is valid.

Returns
If the input state is valid.

Definition at line 123 of file KPadController.cc.

◆ item()

bool Kinoko::System::RaceInputState::item ( ) const
inlinenodiscard

Definition at line 77 of file KPadController.hh.

◆ reset()

void Kinoko::System::RaceInputState::reset ( )
0x8051E85C

Definition at line 111 of file KPadController.cc.

◆ trickDown()

bool Kinoko::System::RaceInputState::trickDown ( ) const
inlinenodiscard

Definition at line 89 of file KPadController.hh.

◆ trickUp()

bool Kinoko::System::RaceInputState::trickUp ( ) const
inlinenodiscard

Definition at line 85 of file KPadController.hh.

Member Data Documentation

◆ buttons

u16 Kinoko::System::RaceInputState::buttons

Definition at line 93 of file KPadController.hh.

◆ buttonsRaw

u16 Kinoko::System::RaceInputState::buttonsRaw

Definition at line 94 of file KPadController.hh.

◆ stick

EGG::Vector2f Kinoko::System::RaceInputState::stick

Definition at line 95 of file KPadController.hh.

◆ stickXRaw

u8 Kinoko::System::RaceInputState::stickXRaw

Definition at line 96 of file KPadController.hh.

◆ stickYRaw

u8 Kinoko::System::RaceInputState::stickYRaw

Definition at line 97 of file KPadController.hh.

◆ trick

Trick Kinoko::System::RaceInputState::trick

Definition at line 98 of file KPadController.hh.

◆ trickRaw

u8 Kinoko::System::RaceInputState::trickRaw

Definition at line 99 of file KPadController.hh.