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
|
/**
* @file d_a_obj_treesh.cpp
*
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_treesh.h"
#include "d/d_com_inf_game.h"
static char* l_arcName = "M_TreeSh";
daTreeSh_HIO_c::daTreeSh_HIO_c() {
shake_strength = 800;
shake_speed = 500;
field_0x8 = 0;
field_0xa.z = 0;
field_0xa.y = 0;
field_0xa.x = 0;
}
static int nodeCallBack(J3DJoint* i_joint, int param_1) {
if (!param_1) {
int jnt_no = i_joint->getJntNo();
J3DModel* model_p = j3dSys.getModel();
daTreeSh_c* tree_p = (daTreeSh_c*)model_p->getUserArea();
cMtx_copy(model_p->getAnmMtx(jnt_no), mDoMtx_stack_c::get());
if (jnt_no == 1) {
mDoMtx_stack_c::YrotM(tree_p->mRot[0].y);
} else if (jnt_no == 2) {
mDoMtx_stack_c::YrotM(tree_p->mRot[1].y);
}
model_p->setAnmMtx(jnt_no, mDoMtx_stack_c::get());
mDoMtx_copy(mDoMtx_stack_c::get(), j3dSys.mCurrentMtx);
}
return 1;
}
void daTreeSh_c::initBaseMtx() {
mpModel->setBaseScale(scale);
setBaseMtx();
}
void daTreeSh_c::setBaseMtx() {
mDoMtx_stack_c::transS(current.pos);
mDoMtx_stack_c::YrotM(shape_angle.y);
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
}
int daTreeSh_c::CreateHeap() {
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 4);
JUT_ASSERT(211, modelData != NULL);
mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
if (mpModel == NULL) {
return 0;
}
return 1;
}
int daTreeSh_c::Create() {
initBaseMtx();
fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
J3DJoint* joint_p = mpModel->getModelData()->getJointNodePointer(0);
fopAcM_setCullSizeBox(this,
joint_p->getMin()->x, joint_p->getMin()->y, joint_p->getMin()->z,
joint_p->getMax()->x, joint_p->getMax()->y, joint_p->getMax()->z);
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 4);
modelData->getJointNodePointer(1)->setCallBack(nodeCallBack);
modelData->getJointNodePointer(2)->setCallBack(nodeCallBack);
mpModel->setUserArea((uintptr_t)this);
return 1;
}
static daTreeSh_HIO_c l_HIO;
int daTreeSh_c::create1st() {
int phase_state = dComIfG_resLoad(&mPhase, l_arcName);
if (phase_state == cPhs_COMPLEATE_e) {
if (MoveBGCreate(l_arcName, 7, NULL, 0x4000, NULL) == cPhs_ERROR_e) {
return cPhs_ERROR_e;
}
#if DEBUG
l_HIO.entryHIO("針葉樹");
#endif
}
return phase_state;
}
int daTreeSh_c::Execute(Mtx** param_0) {
for (int i = 0; i < 2; i++) {
if (mShakeTimer[i] == 0) {
mShakeTimer[i] = cM_rndF(30.0f) + 15.0f;
field_0x5b8[i] = cM_rndFX(0.3f) + 1.0f;
field_0x5c4[i] = field_0x5b8[i] * (l_HIO.shake_speed * (dKyw_get_wind_pow() + 0.2f));
} else {
mShakeTimer[i]--;
}
field_0x5c0[i] += field_0x5c4[i];
}
mRot[0].y = l_HIO.shake_strength * cM_ssin(field_0x5c0[0]);
mRot[1].y = l_HIO.shake_strength * cM_scos(field_0x5c0[1]);
*param_0 = &mpModel->getBaseTRMtx();
return 1;
}
int daTreeSh_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 daTreeSh_c::Delete() {
dComIfG_resDelete(&mPhase, l_arcName);
#if DEBUG
l_HIO.removeHIO();
#endif
return 1;
}
static int daTreeSh_create1st(daTreeSh_c* i_this) {
fopAcM_ct(i_this, daTreeSh_c);
return i_this->create1st();
}
static int daTreeSh_MoveBGDelete(daTreeSh_c* i_this) {
return i_this->MoveBGDelete();
}
static int daTreeSh_MoveBGExecute(daTreeSh_c* i_this) {
return i_this->MoveBGExecute();
}
static int daTreeSh_MoveBGDraw(daTreeSh_c* i_this) {
return i_this->MoveBGDraw();
}
static actor_method_class daTreeSh_METHODS = {
(process_method_func)daTreeSh_create1st,
(process_method_func)daTreeSh_MoveBGDelete,
(process_method_func)daTreeSh_MoveBGExecute,
(process_method_func)NULL,
(process_method_func)daTreeSh_MoveBGDraw,
};
actor_process_profile_definition g_profile_TREESH = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 3,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_TREESH_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(daTreeSh_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_TREESH_e,
/* Actor SubMtd */ &daTreeSh_METHODS,
/* Status */ fopAcStts_UNK_0x40000_e | fopAcStts_CULL_e | fopAcStts_NOEXEC_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
};
|