summaryrefslogtreecommitdiff
path: root/include/m_controller.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/m_controller.h')
-rw-r--r--include/m_controller.h41
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