NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
dAcPyKey_c Class Reference

#include <game/bases/d_ac_py_key.hpp>

Description

A class for managing controller input.

Definition at line 5 of file d_ac_py_key.hpp.

Public Types

enum  STATUS_e {
  STATUS_NO_INPUT = 0 ,
  STATUS_DISABLE_LR = 1 ,
  STATUS_FORCE_JUMP = 3 ,
  STATUS_FORCE_NO_JUMP = 4 ,
  STATUS_SHAKE_COOLDOWN = 6 ,
  STATUS_DEMO = 7 ,
  STATUS_FORCE_RIGHT = 8 ,
  FLAG_NO_INPUT = BIT_FLAG(STATUS_NO_INPUT) ,
  FLAG_DISABLE_LR = BIT_FLAG(STATUS_DISABLE_LR) ,
  FLAG_FORCE_JUMP = BIT_FLAG(STATUS_FORCE_JUMP) ,
  FLAG_FORCE_NO_JUMP = BIT_FLAG(STATUS_FORCE_NO_JUMP) ,
  FLAG_SHAKE_COOLDOWN = BIT_FLAG(STATUS_SHAKE_COOLDOWN) ,
  FLAG_DEMO = BIT_FLAG(STATUS_DEMO) ,
  FLAG_FORCE_RIGHT = BIT_FLAG(STATUS_FORCE_RIGHT)
}
 Status flags for the controller manager. More...
 
enum  BUTTONS_e {
  BUTTON_DOWN = BIT_FLAG(0) ,
  BUTTON_UP = BIT_FLAG(1) ,
  BUTTON_RIGHT = BIT_FLAG(2) ,
  BUTTON_LEFT = BIT_FLAG(3) ,
  BUTTON_CROSS = BUTTON_LEFT | BUTTON_RIGHT | BUTTON_UP | BUTTON_DOWN ,
  BUTTON_TWO = BIT_FLAG(8) ,
  BUTTON_ONE = BIT_FLAG(9) ,
  BUTTON_B = BIT_FLAG(10) ,
  BUTTON_A = BIT_FLAG(11)
}
 Button flags for the controller manager. More...
 

Public Member Functions

 dAcPyKey_c ()
 Constructs a new controller manager.
 
 ~dAcPyKey_c ()
 Destroys the controller manager.
 
void init ()
 Initialize the button manager.
 
void update ()
 Call each frame to process the inputs.
 
void updateEnd ()
 Get the new button states for the next frame.
 
void onStatus (u16 status)
 Enables a status flag.
 
void offStatus (u16 status)
 Disables a status flag.
 
void clearAllKey ()
 Clears all input state.
 
void clearCrossKey ()
 Clears the left and right directional buttons.
 
int buttonCross () const
 Returns whether a directional button is pressed down.
 
int buttonUp () const
 Returns whether the up button is pressed down.
 
int buttonDown () const
 Returns whether the down button is pressed down.
 
int buttonLeft () const
 Returns whether the left button is pressed down.
 
int buttonRight () const
 Returns whether the right button is pressed down.
 
int buttonTwo () const
 Returns whether the two button is pressed down.
 
int buttonOne () const
 Returns whether the one button is pressed down.
 
int buttonDush () const
 Returns whether the run button is pressed down.
 
int buttonCarry () const
 Returns whether the carry button (1 / B) is pressed down.
 
int buttonJump ()
 Returns whether the jump button (2) is pressed down.
 
int buttonYoshiJump () const
 Returns whether the Yoshi jump button (2) is pressed down.
 
bool buttonWalk (int *direction) const
 Returns whether left / right is pressed down. Sets the direction to 0 for right and 1 for left.
 
int buttonCrouch () const
 Returns whether the crouch button (down) is pressed down.
 
int buttonHipAttack () const
 Returns whether the correct buttons (down, no other directions) for a hip attack is pressed down.
 
int buttonDoor () const
 Returns whether the correct buttons (up, no left or right) for a door open is pressed down.
 
int triggerA () const
 Returns whether A was pressed this frame.
 
int triggerCross () const
 Returns whether a directional button was pressed this frame.
 
int triggerUp () const
 Returns whether the up button was pressed this frame.
 
int triggerDown () const
 Returns whether the down button was pressed this frame.
 
int triggerLeft () const
 Returns whether the left button was pressed this frame.
 
int triggerRight () const
 Returns whether the right button was pressed this frame.
 
int triggerTwo () const
 Returns whether the two button was pressed this frame.
 
int triggerOne () const
 Returns whether the one button was pressed this frame.
 
int triggerAttack () const
 Returns whether the attack button (1 / B) was pressed this frame.
 
bool triggerEat ()
 Returns whether the eat button (1 / B) was pressed this frame.
 
bool triggerFire ()
 Returns whether the fire button was pressed this frame.
 
int triggerJumpBase () const
 Returns whether the jump button (2) was pressed this frame.
 
bool triggerJump ()
 Returns whether the jump button (2) was pressed this frame.
 
bool checkHipAttack ()
 Checks whether a hip attack should be performed this frame.
 
u8 triggerShakeJump () const
 Returns whether a shake event was triggered this frame.
 
void clearShakeJump ()
 Clears the shake event state.
 
bool triggerJumpBuf (int n)
 Returns whether a jump occurred in the last n frames.
 
void onDemoButton (int)
 Sets a button for demo mode to pressed down.
 
void offDemoButton (int)
 Sets a button for demo mode to not pressed down.
 
void onDemoTrigger (int)
 Sets a button for demo mode to pressed this frame.
 
void onDemoShake ()
 Sets a shake event for demo mode to be triggered this frame.
 

Public Attributes

int mRemoconID
 This remote's ID, -1 if invalid.
 
u16 mDownButtons
 The buttons currently pressed down.
 
u16 mTriggeredButtons
 The buttons newly pressed down.
 
u16 mPrevDownButtons
 The buttons pressed down in the last frame.
 
u16 mPrevTriggeredButtons
 The buttons newly pressed down in the last frame.
 
u16 mDownButtonsDemo
 The buttons currently pressed down in demo mode.
 
u16 mTriggeredButtonsDemo
 The buttons newly pressed down in demo mode.
 
u16 mDemoDoShake
 Trigger a shake event in demo mode.
 
u16 mStatus
 Uses FLAGS_e enum.
 
u8 mHipAtkHoldCount
 Counts how long the down button is held for the hip attack.
 
bool mHipAtkRead
 Whether hip attack was checked for this frame.
 
bool mHipAtkHoldStart
 Whether the hip attack holding started.
 
u8 mTriggerShakeJump
 Whether a shake was triggered this frame.
 
u8 mActiveShakeJump
 Whether a shake is active this frame.
 
bool mActionTriggered
 Set if eat, fire or jump is triggered.
 
int mShakeCooldown
 Cooldown counter for shake events.
 
int m_20
 [Unused].
 
int mJumpTriggeredHistory [4][10]
 Stores the last 10 frames of jump events for each remote.
 
int mJumpButtonHistory [4][10]
 Stores the last 10 frames of the jump button state for each remote.
 

Member Enumeration Documentation

◆ STATUS_e

Status flags for the controller manager.

Enumerator
STATUS_NO_INPUT 

Disable all inputs.

STATUS_DISABLE_LR 

Disable left and right directional buttons.

STATUS_FORCE_JUMP 

Force the jump button to be pressed down.

STATUS_FORCE_NO_JUMP 

Force a jump input to be ignored.

STATUS_SHAKE_COOLDOWN 

Is in cooldown for shake events.

STATUS_DEMO 

Do not use inputs from the remote.

STATUS_FORCE_RIGHT 

Override the input to always only be the right button.

Definition at line 8 of file d_ac_py_key.hpp.

◆ BUTTONS_e

Button flags for the controller manager.

Definition at line 27 of file d_ac_py_key.hpp.

Constructor & Destructor Documentation

◆ dAcPyKey_c()

dAcPyKey_c::dAcPyKey_c ( )

Constructs a new controller manager.

Definition at line 4 of file d_ac_py_key.cpp.

◆ ~dAcPyKey_c()

dAcPyKey_c::~dAcPyKey_c ( )

Destroys the controller manager.

Definition at line 10 of file d_ac_py_key.cpp.

Member Function Documentation

◆ init()

void dAcPyKey_c::init ( )

Initialize the button manager.

Definition at line 12 of file d_ac_py_key.cpp.

◆ update()

void dAcPyKey_c::update ( )

Call each frame to process the inputs.

Definition at line 16 of file d_ac_py_key.cpp.

◆ updateEnd()

void dAcPyKey_c::updateEnd ( )

Get the new button states for the next frame.

Definition at line 82 of file d_ac_py_key.cpp.

◆ onStatus()

void dAcPyKey_c::onStatus ( u16 status)

Enables a status flag.

Definition at line 111 of file d_ac_py_key.cpp.

◆ offStatus()

void dAcPyKey_c::offStatus ( u16 status)

Disables a status flag.

Definition at line 137 of file d_ac_py_key.cpp.

◆ clearAllKey()

void dAcPyKey_c::clearAllKey ( )

Clears all input state.

Definition at line 141 of file d_ac_py_key.cpp.

◆ clearCrossKey()

void dAcPyKey_c::clearCrossKey ( )

Clears the left and right directional buttons.

Definition at line 150 of file d_ac_py_key.cpp.

◆ buttonCross()

int dAcPyKey_c::buttonCross ( ) const

Returns whether a directional button is pressed down.

Definition at line 159 of file d_ac_py_key.cpp.

◆ buttonUp()

int dAcPyKey_c::buttonUp ( ) const

Returns whether the up button is pressed down.

Definition at line 167 of file d_ac_py_key.cpp.

◆ buttonDown()

int dAcPyKey_c::buttonDown ( ) const

Returns whether the down button is pressed down.

Definition at line 171 of file d_ac_py_key.cpp.

◆ buttonLeft()

int dAcPyKey_c::buttonLeft ( ) const

Returns whether the left button is pressed down.

Definition at line 175 of file d_ac_py_key.cpp.

◆ buttonRight()

int dAcPyKey_c::buttonRight ( ) const

Returns whether the right button is pressed down.

Definition at line 179 of file d_ac_py_key.cpp.

◆ buttonTwo()

int dAcPyKey_c::buttonTwo ( ) const

Returns whether the two button is pressed down.

Definition at line 203 of file d_ac_py_key.cpp.

◆ buttonOne()

int dAcPyKey_c::buttonOne ( ) const

Returns whether the one button is pressed down.

Definition at line 215 of file d_ac_py_key.cpp.

◆ buttonDush()

int dAcPyKey_c::buttonDush ( ) const

Returns whether the run button is pressed down.

Definition at line 223 of file d_ac_py_key.cpp.

◆ buttonCarry()

int dAcPyKey_c::buttonCarry ( ) const

Returns whether the carry button (1 / B) is pressed down.

Definition at line 239 of file d_ac_py_key.cpp.

◆ buttonJump()

int dAcPyKey_c::buttonJump ( )

Returns whether the jump button (2) is pressed down.

Definition at line 263 of file d_ac_py_key.cpp.

◆ buttonYoshiJump()

int dAcPyKey_c::buttonYoshiJump ( ) const

Returns whether the Yoshi jump button (2) is pressed down.

Definition at line 273 of file d_ac_py_key.cpp.

◆ buttonWalk()

bool dAcPyKey_c::buttonWalk ( int * direction) const

Returns whether left / right is pressed down. Sets the direction to 0 for right and 1 for left.

Definition at line 286 of file d_ac_py_key.cpp.

◆ buttonCrouch()

int dAcPyKey_c::buttonCrouch ( ) const

Returns whether the crouch button (down) is pressed down.

Definition at line 301 of file d_ac_py_key.cpp.

◆ buttonHipAttack()

int dAcPyKey_c::buttonHipAttack ( ) const

Returns whether the correct buttons (down, no other directions) for a hip attack is pressed down.

Definition at line 305 of file d_ac_py_key.cpp.

◆ buttonDoor()

int dAcPyKey_c::buttonDoor ( ) const

Returns whether the correct buttons (up, no left or right) for a door open is pressed down.

Definition at line 312 of file d_ac_py_key.cpp.

◆ triggerA()

int dAcPyKey_c::triggerA ( ) const

Returns whether A was pressed this frame.

Definition at line 155 of file d_ac_py_key.cpp.

◆ triggerCross()

int dAcPyKey_c::triggerCross ( ) const

Returns whether a directional button was pressed this frame.

Definition at line 163 of file d_ac_py_key.cpp.

◆ triggerUp()

int dAcPyKey_c::triggerUp ( ) const

Returns whether the up button was pressed this frame.

Definition at line 183 of file d_ac_py_key.cpp.

◆ triggerDown()

int dAcPyKey_c::triggerDown ( ) const

Returns whether the down button was pressed this frame.

Definition at line 187 of file d_ac_py_key.cpp.

◆ triggerLeft()

int dAcPyKey_c::triggerLeft ( ) const

Returns whether the left button was pressed this frame.

Definition at line 191 of file d_ac_py_key.cpp.

◆ triggerRight()

int dAcPyKey_c::triggerRight ( ) const

Returns whether the right button was pressed this frame.

Definition at line 195 of file d_ac_py_key.cpp.

◆ triggerTwo()

int dAcPyKey_c::triggerTwo ( ) const

Returns whether the two button was pressed this frame.

Definition at line 199 of file d_ac_py_key.cpp.

◆ triggerOne()

int dAcPyKey_c::triggerOne ( ) const

Returns whether the one button was pressed this frame.

Definition at line 207 of file d_ac_py_key.cpp.

◆ triggerAttack()

int dAcPyKey_c::triggerAttack ( ) const

Returns whether the attack button (1 / B) was pressed this frame.

Definition at line 227 of file d_ac_py_key.cpp.

◆ triggerEat()

bool dAcPyKey_c::triggerEat ( )

Returns whether the eat button (1 / B) was pressed this frame.

Definition at line 231 of file d_ac_py_key.cpp.

◆ triggerFire()

bool dAcPyKey_c::triggerFire ( )

Returns whether the fire button was pressed this frame.

Definition at line 243 of file d_ac_py_key.cpp.

◆ triggerJumpBase()

int dAcPyKey_c::triggerJumpBase ( ) const

Returns whether the jump button (2) was pressed this frame.

Definition at line 251 of file d_ac_py_key.cpp.

◆ triggerJump()

bool dAcPyKey_c::triggerJump ( )

Returns whether the jump button (2) was pressed this frame.

Definition at line 255 of file d_ac_py_key.cpp.

◆ checkHipAttack()

bool dAcPyKey_c::checkHipAttack ( )

Checks whether a hip attack should be performed this frame.

Definition at line 94 of file d_ac_py_key.cpp.

◆ triggerShakeJump()

u8 dAcPyKey_c::triggerShakeJump ( ) const

Returns whether a shake event was triggered this frame.

Definition at line 277 of file d_ac_py_key.cpp.

◆ clearShakeJump()

void dAcPyKey_c::clearShakeJump ( )

Clears the shake event state.

Definition at line 281 of file d_ac_py_key.cpp.

◆ triggerJumpBuf()

bool dAcPyKey_c::triggerJumpBuf ( int n)

Returns whether a jump occurred in the last n frames.

Definition at line 319 of file d_ac_py_key.cpp.

◆ onDemoButton()

void dAcPyKey_c::onDemoButton ( int buttons)

Sets a button for demo mode to pressed down.

Definition at line 335 of file d_ac_py_key.cpp.

◆ offDemoButton()

void dAcPyKey_c::offDemoButton ( int buttons)

Sets a button for demo mode to not pressed down.

Definition at line 341 of file d_ac_py_key.cpp.

◆ onDemoTrigger()

void dAcPyKey_c::onDemoTrigger ( int buttons)

Sets a button for demo mode to pressed this frame.

Definition at line 347 of file d_ac_py_key.cpp.

◆ onDemoShake()

void dAcPyKey_c::onDemoShake ( )

Sets a shake event for demo mode to be triggered this frame.

Definition at line 353 of file d_ac_py_key.cpp.

Member Data Documentation

◆ mRemoconID

int dAcPyKey_c::mRemoconID

This remote's ID, -1 if invalid.

Definition at line 39 of file d_ac_py_key.hpp.

◆ mDownButtons

u16 dAcPyKey_c::mDownButtons

The buttons currently pressed down.

Definition at line 40 of file d_ac_py_key.hpp.

◆ mTriggeredButtons

u16 dAcPyKey_c::mTriggeredButtons

The buttons newly pressed down.

Definition at line 41 of file d_ac_py_key.hpp.

◆ mPrevDownButtons

u16 dAcPyKey_c::mPrevDownButtons

The buttons pressed down in the last frame.

Definition at line 42 of file d_ac_py_key.hpp.

◆ mPrevTriggeredButtons

u16 dAcPyKey_c::mPrevTriggeredButtons

The buttons newly pressed down in the last frame.

Definition at line 43 of file d_ac_py_key.hpp.

◆ mDownButtonsDemo

u16 dAcPyKey_c::mDownButtonsDemo

The buttons currently pressed down in demo mode.

Definition at line 44 of file d_ac_py_key.hpp.

◆ mTriggeredButtonsDemo

u16 dAcPyKey_c::mTriggeredButtonsDemo

The buttons newly pressed down in demo mode.

Definition at line 45 of file d_ac_py_key.hpp.

◆ mDemoDoShake

u16 dAcPyKey_c::mDemoDoShake

Trigger a shake event in demo mode.

Definition at line 46 of file d_ac_py_key.hpp.

◆ mStatus

u16 dAcPyKey_c::mStatus

Uses FLAGS_e enum.

Definition at line 47 of file d_ac_py_key.hpp.

◆ mHipAtkHoldCount

u8 dAcPyKey_c::mHipAtkHoldCount

Counts how long the down button is held for the hip attack.

Definition at line 48 of file d_ac_py_key.hpp.

◆ mHipAtkRead

bool dAcPyKey_c::mHipAtkRead

Whether hip attack was checked for this frame.

Definition at line 49 of file d_ac_py_key.hpp.

◆ mHipAtkHoldStart

bool dAcPyKey_c::mHipAtkHoldStart

Whether the hip attack holding started.

Definition at line 50 of file d_ac_py_key.hpp.

◆ mTriggerShakeJump

u8 dAcPyKey_c::mTriggerShakeJump

Whether a shake was triggered this frame.

Definition at line 51 of file d_ac_py_key.hpp.

◆ mActiveShakeJump

u8 dAcPyKey_c::mActiveShakeJump

Whether a shake is active this frame.

Definition at line 52 of file d_ac_py_key.hpp.

◆ mActionTriggered

bool dAcPyKey_c::mActionTriggered

Set if eat, fire or jump is triggered.

Definition at line 53 of file d_ac_py_key.hpp.

◆ mShakeCooldown

int dAcPyKey_c::mShakeCooldown

Cooldown counter for shake events.

Definition at line 54 of file d_ac_py_key.hpp.

◆ m_20

int dAcPyKey_c::m_20

[Unused].

Definition at line 55 of file d_ac_py_key.hpp.

◆ mJumpTriggeredHistory

int dAcPyKey_c::mJumpTriggeredHistory[4][10]

Stores the last 10 frames of jump events for each remote.

Definition at line 58 of file d_ac_py_key.hpp.

◆ mJumpButtonHistory

int dAcPyKey_c::mJumpButtonHistory[4][10]

Stores the last 10 frames of the jump button state for each remote.

Definition at line 59 of file d_ac_py_key.hpp.