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
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
|
/**
* d_a_kokiie.cpp
* Object - Forbidden Woods - Hanging flower house
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_kokiie.h"
#include "d/actor/d_a_shand.h"
#include "d/d_s_play.h"
#include "d/d_com_inf_game.h"
#include "d/d_bg_s_movebg_actor.h"
#include "res/Object/Kokiie.h"
#include "f_op/f_op_actor_mng.h"
#include "f_op/f_op_camera.h"
#include "JSystem/JUtility/JUTReport.h"
static cXyz ride_call_back(dBgW*, fopAc_ac_c*, fopAc_ac_c*) {
// There was an unused function here that got stripped out, but it still affected literal and weak function ordering.
f32* dummy = NULL;
*dummy = 10.0f;
*dummy = 50.0f;
*dummy = 5.0f;
*dummy = 1.0f;
*dummy = 1.2f;
*dummy = -100.0f;
*dummy = 0.1f;
cXyz temp(0.0f, 0.0f, 0.0f);
return temp;
}
/* 000000B4-00000154 .text daKokiie_Draw__FP12kokiie_class */
static BOOL daKokiie_Draw(kokiie_class* i_this) {
fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor;
g_env_light.settingTevStruct(TEV_TYPE_BG0, &actor->current.pos, &actor->tevStr);
g_env_light.setLightTevColorType(i_this->mpModel, &(i_this->actor).tevStr);
dComIfGd_setListBG();
mDoExt_modelUpdateDL(i_this->mpModel);
dComIfGd_setList();
return TRUE;
}
/* 00000154-00000884 .text kokiie_move__FP12kokiie_class */
void kokiie_move(kokiie_class* i_this) {
fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor;
int i;
int uVar6;
s16 maxSpeed;
s16 target;
s16 sVar1;
static u8 himo_off_check[] = {1, 2, 4, 8, 16};
static s16 himo_off_ya[] = {
0x1, 0x0, 0x2EE0, 0x1D4C, 0x5FB4, 0x0, 0x4E20, 0x30D4, 0x987C, 0x0, 0x0, 0x1964, 0x7FFF, 0x7FFF, 0x6784, 0x5014,
0xCF2C, 0xE2B4, 0x0, 0x0, 0x0, 0xE4A8, 0x4C2C, 0x1D4C, 0xB1E0, 0xCF2C, 0xB3D4, 0xE2B4, 0x987C, 0xB3D4, 0x8000, 0x1,
};
static s16 himo_off_xa[] = {
0x0, 0x7D0, 0x7D0, 0xBB8, 0x7D0, 0x0, 0xBB8, 0xFA0, 0x7D0, 0x0, 0x0, 0x7D0, 0xBB8, 0x7D0, 0xFA0, 0xFA0,
0x3E8, 0x7D0, 0x0, 0xFA0, 0x0, 0x7D0, 0x7D0, 0xFA0, 0xBB8, 0xFA0, 0xBB8, 0xFA0, 0xFA0, 0xFA0, 0xFA0, 0xFA0,
};
static s16 himo_off_yp[] = {
0x0, 0x96, 0x96, 0x12C, 0x96, 0x190, 0x190, 0x1F4, 0x96, 0x12C, 0x12C, 0x1F4, 0x12C, 0x1F4, 0x1F4, 0x2BC,
0x96, 0x12C, 0x12C, 0x1F4, 0x12C, 0x1F4, 0x1F4, 0x2BC, 0x12C, 0x1F4, 0x1F4, 0x2BC, 0x1F4, 0x2BC, 0x2BC, 0x0,
};
i_this->m298++;
switch (i_this->m29A) {
case 0: {
uVar6 = 0;
for (i = 0; i < ARRAY_SSIZE(i_this->m32C); i++) {
if (i_this->m32C[i] == 2) {
i_this->m32C[i] = 0;
i_this->m338 = 0.0f;
}
if (i_this->m32C[i] != 0) {
if (i_this->m32C[i] == 1) {
i_this->m338 = 1.0f;
i_this->m32C[i] = 5;
}
uVar6 |= himo_off_check[i];
}
}
sVar1 = himo_off_ya[uVar6];
target = himo_off_xa[uVar6];
cLib_addCalc2(&i_this->m2D0, REG8_F(4) - himo_off_yp[uVar6], 0.1f, i_this->m338 * 50.0f);
if ((uVar6 == 0x1f) && dComIfGs_checkGetItem(dItemNo_BOOMERANG_e)) {
i_this->m29A = 1;
actor->health = 0;
i_this->m378 = 1;
}
maxSpeed = i_this->m338 * 10000.0f;
cLib_addCalcAngleS2(&i_this->m334, target, 4, maxSpeed);
if (target != 0) {
cLib_addCalcAngleS2(&i_this->m332, sVar1, 2, maxSpeed);
}
cLib_addCalc2(&i_this->m338, 1.0f, 1.0f, REG8_F(14) + 0.001f);
cLib_addCalcAngleS2(&actor->current.angle.x, 0, 10, 0x200);
cLib_addCalcAngleS2(&actor->current.angle.z, 0, 10, 0x200);
i_this->m2C8.x = i_this->m2BC * cM_ssin(i_this->m298 * 900);
i_this->m2C8.z = i_this->m2C4 * cM_ssin(i_this->m298 * 700);
cLib_addCalc2(&i_this->m2BC, REG14_F(9) + 300.0f, 1.0f, REG14_F(3) + 20.0f);
cLib_addCalc2(&i_this->m2C4, REG14_F(9) + 300.0f, 1.0f, REG14_F(3) + 20.0f);
i_this->m2A4.x = i_this->m2B0 * cM_ssin(i_this->m298 * 0x2ee);
i_this->m2A4.z = i_this->m2B8 * cM_ssin(i_this->m298 * 900);
cLib_addCalc0(&i_this->m2B0, 1.0f, 0.25f);
cLib_addCalc0(&i_this->m2B8, 1.0f, 0.25f);
actor->shape_angle = actor->current.angle + i_this->m2C8;
actor->current.pos = actor->home.pos + i_this->m2A4;
actor->current.pos.y += i_this->m2D0;
cLib_addCalc0(&i_this->m2A4.y, 0.05f, REG0_F(7) + 2.0f);
} break;
case 1:
cLib_addCalcAngleS2(&actor->shape_angle.x, 0, 10, 0x800);
cLib_addCalcAngleS2(&actor->shape_angle.z, 0, 10, 0x800);
cLib_addCalcAngleS2(&i_this->m334, 0, 4, 0x200);
actor->current.pos.y += actor->speed.y;
actor->speed.y -= REG12_F(14) + 3.0f;
if (i_this->m37A == (s16)(REG0_S(4) + 0x1b)) {
if (i_this->m2A2 != 0xff) {
dComIfGs_onSwitch(i_this->m2A2, fopAcM_GetRoomNo(&i_this->actor));
}
fopAcM_seStartCurrent(&i_this->actor, JA_SE_OBJ_KOKIRI_H_CRASH, 0);
dComIfGp_getVibration().StartShock(REG0_S(2) + 4, -0x21, cXyz(0.0f, 1.0f, 0.0f));
}
if (i_this->m37A == (s16)(REG0_S(5) + 0x40)) {
cXyz sp44 = actor->current.pos;
sp44.y = 1170.0f;
dComIfGp_particle_set(dPa_name::ID_AK_SN_KOKIRIHOUSESPLASH00, &sp44);
dComIfGp_particle_set(dPa_name::ID_AK_SN_KOKIRIHOUSESPLASH01, &sp44);
dComIfGp_particle_set(dPa_name::ID_AK_SN_KOKIRIHOUSEHAMON00, &actor->current.pos);
dComIfGp_particle_set(dPa_name::ID_AK_SN_KOKIRIHOUSEHAMON01, &sp44);
}
i_this->m374 = (REG0_F(9) + 5180.0f) - 3800.0f;
if (actor->current.pos.y <= i_this->m374) {
actor->current.pos.y = i_this->m374;
if (actor->speed.y < -20.0f) {
dComIfGp_getVibration().StartShock(REG6_S(2) + 7, -0x21, cXyz(0.0f, 1.0f, 0.0f));
fopAcM_seStartCurrent(&i_this->actor, JA_SE_OBJ_KOKIRI_H_LANDING, 0);
i_this->m39C = REG12_F(10) + 40.0f + 50.0f;
}
actor->speed.y = 0.0f;
cLib_addCalcAngleS2(&i_this->m334, 0, 2, 0x2000);
}
break;
}
}
/* 00000884-00000A18 .text himo_create__FP12kokiie_class */
#if VERSION == VERSION_DEMO
void himo_create(kokiie_class* i_this) {
#else
BOOL himo_create(kokiie_class* i_this) {
#endif
fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor;
#if VERSION > VERSION_DEMO
if ((i_this->m2A2 != 0xff) && fopAcM_isSwitch(&i_this->actor, i_this->m2A2)) {
return FALSE;
}
s32 uVar2 = 0;
#endif
fopAcM_prm_class* pfVar3;
shand_class* pfVar6;
for (s32 i = 0; i < ARRAY_SSIZE(i_this->m2E8); i++) {
switch (i_this->m2E8[i]) {
case 0:
pfVar3 = fopAcM_CreateAppend();
pfVar3->base.position = actor->current.pos;
pfVar3->base.angle.y = actor->current.angle.y + i * 0x3333 + -13000;
pfVar3->base.parameters = 0xffffff01;
pfVar3->room_no = actor->current.roomNo;
i_this->m2D4[i] = fopAcM_Create(fpcNm_SHAND_e, NULL, pfVar3);
i_this->m2E8[i]++;
case 1:
pfVar6 = (shand_class*)fopAcM_SearchByID(i_this->m2D4[i]);
if (pfVar6 != NULL) {
pfVar6->field_308 = fopAcM_GetID(&i_this->actor);
pfVar6->field_310 = &i_this->m2F0[i];
pfVar6->field_314 = &i_this->m32C[i];
i_this->m2E8[i]++;
#if VERSION > VERSION_DEMO
uVar2++;
#endif
}
break;
case 2:
break;
}
}
#if VERSION > VERSION_DEMO
return uVar2 < 5;
#endif
}
/* 00000A18-00000E98 .text demo_camera__FP12kokiie_class */
void demo_camera(kokiie_class* i_this) {
fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor;
camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0));
cXyz sp5C;
cXyz sp50;
cMtx_YrotS(*calc_mtx, actor->shape_angle.y);
switch (i_this->m378) {
case 0:
break;
case 1:
if (!actor->eventInfo.checkCommandDemoAccrpt()) {
fopAcM_orderPotentialEvent(&i_this->actor, 2, 0xffff, 0);
actor->eventInfo.onCondition(dEvtCnd_UNK2_e);
return;
}
i_this->m378++;
camera->mCamera.Stop();
camera->mCamera.SetTrimSize(2);
i_this->m37C = actor->current.pos;
sp5C.x = (REG12_F(2) + 1300.0f) - 800.0f;
sp5C.y = 0.0f;
sp5C.z = REG12_F(4) - 1000.0f;
MtxPosition(&sp5C, &sp50);
i_this->m37C.x = actor->current.pos.x + sp50.x;
i_this->m37C.y = ((REG12_F(5) + 4030.0f) - 3800.0f) + 1500.0f;
i_this->m37C.z = actor->current.pos.z + sp50.z;
i_this->m388 = actor->current.pos;
i_this->m388.y += REG12_F(6) + -450.0f;
i_this->m3A0 = REG12_F(18) + 65.0f;
i_this->m37A = 0;
case 2:
if (i_this->m37A < (s16)(REG12_S(3) + 10)) {
actor->speed.y = 0.0f;
}
cLib_addCalc2(&i_this->m388.y, (actor->current.pos.y - 450.0f) + REG12_F(6), REG12_F(7) + 0.5f, REG12_F(8) + 200.0f);
if (i_this->m37A > (s16)(REG12_S(4) + 0x32)) {
cLib_addCalc2(&i_this->m3A0, REG12_F(19) + 80.0f, 0.02f, REG12_F(20) + 0.5f);
}
if (i_this->m37A == 100) {
mDoAud_seStart(JA_SE_READ_RIDDLE_1);
}
if ((i_this->m37A == 0x96) && (REG0_S(3) == 0)) {
i_this->m378 = 0;
dComIfGp_event_reset();
camera->mCamera.Reset(i_this->m388, i_this->m37C);
camera->mCamera.Start();
camera->mCamera.SetTrimSize(0);
}
break;
}
if (i_this->m378 != 0) {
f32 sin = i_this->m39C * cM_ssin(i_this->m37A * 0x3300);
f32 cos = i_this->m39C * cM_scos(i_this->m37A * 0x3000);
cXyz sp44;
cXyz sp38;
sp44.x = i_this->m37C.x + sin;
sp44.y = i_this->m37C.y + cos;
sp44.z = i_this->m37C.z;
sp38.x = i_this->m388.x + sin;
sp38.y = i_this->m388.y + cos;
sp38.z = i_this->m388.z;
s16 iVar1 = i_this->m39C * cM_scos(i_this->m298 * 0x1c00) * 8.0f;
camera->mCamera.Set(sp38, sp44, iVar1, i_this->m3A0);
cLib_addCalc0(&i_this->m39C, 1.0f, REG0_F(16) + 5.0f);
JUTReport(0x19a, 0x1ae, "K SUB COUNT %d", i_this->m37A);
i_this->m37A = i_this->m37A + 1;
}
}
/* 00000E98-0000107C .text daKokiie_Execute__FP12kokiie_class */
static BOOL daKokiie_Execute(kokiie_class* i_this) {
fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor;
kokiie_move(i_this);
MtxTrans(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z, 0);
cMtx_YrotM(*calc_mtx, actor->shape_angle.y);
cMtx_YrotM(*calc_mtx, i_this->m332);
cMtx_XrotM(*calc_mtx, i_this->m334);
cMtx_YrotM(*calc_mtx, -i_this->m332);
cMtx_XrotM(*calc_mtx, actor->shape_angle.x);
cMtx_ZrotM(*calc_mtx, actor->shape_angle.z);
cMtx_YrotM(*calc_mtx, 0xb54);
i_this->mpModel->setBaseTRMtx(*calc_mtx);
MTXCopy(*calc_mtx, i_this->m340);
i_this->pm_bgw->Move();
cMtx_YrotM(*calc_mtx, -0xb54);
for (s32 i = 0; i < ARRAY_SSIZE(i_this->m2F0); i++) {
MtxPush();
cMtx_YrotM(*calc_mtx, i * 0x3333);
cXyz sp08;
sp08.x = 0.0f;
sp08.y = REG0_F(5) + -170.0f;
sp08.z = REG0_F(6) + 400.0f;
MtxPosition(&sp08, &i_this->m2F0[i]);
MtxPull();
}
#if VERSION == VERSION_DEMO
himo_create(i_this);
#endif
demo_camera(i_this);
return TRUE;
}
/* 0000107C-00001084 .text daKokiie_IsDelete__FP12kokiie_class */
static BOOL daKokiie_IsDelete(kokiie_class*) {
return TRUE;
}
/* 00001084-000010E4 .text daKokiie_Delete__FP12kokiie_class */
static BOOL daKokiie_Delete(kokiie_class* i_this) {
fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor;
dComIfG_resDeleteDemo(&i_this->mPhase, "Kokiie");
#if VERSION > VERSION_DEMO
if (actor->heap != NULL)
#endif
{
dComIfG_Bgsp()->Release(i_this->pm_bgw);
}
return TRUE;
}
/* 000010E4-00001250 .text CallbackCreateHeap__FP10fopAc_ac_c */
static BOOL CallbackCreateHeap(fopAc_ac_c* a_this) {
kokiie_class* actor = (kokiie_class*)a_this;
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Kokiie", dRes_INDEX_KOKIIE_BDL_KOKI_00_e);
actor->mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203);
if (actor->mpModel == NULL) {
return FALSE;
}
JUT_ASSERT(DEMO_SELECT(924, 945), modelData != NULL);
actor->pm_bgw = new dBgW();
JUT_ASSERT(DEMO_SELECT(929, 950), actor->pm_bgw != NULL);
actor->pm_bgw->Set((cBgD_t*)dComIfG_getObjectRes("Kokiie", dRes_INDEX_KOKIIE_DZB_KOKI_00_e), dBgW::MOVE_BG_e, &actor->m340);
actor->pm_bgw->SetCrrFunc(dBgS_MoveBGProc_Typical);
return TRUE;
}
/* 00001250-000014E4 .text daKokiie_Create__FP10fopAc_ac_c */
static cPhs_State daKokiie_Create(fopAc_ac_c* a_this) {
kokiie_class* i_this = (kokiie_class*)a_this;
fopAcM_ct(a_this, kokiie_class);
cPhs_State PVar3 = dComIfG_resLoad(&i_this->mPhase, "Kokiie");
#if VERSION == VERSION_DEMO
if (PVar3 == cPhs_COMPLEATE_e)
#else
if (PVar3 != cPhs_COMPLEATE_e) {
return PVar3;
}
#endif
{
i_this->m2A0 = fopAcM_GetParam(a_this);
if (i_this->m2A0 == 0xff) {
i_this->m2A0 = 0;
}
i_this->m2A2 = fopAcM_GetParam(a_this) >> 0x18;
#if VERSION > VERSION_DEMO
if (himo_create(i_this)) {
return FALSE;
}
#endif
if (!fopAcM_entrySolidHeap(a_this, CallbackCreateHeap, 0x10000)) {
return cPhs_ERROR_e;
}
if ((i_this->pm_bgw != NULL) && dComIfG_Bgsp()->Regist(i_this->pm_bgw, a_this)) {
return cPhs_ERROR_e;
}
switch (i_this->m2A0) {
case 1:
a_this->scale.x = 0.9f;
a_this->scale.z = 0.9f;
break;
case 2:
a_this->scale.x = 0.8f;
a_this->scale.z = 0.8f;
break;
case 3:
a_this->scale.x = 0.7f;
a_this->scale.z = 0.7f;
break;
default:
a_this->scale.z = 1.0f;
a_this->scale.x = 1.0f;
break;
}
a_this->scale.y = 1.0f;
fopAcM_SetMtx(a_this, i_this->mpModel->getBaseTRMtx());
fopAcM_SetMin(a_this, a_this->scale.x * -1000.0f, VERSION_SELECT(-1000.0f, -1000.0f, -1500.0f, -1000.0f), a_this->scale.z * -1000.0f);
fopAcM_SetMax(a_this, a_this->scale.x * 1000.0f, 1000.0f, a_this->scale.z * 1000.0f);
i_this->mpModel->setBaseScale(a_this->scale);
a_this->health = 1;
if ((i_this->m2A2 != 0xff) && fopAcM_isSwitch(a_this, i_this->m2A2)) {
a_this->current.pos.y = i_this->m374 + 50.0f + 720.0f + REG0_F(17);
i_this->m29A = 1;
a_this->health = 0;
#if VERSION == VERSION_DEMO
for (s32 i = 0; i < ARRAY_SSIZE(i_this->m2E8); i++) {
i_this->m2E8[i] = 2;
}
#endif
}
for (s32 i = 0; i < 2; i++) {
daKokiie_Execute(i_this);
}
}
return PVar3;
}
static actor_method_class l_daKokiie_Method = {
(process_method_func)daKokiie_Create,
(process_method_func)daKokiie_Delete,
(process_method_func)daKokiie_Execute,
(process_method_func)daKokiie_IsDelete,
(process_method_func)daKokiie_Draw,
};
actor_process_profile_definition g_profile_KOKIIE = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 0x0003,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_KOKIIE_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(kokiie_class),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_KOKIIE_e,
/* Actor SubMtd */ &l_daKokiie_Method,
/* Status */ fopAcStts_CULL_e | DEMO_SELECT(0, fopAcStts_UNK4000_e) | fopAcStts_UNK40000_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
};
|