summaryrefslogtreecommitdiff
path: root/include/d/lyt/d_lyt_common_arrow.h
blob: 5fd61236fdeffe5d103eb06631863b4d92cf5e11 (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
#ifndef D_LYT_COMMON_ARROW_H
#define D_LYT_COMMON_ARROW_H

#include "d/lyt/d2d.h"
// clang-format off
// vtable order
#include "d/d_cursor_hit_check.h"
// clang-format on
#include "m/m_vec.h"
#include "nw4r/lyt/lyt_bounding.h"
#include "s/s_State.hpp"

class dLytCommonArrow_c {
public:
    dLytCommonArrow_c();
    virtual ~dLytCommonArrow_c() {}

    enum Arrow_e {
        ARROW_LEFT = 0,
        ARROW_RIGHT = 1,
        ARROW_NONE = 2,
    };

    bool build();

    STATE_FUNC_DECLARE(dLytCommonArrow_c, None);
    STATE_FUNC_DECLARE(dLytCommonArrow_c, In);
    STATE_FUNC_DECLARE(dLytCommonArrow_c, Wait);
    STATE_FUNC_DECLARE(dLytCommonArrow_c, Out);

    void setState(s32 state);
    bool draw();

    bool remove();
    bool execute();
    bool requestIn();
    bool requestOut();

    s32 getPointedAtArrow() const {
        return mPointedAtArrow;
    }

    bool isChangingState() const {
        return mIsChangingState;
    }

    nw4r::lyt::Bounding *getArrowBounding(s32 idx) const {
        return mpBoundings[idx];
    }

    s32 getActiveArrow() const {
        return mActiveArrow;
    }

    void setActiveArrow(s32 v) {
        mActiveArrow = v;
    }

    void setBackwards(bool b) {
        mBackwards = b;
    }
    bool triggerArrowPress();
    void setTranslate(const mVec2_c *);

private:
    void displayElement(s32, f32);
    void unbindAt(s32);
    void tickDown(d2d::AnmGroup_c *);
    void checkPointAtPane();

    /* 0x04 */ UI_STATE_MGR_DECLARE(dLytCommonArrow_c);
    /* 0x40 */ d2d::LytBase_c mLytBase;
    d2d::ResAccIf_c mResAcc;
    d2d::AnmGroup_c mAnmGroups[9];
    dCursorHitCheckLyt_c mCsHitCheck;
    /* 0x6A8 */ nw4r::lyt::Bounding *mpBoundings[2];
    /* 0x6B0 */ s32 mType;
    /* 0x6B4 */ s32 mPointedAtArrow;
    /* 0x6B8 */ s32 mActiveArrow;
    /* 0x6BC */ s32 mLastActiveArrow;
    /* 0x6C0 */ s32 mTriggeredArrow;
    /* 0x6C4 */ s32 mTimer;
    /* 0x6C8 */ bool mInRequested;
    /* 0x6C9 */ bool mOutRequested;
    /* 0x6CA */ bool mIsChangingState;
    /* 0x6CB */ bool mVisible;
    /* 0x6CC */ bool mBackwards;
};

#endif