summaryrefslogtreecommitdiff
path: root/include/d/actor/d_a_guard_mng.h
blob: d5d5be96c3c25c1a5351e12eed703784e3600c5e (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
#ifndef D_A_GUARD_MNG_H
#define D_A_GUARD_MNG_H

#include "d/actor/d_a_player.h"
#include "d/d_com_inf_game.h"
#include "d/actor/d_a_tag_guard.h"

/**
 * @ingroup actors-unsorted
 * @class daGuardMng_c
 * @brief Guard Manager?
 *
 * @details
 *
 */
class daGuardMng_c : public fopAc_ac_c {
public:
    void countMerchantNum() {
        mMerchantNum++;
    }

    int execute() {
        static u32 const mGuardDataTbl[2] = {
            0x00000200, 0x00000201,
        };

        if (!daPy_py_c::checkNowWolf() || field_0x573 >= mLimitNum) {
            return 1;
        } else {
            if (field_0x571 < mMerchantNum) {
                field_0x571 = mMerchantNum;
            }

            checkMerchantNum();

            if (mpTagGuard) {
                if (field_0x571 > mMerchantNum && 3 < (field_0x571 - mMerchantNum)) {
                    mpTagGuard->createGuard(mGuardDataTbl[0]);
                    field_0x573++;
                    field_0x571 = mMerchantNum;
                    dComIfGs_onSaveDunSwitch(0x3c);
                }
            }
        }

        return 1;
    }

    u8 getLimitNum() {
        return fopAcM_GetParam(this) & 0xff;
    }

    void create_init() {
        mLimitNum = getLimitNum();
        field_0x573 = 0;
    }

    int create() {
        fopAcM_ct(this, daGuardMng_c);
        create_init();
        return cPhs_COMPLEATE_e;
    }

    u8 checkMerchantNum();
    void checkAppearTag(daTagGuard_c*);

    /* 0x568 */ daTagGuard_c* mpTagGuard;
    /* 0x56C */ f32 field_0x56c;
    /* 0x570 */ u8 mMerchantNum;
    /* 0x571 */ u8 field_0x571;
    /* 0x572 */ u8 mLimitNum;
    /* 0x573 */ u8 field_0x573;
};

#endif /* D_A_GUARD_MNG_H */