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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
/**
* d_a_bita.cpp
* Object - Wooden platforms (Gohma fight)
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_bita.h"
#include "res/Object/Bita.h"
#include "f_op/f_op_actor_mng.h"
#include "f_op/f_op_camera.h"
#include "d/d_bg_s_movebg_actor.h"
#include "d/d_com_inf_game.h"
#include "d/d_kankyo.h"
#include "d/actor/d_a_btd.h"
#include "m_Do/m_Do_ext.h"
#include "m_Do/m_Do_mtx.h"
static btd_class* btd = NULL;
static u32 ita_bmd[] = { dRes_INDEX_BITA_BDL_MBIT1_e, dRes_INDEX_BITA_BDL_MBIT2_e };
static u32 ita_dzb[] = { dRes_INDEX_BITA_DZB_MBIT1_e, dRes_INDEX_BITA_DZB_MBIT2_e };
static u32 ita_Ef_bmd[] = { dRes_INDEX_BITA_BDL_EF_BTDITA0_e, dRes_INDEX_BITA_BDL_EF_BTDITA1_e };
static u32 ita_Ef[] = { dRes_INDEX_BITA_BRK_EF_BTDITA0_e, dRes_INDEX_BITA_BRK_EF_BTDITA1_e };
/* 00000078-000000C4 .text b_a_sub__FPvPv */
static void* b_a_sub(void* search, void* user) {
UNUSED(user);
if (fopAc_IsActor(search) && fopAcM_GetName(search) == fpcNm_BTD_e)
return search;
return NULL;
}
/* 000000C4-0000018C .text daBita_Draw__FP10bita_class */
static BOOL daBita_Draw(bita_class* i_this) {
dKy_getEnvlight().settingTevStruct(TEV_TYPE_BG0, &i_this->current.pos, &i_this->tevStr);
if (i_this->mMode == bita_class::MODE_DEAD && i_this->mSub == 1) {
dKy_getEnvlight().setLightTevColorType(i_this->mpModelEf, &i_this->tevStr);
i_this->mpBrkAnm->entry(i_this->mpModelEf->getModelData());
mDoExt_modelUpdateDL(i_this->mpModelEf);
i_this->mpBrkAnm->remove(i_this->mpModelEf->getModelData());
} else {
dKy_getEnvlight().setLightTevColorType(i_this->mpModel, &i_this->tevStr);
mDoExt_modelUpdateDL(i_this->mpModel);
}
return TRUE;
}
/* 0000018C-000002D0 .text mode_normal__FP10bita_class */
static void mode_normal(bita_class* i_this) {
if (btd != NULL) {
if (btd->m6E16 >= 100) {
cXyz delta = dComIfGp_getCamera(0)->mLookat.mEye - i_this->current.pos;
if (delta.abs() < 1500.0f) {
fopAcM_delete(i_this);
}
} else {
if (i_this->mCyl.ChkTgHit() && i_this->mCyl.GetTgHitObj()->GetAtType() == AT_TYPE_FIRE) {
i_this->mMode = bita_class::MODE_DEAD;
i_this->mSub = 0;
}
}
}
}
/* 000002D0-000004B4 .text mode_dead__FP10bita_class */
static void mode_dead(bita_class* i_this) {
switch (i_this->mSub) {
case 0:
i_this->mTimer = 0;
i_this->field_0x2a7 = cM_rndF(4.0f);
i_this->mSub = 1;
break;
case 1:
i_this->mTimer++;
if (i_this->mTimer == 20) {
fopAcM_seStartCurrent(i_this, JA_SE_OBJ_BTD_BOARD_BURN, 0);
}
if (i_this->mTimer == 88) {
fopAcM_seStartCurrent(i_this, JA_SE_OBJ_BTD_BOARD_BRK, 0);
s32 type = i_this->mType;
if (type > 1)
type = 1;
if (type == 0) {
dComIfGp_particle_set(dPa_name::ID_AK_SN_BTDBURNEDBOARD00, &i_this->current.pos, &i_this->shape_angle);
} else {
dComIfGp_particle_set(dPa_name::ID_AK_SN_BTDBURNEDBOARD01, &i_this->current.pos, &i_this->shape_angle);
}
}
if (i_this->mTimer >= 90)
fopAcM_delete(i_this);
break;
}
}
/* 000004B4-00000584 .text base_mtx_set__FP10bita_class */
static void base_mtx_set(bita_class* i_this) {
MtxTrans(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z, false);
cMtx_YrotM(*calc_mtx, i_this->shape_angle.y);
cMtx_XrotM(*calc_mtx, i_this->shape_angle.x);
if (i_this->mMode == bita_class::MODE_DEAD && i_this->mSub >= 1) {
i_this->mpModelEf->setBaseTRMtx(*calc_mtx);
if (i_this->mTimer < 60)
i_this->mpBrkAnm->play();
fopAcM_SetMtx(i_this, i_this->mpModelEf->getBaseTRMtx());
} else {
i_this->mpModel->setBaseTRMtx(*calc_mtx);
}
}
/* 00000584-00000714 .text daBita_Execute__FP10bita_class */
static BOOL daBita_Execute(bita_class* i_this) {
if (btd == NULL)
btd = (btd_class*)fpcM_Search(b_a_sub, i_this);
if (dComIfGs_getLife() == 0)
fopAcM_OffStatus(i_this, fopAcStts_UNK4000_e);
switch (i_this->mMode) {
case bita_class::MODE_NORMAL:
mode_normal(i_this);
break;
case bita_class::MODE_DEAD:
mode_dead(i_this);
break;
}
base_mtx_set(i_this);
cMtx_copy(*calc_mtx, i_this->mMtx);
i_this->mpBgW->Move();
if (btd != NULL && i_this->mMode == bita_class::MODE_NORMAL) {
cMtx_YrotS(*calc_mtx, i_this->shape_angle.y);
cMtx_XrotM(*calc_mtx, i_this->shape_angle.x);
cXyz offs(0.0f, -80.0f, 160.0f);
cXyz pos;
MtxPosition(&offs, &pos);
VECAdd(&pos, &i_this->current.pos, &pos);
i_this->mCyl.SetC(pos);
i_this->mCyl.SetH(60.0f);
i_this->mCyl.SetR(i_this->scale.x * 400.0f);
dComIfG_Ccsp()->Set(&i_this->mCyl);
}
return TRUE;
}
/* 00000714-0000071C .text daBita_IsDelete__FP10bita_class */
static BOOL daBita_IsDelete(bita_class* i_this) {
return TRUE;
}
/* 0000071C-00000778 .text daBita_Delete__FP10bita_class */
static BOOL daBita_Delete(bita_class* i_this) {
dComIfG_resDelete(&i_this->mPhs, "Bita");
if (i_this->heap != NULL)
dComIfG_Bgsp()->Release(i_this->mpBgW);
return TRUE;
}
/* 00000778-00000A18 .text useHeapInit__FP10fopAc_ac_c */
static BOOL useHeapInit(fopAc_ac_c* i_ac) {
bita_class* i_this = (bita_class*)i_ac;
s32 type = i_this->mType;
if (type > 1)
type = 1;
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Bita", ita_bmd[type]);
JUT_ASSERT(0x23b, modelData != NULL);
J3DModel* model = mDoExt_J3DModel__create(modelData, 0, 0x11020203);
if (model == NULL)
return FALSE;
i_this->mpModel = model;
modelData = (J3DModelData*)dComIfG_getObjectRes("Bita", ita_Ef_bmd[type]);
JUT_ASSERT(0x247, modelData != NULL);
model = mDoExt_J3DModel__create(modelData, 0, 0x11020203);
if (model == NULL)
return FALSE;
i_this->mpModelEf = model;
i_this->mpBrkAnm = new mDoExt_brkAnm();
if (i_this->mpBrkAnm == NULL)
return FALSE;
J3DAnmTevRegKey* brk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bita", ita_Ef[type]);
if (!i_this->mpBrkAnm->init(i_this->mpModelEf->getModelData(), brk, TRUE, J3DFrameCtrl::EMode_NONE))
return FALSE;
i_this->mpBgW = new dBgW();
if (i_this->mpBgW == NULL)
return FALSE;
cBgD_t* dzb = (cBgD_t*)dComIfG_getObjectRes("Bita", ita_dzb[type]);
if (i_this->mpBgW->Set(dzb, dBgW::MOVE_BG_e, &i_this->mMtx) == true)
return FALSE;
i_this->mpBgW->SetCrrFunc(dBgS_MoveBGProc_Typical);
return TRUE;
}
/* 00000A60-00000D24 .text daBita_Create__FP10fopAc_ac_c */
static cPhs_State daBita_Create(fopAc_ac_c* i_ac) {
static dCcD_SrcCyl body_cyl_src = {
// dCcD_SrcGObjInf
{
/* Flags */ 0,
/* SrcObjAt Type */ 0,
/* SrcObjAt Atp */ 0,
/* SrcObjAt SPrm */ 0,
/* SrcObjTg Type */ AT_TYPE_FIRE,
/* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsOther_e,
/* SrcObjCo SPrm */ 0,
/* SrcGObjAt Se */ dCcG_SE_UNK6,
/* SrcGObjAt HitMark */ 0,
/* SrcGObjAt Spl */ dCcG_At_Spl_UNK1,
/* SrcGObjAt Mtrl */ 0,
/* SrcGObjAt SPrm */ 0,
/* SrcGObjTg Se */ 0,
/* SrcGObjTg HitMark */ 0,
/* SrcGObjTg Spl */ 0,
/* SrcGObjTg Mtrl */ 0,
/* SrcGObjTg SPrm */ 0,
/* SrcGObjCo SPrm */ 0,
},
// cM3dGCylS
{{
/* Center */ {0.0f, 0.0f, 0.0f},
/* Radius */ 50.0f,
/* Height */ 20.0f,
}},
};
fopAcM_ct(i_ac, bita_class);
bita_class* i_this = (bita_class*)i_ac;
cPhs_State rt = dComIfG_resLoad(&i_this->mPhs, "Bita");
if (rt == cPhs_COMPLEATE_e) {
btd = NULL;
i_this->mType = (fopAcM_GetParam(i_this) >> 0) & 0xFF;
i_this->mPrmScale = (fopAcM_GetParam(i_this) >> 8) & 0xFF;
if (i_this->mType == 0xFF)
i_this->mType = 0;
if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x30c0))
return cPhs_ERROR_e;
if (dComIfG_Bgsp()->Regist(i_this->mpBgW, i_this))
return cPhs_ERROR_e;
switch (i_this->mPrmScale) {
case 1: i_this->scale.setall(1.5f); break;
case 2: i_this->scale.setall(2.0f); break;
case 3: i_this->scale.setall(3.0f); break;
default: i_this->scale.y = i_this->scale.z = i_this->scale.x = 1.0f; break;
}
fopAcM_SetMtx(i_this, i_this->mpModel->getBaseTRMtx());
fopAcM_SetMin(i_this, i_this->scale.x * -1000.0f, -500.0f, i_this->scale.z * -1000.0f);
fopAcM_SetMax(i_this, i_this->scale.x * 1000.0f, 500.0f, i_this->scale.z * 1000.0f);
i_this->mpModel->setBaseScale(i_this->scale);
i_this->mpModelEf->setBaseScale(i_this->scale);
i_this->shape_angle = i_this->current.angle;
base_mtx_set(i_this);
i_this->mpBgW->Move();
i_this->mCyl.Set(body_cyl_src);
i_this->mCyl.SetStts(&i_this->mStts);
}
return rt;
}
static actor_method_class l_daBita_Method = {
(process_method_func)daBita_Create,
(process_method_func)daBita_Delete,
(process_method_func)daBita_Execute,
(process_method_func)daBita_IsDelete,
(process_method_func)daBita_Draw,
};
actor_process_profile_definition g_profile_BITA = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 0x0003,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_BITA_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(bita_class),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_BITA_e,
/* Actor SubMtd */ &l_daBita_Method,
/* Status */ fopAcStts_CULL_e | fopAcStts_UNK4000_e | fopAcStts_UNK40000_e,
/* Group */ fopAc_ENV_e,
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
};
|