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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
/**
* @file d_a_obj_brakeeff.cpp
*
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_brakeeff.h"
#include "d/d_bg_s.h"
#include "d/d_bg_w.h"
#include "d/d_cc_uty.h"
#include "d/d_com_inf_game.h"
#include "d/d_kankyo.h"
#include "d/d_s_play.h"
#include "m_Do/m_Do_ext.h"
#include "m_Do/m_Do_mtx.h"
int daObj_Brakeeff_Draw(obj_brakeeff_class* i_this) {
fopAc_ac_c* a_this = static_cast<fopAc_ac_c*>(i_this);
J3DModel* model = i_this->mpModel;
g_env_light.settingTevStruct(64, &a_this->current.pos, &i_this->tevStr);
g_env_light.setLightTevColorType_MAJI(model, &a_this->tevStr);
i_this->mpBrk->entry(model->getModelData());
mDoExt_modelUpdateDL(model);
return 1;
}
// Particle IDS
u16 e_name[5] = {0x00, 0x00, 0x00, 0x00, 0x00};
void obj_brakeeff_1(obj_brakeeff_class* i_this) {
fopAc_ac_c* a_this = static_cast<fopAc_ac_c*>(i_this);
cXyz pos;
cXyz misc_vector;
pos = a_this->current.pos;
misc_vector.set(1.0f, 1.0f, 1.0f);
if (i_this->mEffectType == 0) {
pos.y += TREG_F(5) + 75.0f;
} else if (i_this->mEffectType == 1) {
pos.y += TREG_F(6) + 50.0f;
misc_vector.set(0.56f, 0.56f, 0.56f);
}
switch (i_this->mMiscTimer3) {
case 0:
i_this->mMiscTimer3 = 1;
i_this->mMiscTimers[0] = 60;
// [[fallthrough]];
case 1:
for (int i = 0; i < 2; i++) {
i_this->mRuntimeParticleIds[i] =
dComIfGp_particle_set(i_this->mRuntimeParticleIds[i], e_name[i], &pos,
&a_this->current.angle, &misc_vector);
}
if (i_this->mMiscTimers[0] == 0) {
i_this->mDCcD_Sph.SetC(pos);
dComIfG_Ccsp()->Set(&i_this->mDCcD_Sph);
if (i_this->mDCcD_Sph.ChkTgHit()) {
i_this->mMiscTimer3 = 2;
dCcU_AtInfo atInfo;
atInfo.mpCollider = i_this->mDCcD_Sph.GetTgHitObj();
at_power_check(&atInfo);
cXyz result = a_this->current.pos - atInfo.mpActor->current.pos;
a_this->current.angle.y = cM_atan2s(result.x, result.z);
for (int i = 2; i < 5; i++) {
dComIfGp_particle_set(e_name[i], &pos, &a_this->current.angle, &misc_vector);
}
fopAcM_delete(a_this);
}
}
}
}
void action(obj_brakeeff_class* i_this) {
fopAc_ac_c* a_this = static_cast<fopAc_ac_c*>(i_this);
cXyz stack1;
cXyz stack2;
switch (i_this->mMiscTimer2) {
case 0:
obj_brakeeff_1(i_this);
break;
}
}
int daObj_Brakeeff_Execute(obj_brakeeff_class* i_this) {
fopAc_ac_c* a_this = static_cast<fopAc_ac_c*>(i_this);
i_this->mMiscTimer1++;
for (int i = 0; i < 2; i++) {
if (i_this->mMiscTimers[i] != 0) {
i_this->mMiscTimers[i]--;
}
}
action(i_this);
mDoMtx_stack_c::transS(a_this->current.pos.x, a_this->current.pos.y, a_this->current.pos.z);
mDoMtx_stack_c::YrotM((s16)a_this->shape_angle.y);
mDoMtx_stack_c::XrotM((s16)a_this->shape_angle.x);
mDoMtx_stack_c::ZrotM(a_this->shape_angle.z);
i_this->mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
MTXCopy(mDoMtx_stack_c::get(), i_this->mStoredMatrix);
i_this->mpDBgW->Move();
i_this->mpBrk->play();
return 1;
}
int daObj_Brakeeff_IsDelete(obj_brakeeff_class* i_this) {
return 1;
}
int daObj_Brakeeff_Delete(obj_brakeeff_class* i_this) {
fopAc_ac_c* a_this = static_cast<fopAc_ac_c*>(i_this);
fopAcM_RegisterDeleteID(i_this, "Obj_Brakeeff");
dComIfG_resDelete(&i_this->mRequestOfPhase, "Obj_Bef");
dComIfG_Bgsp().Release(i_this->mpDBgW);
return 1;
}
// model data per effect type
u32 bef_bmd[2] = {
5,
6,
};
// J3DAnmTevRegKey per effect type
u32 bef_brk[2] = {
9,
10,
};
int useHeapInit(fopAc_ac_c* i_this) {
obj_brakeeff_class* a_this = static_cast<obj_brakeeff_class*>(i_this);
J3DModelData* modelData =
static_cast<J3DModelData*>(dComIfG_getObjectRes("Obj_Bef", bef_bmd[a_this->mEffectType]));
JUT_ASSERT(339, modelData != NULL);
a_this->mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
if (a_this->mpModel == NULL) {
return 0;
}
a_this->mpBrk = new mDoExt_brkAnm();
if (!a_this->mpBrk) {
return 0;
}
if (!a_this->mpBrk->init(
a_this->mpModel->getModelData(),
(J3DAnmTevRegKey*)dComIfG_getObjectRes("Obj_Bef", bef_brk[a_this->mEffectType]), 1,
J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1))
{
return 0;
}
a_this->mpDBgW = new dBgW();
if (!a_this->mpDBgW) {
return 0;
}
if (a_this->mpDBgW->Set((cBgD_t*)dComIfG_getObjectRes("Obj_Bef", 13), 1,
&a_this->mStoredMatrix) == 1)
{
return 0;
}
a_this->mpDBgW->SetCrrFunc(dBgS_MoveBGProc_Typical);
return 1;
}
int daObj_Brakeeff_Create(fopAc_ac_c* a_this) {
obj_brakeeff_class* i_this = static_cast<obj_brakeeff_class*>(a_this);
fopAcM_ct(i_this, obj_brakeeff_class);
int res_load_result = dComIfG_resLoad(&i_this->mRequestOfPhase, "Obj_Bef");
if (res_load_result == cPhs_COMPLEATE_e) {
OS_REPORT("OBJ_BRAKEEFF PARAM %x\n", fopAcM_GetParam(a_this));
i_this->mEffectType = fopAcM_GetParam(a_this);
OS_REPORT("OBJ_BRAKEEFF//////////////OBJ_BRAKEEFF SET 1 !!\n");
if (!fopAcM_entrySolidHeap(a_this, useHeapInit, 0x4b000)) {
OS_REPORT("//////////////OBJ_BRAKEEFF SET NON !!\n");
return cPhs_ERROR_e;
}
OS_REPORT("//////////////OBJ_BRAKEEFF SET 2 !!\n");
if (dComIfG_Bgsp().Regist(i_this->mpDBgW, i_this)) {
return cPhs_ERROR_e;
}
static dCcD_SrcSph cc_sph_src = {
{
{0x0, {{0x0, 0x0, 0x0}, {0x20, 0x11}, 0x0}}, // mObj
{dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt
{dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg
{0x0}, // mGObjCo
}, // mObjInf
{
{{0.0f, 0.0f, 0.0f}, 40.0f} // mSph
} // mSphAttr
};
fopAcM_SetMtx(a_this, i_this->mpModel->getBaseTRMtx());
i_this->mDCcD_Stts.Init(255, 0, a_this);
i_this->mDCcD_Sph.Set(cc_sph_src);
i_this->mDCcD_Sph.SetStts(&i_this->mDCcD_Stts);
daObj_Brakeeff_Execute(i_this);
}
return res_load_result;
}
actor_method_class l_daObj_Brakeeff_Method = {
(process_method_func)daObj_Brakeeff_Create, (process_method_func)daObj_Brakeeff_Delete,
(process_method_func)daObj_Brakeeff_Execute, (process_method_func)daObj_Brakeeff_IsDelete,
(process_method_func)daObj_Brakeeff_Draw,
};
actor_process_profile_definition g_profile_OBJ_BEF = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 3,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_OBJ_BEF_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(obj_brakeeff_class),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_OBJ_BEF_e,
/* Actor SubMtd */ &l_daObj_Brakeeff_Method,
/* Status */ fopAcStts_UNK_0x40000_e | fopAcStts_CULL_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_7_e,
};
|