summaryrefslogtreecommitdiff
path: root/src/d/actor/d_a_obj_gnndemotakis.cpp
blob: ce0cb7f5df325200f7936ae4043c8ccc6853b791 (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
/**
 * d_a_obj_gnndemotakis.cpp
 * Object - Ganondorf Fight - Background waterfalls (before fight)
 */

#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "res/Object/Gnndemotakis.h"
#include "d/actor/d_a_obj_gnndemotakis.h"

const char daObjGnntakis_c::M_arcname[] = "Gnndemotakis";

/* 00000078-00000098       .text solidHeapCB__15daObjGnntakis_cFP10fopAc_ac_c */
BOOL daObjGnntakis_c::solidHeapCB(fopAc_ac_c* a_this) {
    return ((daObjGnntakis_c*)a_this)->create_heap();
}

/* 00000098-000001F4       .text create_heap__15daObjGnntakis_cFv */
BOOL daObjGnntakis_c::create_heap() {
    J3DModelData* mdl_data;
    J3DAnmTextureSRTKey* btk_data;
    BOOL ret = FALSE;
    mdl_data = static_cast<J3DModelData*>(dComIfG_getObjectRes(M_arcname, dRes_INDEX_GNNDEMOTAKIS_BDL_GNN_DEMO_TAKI_S_e));
    JUT_ASSERT(155, mdl_data != NULL);

    if (mdl_data != NULL) {
        mpModel = mDoExt_J3DModel__create(mdl_data, 0, 0x11020203);
        if (mpModel != NULL) {
            btk_data = static_cast<J3DAnmTextureSRTKey*>(dComIfG_getObjectRes(M_arcname, dRes_INDEX_GNNDEMOTAKIS_BTK_GNN_DEMO_TAKI_S_e));
            JUT_ASSERT(162, btk_data != NULL);
            if (btk_data != NULL && mpBtkAnm.init(mdl_data, btk_data, TRUE, 0, 1.0f, 0, -1, FALSE, 0)) {
                ret = TRUE;
            }
        }
    }
    return ret;
}

/* 000001F4-00000308       .text _create__15daObjGnntakis_cFv */
cPhs_State daObjGnntakis_c::_create() {
    fopAcM_ct(this, daObjGnntakis_c);

    cPhs_State state = dComIfG_resLoad(&mPhs, M_arcname);

    if (state == cPhs_COMPLEATE_e) {
        state = cPhs_ERROR_e;
        if (fopAcM_entrySolidHeap(this, solidHeapCB, 0)) {
            fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
            init_mtx();
            mpBtkAnm.getFrameCtrl()->setFrame(mpBtkAnm.getStartFrame());
            mpBtkAnm.setPlaySpeed(0.0f);
            state = cPhs_COMPLEATE_e;
            m2B0 = FALSE;
        }
    }

    return state;
}

/* 000003AC-000003DC       .text _delete__15daObjGnntakis_cFv */
bool daObjGnntakis_c::_delete() {
    dComIfG_resDelete(&mPhs, M_arcname);
    return TRUE;
}

/* 000003DC-000003FC       .text init_mtx__15daObjGnntakis_cFv */
void daObjGnntakis_c::init_mtx() {
    mpModel->setBaseScale(scale);
}

/* 000003FC-00000514       .text _execute__15daObjGnntakis_cFv */
bool daObjGnntakis_c::_execute() {
    if (strcmp(dComIfGp_getStartStageName(), "GTower") == 0 &&
        dComIfGp_event_runCheck() != FALSE &&
        dComIfGp_evmng_startCheck("g2before") && 
        dComIfGp_demo_get()) {
        if (m2B0 == 0 && dComIfGp_demo_get()->getFrameNoMsg() >= 0x11d9) {
            mpBtkAnm.setFrame(mpBtkAnm.getStartFrame());
            mpBtkAnm.setPlaySpeed(1.0f);
            m2B0 = TRUE;
        } else if (dComIfGp_demo_get()->getFrameNoMsg() >= 0x126f) {
            fopAcM_delete(this);
        }
    }

    mpBtkAnm.play();
    return TRUE;
}

/* 00000514-0000058C       .text _draw__15daObjGnntakis_cFv */
bool daObjGnntakis_c::_draw() {
    g_env_light.settingTevStruct(TEV_TYPE_BG3, &current.pos, &tevStr);
    g_env_light.setLightTevColorType(mpModel, &tevStr);
    mpBtkAnm.entry(mpModel->getModelData());
    mDoExt_modelUpdateDL(mpModel);
    return TRUE;
}

namespace {
/* 0000058C-000005AC       .text Mthd_Create__34@unnamed@d_a_obj_gnndemotakis_cpp@FPv */
cPhs_State Mthd_Create(void* i_this) {
    return ((daObjGnntakis_c*)i_this)->_create();
}

/* 000005AC-000005D0       .text Mthd_Delete__34@unnamed@d_a_obj_gnndemotakis_cpp@FPv */
BOOL Mthd_Delete(void* i_this) {
    return ((daObjGnntakis_c*)i_this)->_delete();
}

/* 000005D0-000005F4       .text Mthd_Execute__34@unnamed@d_a_obj_gnndemotakis_cpp@FPv */
BOOL Mthd_Execute(void* i_this) {
    return ((daObjGnntakis_c*)i_this)->_execute();
}

/* 000005F4-00000618       .text Mthd_Draw__34@unnamed@d_a_obj_gnndemotakis_cpp@FPv */
BOOL Mthd_Draw(void* i_this) {
    return ((daObjGnntakis_c*)i_this)->_draw();
}

/* 00000618-00000620       .text Mthd_IsDelete__34@unnamed@d_a_obj_gnndemotakis_cpp@FPv */
BOOL Mthd_IsDelete(void*) {
    return TRUE;
}

static actor_method_class Gnntakis_Mthd_Table = {
    (process_method_func)Mthd_Create,
    (process_method_func)Mthd_Delete,
    (process_method_func)Mthd_Execute,
    (process_method_func)Mthd_IsDelete,
    (process_method_func)Mthd_Draw,
};
}; // namespace

actor_process_profile_definition g_profile_Obj_Gnntakis = {
    /* Layer ID     */ fpcLy_CURRENT_e,
    /* List ID      */ 0x0003,
    /* List Prio    */ fpcPi_CURRENT_e,
    /* Proc Name    */ fpcNm_Obj_Gnntakis_e,
    /* Proc SubMtd  */ &g_fpcLf_Method.base,
    /* Size         */ sizeof(daObjGnntakis_c),
    /* Size Other   */ 0,
    /* Parameters   */ 0,
    /* Leaf SubMtd  */ &g_fopAc_Method.base,
    /* Draw Prio    */ fpcDwPi_Obj_Gnntakis_e,
    /* Actor SubMtd */ &Gnntakis_Mthd_Table,
    /* Status       */ fopAcStts_UNK4000_e | fopAcStts_UNK40000_e,
    /* Group        */ fopAc_ACTOR_e,
    /* Cull Type    */ fopAc_CULLBOX_CUSTOM_e,
};