summaryrefslogtreecommitdiff
path: root/include/d/actor/d_a_npc_ins.h
blob: 3f8b40a9a0f6208ef19d1b6ac59980eb52bb7254 (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
144
145
146
147
148
149
150
151
152
153
154
155
#ifndef D_A_NPC_INS_H
#define D_A_NPC_INS_H

#include "d/actor/d_a_npc4.h"

struct daNpcIns_HIOParam {
    /* 0x00 */ daNpcF_HIOParam common;
    /* 0x70 */ f32 walk_speed;          // 歩行速度 - Walking Speed
};

class daNpcIns_Param_c {
public:
    virtual ~daNpcIns_Param_c() {}

    static daNpcIns_HIOParam const m;
};

#if DEBUG
class daNpcIns_HIO_c : public mDoHIO_entry_c {
public:
    daNpcIns_HIO_c();

    void genMessage(JORMContext*);

    /* 0x8 */ daNpcIns_HIOParam m;
};

#define NPC_INS_HIO_CLASS daNpcIns_HIO_c
#else
#define NPC_INS_HIO_CLASS daNpcIns_Param_c
#endif

struct insect_param_data {
    int evt_bit_no;
    s16 msg_no;
    u8 field_0x6;
    u8 field_0x7;
};

/**
 * @ingroup actors-npcs
 * @class daNpcIns_c
 * @brief Agitha
 *
 * @details
 *
*/
class daNpcIns_c : public daNpcF_c {
public:
    typedef int (daNpcIns_c::*actionFunc)(void*);
    typedef BOOL (daNpcIns_c::*eventFunc)(int);

    daNpcIns_c();
    ~daNpcIns_c();
    cPhs_Step Create();
    int CreateHeap();
    int Delete();
    int Execute();
    int Draw();
    int ctrlJoint(J3DJoint*, J3DModel*);
    static int createHeapCallBack(fopAc_ac_c*);
    static int ctrlJointCallBack(J3DJoint*, int);
    bool setExpressionAnm(int, bool);
    bool setExpressionBtp(int);
    void setMotionAnm(int, f32);
    void reset();
    int waitShop(void*);
    void setMotion(int, f32, int);
    void setExpression(int, f32);
    int waitPresent(void*);
    int waitOutSide1(void*);
    int waitOutSide2(void*);
    int goHome(void*);
    int talk(void*);
    int demo(void*);
    bool isInsectComplete();
    const insect_param_data& getInsectParamData(int);
    void setWaitAction();
    bool setPath(int);
    bool checkPoint(cXyz&, f32);
    bool setNextPoint();
    inline void getTargetPoint(int, Vec*);
    void pathMoveF();
    inline void setParam();
    inline BOOL main();
    inline void playMotion();
    inline BOOL ctrlBtk();
    inline void setAttnPos();
    inline void lookat();
    inline void setMtx();
    inline int drawDbgInfo();

    int getStartTime() { return fopAcM_GetParam(this) & 0xFF; }
    int getEndTime() { return (fopAcM_GetParam(this) >> 8) & 0xFF; }
    int getTimeHour() { return dKy_getdaytime_hour(); }
    int getTimeMinute() { return dKy_getdaytime_minute(); }
    int getTime() { return getTimeMinute() + getTimeHour() * 60; }
    s16 getMessageNo() { return shape_angle.x; }
    int getPathID1() { return (fopAcM_GetParam(this) >> 16) & 0xFF; }
    int getPathID2() {  return fopAcM_GetParam(this) >> 24; }
    inline BOOL setAction(actionFunc);
    inline void waitEventMng();
    inline BOOL step(s16, int);
    void setLookMode(int i_lookMode) { if (i_lookMode >= 0 && i_lookMode < 4 && i_lookMode != mLookMode) mLookMode = i_lookMode; }
    inline BOOL chkFindPlayer();
    inline void checkPlayerSearch();
    bool isInsect(int type) {
        bool rv = false;

        if (type >= dItemNo_M_BEETLE_e && type <= dItemNo_F_MAYFLY_e) {
            rv = true;
        }

        return rv;
    }
    s16 getInsectMessageNo(int type) { return getInsectParamData(type).msg_no; }
    u32 getInsectEvtBitNo(int type) { return getInsectParamData(type).evt_bit_no; }
    inline void setExpressionTalkAfter();
    inline void playExpression();
    BOOL chkAction(actionFunc action) { return action == mAction; }

    static eventFunc mEvtSeqList[1];

private:
    /* 0xB48 */ Z2Creature mSound;
    /* 0xBD8 */ J3DModel* mpUmbrellaModel;
    /* 0xBDC */ J3DModel* mpKagoModel;
    /* 0xBE0 */ daNpcF_MatAnm_c* mpMatAnm;
    /* 0xBE4 */ daNpcF_Lookat_c mLookat;
    /* 0xC80 */ daNpcF_ActorMngr_c mActorMngr[1];
    /* 0xC88 */ NPC_INS_HIO_CLASS* mpHIO;
    /* 0xC8C */ dCcD_Cyl mCyl;
    /* 0xDC8 */ actionFunc mAction;
    /* 0xDD4 */ actionFunc mPrevAction;
    /* 0xDE0 */ request_of_phase_process_class mPhases[3];
    /* 0xDF8 */ fpc_ProcID mItemID;
    /* 0xDFC */ int field_0xdfc;
    /* 0xE00 */ int mRndValue;
    /* 0xE04 */ dPath* mPath;
    /* 0xE08 */ int mPntIndex;
    /* 0xE0C */ f32 field_0xe0c;
    /* 0xE10 */ f32 mCurrentPosY;
    /* 0xE14 */ s16 field_0xe14;
    /* 0xE16 */ s16 field_0xe16;
    /* 0xE18 */ s16 mInsectMsgNo;
    /* 0xE1A */ s16 mLookMode;
    /* 0xE1C */ u16 mGoHomeTime;
    /* 0xE1E */ u16 mMode;
    /* 0xE20 */ u8 mOrderSpeakEvent;
    /* 0xE21 */ u8 mType;
};

STATIC_ASSERT(sizeof(daNpcIns_c) == 0xe24);

#endif /* D_A_NPC_INS_H */