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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
|
//
// Generated by dtk
// Translation Unit: d_a_ssk.cpp
//
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_ssk.h"
#include "res/Object/Ssk.h"
#include "d/d_com_inf_game.h"
#include "d/d_jnt_hit.h"
#include "f_op/f_op_actor_mng.h"
#include "m_Do/m_Do_ext.h"
/* 00000078-00000194 .text nodeCallBack__FP7J3DNodei */
static BOOL nodeCallBack(J3DNode* node, int calcTiming) {
if (calcTiming == J3DNodeCBCalcTiming_In) {
J3DJoint* joint = (J3DJoint*)node;
s32 jntNo = joint->getJntNo();
J3DModel* model = j3dSys.getModel();
ssk_class* i_this = (ssk_class*)model->getUserArea();
if (i_this != NULL && jntNo < 5) {
MTXCopy(model->getAnmMtx(jntNo), *calc_mtx);
cMtx_YrotM(*calc_mtx, i_this->m2F4[jntNo].y);
cMtx_XrotM(*calc_mtx, i_this->m2F4[jntNo].x);
cMtx_ZrotM(*calc_mtx, i_this->m2F4[jntNo].z);
cXyz offset;
offset.setall(0.0f);
MtxPosition(&offset, &i_this->m314[jntNo]);
model->setAnmMtx(jntNo, *calc_mtx);
MTXCopy(*calc_mtx, J3DSys::mCurrentMtx);
}
}
return TRUE;
}
/* 000001D0-0000033C .text draw_sub__FP9ssk_class */
void draw_sub(ssk_class* i_this) {
J3DModel* pJVar4 = i_this->mpMorf1->getModel();
J3DModel* pJVar3 = i_this->mpMorf2->getModel();
for (u16 i = 0; i < i_this->mpMorf1->getModel()->getModelData()->getJointNum(); i++) {
i_this->mpMorf1->getModel()->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack);
}
pJVar4->setBaseScale(i_this->actor.scale);
mDoMtx_stack_c::transS(i_this->actor.current.pos.x, i_this->actor.current.pos.y, i_this->actor.current.pos.z);
mDoMtx_stack_c::YrotM(i_this->actor.current.angle.y);
mDoMtx_stack_c::XrotM(i_this->actor.current.angle.x);
mDoMtx_stack_c::ZrotM(i_this->actor.current.angle.z);
pJVar4->setBaseTRMtx(mDoMtx_stack_c::get());
pJVar3->setBaseScale(i_this->m350);
mDoMtx_stack_c::transS(i_this->actor.current.pos.x, i_this->actor.current.pos.y, i_this->actor.current.pos.z);
mDoMtx_stack_c::YrotM(i_this->actor.current.angle.y);
mDoMtx_stack_c::XrotM(i_this->actor.current.angle.x);
mDoMtx_stack_c::ZrotM(i_this->actor.current.angle.z);
pJVar3->setBaseTRMtx(mDoMtx_stack_c::get());
i_this->mpMorf1->calc();
}
/* 0000033C-000003E8 .text daSsk_Draw__FP9ssk_class */
static BOOL daSsk_Draw(ssk_class* i_this) {
J3DModel* pJVar2 = i_this->mpMorf1->getModel();
J3DModel* pJVar1 = i_this->mpMorf2->getModel();
#if VERSION == VERSION_DEMO
g_env_light.settingTevStruct(TEV_TYPE_BG0_PLIGHT, &i_this->actor.current.pos, &i_this->actor.tevStr);
#else
g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->actor.current.pos, &i_this->actor.tevStr);
#endif
g_env_light.setLightTevColorType(pJVar2, &i_this->actor.tevStr);
i_this->mpMorf1->entryDL();
g_env_light.settingTevStruct(TEV_TYPE_BG0, &i_this->actor.current.pos, &i_this->actor.tevStr);
g_env_light.setLightTevColorType(pJVar1, &i_this->actor.tevStr);
i_this->mpMorf2->updateDL();
return TRUE;
}
/* 000003E8-00000940 .text nomal_move__FP9ssk_class */
void nomal_move(ssk_class* i_this) {
switch (i_this->m2BA) {
case 0:
if (fopAcM_searchPlayerDistance(&i_this->actor) < i_this->m2C0) {
i_this->mCyl.OnAtSPrmBit(cCcD_TgSPrm_Set_e);
i_this->mCyl.OnAtHitBit();
i_this->m2BA = 1;
}
break;
case 1:
cLib_addCalc2(&i_this->m350.x, 1.0f, 0.5f, 0.3f);
i_this->m350.z = i_this->m350.y = i_this->m350.x;
if (i_this->m350.x > 0.9f) {
i_this->m350.setall(1.0f);
i_this->actor.scale.set(1.0f, 0.0f, 1.0f);
fopAcM_seStart(&i_this->actor, JA_SE_OBJ_JAMA_SHOKU_OUT, 0);
i_this->m2BA = 2;
dComIfGp_particle_set(
dPa_name::ID_IT_SN_TGSYOKU_ROCK00, &i_this->actor.current.pos, NULL, NULL, 0xff, NULL, -1, &i_this->actor.tevStr.mColorK0, &i_this->actor.tevStr.mColorK0
);
dComIfGp_particle_setToon(
dPa_name::ID_IT_ST_TGSYOKU_SMOKE00, &i_this->actor.current.pos, &i_this->actor.shape_angle, NULL, 0xb9, &i_this->m2D0, fopAcM_GetRoomNo(&i_this->actor)
);
}
break;
case 2:
cLib_addCalc2(&i_this->actor.scale.y, 1.0f, 0.5f, 0.3f);
if (i_this->actor.scale.y > 0.9f) {
i_this->actor.scale.y = 1.0f;
if (i_this->m2F2 == 0) {
i_this->m2F2 = 1;
if (fopAcM_GetID(&i_this->actor) & 1) {
i_this->m2F2 = 2;
}
if (cM_rnd() < 0.5f) {
i_this->m2F2 *= -1;
}
}
i_this->m2BA = 10;
}
break;
case 3:
cLib_addCalc0(&i_this->actor.scale.y, 0.5f, 0.3f);
i_this->actor.scale.x = i_this->actor.scale.z = i_this->actor.scale.y;
if (i_this->actor.scale.y < 0.1f) {
i_this->actor.scale.setall(0.0f);
cLib_addCalc0(&i_this->m350.x, 0.2f, 0.5f);
i_this->m350.z = i_this->m350.y = i_this->m350.x;
if (i_this->m350.x < 0.1f) {
i_this->m350.setall(0.0f);
i_this->m2BA = 0;
if (i_this->m2B6 != 0xff && dComIfGs_isSwitch(i_this->m2B6, dComIfGp_roomControl_getStayNo())) {
fopAcM_delete(&i_this->actor);
}
}
}
break;
case 10:
if (i_this->m2B4 == 1 && fopAcM_searchPlayerDistance(&i_this->actor) > i_this->m2C4) {
i_this->mCyl.OffAtSetBit();
i_this->m2BA = 3;
}
if ((i_this->m2B6 != 0xff) && dComIfGs_isSwitch(i_this->m2B6, dComIfGp_roomControl_getStayNo())) {
i_this->mCyl.OffAtSetBit();
i_this->m2BA = 3;
fopAcM_seStart(&i_this->actor, JA_SE_OBJ_JAMA_SHOKU_IN, 0);
}
break;
}
if ((i_this->m2BA == 3) || (i_this->m2BA == 10)) {
i_this->m2F0 += i_this->m2F2;
for (s32 i = 1; i < 5; i++) {
i_this->m2F4[i].x = cM_ssin(i_this->m2F0 * 2000 + (i * 20000)) * 2000.0f;
i_this->m2F4[i].y = cM_ssin(i_this->m2F0 * 1300 + (i * 12000)) * 2000.0f;
i_this->m2F4[i].z = cM_ssin(i_this->m2F0 * 1000 + (i * 15000)) * 4000.0f;
}
s16 angle = cLib_distanceAngleS(i_this->m2F4[1].z, 0x1000);
if (angle < 0x1000) {
if (!i_this->m2B7) {
fopAcM_seStart(&i_this->actor, JA_SE_OBJ_SHOKU_LIFT_MOVE, 0);
i_this->m2B7 = true;
}
} else {
i_this->m2B7 = false;
}
}
}
#if VERSION > VERSION_DEMO
/* 00000940-00000BD8 .text body_atari_check__FP9ssk_class */
void body_atari_check(ssk_class* i_this) {
if (i_this->m2BC > 0) {
i_this->m2BC--;
return;
}
if (!i_this->mCyl.ChkTgHit()) {
return;
}
cCcD_Obj* hitObj = i_this->mCyl.GetTgHitObj();
if (hitObj == NULL) {
return;
}
i_this->m2BC = 8;
switch (hitObj->GetAtType()) {
case AT_TYPE_MACHETE:
case AT_TYPE_SWORD:
case AT_TYPE_UNK800:
case AT_TYPE_DARKNUT_SWORD:
case AT_TYPE_MOBLIN_SPEAR:
case AT_TYPE_PGANON_SWORD:
fopAcM_seStart(&i_this->actor, JA_SE_LK_SW_HIT_S, 0x44);
break;
case AT_TYPE_BOOMERANG:
case AT_TYPE_BOKO_STICK:
case AT_TYPE_UNK2000:
case AT_TYPE_STALFOS_MACE:
fopAcM_seStart(&i_this->actor, JA_SE_LK_W_WEP_HIT, 0x44);
break;
case AT_TYPE_SKULL_HAMMER:
fopAcM_seStart(&i_this->actor, JA_SE_LK_HAMMER_HIT, 0x44);
break;
case AT_TYPE_FIRE_ARROW:
case AT_TYPE_NORMAL_ARROW:
case AT_TYPE_LIGHT_ARROW:
case AT_TYPE_ICE_ARROW:
case AT_TYPE_GRAPPLING_HOOK:
fopAcM_seStart(&i_this->actor, JA_SE_LK_MS_WEP_HIT, 0x44);
break;
case AT_TYPE_BOMB:
case AT_TYPE_WIND:
break;
}
}
#endif
/* 00000BD8-00000C80 .text daSsk_Execute__FP9ssk_class */
static BOOL daSsk_Execute(ssk_class* i_this) {
switch (i_this->m2B8) {
case 0:
nomal_move(i_this);
break;
}
i_this->mCyl.SetC(i_this->actor.current.pos);
i_this->mCyl.SetH(300.0f);
i_this->mCyl.SetR(80.0f);
dComIfG_Ccsp()->Set(&i_this->mCyl);
#if VERSION > VERSION_DEMO
body_atari_check(i_this);
#endif
i_this->m2C4 = i_this->m2C0 + 100.0f;
draw_sub(i_this);
return TRUE;
}
/* 00000C80-00000C88 .text daSsk_IsDelete__FP9ssk_class */
static BOOL daSsk_IsDelete(ssk_class*) {
return TRUE;
}
/* 00000C88-00000CD8 .text daSsk_Delete__FP9ssk_class */
static BOOL daSsk_Delete(ssk_class* i_this) {
dComIfG_resDeleteDemo(&i_this->mPhase, "Ssk");
i_this->m2D0.remove();
return TRUE;
}
/* 00000CD8-00000EB8 .text useHeapInit__FP10fopAc_ac_c */
static BOOL useHeapInit(fopAc_ac_c* a_this) {
ssk_class* i_this = (ssk_class*)a_this;
i_this->mpMorf1 = new mDoExt_McaMorf(
(J3DModelData*)dComIfG_getObjectRes("Ssk", dRes_INDEX_SSK_BDL_TURU_02_e), NULL, NULL, NULL, ~J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000022
);
if (i_this->mpMorf1 == NULL || i_this->mpMorf1->getModel() == NULL) {
return FALSE;
}
i_this->mpMorf2 = new mDoExt_McaMorf(
(J3DModelData*)dComIfG_getObjectRes("Ssk", dRes_INDEX_SSK_BDL_KTANA_00_e),
NULL, NULL, NULL,
DEMO_SELECT(J3DFrameCtrl::EMode_LOOP, J3DFrameCtrl::EMode_NULL),
1.0f, 0, -1,
DEMO_SELECT(0, 1),
NULL,
DEMO_SELECT(0x0, 0x80000),
DEMO_SELECT(0x11020203, 0x11000022)
);
if (i_this->mpMorf2 == NULL || i_this->mpMorf2->getModel() == NULL) {
return FALSE;
}
i_this->mpMorf1->getModel()->setUserArea((u32)i_this);
#if VERSION > VERSION_DEMO
static Vec sph_offset = {0.0f, 0.0f, 0.0f};
static __jnt_hit_data_c search_data[] = {
{
/* mShapeType */ JntHitType_SPH_DELETE_e,
/* mJointIndex */ TURU_02_JNT_B3_e,
/* mRadius */ 50.0f,
/* mpOffsets */ &sph_offset,
},
{
/* mShapeType */ JntHitType_SPH_DELETE_e,
/* mJointIndex */ TURU_02_JNT_B2_e,
/* mRadius */ 30.0f,
/* mpOffsets */ &sph_offset,
},
{
/* mShapeType */ JntHitType_SPH_DELETE_e,
/* mJointIndex */ TURU_02_JNT_B1_e,
/* mRadius */ 20.0f,
/* mpOffsets */ &sph_offset,
},
};
i_this->m708 = JntHit_create(i_this->mpMorf1->getModel(), search_data, ARRAY_SIZE(search_data));
if (i_this->m708 != NULL) {
i_this->actor.jntHit = i_this->m708;
} else {
return FALSE;
}
#endif
return TRUE;
}
/* 00000EB8-00001244 .text daSsk_Create__FP10fopAc_ac_c */
static cPhs_State daSsk_Create(fopAc_ac_c* a_this) {
/* Nonmatching */
static dCcD_SrcCyl body_co_cyl = {
// dCcD_SrcGObjInf
{
/* Flags */ 0,
/* SrcObjAt Type */ AT_TYPE_UNK2000,
/* SrcObjAt Atp */ 1,
/* SrcObjAt SPrm */ cCcD_AtSPrm_Set_e | cCcD_AtSPrm_VsPlayer_e,
/* SrcObjTg Type */ AT_TYPE_ALL & ~AT_TYPE_BOOMERANG & ~AT_TYPE_WATER & ~AT_TYPE_UNK20000 & ~AT_TYPE_WIND & ~AT_TYPE_UNK400000 & ~AT_TYPE_LIGHT,
/* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsEnemy_e,
/* SrcObjCo SPrm */ cCcD_CoSPrm_Set_e | cCcD_CoSPrm_IsPlayer_e | cCcD_CoSPrm_VsEnemy_e,
/* SrcGObjAt Se */ dCcG_SE_WOOD,
/* SrcGObjAt HitMark */ dCcG_AtHitMark_None_e,
/* SrcGObjAt Spl */ dCcG_At_Spl_UNK1,
/* SrcGObjAt Mtrl */ 0,
/* SrcGObjAt SPrm */ 0,
/* SrcGObjTg Se */ 0,
/* SrcGObjTg HitMark */ 0,
/* SrcGObjTg Spl */ dCcG_Tg_Spl_UNK0,
/* SrcGObjTg Mtrl */ 0,
/* SrcGObjTg SPrm */ 0,
/* SrcGObjCo SPrm */ 0,
},
// cM3dGCylS
{{
/* Center */ {0.0f, 0.0f, 0.0f},
/* Radius */ 15.0f,
/* Height */ 0.0f,
}},
};
ssk_class* i_this = (ssk_class*)a_this;
fopAcM_ct_Retail(a_this, ssk_class);
cPhs_State PVar2 = dComIfG_resLoad(&i_this->mPhase, "Ssk");
if (PVar2 == cPhs_COMPLEATE_e) {
fopAcM_ct_Demo(a_this, ssk_class);
i_this->m2D0.setRateOff(0);
i_this->m2B4 = fopAcM_GetParam(a_this);
i_this->m2B5 = fopAcM_GetParam(a_this) >> 8;
i_this->m2B6 = fopAcM_GetParam(a_this) >> 0x18;
if (i_this->m2B5 == 0xff) {
i_this->m2B5 = 0;
}
if (i_this->m2B6 != 0xff && dComIfGs_isSwitch(i_this->m2B6, dComIfGp_roomControl_getStayNo())) {
return cPhs_ERROR_e;
}
i_this->m2C0 = i_this->m2B5 * 10.0f;
if (!i_this->m2C0) {
i_this->m2C0 = 400.0f;
}
u32 heapSize = DEMO_SELECT(0x13C0, 0x1300);
if (!fopAcM_entrySolidHeap(a_this, useHeapInit, heapSize)) {
return cPhs_ERROR_e;
}
fopAcM_SetMtx(a_this, i_this->mpMorf2->getModel()->getBaseTRMtx());
fopAcM_SetMin(a_this, -800.0f, -200.0f, -400.0f);
fopAcM_SetMax(a_this, 500.0f, 1000.0f, 1000.0f);
a_this->attention_info.flags = 0;
i_this->mCyl.Set(body_co_cyl);
i_this->mCyl.SetStts(&i_this->mStts);
i_this->mStts.Init(0xfe, 200, a_this);
i_this->m2B8 = 0;
if (i_this->m2B4 == 0xff) {
i_this->mCyl.OnAtSPrmBit(cCcD_TgSPrm_Set_e);
i_this->mCyl.OnAtHitBit();
a_this->scale.setall(1.0f);
i_this->m350.setall(1.0f);
i_this->m2F2 = 1;
if (fopAcM_GetID(a_this) & 1) {
i_this->m2F2 = 2;
}
if (cM_rnd() < 0.5f) {
i_this->m2F2 *= -1;
}
i_this->m2BA = 10;
} else {
i_this->mCyl.ClrAtSet();
i_this->m350.setall(0.0f);
a_this->scale.setall(0.0f);
}
draw_sub(i_this);
}
return PVar2;
}
static actor_method_class l_daSsk_Method = {
(process_method_func)daSsk_Create,
(process_method_func)daSsk_Delete,
(process_method_func)daSsk_Execute,
(process_method_func)daSsk_IsDelete,
(process_method_func)daSsk_Draw,
};
actor_process_profile_definition g_profile_SSK = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 0x0003,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_SSK_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(ssk_class),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_SSK_e,
/* Actor SubMtd */ &l_daSsk_Method,
/* Status */ fopAcStts_UNK40000_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
};
|