summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/game.h5
-rw-r--r--include/m_controller.h41
-rw-r--r--include/m_event.h (renamed from include/6A0DE0.h)6
-rw-r--r--include/m_lib.h2
-rw-r--r--include/sys_math_atan.h2
5 files changed, 42 insertions, 14 deletions
diff --git a/include/game.h b/include/game.h
index 9bc727e..4ffa403 100644
--- a/include/game.h
+++ b/include/game.h
@@ -7,6 +7,7 @@
#include "gamealloc.h"
#include "libu64/pad.h"
#include "unk.h"
+#include "m_controller.h"
struct GameState;
struct GraphicsContext;
@@ -55,7 +56,9 @@ typedef struct GameState {
/* 0x9C */ UNK_TYPE1 unk_9C[0x3];
/* 0x9F */ u8 running;
/* 0xA0 */ s32 unk_A0;
-} GameState; // size >= 0xA4, size <= 0xE0
+ /* 0xA4 */ UNK_TYPE1 unk_A4[0x4];
+ /* 0xA8 */ Controller controller;
+} GameState; // size = 0xE0
void func_800D2E00_jp(GameState* gameState);
void func_800D2E58_jp(u16 button, Gfx** gfxP);
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
diff --git a/include/6A0DE0.h b/include/m_event.h
index 479f600..03a59a1 100644
--- a/include/6A0DE0.h
+++ b/include/m_event.h
@@ -1,5 +1,5 @@
-#ifndef C_6A0DE0_H
-#define C_6A0DE0_H
+#ifndef M_EVENT_H
+#define M_EVENT_H
#include "ultra64.h"
@@ -39,7 +39,7 @@
// void func_8007D848_jp();
// void func_8007D880_jp();
// void func_8007D8D4_jp();
-// void mEv_CheckTitleDemo();
+s32 mEv_CheckTitleDemo(void);
// void func_8007D91C_jp();
// void func_8007D930_jp();
// void func_8007D9C8_jp();
diff --git a/include/m_lib.h b/include/m_lib.h
index 582c4cb..4cc2b2f 100644
--- a/include/m_lib.h
+++ b/include/m_lib.h
@@ -61,7 +61,7 @@ void *Lib_SegmentedToVirtual(void *ptr); //original name unknown, taken from maj
// void func_8009ADE0_jp();
// void func_8009AE28_jp();
// void func_8009AE44_jp();
-// void check_percent_abs();
+f32 check_percent_abs(f32 x, f32 min, f32 max, f32 scale, int shift_by_min);
// void get_percent_forAccelBrake();
// void Game_play_Projection_Trans();
// void get_percent();
diff --git a/include/sys_math_atan.h b/include/sys_math_atan.h
index 59e1bd1..1a4cfa8 100644
--- a/include/sys_math_atan.h
+++ b/include/sys_math_atan.h
@@ -4,7 +4,7 @@
#include "ultra64.h"
// void U_GetAtanTable();
-// void atans_table();
+s16 atans_table(f32 x, f32 y);
// void atanf_table();
#endif