forked from zeldaret/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathd_a_npc_zra.cpp
More file actions
2695 lines (2428 loc) · 86 KB
/
d_a_npc_zra.cpp
File metadata and controls
2695 lines (2428 loc) · 86 KB
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
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* d_a_npc_zra.cpp
* NPC - Zora
*/
#include "d/actor/d_a_npc_zra.h"
#include "SSystem/SComponent/c_math.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "f_op/f_op_actor_mng.h"
#include "f_op/f_op_kankyo_mng.h"
#include "d/d_com_inf_game.h"
#include "d/d_meter2_info.h"
#include "d/d_procname.h"
#include "d/actor/d_a_canoe.h"
#include "d/actor/d_a_npc_hoz.h"
#include "d/actor/d_a_obj_zraMark.h"
//
// Declarations:
//
/* 80B8DA48-80B8DA4C 000008 0001+03 1/1 0/0 0/0 .bss @1109 */
static u8 lit_1109[1 + 3 /* padding */];
/* 80B8DA4C-80B8DA50 00000C 0001+03 0/0 0/0 0/0 .bss @1107 */
#pragma push
#pragma force_active on
static u8 lit_1107[1 + 3 /* padding */];
#pragma pop
/* 80B8DA50-80B8DA54 000010 0001+03 0/0 0/0 0/0 .bss @1105 */
#pragma push
#pragma force_active on
static u8 lit_1105[1 + 3 /* padding */];
#pragma pop
/* 80B8DA54-80B8DA58 000014 0001+03 0/0 0/0 0/0 .bss @1104 */
#pragma push
#pragma force_active on
static u8 lit_1104[1 + 3 /* padding */];
#pragma pop
/* 80B8DA58-80B8DA5C 000018 0001+03 0/0 0/0 0/0 .bss @1099 */
#pragma push
#pragma force_active on
static u8 lit_1099[1 + 3 /* padding */];
#pragma pop
/* 80B8DA5C-80B8DA60 00001C 0001+03 0/0 0/0 0/0 .bss @1097 */
#pragma push
#pragma force_active on
static u8 lit_1097[1 + 3 /* padding */];
#pragma pop
/* 80B8DA60-80B8DA64 000020 0001+03 0/0 0/0 0/0 .bss @1095 */
#pragma push
#pragma force_active on
static u8 lit_1095[1 + 3 /* padding */];
#pragma pop
/* 80B8DA64-80B8DA68 000024 0001+03 0/0 0/0 0/0 .bss @1094 */
#pragma push
#pragma force_active on
static u8 lit_1094[1 + 3 /* padding */];
#pragma pop
/* 80B8DA68-80B8DA6C 000028 0001+03 0/0 0/0 0/0 .bss @1057 */
#pragma push
#pragma force_active on
static u8 lit_1057[1 + 3 /* padding */];
#pragma pop
/* 80B8DA6C-80B8DA70 00002C 0001+03 0/0 0/0 0/0 .bss @1055 */
#pragma push
#pragma force_active on
static u8 lit_1055[1 + 3 /* padding */];
#pragma pop
/* 80B8DA70-80B8DA74 000030 0001+03 0/0 0/0 0/0 .bss @1053 */
#pragma push
#pragma force_active on
static u8 lit_1053[1 + 3 /* padding */];
#pragma pop
/* 80B8DA74-80B8DA78 000034 0001+03 0/0 0/0 0/0 .bss @1052 */
#pragma push
#pragma force_active on
static u8 lit_1052[1 + 3 /* padding */];
#pragma pop
/* 80B8DA78-80B8DA7C 000038 0001+03 0/0 0/0 0/0 .bss @1014 */
#pragma push
#pragma force_active on
static u8 lit_1014[1 + 3 /* padding */];
#pragma pop
/* 80B8DA7C-80B8DA80 00003C 0001+03 0/0 0/0 0/0 .bss @1012 */
#pragma push
#pragma force_active on
static u8 lit_1012[1 + 3 /* padding */];
#pragma pop
/* 80B8DA80-80B8DA84 000040 0001+03 0/0 0/0 0/0 .bss @1010 */
#pragma push
#pragma force_active on
static u8 lit_1010[1 + 3 /* padding */];
#pragma pop
/* 80B8DA84-80B8DA88 000044 0001+03 0/0 0/0 0/0 .bss @1009 */
#pragma push
#pragma force_active on
static u8 lit_1009[1 + 3 /* padding */];
#pragma pop
/* 80B8DA94-80B8DA98 000054 0004+00 1/1 0/0 0/0 .bss l_HIO */
static daNpc_zrA_Param_c l_HIO;
/* 80B8C458-80B8C508 000000 00B0+00 56/56 0/0 0/0 .rodata m__17daNpc_zrA_Param_c */
daNpc_zrA_Param_c::param const daNpc_zrA_Param_c::m = {
230.0f, // mAttnOffsetY
-3.0f, // mGravity
1.0f, // mScale
800.0f, // mShadowDepth
255.0f, // mCcWeight
230.0f, // mCylH
0.0f, // mWallH
40.0f, // mWallR
30.0f, // mBodyUpAngle
-20.0f, // mBodyDownAngle
30.0f, // mBodyLeftAngle
-30.0f, // mBodyRightAngle
15.0f, // mHeadUpAngle
0.0f, // mHeadDownAngle
0.0f, // mHeadLeftAngle
0.0f, // mHeadRightAngle
0.6f, // mNeckAngleScl
12.0f, // mMorfFrames
3, // mSpeakDistIdx
6, // mSpeakAngleIdx
5, // mTalkDistIdx
6, // mTalkAngleIdx
80.0f, // mAttnFovY
500.0f, // mAttnRadius
300.0f, // mAttnUpperY
-300.0f, // mAttnLowerY
60,
8, // mDamageTimer
0, // mTestExpression
0, // mTestMotion
0, // mTestLookMode
false, // mTest
20.0f, // mSwimSpeed
0.5f, // mMinSwimSpeedScale
0x580, // mSwimAngleSpeed
15.0f, // mSwimAnmRate
0.0f,
0.0f,
1.5f, // mMaxScaleFactor
150.0f, // mMinDepth
100.0f,
20.0f,
4.0f, // mWalkSpeed
0x800, // mWalkAngleSpeed
2, // mWalkAngleScale
6.0f, // mWalkAnmRate
140.0f,
350.0f,
5000.0f,
3000.0f,
};
/* 80B7850C-80B78730 0000EC 0224+00 8/8 0/0 0/0 .text
* getDstPosDst2__16daNpc_zrA_Path_cF4cXyzR4cXyz */
BOOL daNpc_zrA_Path_c::getDstPosDst2(cXyz i_pos, cXyz& o_pnt) {
BOOL ret = false;
o_pnt = getPntPos(getIdx());
if (chkPassedDst(i_pos)) {
ret = true;
if (!setNextIdx()) {
o_pnt = getPntPos(getIdx());
mPosDst = (i_pos - o_pnt).abs();
mPosition = i_pos;
}
}
return ret;
}
/* 80B7876C-80B788F8 00034C 018C+00 4/4 0/0 0/0 .text setNextIdxDst__16daNpc_zrA_Path_cF4cXyz */
void daNpc_zrA_Path_c::setNextIdxDst(cXyz param_0) {
if (!setNextIdx()) {
mPosDst = (param_0 - getPntPos(getIdx())).abs();
mPosition = param_0;
}
}
/* 80B788F8-80B78A60 0004D8 0168+00 1/1 0/0 0/0 .text chkPassedDstXZ__16daNpc_zrA_Path_cF4cXyz */
BOOL daNpc_zrA_Path_c::chkPassedDstXZ(cXyz i_pos) {
return mPosDst + field_0x10 <= (mPosition - i_pos).absXZ();
}
/* 80B78A60-80B78CA0 000640 0240+00 1/1 0/0 0/0 .text
* getDstPosDstXZ__16daNpc_zrA_Path_cF4cXyzR4cXyz */
BOOL daNpc_zrA_Path_c::getDstPosDstXZ(cXyz i_pos, cXyz& o_pnt) {
BOOL ret = false;
o_pnt = getPntPos(getIdx());
if (chkPassedDstXZ(i_pos)) {
if (setNextIdx()) {
ret = true;
} else {
o_pnt = getPntPos(getIdx());
mPosDst = (i_pos - o_pnt).absXZ();
mPosition = i_pos;
}
}
return ret;
}
/* 80B78CA0-80B78CFC 000880 005C+00 1/1 0/0 0/0 .text chkPassedChase__16daNpc_zrA_Path_cFUs4cXyz
*/
BOOL daNpc_zrA_Path_c::chkPassedChase(u16 i_idx, cXyz i_pos) {
return daNpcF_chkPassed(i_pos, (dPnt*)mpRoomPath->m_points, i_idx,
mpRoomPath->m_num, mIsClosed, mIsReversed);
}
/* 80B78CFC-80B78E08 0008DC 010C+00 1/1 0/0 0/0 .text
* getDstPosChase__16daNpc_zrA_Path_cFUs4cXyzR4cXyz */
int daNpc_zrA_Path_c::getDstPosChase(u16 i_idx, cXyz i_pos, cXyz& o_pnt) {
BOOL done = false;
while (!done) {
o_pnt = getPntPos(i_idx);
if (!chkPassedChase(i_idx, i_pos)) {
break;
}
if (mIsReversed) {
if (i_idx == 0) {
done = true;
} else {
i_idx--;
}
} else {
if (i_idx == getEndIdx()) {
done = true;
} else {
i_idx++;
}
}
}
return i_idx;
}
/* 80B78E08-80B7956C 0009E8 0764+00 1/1 0/0 0/0 .text chkPassDst__16daNpc_zrA_Path_cFUs4cXyz */
f32 daNpc_zrA_Path_c::chkPassDst(u16 i_idx, cXyz i_pos) {
u16 prev_idx, next_idx;
dPnt* points = mpRoomPath->m_points;
u16 idx = mIdx;
u8 reversed = mIsReversed;
mIdx = i_idx;
mIsReversed = false;
next_idx = getNextIdx();
mIdx = i_idx;
prev_idx = getBeforeIdx();
mIdx = idx;
mIsReversed = reversed;
cXyz prev_pos, cur_pos, next_pos, pos;
prev_pos.set(points[prev_idx].m_position.x,
points[prev_idx].m_position.y,
points[prev_idx].m_position.z);
cur_pos.set(points[i_idx].m_position.x,
points[i_idx].m_position.y,
points[i_idx].m_position.z);
next_pos.set(points[next_idx].m_position.x,
points[next_idx].m_position.y,
points[next_idx].m_position.z);
f32 dist;
s16 angle;
if (prev_idx != i_idx || next_idx != i_idx) {
if (prev_idx < i_idx && i_idx < next_idx) {
dist = (next_pos - prev_pos).absXZ();
angle = cM_atan2s(next_pos.x - prev_pos.x, next_pos.z - prev_pos.z);
pos = prev_pos;
prev_pos.x = pos.x + dist * -1.0f * cM_ssin(angle);
prev_pos.z = pos.z + dist * -1.0f * cM_scos(angle);
next_pos.x = pos.x + dist * 2.0f * cM_ssin(angle);
next_pos.z = pos.z + dist * 2.0f * cM_scos(angle);
} else if (prev_idx < i_idx) {
dist = (cur_pos - prev_pos).absXZ();
angle = cM_atan2s(cur_pos.x - prev_pos.x, cur_pos.z - prev_pos.z);
pos = cur_pos;
prev_pos.x = pos.x + dist * -2.0f * cM_ssin(angle);
prev_pos.z = pos.z + dist * -2.0f * cM_scos(angle);
next_pos.x = pos.x + dist * 2.0f * cM_ssin(angle);
next_pos.z = pos.z + dist * 2.0f * cM_scos(angle);
} else if (i_idx < next_idx) {
dist = (next_pos - cur_pos).absXZ();
angle = cM_atan2s(next_pos.x - cur_pos.x, next_pos.z - cur_pos.z);
pos = cur_pos;
prev_pos.x = pos.x + dist * -2.0f * cM_ssin(angle);
prev_pos.z = pos.z + dist * -2.0f * cM_scos(angle);
next_pos.x = pos.x + dist * 2.0f * cM_ssin(angle);
next_pos.z = pos.z + dist * 2.0f * cM_scos(angle);
}
f32 proj_x, proj_z, proj2_x, proj2_z;
daNpcF_pntVsLineSegmentLengthSquare2D(i_pos.x, i_pos.z, prev_pos.x, prev_pos.z,
next_pos.x, next_pos.z, &proj_x, &proj_z, &dist);
if (cM3d_IsZero(dist)) {
return -1e9f;
} else {
daNpcF_pntVsLineSegmentLengthSquare2D(cur_pos.x, cur_pos.z, prev_pos.x, prev_pos.z,
next_pos.x, next_pos.z, &proj2_x, &proj2_z, &dist);
s16 angle2;
if (mIsReversed) {
angle2 = cM_atan2s(prev_pos.x - next_pos.x, prev_pos.z - next_pos.z);
} else {
angle2 = cM_atan2s(next_pos.x - prev_pos.x, next_pos.z - prev_pos.z);
}
s16 angle_diff = angle2 - cM_atan2s(proj2_x - proj_x, proj2_z - proj_z);
dist = JMAFastSqrt((proj2_x - proj_x) * (proj2_x - proj_x)
+ (proj2_z - proj_z) * (proj2_z - proj_z));
if ((u16)abs(angle_diff) > 0x4000) {
return dist;
} else {
return -dist;
}
}
} else {
return -1e9f;
}
}
/* 80B8CE90-80B8CE9C 000000 000C+00 10/10 0/0 0/0 .data cNullVec__6Z2Calc */
static u8 cNullVec__6Z2Calc[12] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
/* 80B8CE9C-80B8CEB4 00000C 0004+14 0/0 0/0 0/0 .data @1787 */
static u32 lit_1787[1 + 5 /* padding */] = {
0x02000201,
/* padding */
0x40080000,
0x00000000,
0x3FE00000,
0x00000000,
0x00000000,
};
/* 80B8CEB4-80B8CEE4 000024 0030+00 0/1 0/0 0/0 .data l_bmdGetParamList */
static daNpc_GetParam1 l_bmdGetParamList[6] = {
{3, 4}, // zra
{13, 5}, // zra_tw
{3, 7}, // zra_met
{4, 7}, // zra_sp
{3, 10}, // zra_met_tw
{4, 10}, // zra_sp_tw
};
/* 80B8CEE4-80B8D0DC 000054 01F8+00 1/2 0/0 0/0 .data l_bckGetParamList */
static daNpc_GetParam1 l_bckGetParamList[63] = {
{-1, 0},
{8, 0}, // zra_f_talk_a
{9, 0}, // zra_f_talk_a_sp
{11, 0}, // zra_f_wait_swim
{10, 0}, // zra_f_talk_nomal
{13, 0}, // zra_fh_talk_nomal
{5, 5}, // zra_fh_sadsit_a
{4, 6}, // zra_fh_sadsit_b
{5, 6}, // zra_fh_sadsit_c
{6, 5}, // zra_fh_sadsit_d
{7, 5}, // zra_fh_sadsit_e
{5, 3}, // zra_f_looking_sp
{8, 3}, // zra_fh_looking_sp
{4, 9}, // zra_f_lookup
{7, 9}, // zra_fh_lookup
{7, 3}, // zra_f_talk_swim_sp
{6, 3}, // zra_f_talk_b_sp
{5, 9}, // zra_f_spa_talk_a
{8, 9}, // zra_fh_spa_wait_a
{6, 9}, // zra_f_spa_talk_b
{9, 9}, // zra_fh_spa_wait_b
{17, 0}, // zra_swim_turn
{14, 0}, // zra_still
{12, 0}, // zra_fallswim
{16, 0}, // zra_swim_talk
{8, 5}, // zra_sadsit_a
{6, 6}, // zra_sadsit_b
{7, 6}, // zra_sadsit_c
{9, 5}, // zra_sadsit_d
{10, 5}, // zra_sadsit_e
{4, 8}, // zra_tobikomi_s
{5, 8}, // zra_tobikomi_t
{3, 8}, // zra_tobikomi_e
{11, 3}, // zra_looking_sp
{17, 3}, // zra_talk_swim_sp
{16, 3}, // zra_talk_b_sp
{10, 9}, // zra_lookup
{14, 9}, // zra_spa_wait_b
{12, 9}, // zra_spa_talk_b
{13, 9}, // zra_spa_wait_a
{11, 9}, // zra_spa_talk_a
{5, 2}, // zra_wait_a
{10, 1}, // zra_walk_a
{4, 2}, // zra_talk_a
{7, 1}, // zra_swim_a
{8, 1}, // zra_swim_b
{9, 1}, // zra_wait_swim
{3, 1}, // zra_dive
{4, 1}, // zra_dive_b
{5, 1}, // zra_float
{6, 1}, // zra_float_b
{3, 2}, // zra_step
{18, 3}, // zra_wait_sp
{20, 3}, // zra_walk_a_sp
{15, 3}, // zra_talk_a_sp
{13, 3}, // zra_swim_a_sp
{14, 3}, // zra_swim_b_sp
{19, 3}, // zra_wait_swim_sp
{4, 3}, // zra_dive_sp
{3, 3}, // zra_dive_b_sp
{10, 3}, // zra_float_sp
{9, 3}, // zra_float_b_sp
{12, 3}, // zra_step_sp
};
/* 80B8D0DC-80B8D11C 00024C 0040+00 1/1 0/0 0/0 .data l_btpGetParamList */
static daNpc_GetParam1 l_btpGetParamList[8] = {
{34, 0}, // zra
{16, 5}, // zra_fh_sadsit_a
{10, 6}, // zra_fh_sadsit_b
{11, 6}, // zra_fh_sadsit_c
{17, 5}, // zra_fh_sadsit_d
{18, 5}, // zra_fh_sadsit_e
{17, 9}, // zra_f_spa_talk_b
{18, 9}, // zra_fh_spa_wait_b
};
/* 80B8D11C-80B8D13C 00028C 0020+00 1/3 0/0 0/0 .data l_btkGetParamList */
static daNpc_GetParam1 l_btkGetParamList[4] = {
{28, 0}, // zra
{31, 0}, // zra_water02
{29, 0}, // zra_reset
{30, 0}, // zra_w_eyeball
};
/* 80B8D13C-80B8D14C 0002AC 0010+00 0/1 0/0 0/0 .data l_brkGetParamList */
static daNpc_GetParam1 l_brkGetParamList[2] = {
{24, 0}, // zra
{25, 0}, // zra_water02
};
/* 80B8D14C-80B8D15C 0002BC 0010+00 0/1 0/0 0/0 .data l_bpkGetParamList */
static daNpc_GetParam1 l_bpkGetParamList[2] = {
{20, 0}, // zra
{21, 0}, // zra_water02
};
/* 80B8D15C-80B8D1C4 0002CC 0068+00 0/3 0/0 0/0 .data l_evtGetParamList */
static daNpc_GetParam1 l_evtGetParamList[13] = {
{0, 0},
{1, 0},
{2, 0},
{3, 0},
{4, 0},
{5, 0},
{6, 0},
{7, 0},
{8, 0},
{9, 0},
{10, 0},
{11, 0},
{12, 0},
};
/* 80B8D1C4-80B8D1F8 -00001 0034+00 1/4 0/0 0/0 .data l_evtNames */
static char* l_evtNames[13] = {
NULL,
"TALK_SWIM",
"BEFORE_BLAST_ZRR",
"AFTER_BLAST_ZRR",
"THANKS_BLAST",
"RESULT_ANNOUNCE",
"CARRY_WATERFALL",
"CARRY_WATERFALL_NIGHT",
"CARRY_WATERFALL_SKIP",
"CARRY_WATERFALL_NIGHT_SKIP",
"SEARCH_PRINCE",
"TALK_MULTI",
"TALK_MULTI2",
};
/* 80B8D1F8-80B8D21C 000368 0024+00 0/1 0/0 0/0 .data l_loadObj_list */
static int l_loadObj_list[3][3] = {
{2, 3, -1},
{2, -1, -1},
{-1, -1, -1},
};
/* 80B8D21C-80B8D240 00038C 0024+00 0/1 0/0 0/0 .data l_loadObj_listTW */
static int l_loadObj_listTW[3][3] = {
{4, 5, -1},
{4, -1, -1},
{-1, -1, -1},
};
/* 80B8D240-80B8D260 0003B0 0020+00 1/0 0/0 0/0 .data l_loadRes_ZRAa */
static int l_loadRes_ZRAa[8] = {0, 1, 2, 4, 6, -1, -1, -1};
/* 80B8D260-80B8D280 0003D0 0020+00 1/0 0/0 0/0 .data l_loadRes_Swim */
static int l_loadRes_Swim[8] = {0, 1, 2, 4, -1, -1, -1, -1};
/* 80B8D280-80B8D2A0 0003F0 0020+00 1/0 0/0 0/0 .data l_loadRes_Tobi */
static int l_loadRes_Tobi[8] = {0, 1, 2, 4, 8, -1, -1, -1};
/* 80B8D2A0-80B8D2C0 000410 0020+00 1/0 0/0 0/0 .data l_loadRes_Spa */
static int l_loadRes_Spa[8] = {0, 2, 4, 9, -1, -1, -1, -1};
/* 80B8D2C0-80B8D2E0 000430 0020+00 1/0 0/0 0/0 .data l_loadRes_ZRA0 */
static int l_loadRes_ZRA0[8] = {0, 1, 2, 4, -1, -1, -1, -1};
/* 80B8D2E0-80B8D300 -00001 0020+00 2/2 0/0 0/0 .data l_loadRes_list */
static int* l_loadRes_list[8] = {
l_loadRes_ZRAa, l_loadRes_Swim, l_loadRes_Swim, l_loadRes_Swim,
l_loadRes_Tobi, l_loadRes_Tobi, l_loadRes_Spa, l_loadRes_ZRA0,
};
/* 80B8D300-80B8D32C -00001 002C+00 5/11 0/0 0/0 .data l_resNames */
static char* l_resNames[11] = {
"zrA",
"zrA_nml",
"zrA_nml2",
"zrA_sp",
"zrA_MDL",
"zrA_TW",
"zrA_sad",
"zrA_obj",
"zrA_tobi",
"zrA2",
"zrA_objTW",
};
/* 80B8D32C-80B8D33C -00001 0010+00 1/2 0/0 0/0 .data l_myName */
static char* l_myName[4] = {
"zrA",
"zrA_talk",
"zrR",
"zrWF",
};
/* 80B8D33C-80B8D368 -00001 002C+00 0/1 0/0 0/0 .data mEvtCutNameList__11daNpc_zrA_c */
char* daNpc_zrA_c::mEvtCutNameList[11] = {
"",
"TALK_SWIM",
"BEFORE_BLAST_ZRR",
"AFTER_BLAST_ZRR",
"THANKS_BLAST",
"RESULT_ANNOUNCE",
"CARRY_WATERFALL",
"CARRY_WATERFALL_SKIP",
"SEARCH_PRINCE1",
"SEARCH_PRINCE2",
"TALK_MULTI",
};
daNpc_zrA_c::EventFn daNpc_zrA_c::mEvtCutList[11] = {
NULL,
&ECut_talkSwim,
&ECut_beforeBlastzrR,
&ECut_afterBlastzrR,
&ECut_thanksBlast,
&ECut_resultAnnounce,
&ECut_carryWaterfall,
&ECut_carryWaterfallSkip,
&ECut_searchPrince1,
&ECut_searchPrince2,
&ECut_talkMulti,
};
/* 80B7956C-80B79798 00114C 022C+00 1/1 0/0 0/0 .text __ct__11daNpc_zrA_cFv */
// NONMATCHING daNpcF_c needs to not be inlined
daNpc_zrA_c::daNpc_zrA_c() {
/* empty function */
}
/* 80B79828-80B79B58 001408 0330+00 1/0 0/0 0/0 .text __dt__11daNpc_zrA_cFv */
daNpc_zrA_c::~daNpc_zrA_c() {
int i;
for (i = 0; l_loadRes_list[mType][i] >= 0; i++) {
int res_no = l_loadRes_list[mType][i];
if (res_no == 4) {
if (mTwilight) {
res_no = 5;
}
} else if (res_no == 1) {
if (mSoldierType == SOLDIER_SPEAR) {
res_no = 3;
}
}
dComIfG_resDelete(&mPhase[i], l_resNames[res_no]);
}
if (mSoldierType != SOLDIER_NONE) {
if (mTwilight) {
dComIfG_resDelete(&mPhase[i], l_resNames[10]);
} else {
dComIfG_resDelete(&mPhase[i], l_resNames[7]);
}
}
if (heap != NULL) {
mpMorf->stopZelAnime();
}
}
/* 80B79B58-80B79F38 001738 03E0+00 1/1 0/0 0/0 .text create__11daNpc_zrA_cFv */
cPhs__Step daNpc_zrA_c::create() {
fopAcM_SetupActor(this, daNpc_zrA_c);
mType = getTypeFromArgument();
if (home.angle.x != 0xffff) {
mFlowID = home.angle.x;
} else {
mFlowID = -1;
}
mSoldierType = getSoldierTypeFromParam();
mGameMode = getGameModeFromParam();
mSwitch1 = (u8)home.angle.z;
mSwitch2 = (u8)((u16)home.angle.z >> 8);
mTwilight = dKy_darkworld_check();
if (isDelete()) {
return cPhs_ERROR_e;
}
int res_count = 0;
cPhs__Step step;
int i;
for (i = 0; l_loadRes_list[mType][i] >= 0; i++) {
int res_no = l_loadRes_list[mType][i];
if (res_no == 4) {
if (mTwilight) {
res_no = 5;
}
} else if (res_no == 1) {
if (mSoldierType == SOLDIER_SPEAR) {
res_no = 3;
}
}
step = (cPhs__Step)dComIfG_resLoad(&mPhase[i], l_resNames[res_no]);
if (step == cPhs_ERROR_e || step == cPhs_UNK3_e) {
return cPhs_ERROR_e;
}
if (step == cPhs_COMPLEATE_e) {
res_count++;
}
}
if (mSoldierType != SOLDIER_NONE) {
if (mTwilight) {
step = (cPhs__Step)dComIfG_resLoad(&mPhase[i], l_resNames[10]);
} else {
step = (cPhs__Step)dComIfG_resLoad(&mPhase[i], l_resNames[7]);
}
if (step == cPhs_ERROR_e || step == cPhs_UNK3_e) {
return cPhs_ERROR_e;
}
if (step == cPhs_COMPLEATE_e) {
res_count++;
}
i++;
}
if (res_count == i) {
if (!fopAcM_entrySolidHeap(this, createHeapCallBack, 0x80007280)) {
return cPhs_ERROR_e;
}
fopAcM_SetMtx(this, mpMorf->getModel()->getBaseTRMtx());
fopAcM_setCullSizeBox(this, -300.0f, -50.0f, -300.0f, 300.0f, 450.0f, 300.0f);
mCreatureSound.init(¤t.pos, &eyePos, 3, 1);
mAcchCir.SetWall(daNpc_zrA_Param_c::m.mWallR, daNpc_zrA_Param_c::m.mWallH);
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));
mPaPo.init(&mAcch, daNpc_zrA_Param_c::m.mCylH, daNpc_zrA_Param_c::m.mCylH);
mCcStts.Init(daNpc_zrA_Param_c::m.mCcWeight, 0, this);
mCcCyl.Set(mCcDCyl);
mCcCyl.SetStts(&mCcStts);
mCcCyl.SetTgHitCallback(tgHitCallBack);
mAcch.SetWtrChkMode(2);
mAcch.CrrPos(dComIfG_Bgsp());
mGndChk = mAcch.m_gnd;
mGroundH = mAcch.GetGroundH();
setEnvTevColor();
setRoomNo();
reset();
Execute();
return cPhs_COMPLEATE_e;
}
return cPhs_INIT_e;
}
/* 80B79F38-80B7A360 001B18 0428+00 1/1 0/0 0/0 .text CreateHeap__11daNpc_zrA_cFv */
int daNpc_zrA_c::CreateHeap() {
J3DModelData* model_data = NULL;
u32 model_flag;
if (mTwilight) {
if (l_bmdGetParamList[1].fileIdx >= 0) {
model_data = static_cast<J3DModelData*>(
dComIfG_getObjectRes(l_resNames[l_bmdGetParamList[1].arcIdx],
l_bmdGetParamList[1].fileIdx));
}
model_flag = 0x80000;
} else {
if (l_bmdGetParamList[0].fileIdx >= 0) {
model_data = static_cast<J3DModelData*>(
dComIfG_getObjectRes(l_resNames[l_bmdGetParamList[0].arcIdx],
l_bmdGetParamList[0].fileIdx));
}
model_flag = 0;
}
mpMorf = new mDoExt_McaMorfSO(model_data, NULL, NULL, NULL, -1, 1.0f, 0, -1,
&mCreatureSound, model_flag, 0x11020285);
if (mpMorf != NULL && mpMorf->getModel() == NULL) {
mpMorf->stopZelAnime();
mpMorf = NULL;
}
if (mpMorf == NULL) {
return 0;
}
J3DModel* model = mpMorf->getModel();
for (u16 i = 0; i < model_data->getJointNum(); i++) {
switch (i) {
case 0:
case 1:
case 3:
case 4:
case 5:
case 14:
case 29:
model_data->getJointNodePointer(i)->setCallBack(ctrlJointCallBack);
break;
default:
model_data->getJointNodePointer(i)->setCallBack(NULL);
}
}
model->setUserArea((u32)this);
mpMatAnm = new daNpcF_MatAnm_c();
if (mpMatAnm == NULL) {
return 0;
}
setMotionWaterAnm(1);
if (!setExpressionAnm(ANM_F_TALK_A, false)) {
return 0;
}
setMotionAnm(ANM_WAIT_A, 0.0f);
if (mSoldierType != SOLDIER_NONE) {
for (int i = 0; i < 3; i++) {
int index;
if (mTwilight) {
index = l_loadObj_listTW[mSoldierType][i];
} else {
index = l_loadObj_list[mSoldierType][i];
}
if (index > 0) {
model_data = static_cast<J3DModelData*>(
dComIfG_getObjectRes(l_resNames[l_bmdGetParamList[index].arcIdx],
l_bmdGetParamList[index].fileIdx));
if (model_data != NULL) {
mpObjectModel[i] = mDoExt_J3DModel__create(model_data, 0x80000, 0x11000084);
if (mpObjectModel[i] == NULL) {
return 0;
}
} else {
return 0;
}
} else {
mpObjectModel[i] = NULL;
}
}
}
return 1;
}
/* 80B7A51C-80B7A550 0020FC 0034+00 1/1 0/0 0/0 .text Delete__11daNpc_zrA_cFv */
int daNpc_zrA_c::Delete() {
this->~daNpc_zrA_c();
return 1;
}
/* 80B7A550-80B7A570 002130 0020+00 2/2 0/0 0/0 .text Execute__11daNpc_zrA_cFv */
int daNpc_zrA_c::Execute() {
return execute();
}
/* 80B7A570-80B7A864 002150 02F4+00 1/1 0/0 0/0 .text Draw__11daNpc_zrA_cFv */
int daNpc_zrA_c::Draw() {
BOOL bvar2 = false;
J3DModel* model = mpMorf->getModel();
J3DModelData* model_data = model->getModelData();
model_data->getMaterialNodePointer(1)->setMaterialAnm(mpMatAnm);
if (!mHide) {
if (mTwilight) {
bvar2 = false;
} else {
bvar2 = true;
}
}
if (!checkHide()) {
if (mTwilight) {
g_env_light.settingTevStruct(4, ¤t.pos, &tevStr);
} else {
g_env_light.settingTevStruct(0, ¤t.pos, &tevStr);
}
g_env_light.setLightTevColorType_MAJI(model, &tevStr);
if (!drawDbgInfo()) {
if (mWaterAnmFlags & ANM_PLAY_BTK) {
mWaterBtkAnm.entry(model_data);
}
if (mWaterAnmFlags & ANM_PLAY_BPK) {
mWaterBpkAnm.entry(model_data);
}
if (mAnmFlags & ANM_PLAY_BTP) {
mBtpAnm.entry(model_data);
}
if (mAnmFlags & ANM_PLAY_BTK) {
mBtkAnm.entry(model_data);
}
if (mAnmFlags & ANM_PLAY_BRK) {
mBrkAnm.entry(model_data);
}
if (bvar2) {
fopAcM_setEffectMtx(this, model_data);
}
if (mTwilight) {
dComIfGd_setListDark();
mpMorf->entryDL();
dComIfGd_setList();
} else {
mpMorf->entryDL();
}
if (mAnmFlags & ANM_PLAY_BTP) {
mBtpAnm.remove(model_data);
}
if (mAnmFlags & ANM_PLAY_BTK) {
mBtkAnm.remove(model_data);
}
if (mAnmFlags & ANM_PLAY_BRK) {
mBrkAnm.remove(model_data);
}
if (mWaterAnmFlags & ANM_PLAY_BPK) {
mWaterBpkAnm.remove(model_data);
}
if (mWaterAnmFlags & ANM_PLAY_BTK) {
mWaterBtkAnm.remove(model_data);
}
mShadowKey = dComIfGd_setShadow(mShadowKey, 1, model, ¤t.pos,
daNpc_zrA_Param_c::m.mShadowDepth, 20.0f,
current.pos.y, mGroundH, mGndChk, &tevStr,
0, 1.0f, dDlst_shadowControl_c::getSimpleTex());
drawOtherMdls();
}
}
return 1;
}
/* 80B7A864-80B7AB9C 002444 0338+00 1/1 0/0 0/0 .text
* ctrlJoint__11daNpc_zrA_cFP8J3DJointP8J3DModel */
int daNpc_zrA_c::ctrlJoint(J3DJoint* i_joint, J3DModel* i_model) {
int jnt_no = i_joint->getJntNo();
Mtx mtx1, mtx2;
cXyz pos;
if (mSwimMode != SWIM_WAIT) {
mDoMtx_stack_c::copy(i_model->getAnmMtx(jnt_no));
switch (jnt_no) {
case 29:
calcWaistAngle();
MTXCopy(mDoMtx_stack_c::get(), mtx1);
pos.set(mtx1[0][3], mtx1[1][3], mtx1[2][3]);
mtx1[0][3] = mtx1[1][3] = mtx1[2][3] = 0.0f;
mDoMtx_stack_c::ZXYrotS(mCurAngle);
mDoMtx_stack_c::inverse();
MTXCopy(mDoMtx_stack_c::get(), mtx2);
mDoMtx_stack_c::transS(pos);
mDoMtx_stack_c::ZXYrotM(mCurAngle);
mDoMtx_stack_c::ZXYrotM(mWaistAngle);
mDoMtx_stack_c::concat(mtx2);
mDoMtx_stack_c::concat(mtx1);
break;
}
i_model->setAnmMtx(jnt_no, mDoMtx_stack_c::get());
MTXCopy(mDoMtx_stack_c::get(), J3DSys::mCurrentMtx);
return 1;
}
int lookat_joints[3] = {1, 3, 4};
if (jnt_no == 0) {
mDoMtx_stack_c::copy(mpMorf->getModel()->getAnmMtx(1));
mDoMtx_stack_c::multVecZero(&mLookatPos[0]);
mDoMtx_stack_c::copy(mpMorf->getModel()->getAnmMtx(3));
mDoMtx_stack_c::multVecZero(&mLookatPos[1]);
mDoMtx_stack_c::copy(mpMorf->getModel()->getAnmMtx(4));
mDoMtx_stack_c::multVecZero(&mLookatPos[2]);
}
mDoMtx_stack_c::copy(i_model->getAnmMtx(jnt_no));
switch (jnt_no) {
case 1:
case 3:
case 4:
setLookatMtx(jnt_no, lookat_joints, daNpc_zrA_Param_c::m.mNeckAngleScl);
break;
}
if (jnt_no == 1) {
mDoMtx_stack_c::YrotM(field_0x908[0].z);
mDoMtx_stack_c::ZrotM(-field_0x908[0].x);
} else if (jnt_no == 4) {
mDoMtx_stack_c::YrotM(field_0x908[2].z);
mDoMtx_stack_c::ZrotM(field_0x908[2].x);
}
i_model->setAnmMtx(jnt_no, mDoMtx_stack_c::get());
MTXCopy(mDoMtx_stack_c::get(), J3DSys::mCurrentMtx);
if ((jnt_no == 4 || jnt_no == 14) && (mAnmFlags & ANM_PLAY_BCK)) {
J3DAnmTransform* bck_anm = mBckAnm.getBckAnm();
mBckAnm.changeBckOnly(mpMorf->getAnm());
mpMorf->changeAnm(bck_anm);
}
return 1;
}
/* 80B7AB9C-80B7ABBC 00277C 0020+00 1/1 0/0 0/0 .text
* createHeapCallBack__11daNpc_zrA_cFP10fopAc_ac_c */
int daNpc_zrA_c::createHeapCallBack(fopAc_ac_c* i_this) {
return static_cast<daNpc_zrA_c*>(i_this)->CreateHeap();
}
/* 80B7ABBC-80B7AC08 00279C 004C+00 2/2 0/0 0/0 .text ctrlJointCallBack__11daNpc_zrA_cFP8J3DJointi
*/
int daNpc_zrA_c::ctrlJointCallBack(J3DJoint* i_joint, int param_1) {
if (param_1 == 0) {
J3DModel* model = j3dSys.getModel();
daNpc_zrA_c* _this = (daNpc_zrA_c*)model->getUserArea();
if (_this != NULL) {
_this->ctrlJoint(i_joint, model);
}
}
return 1;
}
/* 80B7AC08-80B7ADF0 0027E8 01E8+00 1/0 0/0 0/0 .text setParam__11daNpc_zrA_cFv */
void daNpc_zrA_c::setParam() {
u32 attn_flags = 0xa;
BOOL in_water = mAcch.ChkWaterIn();
if (mTwilight) {
attn_flags = 0x80000a;
}
selectAction();
if (!mTwilight && daPy_py_c::checkNowWolf()) {
attn_flags = 0;
}
if (field_0x1521) {
field_0x14d0 = 0;
field_0x14d4 = 0;