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
481
482
483
|
/**
* @file d_a_npc_drainSol.cpp
*
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_npc_drainSol.h"
#include "d/actor/d_a_npc.h"
static int l_bmdGetParamList[] = {
9, 7
};
static daNpc_GetParam3 l_bckGetParamList[] = {
{5, 2},
{4, 2},
{4, 0},
};
static char* l_arcNames[2] = {
"DrainSol1",
"DrainSol2",
};
const daNpcDrSol_HIOParam daNpcDrSol_Param_c::m = {
40.0f,
0.0f,
1.0f,
300.0f,
255.0f,
160.0f,
35.0f,
40.0f,
0.0f,
0.0f,
10.0f,
-10.0f,
30.0f,
-10.0f,
45.0f,
-45.0f,
0.6f,
12.0f,
3,
6,
4,
6,
60.0f,
500.0f,
300.0f,
-300.0f,
60,
0,
0,
0,
0,
0,
0,
};
static NPC_DRSOL_HIO_CLASS l_HIO;
#if DEBUG
daNpcDrSol_HIO_c::daNpcDrSol_HIO_c() {
m = daNpcDrSol_Param_c::m;
}
void daNpcDrSol_HIO_c::genMessage(JORMContext* ctx) {
// NONMATCHING
}
#endif
daNpcDrSol_c::daNpcDrSol_c() {}
daNpcDrSol_c::~daNpcDrSol_c() {
dComIfG_resDelete(&mPhase, l_arcNames[mType]);
if (heap != NULL) {
mAnm_p->stopZelAnime();
}
#if DEBUG
if (mpHIO != NULL) {
mpHIO->removeHIO();
}
#endif
}
int daNpcDrSol_c::Create() {
fopAcM_ct(this, daNpcDrSol_c);
if (!dKy_darkworld_check()) {
return cPhs_ERROR_e;
}
mType = getType();
mMessageNo = getMessageNo();
int phase_state = cPhs_ERROR_e;
phase_state = dComIfG_resLoad(&mPhase, l_arcNames[mType]);
if (phase_state == cPhs_COMPLEATE_e) {
if (!fopAcM_entrySolidHeap(this, createHeapCallBack, 0x29B0)) {
return cPhs_ERROR_e;
}
J3DModelData* model_data = mAnm_p->getModel()->getModelData();
fopAcM_SetMtx(this, mAnm_p->getModel()->getBaseTRMtx());
fopAcM_setCullSizeBox(this, -60.0f, -10.0f, -60.0f, 60.0f, 200.0f, 60.0f);
mSound.init(¤t.pos, &eyePos, 3, 1);
#if DEBUG
mpHIO = &l_HIO;
mpHIO->entryHIO("下水道の兵士");
#endif
mAcchCir.SetWall(mpHIO->m.common.width, mpHIO->m.common.knee_length);
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.CrrPos(dComIfG_Bgsp());
mCcStts.Init(0xFF, 0, this);
mCyl.Set(mCcDCyl);
mCyl.SetStts(&mCcStts);
mCyl.SetTgType(0);
mCyl.SetTgSPrm(0);
mGndChk = mAcch.m_gnd;
mGroundH = mAcch.GetGroundH();
setEnvTevColor();
setRoomNo();
reset();
Execute();
}
return phase_state;
}
int daNpcDrSol_c::CreateHeap() {
J3DModelData* mdlData_p = (J3DModelData*)dComIfG_getObjectRes(l_arcNames[mType], l_bmdGetParamList[mType]);
JUT_ASSERT(268, NULL != mdlData_p);
mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020084);
if (mAnm_p != NULL && mAnm_p->getModel() == NULL) {
mAnm_p->stopZelAnime();
mAnm_p = NULL;
}
if (mAnm_p == NULL) {
return 0;
}
Vec sp28[] = {
{1.0f, 1.0f, 1.0f},
{1.0f, 1.1983438f, 2.173357f},
};
cXyz sp18(sp28[mType]);
mAnm_p->offTranslate();
mAnm_p->setTranslateScale(sp18);
if (mType == 0) {
mdlData_p = (J3DModelData*)dComIfG_getObjectRes(l_arcNames[0], 8);
JUT_ASSERT(305, NULL != mdlData_p);
field_0xbd8 = mDoExt_J3DModel__create(mdlData_p, 0x80000, 0x11000084);
if (field_0xbd8 == NULL) {
return 0;
}
}
return 1;
}
int daNpcDrSol_c::Delete() {
fopAcM_RegisterDeleteID(this, "NPC_DRSOL");
this->~daNpcDrSol_c();
return 1;
}
int daNpcDrSol_c::Execute() {
execute();
if (daPy_py_c::checkNowWolfEyeUp() && !fopAcM_CheckCondition(this, 4) && chkFindPlayer() && getSwitchNo() != 0xFF) {
fopAcM_onSwitch(this, getSwitchNo());
}
return 1;
}
int daNpcDrSol_c::Draw() {
draw(FALSE, FALSE, mpHIO->m.common.real_shadow_size, NULL, 0);
return 1;
}
void daNpcDrSol_c::drawOtherMdls() {
if (daPy_py_c::checkNowWolfEyeUp() && field_0xbd8 != NULL) {
g_env_light.setLightTevColorType_MAJI(field_0xbd8, &tevStr);
mDoMtx_stack_c::copy(mAnm_p->getModel()->getAnmMtx(14));
field_0xbd8->setBaseTRMtx(mDoMtx_stack_c::get());
mDoExt_modelUpdateDL(field_0xbd8);
}
}
int daNpcDrSol_c::createHeapCallBack(fopAc_ac_c* actor) {
return ((daNpcDrSol_c*)actor)->CreateHeap();
}
void daNpcDrSol_c::playMotion() {
daNpcF_anmPlayData dat0 = {0, mpHIO->m.common.morf_frame, 0};
daNpcF_anmPlayData* pDat0[] = {&dat0};
daNpcF_anmPlayData dat1 = {1, mpHIO->m.common.morf_frame, 0};
daNpcF_anmPlayData* pDat1[] = {&dat1};
daNpcF_anmPlayData dat2a = {2, mpHIO->m.common.morf_frame, 1};
daNpcF_anmPlayData dat2b = {1, 0.0f, 0};
daNpcF_anmPlayData* pDat2[] = {&dat2a, &dat2b};
daNpcF_anmPlayData dat3a = {0, mpHIO->m.common.morf_frame, 0};
daNpcF_anmPlayData* pDat3[] = {&dat3a};
daNpcF_anmPlayData** ppDat[5] = {
pDat0,
pDat1,
pDat3,
pDat3,
pDat2,
};
if (mMotion >= 0 && mMotion < 5) {
field_0xd34 = mMotionPhase;
playMotionAnm(ppDat);
}
}
void daNpcDrSol_c::reset() {
initialize();
mAction = NULL;
mMode = 0;
gravity = 0.0f;
current.pos = home.pos;
old.pos = current.pos;
current.angle.set(0, home.angle.y, 0);
old.angle = current.angle;
shape_angle = current.angle;
mCurAngle = current.angle;
mOldAngle = mCurAngle;
speedF = 0.0f;
speed.setall(0.0f);
mMotionMorfOverride = 0.0f;
mTwilight = dKy_darkworld_check();
attention_info.distances[fopAc_attn_LOCK_e] = getDistTableIdx(mpHIO->m.common.attention_distance, mpHIO->m.common.attention_angle);
attention_info.distances[fopAc_attn_TALK_e] = attention_info.distances[fopAc_attn_LOCK_e];
attention_info.distances[fopAc_attn_SPEAK_e] = getDistTableIdx(mpHIO->m.common.talk_distance, mpHIO->m.common.talk_angle);
setAction(&daNpcDrSol_c::wait);
}
int daNpcDrSol_c::setAction(bool (daNpcDrSol_c::*i_action)(void*)) {
mMode = 3;
if (mAction) {
(this->*mAction)(NULL);
}
mMode = 0;
mAction = i_action;
if (mAction) {
(this->*mAction)(NULL);
}
return TRUE;
}
bool daNpcDrSol_c::chkFindPlayer() {
dBgS_LinChk linechk;
cXyz end(fopAcM_GetPosition_p(daPy_getPlayerActorClass())->x, eyePos.y, fopAcM_GetPosition_p(daPy_getPlayerActorClass())->z);
linechk.Set(&eyePos, &end, this);
if (dComIfG_Bgsp().LineCross(&linechk)) {
return false;
}
return true;
}
bool daNpcDrSol_c::wait(void* param_0) {
switch (mMode) {
case 0:
setMotion(mType, -1.0f, 0);
mMode = 2;
break;
case 2:
if (dComIfGp_event_runCheck() && eventInfo.checkCommandTalk()) {
if (!dComIfGp_event_chkTalkXY() || dComIfGp_evmng_ChkPresentEnd()) {
setAction(&daNpcDrSol_c::talk);
}
} else {
orderEvent(field_0xd38, NULL, 0xFFFF, 40, 0xFF, 1);
}
break;
case 3:
JUT_ASSERT(760, 0);
break;
}
return 1;
}
void daNpcDrSol_c::setMotion(int i_motion, f32 i_morf, int param_2) {
s16 motion = i_motion;
if ((param_2 != 0 || mMotion != motion) && motion >= 0 && motion < 5) {
if (motion == 0 && mType == 1) {
motion = 1;
} else if (motion == 1 && mType == 0) {
motion = 0;
}
mMotion = motion;
mMotionMorfOverride = i_morf;
mMotionPrevPhase = -1;
mMotionPhase = 0;
field_0xd34 = 0;
}
}
bool daNpcDrSol_c::talk(void* param_0) {
bool rt = false;
switch (mMode) {
case 0:
initTalk(mMessageNo, NULL);
mMsgTimer = 0;
field_0xd38 = 0;
mMode = 2;
break;
case 2:
if (talkProc(NULL, 1, NULL)) {
setAction(&daNpcDrSol_c::wait);
rt = true;
} else {
int spC, sp8;
if (ctrlMsgAnm(spC, sp8, this, TRUE)) {
setMotion(sp8, -1.0f, 0);
}
}
break;
case 3:
dComIfGp_event_reset();
break;
default:
JUT_ASSERT(760, 0);
break;
}
return rt;
}
static int daNpcDrSol_Create(void* i_this) {
return ((daNpcDrSol_c*)i_this)->Create();
}
static int daNpcDrSol_Delete(void* i_this) {
return ((daNpcDrSol_c*)i_this)->Delete();
}
static int daNpcDrSol_Execute(void* i_this) {
return ((daNpcDrSol_c*)i_this)->Execute();
}
static int daNpcDrSol_Draw(void* i_this) {
return ((daNpcDrSol_c*)i_this)->Draw();
}
static int daNpcDrSol_IsDelete(void* i_this) {
return 1;
}
void daNpcDrSol_c::setParam() {
if (checkHide()) {
attention_info.flags = 0;
} else {
attention_info.flags = fopAc_AttnFlag_UNK_0x400000 | fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e;
}
#if PLATFORM_SHIELD
attention_info.distances[fopAc_attn_LOCK_e] = getDistTableIdx(mpHIO->m.common.attention_distance, mpHIO->m.common.attention_angle);
attention_info.distances[fopAc_attn_TALK_e] = attention_info.distances[fopAc_attn_LOCK_e];
attention_info.distances[fopAc_attn_SPEAK_e] = getDistTableIdx(mpHIO->m.common.talk_distance, mpHIO->m.common.talk_angle);
mAcchCir.SetWallR(mpHIO->m.common.width);
mAcchCir.SetWallH(mpHIO->m.common.knee_length);
#endif
}
BOOL daNpcDrSol_c::main() {
if (mAction != NULL) {
(this->*mAction)(NULL);
}
playMotion();
return 0;
}
void daNpcDrSol_c::setAttnPos() {
setMtx();
cXyz sp14(10.0f, 15.0f, 0.0f);
mDoMtx_stack_c::copy(mAnm_p->getModel()->getAnmMtx(4));
mDoMtx_stack_c::multVecZero(&mHeadPos);
mDoMtx_stack_c::multVec(&sp14, &eyePos);
attention_info.position.set(mHeadPos.x, mHeadPos.y + mpHIO->m.common.attention_offset, mHeadPos.z);
cXyz sp8;
mDoMtx_stack_c::copy(mAnm_p->getModel()->getAnmMtx(2));
mDoMtx_stack_c::multVecZero(&sp8);
sp8.y = current.pos.y;
mCyl.SetC(sp8);
mCyl.SetH(mpHIO->m.common.height);
mCyl.SetR(mpHIO->m.common.width);
dComIfG_Ccsp()->Set(&mCyl);
}
void daNpcDrSol_c::setMotionAnm(int i_index, f32 i_morf) {
J3DAnmTransformKey* bck_p = NULL;
bck_p = getTrnsfrmKeyAnmP(l_arcNames[mType], l_bckGetParamList[i_index].fileIdx);
int attr = l_bckGetParamList[i_index].attr;
mAnmFlags &= ~(ANM_PLAY_MORF | ANM_PAUSE_MORF);
if (bck_p != NULL && setMcaMorfAnm(bck_p, 1.0f, i_morf, attr, 0, -1)) {
mAnmFlags |= ANM_PLAY_MORF | ANM_PAUSE_MORF;
mMotionLoops = 0;
}
}
BOOL daNpcDrSol_c::drawDbgInfo() {
return false;
}
static char* dummyString() {
return "Shoe";
};
static actor_method_class daNpcDrSol_MethodTable = {
(process_method_func)daNpcDrSol_Create,
(process_method_func)daNpcDrSol_Delete,
(process_method_func)daNpcDrSol_Execute,
(process_method_func)daNpcDrSol_IsDelete,
(process_method_func)daNpcDrSol_Draw,
};
actor_process_profile_definition g_profile_NPC_DRSOL = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 7,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_NPC_DRSOL_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(daNpcDrSol_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_NPC_DRSOL_e,
/* Actor SubMtd */ &daNpcDrSol_MethodTable,
/* Status */ fopAcStts_UNK_0x40000_e | fopAcStts_UNK_0x4000_e | fopAcStts_CULL_e | fopAcStts_NOEXEC_e | fopAcStts_UNK_0x4_e | fopAcStts_UNK_0x2_e | fopAcStts_UNK_0x1_e,
/* Group */ fopAc_NPC_e,
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
};
|