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
|
/**
* d_a_obj_bbox.cpp
* Object - Breakable Wooden Box
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_bbox.h"
#include "d/d_com_inf_game.h"
#include "f_pc/f_pc_name.h"
const static dCcD_SrcCyl l_cyl_src = {
{
{0x0, {{0x0, 0x0, 0x1f}, {0xd8000000, 0x11}, 0x78}}, // mObj
{dCcD_SE_NONE, 0x1, 0x0, 0x0, 0x0}, // mGObjAt
{dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x6}, // mGObjTg
{0x0}, // mGObjCo
}, // mObjInf
{
{
{0.0f, 0.0f, 0.0f}, // mCenter
90.0f, // mRadius
100.0f // mHeight
} // mCyl
}
};
static char* l_arcName = "M_BBox";
void daObjBBox_c::initBaseMtx() {
mpModel->setBaseScale(scale);
setBaseMtx();
}
void daObjBBox_c::setBaseMtx() {
mDoMtx_stack_c::transS(current.pos);
mDoMtx_stack_c::YrotM(shape_angle.y);
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
MTXCopy(mDoMtx_stack_c::get(), mBgMtx);
}
int daObjBBox_c::Create() {
initBaseMtx();
fopAcM_SetMtx(this, mpModel->mBaseTransformMtx);
mStts.Init(0xff, 0xff, this);
mCyl.Set(l_cyl_src);
mCyl.SetStts(&mStts);
fopAcM_setCullSizeBox2(this, mpModel->getModelData());
return 1;
}
int daObjBBox_c::CreateHeap() {
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 4);
mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
return mpModel != NULL ? 1 : 0;
}
int daObjBBox_c::create1st() {
fopAcM_ct(this, daObjBBox_c);
if (fopAcM_isSwitch(this, getSwNo())) {
return cPhs_ERROR_e;
}
int phase = dComIfG_resLoad(&mPhaseReq, l_arcName);
if (phase == cPhs_COMPLEATE_e) {
phase = MoveBGCreate(l_arcName, 7, NULL, 0xC00, NULL);
if (phase == cPhs_ERROR_e) {
return phase;
}
}
return phase;
}
int daObjBBox_c::Execute(Mtx** i_mtx) {
static const u16 particle_id[5] = {
0x83B0, 0x83B1, 0x83B2, 0x83B3, 0x83B4,
};
if (mCyl.ChkTgHit() != 0) {
cCcD_Obj* hitObj = mCyl.GetTgHitObj();
if (hitObj != NULL) {
if (hitObj->ChkAtType(0xd8000000)) {
for (int i = 0; i < 5; i++) {
dComIfGp_particle_set(particle_id[i], ¤t.pos, NULL, &scale, 0xff, NULL,
-1, NULL, NULL, NULL);
}
fopAcM_seStart(this, Z2SE_OBJ_WOODBOX_BREAK, 0);
fopAcM_onSwitch(this, getSwNo());
fopAcM_delete(this);
}
}
}
*i_mtx = &mBgMtx;
setBaseMtx();
mCyl.SetC(current.pos);
dComIfG_Ccsp()->Set(&mCyl);
return 1;
}
int daObjBBox_c::Draw() {
g_env_light.settingTevStruct(0x10, ¤t.pos, &tevStr);
g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr);
dComIfGd_setListBG();
mDoExt_modelUpdateDL(mpModel);
dComIfGd_setList();
return 1;
}
int daObjBBox_c::Delete() {
dComIfG_resDelete(&mPhaseReq, l_arcName);
return 1;
}
static int daObjBBox_create1st(daObjBBox_c* i_this) {
fopAcM_ct(i_this, daObjBBox_c);
return i_this->create1st();
}
static int daObjBBox_MoveBGDelete(daObjBBox_c* i_this) {
return i_this->MoveBGDelete();
}
static int daObjBBox_MoveBGExecute(daObjBBox_c* i_this) {
return i_this->MoveBGExecute();
}
static int daObjBBox_MoveBGDraw(daObjBBox_c* i_this) {
return i_this->MoveBGDraw();
}
static actor_method_class daObjBBox_METHODS = {
(process_method_func)daObjBBox_create1st,
(process_method_func)daObjBBox_MoveBGDelete,
(process_method_func)daObjBBox_MoveBGExecute,
(process_method_func)NULL,
(process_method_func)daObjBBox_MoveBGDraw,
};
actor_process_profile_definition g_profile_Obj_BBox = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 3,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_Obj_BBox_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(daObjBBox_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_Obj_BBox_e,
/* Actor SubMtd */ &daObjBBox_METHODS,
/* Status */ fopAcStts_UNK_0x40000_e | fopAcStts_CULL_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
};
|