summaryrefslogtreecommitdiff
path: root/include/Player/PlayerControl.hpp
blob: f2cc23eb66d22f0308f9741b755b1c4eded15473 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#pragma once

#include "global.h"
#include "nds/math.h"
#include "types.h"

#include "Actor/Actor.hpp"
#include "Actor/ActorManager.hpp"
#include "Debug/DebugHierarchy.hpp"
#include "Item/Item.hpp"
#include "Player/TouchControl.hpp"
#include "Player/TouchGesture.hpp"

typedef u16 TouchEdge;
enum TouchEdge_ {
    TouchEdge_Right  = 0,
    TouchEdge_Left   = 1,
    TouchEdge_Bottom = 2,
    TouchEdge_Top    = 3,
    TouchEdge_Middle = 4
};

class PlayerControl : public TouchControl {
public:
    /* 00 (base) */
    /* 38 */ Vec3p mTouchWorld; // tile position
    /* 44 */ Vec3p mUnk_44;
    /* 50 */ q20 mTouchSpeedX; // how fast the stylus moves
    /* 54 */ q20 mTouchSpeedY;
    /* 58 */ q20 mTouchDist; // pixel distance from touch to link, deadzone is 20 pixels
    /* 5c */ unk32 mUnk_5c;
    /* 60 */ s16 mTouchDuration;
    /* 62 */ s16 mTouchSlowDuration; // resets to 0 if stylus is fast enough
    /* 64 */ s16 mTouchFastTime; // gets set to mTouchDuration if stylus is fast enough
    /* 66 */ s16 mTouchFastX; // gets set to mTouchX if stylus is fast enough
    /* 68 */ s16 mTouchFastY; // gets set to mTouchY if stylus is fast enough
    /* 6a */ s16 mTouchAngle; // angle from touch to link, 0 = down, 0x4000 = right, 0x8000 = up, 0xc000 = left
    /* 6c */ s16 mTouchFastAngle; // gets set to mTouchAngle if stylus is fast enough
    /* 6e */ TouchEdge mTouchEdge; // changes value when touching close to the edge of the screen
    /* 70 */ TouchEdge mTouchLastEdge;
    /* 72 */ s16 mTouchDiffX;
    /* 74 */ s16 mTouchDiffY;
    /* 76 */ bool mTouchFast;
    /* 77 */ unk8 mUnk_77;
    /* 78 */ bool mUnk_78;
    /* 79 */ bool mUsingEquipItem;
    /* 7a */ bool mUnk_7a;
    /* 7b */ bool mUnk_7b;
    /* 7c */ s8 mUnk_7c;
    /* 7d */ bool mUnk_7d;
    /* 7e */ s8 mUnk_7e;
    /* 7f */ bool mUnk_7f;
    /* 80 */ bool mUnk_80;
    /* 81 */ bool mFollowing;
    /* 82 */ unk8 mUnk_82;
    /* 83 */ bool mUnk_83;
    /* 84 */ ActorRef mFollowRef;
    /* 8c */ ActorRef mNextFollowRef;
    /* 94 */ ActorRef mLastFollowRef;
    /* 9c */ unk8 mUnk_9c;
    /* 9d */ unk8 mUnk_9d;
    /* 9e */ unk8 mUnk_9e[2];
    /* a0 */ void *mFollowActor;
    /* a4 */ q20 mFollowDist;
    /* a8 */ u16 mFollowStuckTimer;
    /* aa */ u16 mCutsceneEndTimer;
    /* ac */ s16 mUnk_ac;
    /* ae */ unk16 mUnk_ae;
    /* b0 */ Vec3p mAim; // used by boomerang, bow and rope
    /* bc */ Vec3p mAimWorld; // used by hammer
    /* c8 */ s32 mUnk_c8;
    /* cc */ s32 mUnk_cc;
    /* d0 */ TouchGesture **mTouchGesture;
    /* d4 */ DebugHierarchy *mDebug;
    /* d8 */

    static bool func_ov00_020aeeac();
    void func_ov00_020aeef8();
    void func_ov00_020aef30();
    void UpdateAim();
    Actor *GetFollowActor();
    bool func_ov00_020af01c(unk8 *param1);
    void SetUnk_80();
    void StopFollowing();
    void func_ov00_020af06c();
    void UpdateUsingEquipItem();
    bool func_ov00_020af2d4(u32 param1, bool param2);
    bool CheckTouchedNow(u32 param1);
    bool CheckUntouchedNow(u32 param1);
    bool CheckTouching(u32 param1);
    bool CheckTouchFast(u32 param1);
    bool func_ov00_020af4a4();
    void func_ov00_020af538();
    void func_ov00_020af6e4(Vec3p *param1, s32 param3, s32 param4);
    bool func_ov00_020af778();
    bool func_ov00_020afad8(Vec3p *param1);
    void func_ov00_020afb6c();
    bool func_ov00_020afe88(s32 param1, bool param2);
    bool func_ov00_020afeec(unk32 param1, bool param2);
    void func_ov00_020aff90(unk32 param1, unk32 param2);
    void func_ov00_020affec(Vec3p *param1, s32 y, s32 param3, Vec3p *param4);
    void func_ov00_020b014c();
    void SetAim();
    bool UpdateAimWorld(Vec3p *param1);
    s16 GetTouchAngle();
    u32 func_ov00_020b034c();
    s32 func_ov00_020b0418();
    bool func_ov00_020b049c(Vec3p *param1, bool param2);
    bool func_ov00_020b05e8(Vec3p *param1);
    bool func_ov00_020b0778(Vec3p *param1, u32 param2, unk32 param3);
    bool CheckNotTouching();
    bool func_ov00_020b0ad0(Actor *actor);
    bool func_ov00_020b0b0c(s16 *pAngle, ItemFlag *pEquipId, unk32 *pCardinal, bool *pFast);
    bool func_ov00_020b0de8(Vec3p *param1);
    bool func_ov00_020b0e54(Vec3p *param1, Vec3p *param2);
    bool func_ov00_020b0f88(Vec3p *param1, unk32 param2, Vec3p *param3);
    bool func_ov00_020b1058(Vec3p *param1, unk32 param2, Vec3p *param3, Vec3p *param4);
    bool IsUntouchedNow();
    bool IsNotUntouchedNow();
    bool func_ov00_020b1248(unk32 *param1);
    bool func_ov00_020b129c();
    bool func_ov00_020b12d0(s16 *pAngle);
    bool IsNotTouching();
    bool IsTouchingFast();
    bool IsTappedNow();
    bool func_ov00_020b13c4();

    void ResetTouchWorld();
    void InitTouchMovement();
    void func_ov000_020b7924(s32 param1);
    void ApplyTouchWorld(Vec3p *result, unk32 scale);
    bool func_ov000_020b7d6c();

    PlayerControl();
    ~PlayerControl();
    static void Create();
    static void Destroy();
    void Init();
    void func_ov004_0210b1d0();
    static void func_ov004_0210b1f0();
};

extern PlayerControl *gPlayerControl;