summaryrefslogtreecommitdiff
path: root/src/d/actor/d_a_obj_bscurtain.cpp
blob: de3352b9e0cc718cc80e72f228fa15ca7dbdf76a (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
/**
 * d_a_obj_bscurtain.cpp
 * Object - Curtains (Beedle's Shop)
 */

#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_bscurtain.h"
#include "res/Object/Ptc.h"
#include "f_op/f_op_actor_mng.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "d/d_bg_w.h"
#include "d/d_com_inf_game.h"
#include "m_Do/m_Do_ext.h"
#include "m_Do/m_Do_mtx.h"

static daObj_Bscurtain_HIO_c l_HIO;

/* 000000EC-00000118       .text __ct__21daObj_Bscurtain_HIO_cFv */
daObj_Bscurtain_HIO_c::daObj_Bscurtain_HIO_c() {
    mNo = -1;
    field_0x08 = 0.0f;
    field_0x0c = 0;
}

const char daObj_Bscurtain_c::M_arcname[4] = "Ptc";

/* 00000118-000001C8       .text set_mtx__17daObj_Bscurtain_cFv */
void daObj_Bscurtain_c::set_mtx() {
    static cXyz trans = cXyz::Zero;
    mDoMtx_stack_c::transS(trans);
    mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
}

/* 00000204-00000224       .text CheckCreateHeap__FP10fopAc_ac_c */
static BOOL CheckCreateHeap(fopAc_ac_c* i_this) {
    return ((daObj_Bscurtain_c*)i_this)->CreateHeap();
}

/* 00000224-00000334       .text CreateHeap__17daObj_Bscurtain_cFv */
BOOL daObj_Bscurtain_c::CreateHeap() {
    J3DModelData* modelData;
    if ((fpcM_GetParam(this) & 0xFF) != 1 || dComIfGs_isEventBit(dSv_event_flag_c::UNK_1F08) != 0) {
        modelData = (J3DModelData*)dComIfG_getObjectRes(M_arcname, dRes_INDEX_PTC_BDL_PTCO_e);
    } else {
        modelData = (J3DModelData*)dComIfG_getObjectRes(M_arcname, dRes_INDEX_PTC_BDL_PTCU_e);
    }

    JUT_ASSERT(0xa9, modelData != NULL);
    mpModel = mDoExt_J3DModel__create(modelData, 0x0, 0x11020203);

    return mpModel != NULL;
}

/* 00000334-00000370       .text CreateInit__17daObj_Bscurtain_cFv */
cPhs_State daObj_Bscurtain_c::CreateInit() {
    set_mtx();
    fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
    return cPhs_COMPLEATE_e;
}

cPhs_State daObj_Bscurtain_c::_create() {
    fopAcM_ct(this, daObj_Bscurtain_c);

    cPhs_State ret = dComIfG_resLoad(&mPhs, M_arcname);

    if (ret == cPhs_COMPLEATE_e) {
        if (fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x10000)) {
            ret = CreateInit();
        } else {
            ret = cPhs_ERROR_e;
        }
    }

    return ret;
}

bool daObj_Bscurtain_c::_delete() {
    dComIfG_resDelete(&mPhs, M_arcname);
    return true;
}

bool daObj_Bscurtain_c::_execute() {
    set_mtx();
    return false;
}

bool daObj_Bscurtain_c::_draw() {
    dComIfGd_setListBG();
    g_env_light.settingTevStruct(TEV_TYPE_BG0, &current.pos, &tevStr);
    g_env_light.setLightTevColorType(mpModel, &tevStr);
    mDoExt_modelUpdateDL(mpModel);
    dComIfGd_setList();
    return true;
}

/* 00000370-00000400       .text daObj_BscurtainCreate__FPv */
static cPhs_State daObj_BscurtainCreate(void* i_this) {
    return ((daObj_Bscurtain_c*)i_this)->_create();
}

/* 00000400-00000430       .text daObj_BscurtainDelete__FPv */
static BOOL daObj_BscurtainDelete(void* i_this) {
    return ((daObj_Bscurtain_c*)i_this)->_delete();
}

/* 00000430-00000454       .text daObj_BscurtainExecute__FPv */
static BOOL daObj_BscurtainExecute(void* i_this) {
    return ((daObj_Bscurtain_c*)i_this)->_execute();
}

/* 00000454-000004F8       .text daObj_BscurtainDraw__FPv */
static BOOL daObj_BscurtainDraw(void* i_this) {
    return ((daObj_Bscurtain_c*)i_this)->_draw();
}

/* 000004F8-00000500       .text daObj_BscurtainIsDelete__FPv */
static BOOL daObj_BscurtainIsDelete(void* i_this) {
    return TRUE;
}

static actor_method_class daObj_BscurtainMethodTable = {
    (process_method_func)daObj_BscurtainCreate,
    (process_method_func)daObj_BscurtainDelete,
    (process_method_func)daObj_BscurtainExecute,
    (process_method_func)daObj_BscurtainIsDelete,
    (process_method_func)daObj_BscurtainDraw,
};

actor_process_profile_definition g_profile_Obj_Bscurtain = {
    /* Layer ID     */ fpcLy_CURRENT_e,
    /* List ID      */ 0x0003,
    /* List Prio    */ fpcPi_CURRENT_e,
    /* Proc Name    */ fpcNm_Obj_Bscurtain_e,
    /* Proc SubMtd  */ &g_fpcLf_Method.base,
    /* Size         */ sizeof(daObj_Bscurtain_c),
    /* Size Other   */ 0,
    /* Parameters   */ 0,
    /* Leaf SubMtd  */ &g_fopAc_Method.base,
    /* Draw Prio    */ fpcDwPi_Obj_Bscurtain_e,
    /* Actor SubMtd */ &daObj_BscurtainMethodTable,
    /* Status       */ fopAcStts_NOCULLEXEC_e | fopAcStts_UNK40000_e,
    /* Group        */ fopAc_ACTOR_e,
    /* Cull Type    */ fopAc_CULLBOX_4_e,
};