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
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
|
/**
* @file d_a_npc_doc.cpp
*
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_npc_doc.h"
#include "Z2AudioLib/Z2Instances.h"
/* 809AA460-809AA468 000020 0008+00 1/1 0/0 0/0 .data l_bmdData */
static int l_bmdData[1][2] = {
{14, 1},
};
/* 809AA468-809AA478 -00001 0010+00 0/1 0/0 0/0 .data l_evtList */
static daNpcT_evtData_c l_evtList[2] = {
{"", 0},
{"NO_RESPONSE", 0},
};
/* 809AA478-809AA484 -00001 000C+00 2/3 0/0 0/0 .data l_resNameList */
static char* l_resNameList[3] = {
"",
"Doc",
"Doc1",
};
/* 809AA484-809AA488 000044 0003+01 1/0 0/0 0/0 .data l_loadResPtrn0 */
static s8 l_loadResPtrn0[] = {
1,
2,
-1,
};
/* 809AA488-809AA494 -00001 000C+00 1/2 0/0 0/0 .data l_loadResPtrnList */
static s8* l_loadResPtrnList[3] = {
l_loadResPtrn0,
l_loadResPtrn0,
l_loadResPtrn0,
};
/* 809AA494-809AA5AC 000054 0118+00 0/1 0/0 0/0 .data l_faceMotionAnmData */
static daNpcT_faceMotionAnmData_c l_faceMotionAnmData[10] = {
{-1, 0, 0, 20, 2, 1, 1},
{6, 0, 1, 20, 2, 1, 1},
{9, 0, 2, 34, 0, 2, 0},
{13, 2, 2, 38, 2, 2, 0},
{10, 0, 2, 35, 0, 2, 0},
{11, 0, 2, 36, 0, 2, 0},
{14, 2, 2, 39, 2, 2, 0},
{12, 0, 2, 37, 0, 2, 0},
{7, 0, 2, 20, 2, 1, 1},
{8, 2, 2, 20, 2, 1, 1},
};
/* 809AA5AC-809AA734 00016C 0188+00 0/1 0/0 0/0 .data l_motionAnmData */
static daNpcT_motionAnmData_c l_motionAnmData[14] = {
{11, 2, 1, 17, 0, 1, 1, 0},
{8, 0, 1, 17, 0, 1, 1, 0},
{7, 0, 1, 17, 0, 1, 1, 0},
{9, 0, 1, 17, 0, 1, 1, 0},
{10, 2, 1, 17, 0, 1, 1, 0},
{21, 2, 2, 17, 0, 1, 1, 0},
{15, 0, 2, 26, 0, 2, 0, 0},
{16, 2, 2, 27, 2, 2, 0, 0},
{17, 0, 2, 28, 0, 2, 0, 0},
{18, 0, 2, 29, 0, 2, 0, 0},
{19, 2, 2, 30, 2, 2, 0, 0},
{20, 0, 2, 31, 0, 2, 0, 0},
{5, 0, 2, 24, 0, 2, 0, 0},
{6, 2, 2, 25, 2, 2, 0, 0},
};
/* 809AA734-809AA7D4 0002F4 00A0+00 0/1 0/0 0/0 .data l_faceMotionSequenceData */
static daNpcT_MotionSeqMngr_c::sequenceStepData_c l_faceMotionSequenceData[40] = {
{1, -1, 1}, {-1, 0, 0}, {-1, 0, 0}, {-1, 0, 0}, {2, -1, 1}, {3, 0, 0}, {-1, 0, 0}, {-1, 0, 0},
{2, -1, 1}, {3, 0, 0}, {-1, 0, 0}, {-1, 0, 0}, {5, -1, 1}, {6, 0, 0}, {-1, 0, 0}, {-1, 0, 0},
{6, -1, 0}, {-1, 0, 0}, {-1, 0, 0}, {-1, 0, 0}, {8, -1, 1}, {9, 0, 0}, {-1, 0, 0}, {-1, 0, 0},
{3, -1, 0}, {-1, 0, 0}, {-1, 0, 0}, {-1, 0, 0}, {6, -1, 0}, {-1, 0, 0}, {-1, 0, 0}, {-1, 0, 0},
{9, -1, 0}, {-1, 0, 0}, {-1, 0, 0}, {-1, 0, 0}, {0, -1, 0}, {-1, 0, 0}, {-1, 0, 0}, {-1, 0, 0},
};
/* 809AA7D4-809AA8A4 000394 00D0+00 0/1 0/0 0/0 .data l_motionSequenceData */
static daNpcT_MotionSeqMngr_c::sequenceStepData_c l_motionSequenceData[52] = {
{0, -1, 0}, {-1, 0, 0}, {-1, 0, 0}, {-1, 0, 0}, {3, -1, 1}, {4, 0, 0}, {-1, 0, 0}, {-1, 0, 0},
{4, -1, 0}, {-1, 0, 0}, {-1, 0, 0}, {-1, 0, 0}, {6, -1, 1}, {7, 0, 0}, {-1, 0, 0}, {-1, 0, 0},
{7, -1, 0}, {-1, 0, 0}, {-1, 0, 0}, {-1, 0, 0}, {9, -1, 1}, {10, 0, 0}, {-1, 0, 0}, {-1, 0, 0},
{10, -1, 0}, {-1, 0, 0}, {-1, 0, 0}, {-1, 0, 0}, {11, -1, 1}, {0, 0, 0}, {-1, 0, 0}, {-1, 0, 0},
{12, -1, 1}, {13, 0, 0}, {-1, 0, 0}, {-1, 0, 0}, {13, -1, 0}, {-1, 0, 0}, {-1, 0, 0}, {-1, 0, 0},
{1, -1, 1}, {-1, 0, 0}, {-1, 0, 0}, {-1, 0, 0}, {2, -1, 1}, {-1, 0, 0}, {-1, 0, 0}, {-1, 0, 0},
{5, -1, 0}, {-1, 0, 0}, {-1, 0, 0}, {-1, 0, 0},
};
/* 809AA8A4-809AA8A8 -00001 0004+00 1/1 0/0 0/0 .data mCutNameList__11daNpc_Doc_c */
char* daNpc_Doc_c::mCutNameList[1] = {""};
/* 809AA8A8-809AA8B4 000468 000C+00 2/2 0/0 0/0 .data mCutList__11daNpc_Doc_c */
daNpc_Doc_c::cutFunc daNpc_Doc_c::mCutList[1] = {
NULL,
};
/* 809AA31C-809AA3AC 000000 0090+00 8/8 0/0 0/0 .rodata m__17daNpc_Doc_Param_c */
const daNpc_Doc_HIOParam daNpc_Doc_Param_c::m = {
140.0f,
-3.0f,
1.0f,
400.0f,
255.0f,
110.0f,
35.0f,
55.0f,
0.0f,
0.0f,
10.0f,
-10.0f,
30.0f,
-10.0f,
45.0f,
-45.0f,
0.6f,
12.0f,
3,
6,
5,
6,
110.0f,
0.0f,
0.0f,
0.0f,
60,
8,
0,
0,
0,
0,
0,
4.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
3.0f,
};
/* 809AAB1C-809AAB20 000054 0004+00 1/1 0/0 0/0 .bss l_HIO */
static NPC_DOC_HIO_CLASS l_HIO;
/* 809A6C8C-809A6DC0 0000EC 0134+00 1/0 0/0 0/0 .text __dt__11daNpc_Doc_cFv */
daNpc_Doc_c::~daNpc_Doc_c() {
OS_REPORT("|%06d:%x|daNpc_Doc_c -> デストラクト\n", g_Counter.mCounter0, this);
if (mpMorf[0] != NULL) {
mpMorf[0]->stopZelAnime();
}
#if DEBUG
if (mpHIO != NULL) {
mpHIO->removeHIO();
}
#endif
deleteRes(l_loadResPtrnList[mType], (const char**)l_resNameList);
}
/* 809A6DC0-809A7088 000220 02C8+00 1/1 0/0 0/0 .text create__11daNpc_Doc_cFv */
int daNpc_Doc_c::create() {
daNpcT_ct(this, daNpc_Doc_c, l_faceMotionAnmData, l_motionAnmData,
l_faceMotionSequenceData, 4, l_motionSequenceData, 4, l_evtList, l_resNameList);
mType = getType();
mFlowNodeNo = getFlowNodeNo();
mTwilight = dKy_darkworld_check();
int phase_state = loadRes(l_loadResPtrnList[mType], (const char**)l_resNameList);
if (phase_state == cPhs_COMPLEATE_e) {
OS_REPORT("\t(%s:%d) flowNo:%d, PathID:%02x, BitSW:%02x, OnHour:%2d, OffHour:%2d<%08x> ",
fopAcM_getProcNameString(this), mType, mFlowNodeNo, getPathID(), getBitSW(), getOnHour(), getOffHour(), fopAcM_GetParam(this) & 0xFF);
if (isDelete()) {
OS_REPORT("===>isDelete:TRUE\n");
return cPhs_ERROR_e;
}
OS_REPORT("\n");
static int const heapSize[3] = {
0x4850, 0x4850, 0x0,
};
if (!fopAcM_entrySolidHeap(this, createHeapCallBack, heapSize[mType])) {
return cPhs_ERROR_e;
}
J3DModelData* mdlData_p = mpMorf[0]->getModel()->getModelData();
fopAcM_SetMtx(this, mpMorf[0]->getModel()->getBaseTRMtx());
fopAcM_setCullSizeBox(this, -200.0f, -100.0f, -200.0f, 200.0f, 200.0f, 200.0f);
mSound.init(¤t.pos, &eyePos, 3, 1);
field_0x9c0.init(&mAcch, 0.0f, 0.0f);
#if DEBUG
mpHIO = &l_HIO;
mpHIO->entryHIO("町医者");
#endif
reset();
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));
mCcStts.Init(mpHIO->m.common.weight, 0, this);
mCyl.Set(mCcDCyl);
mCyl.SetStts(&mCcStts);
mCyl.SetTgHitCallback(tgHitCallBack);
mAcch.CrrPos(dComIfG_Bgsp());
mGndChk = mAcch.m_gnd;
mGroundH = mAcch.GetGroundH();
if (mGroundH != -G_CM3D_F_INF) {
setEnvTevColor();
setRoomNo();
}
mCreating = true;
Execute();
mCreating = false;
}
return phase_state;
}
/* 809A7088-809A730C 0004E8 0284+00 1/1 0/0 0/0 .text CreateHeap__11daNpc_Doc_cFv */
int daNpc_Doc_c::CreateHeap() {
void* mdlData_p = NULL;
J3DModel* model = NULL;
int resIdx;
int bmdIdx;
enum { IDX0 };
int idx = mTwilight == true ? IDX0 : IDX0;
resIdx = l_bmdData[idx][1];
bmdIdx = l_bmdData[idx][0];
mdlData_p = dComIfG_getObjectRes(l_resNameList[resIdx], bmdIdx);
if (mdlData_p == NULL) {
return 0;
}
u32 sp1C = 0x11020284;
mpMorf[0] = new mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, sp1C);
if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) {
return 0;
}
model = mpMorf[0]->getModel();
for (u16 i = 0; i < ((J3DModelData*)mdlData_p)->getJointNum(); i++) {
((J3DModelData*)mdlData_p)->getJointNodePointer(i)->setCallBack(ctrlJointCallBack);
}
model->setUserArea((uintptr_t)this);
mpMatAnm[0] = new daNpcT_MatAnm_c();
if (mpMatAnm[0] == NULL) {
return 0;
}
if (setFaceMotionAnm(1, false) && setMotionAnm(0, 0.0f, FALSE)) {
return 1;
}
return 0;
}
/* 809A74C8-809A74FC 000928 0034+00 1/1 0/0 0/0 .text Delete__11daNpc_Doc_cFv */
int daNpc_Doc_c::Delete() {
OS_REPORT("|%06d:%x|daNpc_Doc_c -> Delete\n", g_Counter.mCounter0, this);
fpc_ProcID id = fopAcM_GetID(this);
this->~daNpc_Doc_c();
return 1;
}
/* 809A74FC-809A751C 00095C 0020+00 2/2 0/0 0/0 .text Execute__11daNpc_Doc_cFv */
int daNpc_Doc_c::Execute() {
return execute();
}
/* 809A751C-809A75B0 00097C 0094+00 1/1 0/0 0/0 .text Draw__11daNpc_Doc_cFv */
int daNpc_Doc_c::Draw() {
if (mpMatAnm[0] != NULL) {
J3DModelData* mdlData_p = mpMorf[0]->getModel()->getModelData();
mdlData_p->getMaterialNodePointer(getEyeballMaterialNo())->setMaterialAnm(mpMatAnm[0]);
}
#if DEBUG
return draw(chkAction(&daNpc_Doc_c::test), FALSE, mRealShadowSize, NULL, 100.0f, FALSE, FALSE, FALSE);
#else
return draw(FALSE, FALSE, mRealShadowSize, NULL, 100.0f, FALSE, FALSE, FALSE);
#endif
}
/* 809A75B0-809A75D0 000A10 0020+00 1/1 0/0 0/0 .text
* createHeapCallBack__11daNpc_Doc_cFP10fopAc_ac_c */
int daNpc_Doc_c::createHeapCallBack(fopAc_ac_c* i_this) {
return ((daNpc_Doc_c*)i_this)->CreateHeap();
}
/* 809A75D0-809A7628 000A30 0058+00 1/1 0/0 0/0 .text ctrlJointCallBack__11daNpc_Doc_cFP8J3DJointi
*/
int daNpc_Doc_c::ctrlJointCallBack(J3DJoint* i_joint, int param_1) {
if (param_1 == 0) {
J3DModel* mdl_p = j3dSys.getModel();
daNpc_Doc_c* actor = (daNpc_Doc_c*)mdl_p->getUserArea();
if (actor != NULL) {
actor->ctrlJoint(i_joint, mdl_p);
}
}
return 1;
}
/* 809A7628-809A7660 000A88 0038+00 1/1 0/0 0/0 .text getType__11daNpc_Doc_cFv */
int daNpc_Doc_c::getType() {
u8 r31 = fopAcM_GetParam(this) & 0xFF;
switch (r31) {
case 0:
return 0;
case 1:
return 1;
default:
return 2;
}
}
/* 809A7660-809A7694 000AC0 0034+00 1/1 0/0 0/0 .text isDelete__11daNpc_Doc_cFv */
int daNpc_Doc_c::isDelete() {
switch (mType) {
case 0:
return 0;
case 1:
return 0;
default:
return 0;
}
}
/* 809A7694-809A7918 000AF4 0284+00 1/1 0/0 0/0 .text reset__11daNpc_Doc_cFv */
void daNpc_Doc_c::reset() {
csXyz sp10;
u32 var_r29 = (uintptr_t)&field_0xfc8 - (uintptr_t)&field_0xfac;
if (mpMatAnm[0] != NULL) {
mpMatAnm[0]->initialize();
}
initialize();
memset(&field_0xfac, 0, var_r29);
if (getPathID() != 0xFF) {
mPath.initialize();
mPath.setPathInfo(getPathID(), fopAcM_GetRoomNo(this), 0);
}
sp10.setall(0);
sp10.y = home.angle.y;
switch (mType) {
case 0:
break;
case 1:
if (daNpcT_chkEvtBit(0x141)) {
field_0xfc4 = 1;
int temp_r29 = mPath.getNumPnts() - 1;
cXyz sp48(mPath.getPntPos(temp_r29));
cXyz sp3C(mPath.getPntPos(temp_r29 - 1));
home.pos = sp48;
home.angle.y = cLib_targetAngleY(&sp3C, &sp48);
sp10.y = home.angle.y;
setPos(home.pos);
}
break;
}
setAngle(sp10);
}
/* 809A7918-809A79A4 000D78 008C+00 1/0 0/0 0/0 .text afterJntAnm__11daNpc_Doc_cFi */
void daNpc_Doc_c::afterJntAnm(int i_joint) {
if (i_joint == 1) {
mDoMtx_stack_c::YrotM(mStagger.getAngleZ(1));
mDoMtx_stack_c::ZrotM(-mStagger.getAngleX(1));
} else if (i_joint == 4) {
mDoMtx_stack_c::YrotM(mStagger.getAngleZ(0));
mDoMtx_stack_c::ZrotM(-mStagger.getAngleX(0));
}
}
/* 809A79A4-809A7ABC 000E04 0118+00 1/0 0/0 0/0 .text setParam__11daNpc_Doc_cFv */
void daNpc_Doc_c::setParam() {
selectAction();
srchActors();
u32 attn_flags = fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e;
s16 talk_distance = mpHIO->m.common.talk_distance;
s16 talk_angle = mpHIO->m.common.talk_angle;
s16 attention_distance = mpHIO->m.common.attention_distance;
s16 attention_angle = mpHIO->m.common.attention_angle;
attention_info.distances[fopAc_attn_LOCK_e] = daNpcT_getDistTableIdx(attention_distance, attention_angle);
attention_info.distances[fopAc_attn_TALK_e] = attention_info.distances[fopAc_attn_LOCK_e];
attention_info.distances[fopAc_attn_SPEAK_e] = daNpcT_getDistTableIdx(talk_distance, talk_angle);
if (daPy_py_c::checkNowWolf()) {
attn_flags |= fopAc_AttnFlag_UNK_0x800000;
}
attention_info.flags = attn_flags;
scale.set(mpHIO->m.common.scale, mpHIO->m.common.scale, mpHIO->m.common.scale);
mCcStts.SetWeight(mpHIO->m.common.weight);
mCylH = mpHIO->m.common.height;
mWallR = mpHIO->m.common.width;
mAttnFovY = mpHIO->m.common.fov;
mAcchCir.SetWallR(mWallR);
mAcchCir.SetWallH(mpHIO->m.common.knee_length);
mRealShadowSize = mpHIO->m.common.real_shadow_size;
mExpressionMorfFrame = mpHIO->m.common.expression_morf_frame;
mMorfFrames = mpHIO->m.common.morf_frame;
gravity = mpHIO->m.common.gravity;
}
/* 809A7ABC-809A7BC4 000F1C 0108+00 1/0 0/0 0/0 .text checkChangeEvt__11daNpc_Doc_cFv */
BOOL daNpc_Doc_c::checkChangeEvt() {
if (!chkAction(&daNpc_Doc_c::talk)) {
mPreItemNo = 0;
if (dComIfGp_event_chkTalkXY()) {
if (dComIfGp_evmng_ChkPresentEnd()) {
mPreItemNo = dComIfGp_event_getPreItemNo();
if (mType == 1) {
if (mPreItemNo == fpcNm_ITEM_WOOD_STATUE) {
return 0;
}
if (!daNpcT_chkEvtBit(0x141) && mPreItemNo == fpcNm_ITEM_BILL) {
return 0;
}
}
mEvtNo = 1;
evtChange();
}
return true;
}
}
return false;
}
/* 809A7BC4-809A7C3C 001024 0078+00 1/0 0/0 0/0 .text setAfterTalkMotion__11daNpc_Doc_cFv
*/
void daNpc_Doc_c::setAfterTalkMotion() {
int idx = 9;
switch (mFaceMotionSeqMngr.getNo()) {
case 5:
idx = 8;
break;
}
mFaceMotionSeqMngr.setNo(idx, -1.0f, FALSE, 0);
}
/* 809A7C3C-809A7C40 00109C 0004+00 1/1 0/0 0/0 .text srchActors__11daNpc_Doc_cFv */
void daNpc_Doc_c::srchActors() {}
/* 809A7C40-809A7CE0 0010A0 00A0+00 1/0 0/0 0/0 .text evtTalk__11daNpc_Doc_cFv */
BOOL daNpc_Doc_c::evtTalk() {
if (chkAction(&daNpc_Doc_c::talk)) {
(this->*mAction)(NULL);
} else {
setAction(&daNpc_Doc_c::talk);
}
return TRUE;
}
/* 809A7CE0-809A7DA8 001140 00C8+00 1/0 0/0 0/0 .text evtCutProc__11daNpc_Doc_cFv */
BOOL daNpc_Doc_c::evtCutProc() {
int staffId = dComIfGp_getEventManager().getMyStaffId("Doc", this, -1);
if (staffId != -1) {
mStaffId = staffId;
int act_idx = dComIfGp_getEventManager().getMyActIdx(mStaffId, mCutNameList, 1, FALSE, FALSE);
if ((this->*mCutList[act_idx])(mStaffId)) {
dComIfGp_getEventManager().cutEnd(mStaffId);
}
return TRUE;
}
return FALSE;
}
/* 809A7DA8-809A7F3C 001208 0194+00 1/0 0/0 0/0 .text action__11daNpc_Doc_cFv */
void daNpc_Doc_c::action() {
fopAc_ac_c* actor_p = hitChk(&mCyl, 0xFFFFFFFF);
if (actor_p != NULL && mCyl.GetTgHitObj()->ChkAtType(AT_TYPE_THROW_OBJ)) {
mStagger.setParam(this, actor_p, mCurAngle.y);
setDamage(0, 9, 0);
mDamageTimerStart = 0;
mJntAnm.lookNone(1);
field_0xfc6 = 0;
}
if (mStagger.checkRebirth()) {
mStagger.initialize();
mMode = MODE_INIT;
}
if (field_0xfac) {
if (mAction == field_0xfac) {
(this->*mAction)(NULL);
} else {
setAction(field_0xfac);
}
}
}
/* 809A7F3C-809A80B8 00139C 017C+00 1/0 0/0 0/0 .text beforeMove__11daNpc_Doc_cFv */
// NONMATCHING - small regalloc with getOffHour
void daNpc_Doc_c::beforeMove() {
if (mType == 0 && field_0xe34 == 0) {
int hour = 0;
if (mTwilight != 0) {
hour = dKy_getDarktime_hour();
} else {
hour = dKy_getdaytime_hour();
}
mHide = 0;
if ((getOnHour() >= 0 && hour < getOnHour()) || (getOffHour() >= 0 && getOffHour() < hour)) {
mHide = 1;
}
}
fopAcM_OffStatus(this, fopAcM_STATUS_UNK_0x8000000);
if (checkHide()) {
fopAcM_OnStatus(this, fopAcM_STATUS_UNK_0x8000000);
}
if (checkHide() || mNoDraw) {
attention_info.flags = 0;
}
}
/* 809A80B8-809A83A8 001518 02F0+00 1/0 0/0 0/0 .text setAttnPos__11daNpc_Doc_cFv */
void daNpc_Doc_c::setAttnPos() {
cXyz pos(30.0f, 0.0f, 0.0f);
mStagger.calc(FALSE);
f32 rad = cM_s2rad((s16)(mCurAngle.y - field_0xd7e.y));
mJntAnm.setParam(this, mpMorf[0]->getModel(), &pos, getBackboneJointNo(), getNeckJointNo(), getHeadJointNo(),
mpHIO->m.common.body_angleX_min, mpHIO->m.common.body_angleX_max, mpHIO->m.common.body_angleY_min, mpHIO->m.common.body_angleY_max,
mpHIO->m.common.head_angleX_min, mpHIO->m.common.head_angleX_max, mpHIO->m.common.head_angleY_min, mpHIO->m.common.head_angleY_max,
mpHIO->m.common.neck_rotation_ratio, rad, NULL);
mJntAnm.calcJntRad(0.1f, 1.0f, rad);
setMtx();
mDoMtx_stack_c::copy(mpMorf[0]->getModel()->getAnmMtx(getHeadJointNo()));
mDoMtx_stack_c::multVec(&pos, &eyePos);
mJntAnm.setEyeAngleX(eyePos, 1.0f, -0x1000);
mJntAnm.setEyeAngleY(eyePos, mCurAngle.y, TRUE, 1.0f, 0);
pos.set(0.0f, 0.0f, 60.0f);
pos.y = mpHIO->m.common.attention_offset;
mDoMtx_stack_c::YrotS(mCurAngle.y);
mDoMtx_stack_c::multVec(&pos, &pos);
attention_info.position = pos + current.pos;
static cXyz prtclScl(1.0f, 1.0f, 1.0f);
setFootPos();
if (3.0f < speedF) {
setFootPrtcl(&prtclScl, 11.0f, 0.0f);
}
}
/* 809A83A8-809A8530 001808 0188+00 1/0 0/0 0/0 .text setCollision__11daNpc_Doc_cFv */
void daNpc_Doc_c::setCollision() {
cXyz pos;
if (!mHide) {
u32 co_s_prm = 0x79;
u32 tg_type = 0xD8FBFDFF;
u32 tg_s_prm = 0x1F;
if (mTwilight) {
tg_type = 0;
tg_s_prm = 0;
} else if (mStagger.checkStagger()) {
tg_type = 0;
tg_s_prm = 0;
}
mCyl.SetCoSPrm(co_s_prm);
mCyl.SetTgType(tg_type);
mCyl.SetTgSPrm(tg_s_prm);
mCyl.OnTgNoHitMark();
pos.set(0.0f, 0.0f, 20.0f);
f32 cyl_h = mCylH;
f32 wall_r = mWallR;
if (mType == 1) {
if (!daNpcT_chkEvtBit(0x141)) {
wall_r = 100.0f;
}
}
mDoMtx_stack_c::YrotS(mCurAngle.y);
mDoMtx_stack_c::multVec(&pos, &pos);
pos += current.pos;
mCyl.SetH(cyl_h);
mCyl.SetR(wall_r);
mCyl.SetC(pos);
dComIfG_Ccsp()->Set(&mCyl);
}
mCyl.ClrCoHit();
mCyl.ClrTgHit();
}
/* 809A8530-809A8538 001990 0008+00 1/0 0/0 0/0 .text drawDbgInfo__11daNpc_Doc_cFv */
BOOL daNpc_Doc_c::drawDbgInfo() {
return false;
}
/* 809A8538-809A8620 001998 00E8+00 1/1 0/0 0/0 .text selectAction__11daNpc_Doc_cFv */
BOOL daNpc_Doc_c::selectAction() {
field_0xfac = NULL;
switch (mType) {
case 1:
if (!daNpcT_chkEvtBit(0x11B) && field_0xfc4 == 0 && daNpcT_chkEvtBit(0x141)) {
field_0xfac = &daNpc_Doc_c::walk;
} else {
field_0xfac = &daNpc_Doc_c::wait;
}
break;
default:
field_0xfac = &daNpc_Doc_c::wait;
break;
}
return TRUE;
}
/* 809A8620-809A864C 001A80 002C+00 2/2 0/0 0/0 .text
* chkAction__11daNpc_Doc_cFM11daNpc_Doc_cFPCvPvPv_i */
int daNpc_Doc_c::chkAction(int (daNpc_Doc_c::*i_action)(void*)) {
return mAction == i_action;
}
/* 809A864C-809A86F4 001AAC 00A8+00 2/2 0/0 0/0 .text
* setAction__11daNpc_Doc_cFM11daNpc_Doc_cFPCvPvPv_i */
int daNpc_Doc_c::setAction(int (daNpc_Doc_c::*i_action)(void*)) {
mMode = MODE_EXIT;
if (mAction) {
(this->*mAction)(NULL);
}
mMode = MODE_ENTER;
mAction = i_action;
if (mAction) {
(this->*mAction)(NULL);
}
return 1;
}
/* 809A86F4-809A8A9C 001B54 03A8+00 2/0 0/0 0/0 .text wait__11daNpc_Doc_cFPv */
int daNpc_Doc_c::wait(void* param_0) {
switch (mMode) {
case 0:
case 1:
if (!mStagger.checkStagger()) {
if (field_0xfc6 != 0 && !daPy_py_c::checkNowWolf()) {
mFaceMotionSeqMngr.setNo(9, -1.0f, 0, 0);
mMotionSeqMngr.setNo(0xB, -1.0f, 0, 0);
field_0xfc6 = 0;
} else {
mFaceMotionSeqMngr.setNo(9, -1.0f, 0, 0);
mMotionSeqMngr.setNo(0, -1.0f, 0, 0);
}
mMode = 2;
}
case 2:
if (mType == 1 && !daNpcT_chkEvtBit(0x7A)) {
mSpeakEvent = 1;
field_0xe33 = 1;
}
if (!mStagger.checkStagger()) {
if (mMotionSeqMngr.getNo() == 11) {
mJntAnm.lookNone(0);
if (mMotionSeqMngr.checkEndSequence()) {
mMode = 1;
}
attention_info.flags = 0;
} else {
if (daPy_py_c::checkNowWolf()) {
mPlayerActorMngr.remove();
}
if (mPlayerActorMngr.getActorP() != NULL) {
mJntAnm.lookPlayer(0);
if (!chkActorInSight(mPlayerActorMngr.getActorP(), mAttnFovY, mCurAngle.y)) {
mJntAnm.lookNone(0);
}
if (!srchPlayerActor() && home.angle.y == mCurAngle.y) {
mMode = 1;
}
} else {
mJntAnm.lookNone(0);
if (home.angle.y != mCurAngle.y) {
if (field_0xe34 != 0) {
if (step(home.angle.y, -1, -1, 0x1E, 0)) {
mMode = 1;
field_0xfc6 = 0;
}
} else {
setAngle(home.angle.y);
mMode = 1;
field_0xfc6 = 0;
}
attention_info.flags = 0;
} else if (!mTwilight) {
srchPlayerActor();
}
}
}
switch (mJntAnm.getMode()) {
case 0:
break;
}
}
break;
case 3:
break;
}
return 1;
}
/* 809A8A9C-809A8C78 001EFC 01DC+00 1/0 0/0 0/0 .text walk__11daNpc_Doc_cFPv */
int daNpc_Doc_c::walk(void* param_0) {
switch (mMode) {
case 0:
case 1:
if (!mStagger.checkStagger()) {
mFaceMotionSeqMngr.setNo(9, -1.0f, 0, 0);
mMotionSeqMngr.setNo(0xC, -1.0f, 0, 0);
mAcch.SetWallNone();
mMode = 2;
}
/* fallthrough */
case 2:
if (!mStagger.checkStagger()) {
cXyz sp20;
mJntAnm.lookNone(0);
JUT_ASSERT(1731, NULL != mPath.getPathInfo());
int var_r29 = mPath.getDstPosH(current.pos, &sp20, mPath.getNumPnts(), 2);
calcSpeedAndAngle(sp20, var_r29, 4, 0x800);
if (var_r29 != 0 && cM3d_IsZero(speedF)) {
field_0xfc4 = 1;
home.angle.y = current.angle.y;
mPlayerActorMngr.remove();
}
}
attention_info.flags = 0;
break;
case 3:
mAcch.ClrWallNone();
break;
}
return 1;
}
/* 809A8C78-809A904C 0020D8 03D4+00 3/0 0/0 0/0 .text talk__11daNpc_Doc_cFPv */
int daNpc_Doc_c::talk(void* param_0) {
switch (mMode) {
case MODE_ENTER:
case MODE_INIT:
if (!mStagger.checkStagger()) {
if (mPreItemNo == fpcNm_ITEM_BILL) {
initTalk(0x43F, NULL);
} else if (mPreItemNo == fpcNm_ITEM_WOOD_STATUE) {
initTalk(0x447, NULL);
} else {
initTalk(mFlowNodeNo, NULL);
}
field_0xfc5 = 0;
if (daPy_py_c::checkNowWolf() || (field_0xfc4 == 1 && mPreItemNo == 0)) {
field_0xfc5 = 1;
}
field_0xfc6 = 0;
mMode = 2;
}
// fallthrough
case MODE_RUN:
if (!mStagger.checkStagger()) {
if (mTwilight || mPlayerAngle == mCurAngle.y || daPy_py_c::checkNowWolf() || (field_0xfc4 == 1 && mPreItemNo == 0 && (!daNpcT_chkEvtBit(0x120) || daNpcT_chkEvtBit(0x164)))) {
mJntAnm.lookNone(0);
if (field_0xfc5 == 0) {
mMotionSeqMngr.setNo(0xA, -1.0f, 0, 0);
field_0xfc5 = 1;
field_0xfc6 = 1;
} else {
if (mMotionSeqMngr.getNo() != 10 || mMotionSeqMngr.checkEndSequence()) {
int sp8[] = {-1, -1};
if (mPreItemNo == fpcNm_ITEM_BILL) {
sp8[0] = 0x1457;
} else if (mPreItemNo == fpcNm_ITEM_WOOD_STATUE) {
sp8[0] = 0x146E;
if (daNpcT_chkEvtBit(0x163)) {
sp8[0] = 0x1472;
}
}
if (talkProc(sp8, 0, NULL, 0)) {
if (!mFlow.checkEndFlow()) {
daPy_getPlayerActorClass()->changeOriginalDemo();
daPy_getPlayerActorClass()->changeDemoMode(6, 0, 1, 0);
} else {
mPlayerActorMngr.entry(daPy_getPlayerActorClass());
dComIfGp_event_reset();
mMode = 3;
}
}
}
mJntAnm.lookPlayer(0);
if (mTwilight || daPy_py_c::checkNowWolf() || (field_0xfc4 == 1 && mPreItemNo == 0 && (!daNpcT_chkEvtBit(0x120) || daNpcT_chkEvtBit(0x164)))) {
mJntAnm.lookNone(0);
}
}
} else {
step(mPlayerAngle, -1, -1, 0x1E, 0);
}
}
break;
case 3:
break;
}
return 0;
}
/* 809A904C-809A906C 0024AC 0020+00 1/0 0/0 0/0 .text daNpc_Doc_Create__FPv */
static int daNpc_Doc_Create(void* i_this) {
return ((daNpc_Doc_c*)i_this)->create();
}
/* 809A906C-809A908C 0024CC 0020+00 1/0 0/0 0/0 .text daNpc_Doc_Delete__FPv */
static int daNpc_Doc_Delete(void* i_this) {
return ((daNpc_Doc_c*)i_this)->Delete();
}
/* 809A908C-809A90AC 0024EC 0020+00 1/0 0/0 0/0 .text daNpc_Doc_Execute__FPv */
static int daNpc_Doc_Execute(void* i_this) {
return ((daNpc_Doc_c*)i_this)->Execute();
}
/* 809A90AC-809A90CC 00250C 0020+00 1/0 0/0 0/0 .text daNpc_Doc_Draw__FPv */
static int daNpc_Doc_Draw(void* i_this) {
return ((daNpc_Doc_c*)i_this)->Draw();
}
/* 809A90CC-809A90D4 00252C 0008+00 1/0 0/0 0/0 .text daNpc_Doc_IsDelete__FPv */
static int daNpc_Doc_IsDelete(void* i_this) {
return 1;
}
/* 809AA8FC-809AA91C -00001 0020+00 1/0 0/0 0/0 .data daNpc_Doc_MethodTable */
static actor_method_class daNpc_Doc_MethodTable = {
(process_method_func)daNpc_Doc_Create,
(process_method_func)daNpc_Doc_Delete,
(process_method_func)daNpc_Doc_Execute,
(process_method_func)daNpc_Doc_IsDelete,
(process_method_func)daNpc_Doc_Draw,
};
/* 809AA91C-809AA94C -00001 0030+00 0/0 0/0 1/0 .data g_profile_NPC_DOC */
extern actor_process_profile_definition g_profile_NPC_DOC = {
fpcLy_CURRENT_e, // mLayerID
7, // mListID
fpcPi_CURRENT_e, // mListPrio
PROC_NPC_DOC, // mProcName
&g_fpcLf_Method.base, // sub_method
sizeof(daNpc_Doc_c), // mSize
0, // mSizeOther
0, // mParameters
&g_fopAc_Method.base, // sub_method
335, // mPriority
&daNpc_Doc_MethodTable, // sub_method
0x00040107, // mStatus
fopAc_NPC_e, // mActorType
fopAc_CULLBOX_CUSTOM_e, // cullType
};
AUDIO_INSTANCES;
|