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
|
/**
* d_a_obj_mshokki.cpp
* Object - Dishes and cutlery inside Forsaken Fortress
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_mshokki.h"
#include "res/Object/Mshokki.h"
#include "d/d_kankyo.h"
#include "d/d_com_inf_game.h"
#include "f_op/f_op_actor_mng.h"
#include "m_Do/m_Do_hostIO.h"
#if VERSION == VERSION_DEMO
class daObjMshokki_HIO_c : public JORReflexible {
public:
daObjMshokki_HIO_c();
virtual ~daObjMshokki_HIO_c() {}
void genMessage(JORMContext* ctx) {}
public:
/* 0x04 */ s8 mNo;
/* 0x08 */ f32 m08;
/* 0x0C */ f32 m0C;
/* 0x10 */ f32 m10;
/* 0x14 */ f32 m14;
/* 0x18 */ f32 m18;
/* 0x1C */ f32 m1C;
/* 0x20 */ f32 m20;
/* 0x24 */ f32 m24;
/* 0x28 */ f32 m28;
/* 0x2C */ f32 m2C;
/* 0x30 */ f32 m30;
/* 0x34 */ f32 m34;
/* 0x38 */ f32 m38;
/* 0x3C */ f32 m3C;
/* 0x40 */ s8 m40;
}; // size = 0x44
static daObjMshokki_HIO_c l_HIO;
#else
namespace L_HIO {
static const f32 m08 = 20.0f;
static const f32 m0C = 20.0f;
static const f32 m10 = 128.0f;
static const f32 m14 = 3072.0f;
static const f32 m18 = 4096.0f;
static const f32 m1C = 6.0f;
static const f32 m20 = 11.0f;
static const f32 m24 = 4096.0f;
static const f32 m28 = 1.0f;
static const f32 m2C = 24.0f;
static const f32 m30 = 0.0f;
static const f32 m34 = 0.5f;
static const f32 m38 = 0.8f;
static const f32 m3C = 0.1f;
} // namespace L_HIO
#endif
namespace {
static const char l_arcname[] = "Mshokki";
static const dCcD_SrcCyl l_cyl_src = {
// dCcD_SrcGObjInf
{
/* Flags */ 0,
/* SrcObjAt Type */ 0,
/* SrcObjAt Atp */ 0,
/* SrcObjAt SPrm */ 0,
/* SrcObjTg Type */ AT_TYPE_ALL & ~AT_TYPE_WATER & ~AT_TYPE_UNK20000 & ~AT_TYPE_UNK400000 & ~AT_TYPE_LIGHT,
/* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsOther_e,
/* SrcObjCo SPrm */ cCcD_CoSPrm_Set_e | cCcD_CoSPrm_IsOther_e | cCcD_CoSPrm_VsEnemy_e | cCcD_CoSPrm_VsPlayer_e | cCcD_CoSPrm_VsOther_e,
/* SrcGObjAt Se */ 0,
/* SrcGObjAt HitMark */ dCcG_AtHitMark_None_e,
/* SrcGObjAt Spl */ dCcG_At_Spl_UNK0,
/* SrcGObjAt Mtrl */ 0,
/* SrcGObjAt SPrm */ 0,
/* SrcGObjTg Se */ 0,
/* SrcGObjTg HitMark */ 0,
/* SrcGObjTg Spl */ dCcG_Tg_Spl_UNK0,
/* SrcGObjTg Mtrl */ 0,
/* SrcGObjTg SPrm */ dCcG_TgSPrm_NoConHit_e | dCcG_TgSPrm_NoHitMark_e,
/* SrcGObjCo SPrm */ 0,
},
// cM3dGCylS
{{
/* Center */ {0.0f, 0.0f, 0.0f},
/* Radius */ 35.0f,
/* Height */ 50.0f,
}},
};
struct LData {
/* 0x00 */ f32 m00;
/* 0x04 */ f32 radius;
/* 0x08 */ f32 height;
/* 0x0C */ f32 m0C;
}; // size = 0x10
static const LData l_data[] = {
{20.0f, 15.0f, 40.0f, 6144.0f},
{7.5f, 30.0f, 15.0f, 2048.0f},
{15.0f, 15.0f, 30.0f, 8192.0f},
};
} // namespace
#if VERSION == VERSION_DEMO
daObjMshokki_HIO_c::daObjMshokki_HIO_c() {
mNo = -1;
m08 = 20.0f;
m0C = 20.0f;
m10 = 128.0f;
m14 = 3072.0f;
m18 = 4096.0f;
m1C = 6.0f;
m20 = 11.0f;
m24 = 4096.0f;
m28 = 1.0f;
m2C = 24.0f;
m30 = 0.0f;
m34 = 0.5f;
m38 = 0.8f;
m3C = 0.1f;
m40 = 0;
}
#endif
/* 00000078-00000108 .text set_mtx__14daObjMshokki_cFv */
void daObjMshokki_c::set_mtx() {
mModel->setBaseScale(scale);
mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z);
mDoMtx_stack_c::YrotM(shape_angle.y);
mDoMtx_stack_c::XrotM(shape_angle.x);
mModel->setBaseTRMtx(mDoMtx_stack_c::get());
}
/* 00000108-0000012C .text solidHeapCB__14daObjMshokki_cFP10fopAc_ac_c */
BOOL daObjMshokki_c::solidHeapCB(fopAc_ac_c* a_this) {
return ((daObjMshokki_c*)a_this)->create_heap();
}
/* 0000012C-000001FC .text create_heap__14daObjMshokki_cFv */
bool daObjMshokki_c::create_heap() {
static s32 bdl_idx[] = {dRes_INDEX_MSHOKKI_BDL_POT_e, dRes_INDEX_MSHOKKI_BDL_OSARA_e, dRes_INDEX_MSHOKKI_BDL_KOPPU_e};
bool uVar3 = true;
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcname, bdl_idx[m60C]);
if (modelData == NULL) {
JUT_ASSERT(DEMO_SELECT(352, 356), FALSE);
uVar3 = false;
} else {
mModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000022);
if (mModel == NULL) {
uVar3 = false;
}
}
return uVar3;
}
/* 000001FC-0000032C .text checkCollision__14daObjMshokki_cFv */
bool daObjMshokki_c::checkCollision() {
bool uVar4 = false;
if (mCyl.ChkTgHit()) {
cCcD_Obj* pcVar3 = mCyl.GetTgHitObj();
if (pcVar3 != NULL) {
if (pcVar3->ChkAtType(AT_TYPE_WIND)) {
speedF = mCyl.GetTgRVecP()->absXZ() * HIO(m34);
current.angle.y = cM_atan2s(mCyl.GetTgRVecP()->x, mCyl.GetTgRVecP()->z);
} else {
break_proc();
uVar4 = true;
}
}
mCyl.ClrTgHit();
}
return uVar4;
}
/* 0000032C-000004E4 .text co_hitCallback__14daObjMshokki_cFP10fopAc_ac_cP12dCcD_GObjInfP10fopAc_ac_cP12dCcD_GObjInf */
void daObjMshokki_c::co_hitCallback(fopAc_ac_c* a_this, dCcD_GObjInf*, fopAc_ac_c* other_actor, dCcD_GObjInf*) {
daObjMshokki_c* i_this = (daObjMshokki_c*)a_this;
f32 fVar1;
s16 sVar3 = cM_atan2s(i_this->current.pos.x - other_actor->current.pos.x, i_this->current.pos.z - other_actor->current.pos.z);
#if VERSION == VERSION_DEMO
if (other_actor == dComIfGp_getPlayer(0) && abs(other_actor->current.angle.y - sVar3) < (s16)HIO(m24) && other_actor->speedF >= HIO(m1C) + HIO(m20) &&
abs(i_this->m618 - i_this->m614) > 2)
#else
if (other_actor == dComIfGp_getPlayer(0) && abs(other_actor->current.angle.y - sVar3) < HIO(m24) && other_actor->speedF >= HIO(m1C) + HIO(m20) &&
abs(i_this->m618 - i_this->m614) > 2)
#endif
{
fVar1 = (other_actor->speedF - (HIO(m1C) + HIO(m20))) / HIO(m28);
if (fVar1 > 1.0f) {
fVar1 = 1.0f;
}
s32 cos = fVar1 * 6144.0f;
i_this->speedF = other_actor->speedF * cM_scos(cos);
i_this->speed.y = HIO(m30) * fVar1 + HIO(m2C);
i_this->current.angle.y = sVar3;
i_this->shape_angle.y = sVar3;
i_this->mCyl.SetCoHitCallback(NULL);
i_this->m618 = i_this->m614;
} else if (other_actor->speedF >= HIO(m1C)) {
fVar1 = (other_actor->speedF - HIO(m1C)) / HIO(m20);
if (fVar1 > 1.0f) {
fVar1 = 1.0f;
}
s16 angle_x = l_data[i_this->m60C].m0C * fVar1;
s16 angle_y = other_actor->current.angle.y;
i_this->shape_angle.x = angle_x;
i_this->shape_angle.y = angle_y;
#if VERSION == VERSION_DEMO
i_this->m61C = angle_y + HIO(m18) * 2.0f;
#else
i_this->m61C = angle_y + (s16)(HIO(m18) * 2.0f);
#endif
}
}
/* 000004E4-00000610 .text break_proc__14daObjMshokki_cFv */
void daObjMshokki_c::break_proc() {
static u16 particle_id[] = {dPa_name::ID_AK_JN_BREAKMAJUPOT00, dPa_name::ID_AK_JN_BREAKMAJUPLATE00, dPa_name::ID_AK_JN_BREAKMAJUCUP00};
dComIfGp_particle_set(particle_id[m60C], ¤t.pos, &shape_angle, NULL, 0xff, NULL, -1, &tevStr.mColorK0);
fopAcM_seStartCurrent(this, JA_SE_OBJ_COL_SWC_CHNS, dComIfG_Bgsp()->GetMtrlSndId(mAcch.m_gnd));
dKy_Sound_set(current.pos, 150, fopAcM_GetID(this), 5);
fopAcM_delete(this);
}
/* 00000610-00000740 .text set_se__14daObjMshokki_cFv */
void daObjMshokki_c::set_se() {
static s32 se_flag[] = {JA_SE_OBJ_CUP_SWING, JA_SE_OBJ_DISH_SWING, JA_SE_OBJ_CUP_SWING};
s16 tmp = shape_angle.y - m61C;
#if VERSION == VERSION_DEMO
if (abs(tmp) < HIO(m18)) {
#else
if (abs(tmp) < (s32)HIO(m18)) {
#endif
s16 uVar4 = (shape_angle.x / l_data[m60C].m0C) * 0x4000;
if (uVar4 > 0x4000) {
uVar4 = 0x4000;
}
fopAcM_seStartCurrent(this, se_flag[m60C], cM_ssin(uVar4) * 100.0f);
}
}
/* 00000740-00000A1C .text _create__14daObjMshokki_cFv */
cPhs_State daObjMshokki_c::_create() {
fopAcM_ct(this, daObjMshokki_c);
if (fopAcM_IsFirstCreating(this)) {
m60C = param_get_arg();
if (m60C < 0 || m60C >= 3) {
JUT_ASSERT(DEMO_SELECT(644, 648), FALSE);
m60C = 0;
}
}
cPhs_State ret = dComIfG_resLoad(&mPhase, l_arcname);
if (ret == cPhs_COMPLEATE_e) {
if (fopAcM_entrySolidHeap(this, solidHeapCB, 0x4C0)) {
fopAcM_SetMtx(this, mModel->getBaseTRMtx());
set_mtx();
mAcchCir.SetWall(50.0f, 35.0f);
mAcch.Set(
fopAcM_GetPosition_p(this),
fopAcM_GetOldPosition_p(this),
this,
1,
&mAcchCir,
fopAcM_GetSpeed_p(this),
fopAcM_GetAngle_p(this),
fopAcM_GetShapeAngle_p(this)
);
mAcch.ClrWaterNone();
mAcch.ClrRoofNone();
mAcch.SetRoofCrrHeight(50.0f);
mAcch.CrrPos(*dComIfG_Bgsp());
mAcch.ClrGroundLanding();
mStts.Init(100, 0xff, this);
mCyl.Set(l_cyl_src);
mCyl.SetStts(&mStts);
mCyl.StartCTg(current.pos);
mCyl.SetR(l_data[m60C].radius);
mCyl.SetH(l_data[m60C].height);
mCyl.SetCoHitCallback(co_hitCallback);
fopAcM_SetGravity(this, -6.0f);
} else {
ret = cPhs_ERROR_e;
}
}
#if VERSION == VERSION_DEMO
if (l_HIO.mNo < 0) {
l_HIO.mNo = mDoHIO_createChild("魔獣島内部の食器", &l_HIO);
}
#endif
return ret;
}
/* 00000C44-00000C74 .text _delete__14daObjMshokki_cFv */
bool daObjMshokki_c::_delete() {
dComIfG_resDelete(&mPhase, l_arcname);
#if VERSION == VERSION_DEMO
if (l_HIO.mNo >= 0) {
mDoHIO_deleteChild(l_HIO.mNo);
l_HIO.mNo = -1;
}
#endif
return true;
}
/* 00000C74-00000E24 .text _execute__14daObjMshokki_cFv */
bool daObjMshokki_c::_execute() {
fopAcM_posMoveF(this, mStts.GetCCMoveP());
mAcch.CrrPos(*dComIfG_Bgsp());
speedF *= HIO(m38);
if (speedF < HIO(m3C)) {
speedF = 0.0f;
}
if (mAcch.ChkGroundHit()) {
if (abs(shape_angle.x) > (s32)HIO(m10)) {
shape_angle.x += -(s16)HIO(m10);
shape_angle.y += (s16)HIO(m18);
set_se();
} else {
shape_angle.x = 0;
}
} else {
shape_angle.x += -(s32)HIO(m14);
}
#if VERSION == VERSION_DEMO
mCyl.SetR(l_HIO.m0C);
mCyl.SetH(l_HIO.m08);
#endif
if (m612 == 1 && mAcch.ChkGroundLanding()) {
break_proc();
} else {
if (mAcch.ChkGroundHit() && !mAcch.ChkGroundLanding()) {
m612 = 1;
}
mStts.Move();
if (!checkCollision()) {
set_mtx();
mCyl.MoveCTg(current.pos);
mStts.SetRoomId(current.roomNo);
dComIfG_Ccsp()->Set(&mCyl);
attention_info.position.x = current.pos.x;
attention_info.position.y = current.pos.y + l_data[m60C].m00;
attention_info.position.z = current.pos.z;
eyePos = attention_info.position;
}
}
m614++;
return true;
}
/* 00000E24-00000E84 .text _draw__14daObjMshokki_cFv */
bool daObjMshokki_c::_draw() {
g_env_light.settingTevStruct(TEV_TYPE_ACTOR, ¤t.pos, &tevStr);
g_env_light.setLightTevColorType(mModel, &tevStr);
mDoExt_modelUpdateDL(mModel);
return true;
}
/* 00000E84-00000EA4 .text daObjMshokki_Create__FP10fopAc_ac_c */
static cPhs_State daObjMshokki_Create(fopAc_ac_c* i_this) {
return ((daObjMshokki_c*)i_this)->_create();
}
/* 00000EA4-00000EC8 .text daObjMshokki_Delete__FP14daObjMshokki_c */
static BOOL daObjMshokki_Delete(daObjMshokki_c* i_this) {
return ((daObjMshokki_c*)i_this)->_delete();
}
/* 00000EC8-00000EEC .text daObjMshokki_Execute__FP14daObjMshokki_c */
static BOOL daObjMshokki_Execute(daObjMshokki_c* i_this) {
return ((daObjMshokki_c*)i_this)->_execute();
}
/* 00000EEC-00000F10 .text daObjMshokki_Draw__FP14daObjMshokki_c */
static BOOL daObjMshokki_Draw(daObjMshokki_c* i_this) {
return ((daObjMshokki_c*)i_this)->_draw();
}
/* 00000F10-00000F18 .text daObjMshokki_IsDelete__FP14daObjMshokki_c */
static BOOL daObjMshokki_IsDelete(daObjMshokki_c*) {
return TRUE;
}
static actor_method_class l_daObjMshokki_Method = {
(process_method_func)daObjMshokki_Create,
(process_method_func)daObjMshokki_Delete,
(process_method_func)daObjMshokki_Execute,
(process_method_func)daObjMshokki_IsDelete,
(process_method_func)daObjMshokki_Draw,
};
actor_process_profile_definition g_profile_Obj_Mshokki = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 0x0008,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_Obj_Mshokki_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(daObjMshokki_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_Obj_Mshokki_e,
/* Actor SubMtd */ &l_daObjMshokki_Method,
/* Status */ fopAcStts_CULL_e | fopAcStts_UNK40000_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_0_e,
};
|