summaryrefslogtreecommitdiff
path: root/include/d/actor/d_a_obj_catdoor.h
blob: dd7141d92083eba4c8ca358e3827c6835f696463 (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
#ifndef D_A_OBJ_CATDOOR_H
#define D_A_OBJ_CATDOOR_H

#include "f_op/f_op_actor_mng.h"
#include "d/d_bg_w.h"

class daObjCatDoor_Door_c {
public:
    /* 0x00 */ J3DModel* pmodel;
    /* 0x04 */ dBgW bgw;
    /* 0xe0 */ Mtx mtx;
    /* 0xf4 */ s16 angle;
};

class daObjCatDoor_Attr_c {
public:
    /* 0x0 */ s16 speed;
    /* 0x2 */ s16 decay_rate;
};

class daObjCatDoor_Hio_c : public mDoHIO_entry_c {
public:
    daObjCatDoor_Hio_c();
    ~daObjCatDoor_Hio_c();

    void genMessage(JORMContext*);

    void ct();
    void dt();
    void default_set();

    /* 0x8 */ int field_0x8;
    /* 0xC */ daObjCatDoor_Attr_c m_attr;
};

/**
 * @ingroup actors-objects
 * @class daObjCatDoor_c
 * @brief Cat Door
 *
 * @details
 *
 */
class daObjCatDoor_c : public fopAc_ac_c {
public:
    inline ~daObjCatDoor_c();

    const daObjCatDoor_Attr_c* attr() const;
    void initBaseMtx();
    void setBaseMtx();
    void calcOpen();

    u8 getSwitchNo() { return fopAcM_GetParam(this); }

    inline int createHeap();
    inline int draw();
    inline int execute();
    inline int create();
    inline void create_init();

    void _toDoorOpened() {
        mDoor1.angle = 0x8800;
        mDoor2.angle = 0x7800;
        setBaseMtx();
        fopAcM_onSwitch(this, getSwitchNo());
    }

    void setDoorOpen() {
        mRotSpeed = attr()->decay_rate;
        dBgW* bgw1 = &mDoor1.bgw;
        if (bgw1->ChkUsed()) {
            dComIfG_Bgsp().Release(bgw1);
        }

        dBgW* bgw2 = &mDoor2.bgw;
        if (bgw2->ChkUsed()) {
            dComIfG_Bgsp().Release(bgw2);
        }

        Z2GetAudioMgr()->seStart(Z2SE_OBJ_GZ_NE_DOOR_OP, &current.pos, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
    }

private:
    /* 0x568 */ request_of_phase_process_class mPhaseReq;
    /* 0x570 */ daObjCatDoor_Door_c mDoor1;
    /* 0x660 */ daObjCatDoor_Door_c mDoor2;
    /* 0x760 */ Mtx mMtx;
    /* 0x790 */ s16 mRotSpeed;

public:
    static const daObjCatDoor_Attr_c M_attr;
};

#endif /* D_A_OBJ_CATDOOR_H */