summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAetias <aetias@outlook.com>2024-03-19 17:53:59 +0100
committerAetias <aetias@outlook.com>2024-03-19 17:53:59 +0100
commit6f707bb31d5411e8292b8df833f1faccfc70fc64 (patch)
treebda79a2cb0e6d63a7b5f3f49897e773fe82175ad /include
parentf9f944ae47471903b1f56e2d53a6199e3dc71cc9 (diff)
Add `TouchControl.s`
Diffstat (limited to 'include')
-rw-r--r--include/Player/TouchControl.hpp45
-rw-r--r--include/lib/touch.h17
2 files changed, 62 insertions, 0 deletions
diff --git a/include/Player/TouchControl.hpp b/include/Player/TouchControl.hpp
new file mode 100644
index 00000000..804078c9
--- /dev/null
+++ b/include/Player/TouchControl.hpp
@@ -0,0 +1,45 @@
+#pragma once
+
+#include "global.h"
+#include "types.h"
+#include "lib/touch.h"
+
+typedef u16 TouchFlags;
+enum TouchFlag_ {
+ TouchFlag_TouchedNow = 0x0001,
+ TouchFlag_UntouchedNow = 0x0002,
+ TouchFlag_Repeat = 0x0004,
+};
+
+class TouchControl {
+public:
+ /* 00 */ u16 mSpeed;
+ /* 02 */ u16 mTimeBetweenTouches; // gets set to mTimeSinceTouch when touching the screen
+ /* 04 */ u16 mTimeSinceTouch; // increases by mSpeed every frame
+ /* 06 */ unk16 mRepeatStart;
+ /* 08 */ unk16 mRepeatLoop;
+ // mRepeatTimer starts at mRepeatStart, decreases by mSpeed while touching the screen.
+ // if equal to 0, mRepeatTimer gets set to mRepeatLoop and the Repeat flag is set
+ /* 0a */ unk16 mRepeatTimer;
+ /* 0c */ bool mTouch;
+ /* 10 */ s32 mTouchX;
+ /* 14 */ s32 mTouchY;
+ /* 18 */ bool mTouchPrev;
+ /* 1c */ s32 mTouchPrevX;
+ /* 20 */ s32 mTouchPrevY;
+ /* 24 */ s32 mTouchLastX;
+ /* 28 */ s32 mTouchLastY;
+ /* 2c */ s32 mTouchStartX;
+ /* 30 */ s32 mTouchStartY;
+ /* 34 */ TouchFlags mFlags;
+ /* 36 */
+
+ TouchControl();
+ void IncreaseSpeed(s16 increase);
+ void UpdateFlags(u16 speed);
+ void UpdateWithStateFlags(TouchStateFlags *state, u16 speed);
+ void Update(TouchState *state, u16 speed);
+ bool func_ov00_0207aeac();
+ void UpdateConditionally(TouchState *state, u16 speed);
+ void func_ov00_0207af38(u16 speed, bool param2);
+};
diff --git a/include/lib/touch.h b/include/lib/touch.h
new file mode 100644
index 00000000..41d29e4d
--- /dev/null
+++ b/include/lib/touch.h
@@ -0,0 +1,17 @@
+#pragma once
+
+struct TouchStateFlags {
+ u16 touchX;
+ u16 touchY;
+ u16 touch;
+ u16 flags;
+};
+
+struct TouchState {
+ bool touch;
+ s32 touchX;
+ s32 touchY;
+};
+
+void WaitForTouchUpdate(u16 param1);
+bool GetTouchStateFlags(TouchStateFlags *pState);