summaryrefslogtreecommitdiff
path: root/soh/src/code/padutils.c
diff options
context:
space:
mode:
authorArchez <Archez@users.noreply.github.com>2024-08-13 01:09:49 -0400
committerArchez <Archez@users.noreply.github.com>2024-08-13 01:09:49 -0400
commit651348d2a94f6bfa5f7e7f89800908e9e8a4a3e5 (patch)
treef54e376533a8926010561fd1fe47384b8431ad41 /soh/src/code/padutils.c
parent0bc6ca08e0549ec2ce780e6dd1295f84a194cc25 (diff)
parent73be4e55591f547df1a27884fdddbae36f603e07 (diff)
Merge remote-tracking branch 'origin/develop' into macready-golf-merge
Diffstat (limited to 'soh/src/code/padutils.c')
-rw-r--r--soh/src/code/padutils.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/soh/src/code/padutils.c b/soh/src/code/padutils.c
index 6a58b14f6..c4548ae32 100644
--- a/soh/src/code/padutils.c
+++ b/soh/src/code/padutils.c
@@ -92,3 +92,60 @@ void PadUtils_UpdateRelXY(Input* input) {
PadUtils_SetRelXY(input, relX, relY);
}
+
+// #region SOH [Enhancement]
+s8 PadUtils_GetCurRX(Input* input) {
+ return input->cur.right_stick_x;
+}
+
+s8 PadUtils_GetCurRY(Input* input) {
+ return input->cur.right_stick_y;
+}
+
+void PadUtils_SetRelRXY(Input* input, s32 x, s32 y) {
+ input->rel.right_stick_x = x;
+ input->rel.right_stick_y = y;
+}
+
+s8 PadUtils_GetRelRXImpl(Input* input) {
+ return input->rel.right_stick_x;
+}
+
+s8 PadUtils_GetRelRYImpl(Input* input) {
+ return input->rel.right_stick_y;
+}
+
+s8 PadUtils_GetRelRX(Input* input) {
+ return PadUtils_GetRelRXImpl(input);
+}
+
+s8 PadUtils_GetRelRY(Input* input) {
+ return PadUtils_GetRelRYImpl(input);
+}
+
+void PadUtils_UpdateRelRXY(Input* input) {
+ s32 curX = PadUtils_GetCurRX(input);
+ s32 curY = PadUtils_GetCurRY(input);
+ s32 relX;
+ s32 relY;
+
+ if (curX > 7) {
+ relX = (curX < 0x43) ? curX - 7 : 0x43 - 7;
+ } else if (curX < -7) {
+ relX = (curX > -0x43) ? curX + 7 : -0x43 + 7;
+ } else {
+ relX = 0;
+ }
+
+ if (curY > 7) {
+ relY = (curY < 0x43) ? curY - 7 : 0x43 - 7;
+
+ } else if (curY < -7) {
+ relY = (curY > -0x43) ? curY + 7 : -0x43 + 7;
+ } else {
+ relY = 0;
+ }
+
+ PadUtils_SetRelRXY(input, relX, relY);
+}
+// #endregion