diff options
| author | Prakxo <87568477+Prakxo@users.noreply.github.com> | 2023-08-14 18:20:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-14 10:20:27 -0700 |
| commit | bdb8ef6d5b33c24580d7861c4ccf8d937caac8fb (patch) | |
| tree | 441ff7c143fe25abd08d24d94fd2122f5b79a4f6 /include/m_controller.h | |
| parent | 8aa8fb893a2258a27e77b2872c189a93dc427a2e (diff) | |
m_controller OK (#48)
* m_pause OK
* yeah now it's OK lol
* refactor
* refactor 2
* m_controller OK
* format
* fix size comment in game
* refactor 3
* refactor 4
* refactor 5
* add unused macro
Diffstat (limited to 'include/m_controller.h')
| -rw-r--r-- | include/m_controller.h | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/include/m_controller.h b/include/m_controller.h index fc5a6f8..5a8eaf8 100644 --- a/include/m_controller.h +++ b/include/m_controller.h @@ -6,17 +6,42 @@ #define CHECK_BTN_ALL(state, combo) (~((state) | ~(combo)) == 0) #define RESET_BUTTON 0x80 +#define STICK_MIN 9.899495f +#define STICK_MAX 61.0f +#define STICK_UNCORRECTED_SCALE (1.0f / STICK_MAX) +#define STICK_CORRECTED_SCALE (1.0f / (STICK_MAX - STICK_MIN)) + +typedef struct Controller { + /* 0x00 */ f32 moveX; + /* 0x04 */ f32 moveY; + /* 0x08 */ f32 moveR; + /* 0x0C */ s16 moveAngle; + + /* 0x10 */ f32 lastMoveX; + /* 0x14 */ f32 lastMoveY; + /* 0x18 */ f32 lastMoveR; + /* 0x1C */ s16 lastMoveAngle; + + /* 0x20 */ f32 adjustedX; + /* 0x24 */ f32 adjustedY; + /* 0x28 */ f32 adjustedR; + + /* 0x2C */ f32 lastAdjustedX; + /* 0x30 */ f32 lastAdjustedY; + /* 0x34 */ f32 lastAdjustedR; +} Controller; // size = 0x38 + struct GameState; void mCon_ct(struct GameState* gameState); void mCon_dt(struct GameState* gameState); -// void mCon_calc(); -// void mCon_main(); -// void chkButton(); -// void getButton(); -// void chkTrigger(); -// void getTrigger(); -// void getJoystick_X(); -// void getJoystick_Y(); +void mCon_calc(Controller* controller, f32 x, f32 y); +void mCon_main(struct GameState* game); +s32 chkButton(u16 mask); +u16 getButton(void); +s32 chkTrigger(u16 mask); +u16 getTrigger(void); +s32 getJoystick_X(void); +s32 getJoystick_Y(void); #endif |
