summaryrefslogtreecommitdiff
path: root/src/d/actor/d_a_swattack.cpp
blob: 09ed1bf5f3c7ec549b5613f14d6f77ecd364ced8 (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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
//
// Generated by dtk
// Translation Unit: d_a_swattack.cpp
//

#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_swattack.h"
#include "f_op/f_op_actor_mng.h"
#include "d/d_cc_d.h"
#include "d/d_com_inf_game.h"

static dCcD_SrcCyl l_cyl_src = {
    // dCcD_SrcGObjInf
    {
        /* Flags             */ 0,
        /* SrcObjAt  Type    */ 0,
        /* SrcObjAt  Atp     */ 0,
        /* SrcObjAt  SPrm    */ 0,
        /* SrcObjTg  Type    */ AT_TYPE_ALL,
        /* SrcObjTg  SPrm    */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsOther_e,
        /* SrcObjCo  SPrm    */ 0,
        /* SrcGObjAt Se      */ 0,
        /* SrcGObjAt HitMark */ 0,
        /* SrcGObjAt Spl     */ 0,
        /* SrcGObjAt Mtrl    */ 0,
        /* SrcGObjAt SPrm    */ 0,
        /* SrcGObjTg Se      */ 0,
        /* SrcGObjTg HitMark */ 0,
        /* SrcGObjTg Spl     */ 0,
        /* SrcGObjTg Mtrl    */ 0,
        /* SrcGObjTg SPrm    */ 0,
        /* SrcGObjCo SPrm    */ 0,
    },
    // cM3dGCylS
    {{
        /* Center */ {0.0f, 0.0f, 0.0f},
        /* Radius */ 50.0f,
        /* Height */ 50.0f,
    }},
};

/* 00000078-00000080       .text _delete__8daSwAt_cFv */
bool daSwAt_c::_delete() {
    return true;
}

/* 00000080-00000120       .text CreateInit__8daSwAt_cFv */
void daSwAt_c::CreateInit() {
    mStts.Init(0xFF, 0xFF, this);
    mCyl.Set(l_cyl_src);
    mCyl.SetStts(&mStts);
    mCyl.SetR(scale.x * 25.0f);
    mCyl.SetH(scale.y * 50.0f);
    mAtType = daSwAt_prm::getAtType(this);
    mSwitchNo = daSwAt_prm::getSwitchNo(this);
    fopAcM_offDraw(this);
}

/* 00000120-0000020C       .text _create__8daSwAt_cFv */
cPhs_State daSwAt_c::_create() {
    fopAcM_ct(this, daSwAt_c);
    CreateInit();
    return cPhs_COMPLEATE_e;
}

/* 000003C4-0000055C       .text _execute__8daSwAt_cFv */
bool daSwAt_c::_execute() {
    bool triggered = false;
    if (mCyl.ChkTgHit()) {
        cCcD_Obj* obj = mCyl.GetTgHitObj();
        if(obj) {
            switch (mAtType) {
            case 0xFF:
                triggered = true;
                break;
            case 0:
                if (obj->ChkAtType(AT_TYPE_SWORD) || obj->ChkAtType(AT_TYPE_BOKO_STICK) ||
                    obj->ChkAtType(AT_TYPE_STALFOS_MACE) || obj->ChkAtType(AT_TYPE_MACHETE) ||
                    obj->ChkAtType(AT_TYPE_DARKNUT_SWORD))
                {
                    triggered = true;
                }
                break;
            case 1:
                if (obj->ChkAtType(AT_TYPE_BOMB)) {
                    triggered = true;
                }
                break;
            case 2:
                if (obj->ChkAtType(AT_TYPE_BOOMERANG)) {
                    triggered = true;
                }
                break;
            case 3:
                if (obj->ChkAtType(AT_TYPE_SKULL_HAMMER)) {
                    triggered = true;
                }
                break;
            case 4:
                if (obj->ChkAtType(AT_TYPE_FIRE_ARROW) || obj->ChkAtType(AT_TYPE_ICE_ARROW) ||
                    obj->ChkAtType(AT_TYPE_LIGHT_ARROW) || obj->ChkAtType(AT_TYPE_NORMAL_ARROW))
                {
                    triggered = true;
                }
                break;
            case 5:
                if (obj->ChkAtType(0x8000)) {
                    triggered = true;
                }
                break;
            }
        }
    }

    if (triggered) {
        fopAcM_onSwitch(this, mSwitchNo);
    }

    mCyl.SetC(current.pos);
    dComIfG_Ccsp()->Set(&mCyl);
    return true;
}

/* 0000055C-00000564       .text _draw__8daSwAt_cFv */
bool daSwAt_c::_draw() {
    return true;
}

/* 00000564-00000584       .text daSwAt_Create__FPv */
static cPhs_State daSwAt_Create(void* i_this) {
    return ((daSwAt_c*)i_this)->_create();
}

/* 00000584-000005A8       .text daSwAt_Delete__FPv */
static BOOL daSwAt_Delete(void* i_this) {
    return ((daSwAt_c*)i_this)->_delete();
}

/* 000005A8-000005CC       .text daSwAt_Draw__FPv */
static BOOL daSwAt_Draw(void* i_this) {
    return ((daSwAt_c*)i_this)->_draw();
}

/* 000005CC-000005F0       .text daSwAt_Execute__FPv */
static BOOL daSwAt_Execute(void* i_this) {
    return ((daSwAt_c*)i_this)->_execute();
}

/* 000005F0-000005F8       .text daSwAt_IsDelete__FPv */
static BOOL daSwAt_IsDelete(void* i_this) {
    return TRUE;
}

static actor_method_class daSwAtMethodTable = {
    (process_method_func)daSwAt_Create,
    (process_method_func)daSwAt_Delete,
    (process_method_func)daSwAt_Execute,
    (process_method_func)daSwAt_IsDelete,
    (process_method_func)daSwAt_Draw,
};

actor_process_profile_definition g_profile_SW_ATTACK = {
    /* Layer ID     */ fpcLy_CURRENT_e,
    /* List ID      */ 0x0007,
    /* List Prio    */ fpcPi_CURRENT_e,
    /* Proc Name    */ fpcNm_SW_ATTACK_e,
    /* Proc SubMtd  */ &g_fpcLf_Method.base,
    /* Size         */ sizeof(daSwAt_c),
    /* Size Other   */ 0,
    /* Parameters   */ 0,
    /* Leaf SubMtd  */ &g_fopAc_Method.base,
    /* Draw Prio    */ fpcDwPi_SW_ATTACK_e,
    /* Actor SubMtd */ &daSwAtMethodTable,
    /* Status       */ fopAcStts_CULL_e | fopAcStts_UNK40000_e,
    /* Group        */ fopAc_ACTOR_e,
    /* Cull Type    */ fopAc_CULLBOX_CUSTOM_e,
};