forked from zeldaret/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathd_a_b_ds.cpp
More file actions
6132 lines (5220 loc) · 187 KB
/
d_a_b_ds.cpp
File metadata and controls
6132 lines (5220 loc) · 187 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_b_ds.cpp
* Boss - Stallord
*/
#include "d/actor/d_a_b_ds.h"
#include "d/actor/d_a_player.h"
#include "d/d_s_play.h"
#include "dol2asm.h"
#include "f_op/f_op_actor_mng.h"
#include "f_op/f_op_msg.h"
#include "f_op/f_op_msg_mng.h"
#include "d/actor/d_a_spinner.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "SSystem/SComponent/c_math.h"
#include "c/c_damagereaction.h"
enum daB_DS_Joint {
DS_JNT_BACKBONE1,
DS_JNT_BACKBONE2,
DS_JNT_BACKBONE3,
DS_JNT_BACKBONE4,
DS_JNT_NECK1,
DS_JNT_NECK2,
DS_JNT_HEAD,
DS_JNT_JAW,
DS_JNT_SHOULDER_BL,
DS_JNT_ARM_L1,
DS_JNT_ARM_L2,
DS_JNT_HAND_L,
DS_JNT_LYUBI_A1,
DS_JNT_LYUBI_A2,
DS_JNT_LYUBI_A3,
DS_JNT_LYUBI_B1,
DS_JNT_LYUBI_B2,
DS_JNT_LYUBI_B3,
DS_JNT_LYUBI_C1,
DS_JNT_LYUBI_C2,
DS_JNT_LYUBI_C3,
DS_JNT_LYUBI_D1,
DS_JNT_LYUBI_D2,
DS_JNT_LYUBI_D3,
DS_JNT_LYUBI_E1,
DS_JNT_LYUBI_E2,
DS_JNT_LYUBI_E3,
DS_JNT_SHOULDER_BR,
DS_JNT_ARM_R1,
DS_JNT_ARM_R2,
DS_JNT_HAND_R,
DS_JNT_RYUBI_A1,
DS_JNT_RYUBI_A2,
DS_JNT_RYUBI_A3,
DS_JNT_RYUBI_B1,
DS_JNT_RYUBI_B2,
DS_JNT_RYUBI_B3,
DS_JNT_RYUBI_C1,
DS_JNT_RYUBI_C2,
DS_JNT_RYUBI_C3,
DS_JNT_RYUBI_D1,
DS_JNT_RYUBI_D2,
DS_JNT_RYUBI_D3,
DS_JNT_RYUBI_E1,
DS_JNT_RYUBI_E2,
DS_JNT_RYUBI_E3,
DS_JNT_SHOULDER_L,
DS_JNT_SHOULDER_R,
};
enum daB_DS_head_Joint {
DS_HEAD_JNT_HEAD,
DS_HEAD_JNT_FUR_B,
DS_HEAD_JNT_FUR_L1,
DS_HEAD_JNT_FUR_L2,
DS_HEAD_JNT_FUR_R1,
DS_HEAD_JNT_FUR_R2,
DS_HEAD_JNT_JAW,
};
/* 805DD248-805DD254 000000 000C+00 4/4 0/0 0/0 .data cNullVec__6Z2Calc */
SECTION_DATA static u8 cNullVec__6Z2Calc[12] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
/* 805DD254-805DD268 00000C 0004+10 0/0 0/0 0/0 .data @1787 */
#pragma push
#pragma force_active on
SECTION_DATA static u32 lit_1787[1 + 4 /* padding */] = {
0x02000201,
/* padding */
0x40080000,
0x00000000,
0x3FE00000,
0x00000000,
};
#pragma pop
/* 805DD268-805DD270 000020 0008+00 0/0 0/0 0/0 .data e_prim$3811 */
#pragma push
#pragma force_active on
SECTION_DATA static u8 e_prim[8] = {
0xFF, 0x78, 0x00, 0x00, 0xFF, 0x64, 0x78, 0x00,
};
#pragma pop
/* 805DD270-805DD278 000028 0008+00 0/0 0/0 0/0 .data e_env$3812 */
#pragma push
#pragma force_active on
SECTION_DATA static u8 e_env[8] = {
0x5A, 0x2D, 0x2D, 0x00, 0x3C, 0x1E, 0x1E, 0x00,
};
#pragma pop
/* 805DD278-805DD280 000030 0006+02 0/0 0/0 0/0 .data eff_id$3820 */
#pragma push
#pragma force_active on
SECTION_DATA static u8 eff_id[6 + 2 /* padding */] = {
0x02,
0x9D,
0x02,
0x9E,
0x02,
0x9F,
/* padding */
0x00,
0x00,
};
#pragma pop
namespace {
/* 805DD280-805DD2C0 000038 0040+00 0/1 0/0 0/0 .data cc_ds_week_src__22@unnamed@d_a_b_ds_cpp@ */
static dCcD_SrcSph cc_ds_week_src = {
{
0,
{{0, 0, 0}, {0x00fbfdff, 0x43}, {0x75}}, // mObj
{0, 0, 0, 0, 0}, // mGObjAt
{0, 2, 0, 0, 0x303}, // mGObjTg
{0}, // mGObjCo
}, // mObjInf
{{
{0.0f, 0.0f, 0.0f}, // mCenter
40.0f, // mRadius
}} // mSph
};
/* 805DD2C0-805DD300 000078 0040+00 0/1 0/0 0/0 .data cc_ds_head_src__22@unnamed@d_a_b_ds_cpp@ */
static dCcD_SrcSph cc_ds_head_src = {
{
0,
{{0, 0, 0}, {0xd8fbfdff, 3}, {0x55}}, // mObj
{0xa, 0, 0, 0, 0}, // mGObjAt
{0, 2, 0, 0, 0x303}, // mGObjTg
{0}, // mGObjCo
}, // mObjInf
{{
{0.0f, 0.0f, 0.0f}, // mCenter
40.0f, // mRadius
}} // mSph
};
/* 805DD300-805DD340 0000B8 0040+00 0/0 0/0 0/0 .data cc_ds_body_src__22@unnamed@d_a_b_ds_cpp@ */
static dCcD_SrcSph cc_ds_body_src = {
{
0,
{{0, 0, 0}, {0xd8fbfdff, 0x43}, {0x75}}, // mObj
{0, 0, 0, 0, 0}, // mGObjAt
{0xa, 2, 0, 0, 0x303}, // mGObjTg
{0}, // mGObjCo
}, // mObjInf
{{
{0.0f, 0.0f, 0.0f}, // mCenter
40.0f, // mRadius
}} // mSph
};
/* 805DD340-805DD384 0000F8 0044+00 0/1 0/0 0/0 .data cc_ds_backbone_src__22@unnamed@d_a_b_ds_cpp@
*/
static dCcD_SrcCyl cc_ds_backbone_src = {
{
0,
{{0, 0, 0}, {0xd8fbfdff, 0x43}, {0x55}}, // mObj
{0, 0, 0, 0, 0}, // mGObjAt
{0xa, 2, 0, 0, 0x307}, // mGObjTg
{0}, // mGObjCo
}, // mObjInf
{
{0.0f, 0.0f, 0.0f}, // mCenter
30.0f, // mRadius
130.0f, // mHeight
} // mCyl
};
/* 805DD384-805DD3C8 00013C 0044+00 0/1 0/0 0/0 .data
* cc_ds_hand_at_cyl_src__22@unnamed@d_a_b_ds_cpp@ */
static dCcD_SrcCyl cc_ds_hand_at_cyl_src = {
{
0,
{{0x100000, 4, 0x1f}, {0xd8fbfdff, 3}, {0x75}}, // mObj
{0xa, 0, 0xe, 0, 0}, // mGObjAt
{0, 2, 0, 0, 0x307}, // mGObjTg
{0}, // mGObjCo
}, // mObjInf
{
{0.0f, 0.0f, 0.0f}, // mCenter
30.0f, // mRadius
130.0f, // mHeight
} // mCyl
};
/* 805DD3C8-805DD408 000180 0040+00 0/1 0/0 0/0 .data
* cc_ds_breath_at_src__22@unnamed@d_a_b_ds_cpp@ */
static dCcD_SrcSph cc_ds_breath_at_src = {
{
0,
{{0x100000, 3, 0xd}, {0, 0}, {0}}, // mObj
{0xd, 0, 0xd, 0, 0}, // mGObjAt
{0, 0, 0, 0, 0}, // mGObjTg
{0}, // mGObjCo
}, // mObjInf
{{
{0.0f, 0.0f, 0.0f}, // mCenter
40.0f, // mRadius
}} // mSph
};
}; // namespace
f32 dummyLiteral0() {
f32 temp = 100.0f;
f32 temp_0 = 0.0f;
temp += temp_0;
temp += 1.0f;
return temp;
}
f64 dummyLiteral1() {
return 0.5;
}
f64 dummyLiteral2() {
return 3.0;
}
f64 dummyLiteral3() {
return 0.0;
}
f32 dummyLiteral4() {
return 0.01f;
}
/* 805CB22C-805CB314 0000EC 00E8+00 1/1 0/0 0/0 .text __ct__12daB_DS_HIO_cFv */
daB_DS_HIO_c::daB_DS_HIO_c() {
field_0x04 = -1;
mModelSize = 1.0f;
mHandRange = 2000.0f;
mBreathRange = 3900.0f;
mGuardSpawnRange = 2000.0f;
mNoSearchRange = 2500.0f;
mP2MoveAxis = 2800.0f;
mP2AttackHeight = 700.0f;
mP2ModelSize = 5.0f;
mP2FallTime = 250;
mPedestalFallTime = 200;
mSandFallWaitTime = 50;
mP2BulletFireTime = 5;
mP2OuterWallAttackTime = 850;
mP2TrapCreateWaitTime1 = 0;
mP2TrapCreateWaitTime2 = 300;
mP2TrapCreateID1 = 70;
mP2TrapCreateID2 = 10;
mHintTime1 = 600;
mHintTime2 = 600;
mP2OuterWallTrapSpeed = 12;
mTowerTrapSpeed = 14;
mP2ApproachAccel = 5;
mP2ApproachSpeedMax = 100;
mP2ApproachAfterBullet = 0x400;
mP2ApproachDist = 0x1800;
mP2Health = 1080;
mP2HealthDebugOn = false;
}
/* ############################################################################################## */
/* 805DDA70-805DDA74 000008 0001+03 8/8 0/0 0/0 .bss @1109 */
static u8 lit_1109[1 + 3 /* padding */];
/* 805DDA74-805DDA78 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
/* 805DDA78-805DDA7C 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
/* 805DDA7C-805DDA80 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
/* 805DDA80-805DDA84 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
/* 805DDA84-805DDA88 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
/* 805DDA88-805DDA8C 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
/* 805DDA8C-805DDA90 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
/* 805DDA90-805DDA94 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
/* 805DDA94-805DDA98 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
/* 805DDA98-805DDA9C 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
/* 805DDA9C-805DDAA0 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
/* 805DDAA0-805DDAA4 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
/* 805DDAA4-805DDAA8 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
/* 805DDAA8-805DDAAC 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
/* 805DDAAC-805DDAB0 -00001 0004+00 2/2 0/0 0/0 .bss None */
/* 805DDAAC 0001+00 data_805DDAAC @1009 */
/* 805DDAAD 0003+00 data_805DDAAD None */
static u8 struct_805DDAAC;
static bool hioInit;
/* 805DDABC-805DDB0C 000054 0050+00 21/23 0/0 0/0 .bss l_HIO */
static daB_DS_HIO_c l_HIO;
/* 805DDB0C-805DDB10 -00001 0004+00 0/1 0/0 0/0 .bss None */
/* 805DDB0C 0002+00 data_805DDB0C handL_ang */
/* 805DDB0E 0002+00 data_805DDB0E handR_ang */
static s16 handL_ang;
static s16 handR_ang;
/* 805DDB10-805DDB14 -00001 0004+00 3/4 0/0 0/0 .bss None */
/* 805DDB10 0002+00 data_805DDB10 handX_ang */
/* 805DDB12 0002+00 breathTimerBase None */
static s16 handX_ang;
static u8 breathTimerBase;
/* 805CB314-805CB4A4 0001D4 0190+00 2/1 0/0 0/0 .text ctrlJoint__8daB_DS_cFP8J3DJointP8J3DModel */
int daB_DS_c::ctrlJoint(J3DJoint* i_joint, J3DModel* i_model) {
cXyz sp40;
cXyz sp4C;
csXyz rot;
u16 joint_no = i_joint->getJntNo();
mDoMtx_stack_c::copy(i_model->getAnmMtx(joint_no));
if (mBossPhase == 0) {
switch (joint_no) {
case DS_JNT_NECK1:
rot.x = 0;
rot.y = FAST_DIV(mHeadAngle.y, 2);
rot.z = mHeadAngle.x;
mDoMtx_stack_c::ZXYrotM(rot);
break;
case DS_JNT_HEAD:
rot.x = 0;
rot.y = FAST_DIV(mHeadAngle.y, 2);
rot.z = mHeadAngle.x;
mDoMtx_stack_c::ZXYrotM(rot);
break;
case DS_JNT_ARM_L1:
mDoMtx_stack_c::YrotM(handL_ang);
mDoMtx_stack_c::XrotM(handX_ang);
break;
case DS_JNT_ARM_L2:
mDoMtx_stack_c::YrotM(-handL_ang);
break;
case DS_JNT_ARM_R1:
mDoMtx_stack_c::YrotM(-handR_ang);
mDoMtx_stack_c::XrotM(-handX_ang);
break;
case DS_JNT_ARM_R2:
mDoMtx_stack_c::YrotM(handR_ang);
break;
}
}
i_model->setAnmMtx(joint_no, mDoMtx_stack_c::get());
MTXCopy(mDoMtx_stack_c::get(), J3DSys::mCurrentMtx);
return 1;
}
/* 805CB4A4-805CB4F0 000364 004C+00 1/1 0/0 0/0 .text JointCallBack__8daB_DS_cFP8J3DJointi */
int daB_DS_c::JointCallBack(J3DJoint* i_joint, int param_1) {
if (param_1 == 0) {
daB_DS_c* a_this = (daB_DS_c*)j3dSys.getModel()->getUserArea();
if (a_this != NULL) {
a_this->ctrlJoint(i_joint, j3dSys.getModel());
}
}
return 1;
}
/* 805CB4F0-805CBAA8 0003B0 05B8+00 1/1 0/0 0/0 .text draw__8daB_DS_cFv */
int daB_DS_c::draw() {
if (arg0 == TYPE_BULLET_A || arg0 == TYPE_BULLET_B || arg0 == TYPE_BULLET_C ||
mBossPhase == 100)
{
return 1;
}
J3DModel* model = mpMorf->getModel();
g_env_light.settingTevStruct(0, ¤t.pos, &tevStr);
g_env_light.setLightTevColorType_MAJI(model->mModelData, &tevStr);
J3DModelData* model_data = model->getModelData();
if (arg0 == TYPE_BATTLE_2) {
if (!mDead) {
if (model_data->getMaterialNodePointer(2) != NULL) {
model_data->getMaterialNodePointer(2)->getTevColor(2)->a = (u8)mEyeColorAlpha;
model_data->getMaterialNodePointer(1)->getTevKColor(1)->a = mCrackAlpha;
}
mpMorf->entryDL();
cXyz shadow_pos;
shadow_pos.set(current.pos.x, current.pos.y + 120.0f, current.pos.z);
tevStr.field_0x344 = field_0x7f8;
mShadowKey = dComIfGd_setShadow(mShadowKey, 0, model, &shadow_pos, 6000.0f, 0.0f,
current.pos.y, mAcch.GetGroundH(), mAcch.m_gnd, &tevStr,
0, 1.0f, dDlst_shadowControl_c::getSimpleTex());
}
if (!mNoDrawSword) {
J3DModel* sword_model = mpSwordMorf->getModel();
g_env_light.settingTevStruct(0, &mSwordPos, &tevStr);
g_env_light.setLightTevColorType_MAJI(sword_model->mModelData, &tevStr);
mpSwordBrkAnm->entry(sword_model->getModelData());
mpSwordMorf->entryDL();
}
if (mPlayPatternAnm) {
mpPatternBrkAnm->entry(mpPatternModel->getModelData());
mpPatternBtkAnm->entry(mpPatternModel->getModelData());
mDoExt_modelUpdateDL(mpPatternModel);
}
return 1;
} else {
if (model_data->getMaterialNodePointer(2) != NULL) {
model_data->getMaterialNodePointer(2)->getTevColor(2)->a = (u8)mEyeColorAlpha;
model_data->getMaterialNodePointer(1)->getTevKColor(1)->a = mCrackAlpha;
}
u8 backbone_hide_mat = 0;
if (mBossPhase != 0) {
backbone_hide_mat = 6;
} else if (mBackboneLevel == 1) {
backbone_hide_mat = 4;
} else if (mBackboneLevel == 2) {
backbone_hide_mat = 5;
}
if (mBackboneCrackAlpha[mBackboneLevel] != 255.0f) {
J3DMaterial* material =
model->getModelData()->getMaterialNodePointer((u8)(mBackboneLevel + 4));
if (material != NULL) {
material->getTevKColor(1)->a = mBackboneCrackAlpha[mBackboneLevel];
}
}
if (mBackboneLevel != 0 && mBackboneLevel < 3) {
for (int i = 4; i < backbone_hide_mat + 1; i++) {
J3DShape* shape =
mpMorf->getModel()->getModelData()->getMaterialNodePointer((u8)i)->getShape();
if (shape != NULL) {
shape->hide();
}
}
} else {
for (int i = 4; i < 7; i++) {
J3DShape* shape =
mpMorf->getModel()->getModelData()->getMaterialNodePointer((u8)i)->getShape();
if (shape != NULL) {
shape->show();
}
}
}
mpMorf->entryDL();
if (!mNoDrawSword) {
J3DModel* sword_model = mpSwordMorf->getModel();
g_env_light.settingTevStruct(0, &mSwordPos, &tevStr);
g_env_light.setLightTevColorType_MAJI(sword_model->mModelData, &tevStr);
mpSwordBrkAnm->entry(sword_model->getModelData());
mpSwordMorf->entryDL();
}
if (mPlayPatternAnm) {
mpOpPatternBrkAnm->entry(mpOpPatternModel->getModelData());
mpOpPatternBtkAnm->entry(mpOpPatternModel->getModelData());
mDoExt_modelUpdateDL(mpOpPatternModel);
}
if (mDrawZant) {
J3DModel* zant_model = mpZantMorf->getModel();
g_env_light.settingTevStruct(3, &mSwordPos, &tevStr);
g_env_light.setLightTevColorType_MAJI(zant_model->mModelData, &tevStr);
J3DShape* shape =
mpZantMorf->getModel()->getModelData()->getMaterialNodePointer(2)->getShape();
if (shape != NULL) {
if (!mDrawZantSword) {
shape->hide();
} else {
shape->show();
}
}
mpZantMorf->entryDL();
}
cXyz shadow_pos;
shadow_pos.set(current.pos.x, current.pos.y + 1000.0f, current.pos.z);
model = mpMorf->getModel();
tevStr.field_0x344 = field_0x7f8;
mShadowKey = dComIfGd_setShadow(mShadowKey, 0, model, &shadow_pos, 7000.0f, 0.0f,
current.pos.y, mAcch.GetGroundH(), mAcch.m_gnd, &tevStr, 0,
1.0f, dDlst_shadowControl_c::getSimpleTex());
return 1;
}
}
/* 805CBAA8-805CBAC8 000968 0020+00 1/0 0/0 0/0 .text daB_DS_Draw__FP8daB_DS_c */
static int daB_DS_Draw(daB_DS_c* i_this) {
return i_this->draw();
}
/* 805CBAC8-805CBB74 000988 00AC+00 18/18 0/0 0/0 .text setBck__8daB_DS_cFiUcff */
void daB_DS_c::setBck(int i_anmID, u8 i_attr, f32 i_morf, f32 i_rate) {
J3DAnmTransform* anm = static_cast<J3DAnmTransform*>(dComIfG_getObjectRes("B_DS", i_anmID));
mpMorf->setAnm(anm, i_attr, i_morf, i_rate, 0.0f, -1.0f);
mAnmID = i_anmID;
}
/* 805CBB74-805CBB80 000A34 000C+00 18/18 0/0 0/0 .text setActionMode__8daB_DS_cFii */
void daB_DS_c::setActionMode(int i_action, int i_mode) {
mAction = i_action;
mMode = i_mode;
}
/* 805DD470-805DD474 000228 0004+00 5/6 0/0 0/0 .data eff_smoke_id */
static u16 eff_smoke_id[2] = {0x8BC4, 0x8BC5};
/* 805CBB80-805CBD00 000A40 0180+00 1/1 0/0 0/0 .text mSmokeSet__8daB_DS_cFv */
void daB_DS_c::mSmokeSet() {
if (mSmokeCount >= 20) {
return;
}
if (mAcch.ChkGroundHit()) {
if (field_0x84d == 0 && mAcch.GetGroundH() != -1000000000.0f) {
cXyz particle_scale(1.0f, 1.0f, 1.0f);
cXyz particle_pos(current.pos);
csXyz particle_angle(shape_angle);
particle_pos.y = mAcch.GetGroundH();
particle_angle.z = 0;
particle_angle.x = 0;
mSmokeParticleKey[mSmokeCount] =
dComIfGp_particle_set(mSmokeParticleKey[mSmokeCount], eff_smoke_id[1],
&particle_pos, &particle_angle, &particle_scale);
mSoundPos = current.pos;
mSound.startCreatureSound(Z2SE_EN_DS_H_COL, 0, -1);
field_0x84d = 1;
mSmokeCount++;
}
} else {
field_0x84d = 0;
}
}
/* 805CBD00-805CBD64 000BC0 0064+00 3/3 0/0 0/0 .text mHeadAngle_Clear__8daB_DS_cFv */
void daB_DS_c::mHeadAngle_Clear() {
cLib_addCalcAngleS2(&mHeadAngle.x, 0, 20, 0x100);
cLib_addCalcAngleS2(&mHeadAngle.y, 0, 20, 0x100);
cLib_addCalcAngleS2(&mHeadAngle.z, 0, 20, 0x100);
}
/* 805CBD64-805CBED0 000C24 016C+00 1/1 0/0 0/0 .text HandHitSoundSet__8daB_DS_cFb */
void daB_DS_c::HandHitSoundSet(bool i_isLeft) {
csXyz hit_angle;
cXyz sp18, hit_pos;
if (!i_isLeft) {
sp18 = mHandPos[1] - *mHandAtRCyl.GetTgHitPosP();
hit_pos = *mHandAtRCyl.GetTgHitPosP();
hit_pos.y += 100.0f;
mSoundPos = mHandPos[1];
} else {
sp18 = mHandPos[0] - *mHandAtLCyl.GetTgHitPosP();
hit_pos = *mHandAtLCyl.GetTgHitPosP();
hit_pos.y += 100.0f;
mSoundPos = mHandPos[0];
}
hit_angle.x = 0;
hit_angle.y = sp18.atan2sX_Z();
hit_angle.z = 0;
def_se_set(&mSound, mAtInfo.mpCollider, 2, NULL);
dComIfGp_setHitMark(2, this, &hit_pos, &hit_angle, NULL, 0);
}
/* 805CBED0-805CC158 000D90 0288+00 1/1 0/0 0/0 .text handSPosSet__8daB_DS_cFi */
void daB_DS_c::handSPosSet(int i_hand) {
cXyz chk_pos, particle_pos;
csXyz particle_angle;
dBgS_GndChk gnd_chk;
chk_pos = mFingerPos[i_hand];
chk_pos.y += 800.0f;
gnd_chk.SetPos(&chk_pos);
chk_pos.y = dComIfG_Bgsp().GroundCross(&gnd_chk);
if (chk_pos.y == -1000000000.0f) {
chk_pos.y = mFingerPos[i_hand].y;
}
particle_pos = chk_pos - mHandPos[i_hand];
mDoMtx_YrotS(*calc_mtx, (s16)particle_pos.atan2sX_Z());
chk_pos.x = 0.0f;
chk_pos.y = 200.0f;
chk_pos.z = 400.0f;
MtxPosition(&chk_pos, &particle_pos);
particle_pos += mHandPos[i_hand];
particle_pos.y += 800.0f;
gnd_chk.SetPos(&particle_pos);
particle_pos.y = dComIfG_Bgsp().GroundCross(&gnd_chk);
if (particle_pos.y == -1000000000.0f) {
particle_pos.y = mHandPos[i_hand].y;
}
chk_pos = particle_pos - mHandPos[i_hand];
particle_angle.x = chk_pos.atan2sY_XZ();
particle_angle.y = particle_pos.atan2sX_Z();
particle_angle.z = 0;
cXyz particle_scale(1.0f, 1.0f, 1.0f);
for (int i = 0; i < 2; i++) {
mHandSmokeParticleKey[(i_hand << 1) + i] =
dComIfGp_particle_set(mHandSmokeParticleKey[(i_hand << 1) + i], eff_smoke_id[i],
&particle_pos, &particle_angle, &particle_scale);
}
dComIfGp_getVibration().StartShock(2, 0x4F, cXyz(0.0f, 1.0f, 0.0f));
}
/* 805CC158-805CC1C4 001018 006C+00 8/8 0/0 0/0 .text hand_smokeSet__8daB_DS_cFUc */
void daB_DS_c::hand_smokeSet(u8 i_hand) {
if (i_hand == 0 || i_hand == 1) {
handSPosSet(0);
}
if (i_hand == 0 || i_hand == 2) {
handSPosSet(1);
}
}
/* 805CC1C4-805CC454 001084 0290+00 1/1 0/0 0/0 .text mZsMoveChk__8daB_DS_cFv */
void daB_DS_c::mZsMoveChk() {
cXyz offset, zs_pos;
fopAc_ac_c* staltroop;
int indices[15];
int count = 0;
int i;
for (i = 0; i < 15; i++) {
indices[count] = 0;
if (mStaltroopID[i] != 0) {
if (fopAcM_SearchByID(mStaltroopID[i], &staltroop) == 0) {
mStaltroopID[i] = 0;
} else {
indices[count] = i;
count++;
}
}
}
if (count == 0) {
return;
}
dBgS_GndChk gnd_chk;
s16 angle_y = fopAcM_searchPlayerAngleY(this);
for (i = 0; i < count; i++) {
if (indices[i] == 0) {
continue;
}
mDoMtx_YrotS(*calc_mtx, angle_y);
offset.x = 0.0f;
offset.y = 0.0f;
offset.z = 1500.0f;
offset.z += cM_rndF(500.0f);
MtxPosition(&offset, &zs_pos);
zs_pos += current.pos;
zs_pos.y += 2000.0f;
gnd_chk.SetPos(&zs_pos);
if (zs_pos.y != -1000000000.0f) {
zs_pos.y = dComIfG_Bgsp().GroundCross(&gnd_chk);
} else {
zs_pos.y = current.pos.y += 800.0f;
}
if (mStaltroopID[indices[i]] != 0 &&
fopAcM_SearchByID(mStaltroopID[indices[i]], &staltroop) != 0 && staltroop != NULL)
{
staltroop->home.pos.x = zs_pos.x;
staltroop->home.pos.y = zs_pos.y;
staltroop->home.pos.z = zs_pos.z;
}
angle_y = fopAcM_searchPlayerAngleY(this);
angle_y += (s16)cM_rndFX(0x2000);
}
if (!daPy_getPlayerActorClass()->checkSpinnerRide() || mAction == ACT_DAMAGE ||
fopAcM_searchPlayerDistance(this) > l_HIO.mBreathRange)
{
mIsAppear = false;
return;
}
mIsAppear = true;
}
/* 805CC454-805CC6F4 001314 02A0+00 1/1 0/0 0/0 .text mZsMoveChk_Guard__8daB_DS_cFv */
void daB_DS_c::mZsMoveChk_Guard() {
static s16 mGuardDt[5] = {-0x1800, 0xC00, -0xC00, 0, 0x1800};
cXyz offset, zs_pos;
s16 angle_to_player = fopAcM_searchPlayerAngleY(this);
fopAc_ac_c* staltroop;
dBgS_GndChk gnd_chk;
s16 angle_y[5];
int i = 0;
int index = cM_rndF(5.0f);
for (; i < 5; i++, index++) {
if (index > 4) {
index = 0;
}
angle_y[i] = angle_to_player;
if (mGuardDt[index] != 0) {
angle_y[i] += mGuardDt[index];
}
}
for (int i = 0; i < 5; i++) {
mDoMtx_YrotS(*calc_mtx, angle_y[i]);
offset.x = 0.0f;
offset.y = 0.0f;
offset.z = 500.0f;
MtxPosition(&offset, &zs_pos);
zs_pos += current.pos;
zs_pos.y += 2000.0f;
gnd_chk.SetPos(&zs_pos);
if (zs_pos.y != -1000000000.0f) {
zs_pos.y = dComIfG_Bgsp().GroundCross(&gnd_chk);
} else {
zs_pos.y = current.pos.y += 800.0f;
}
if (mStaltroop2ID[i] != 0 && fopAcM_SearchByID(mStaltroop2ID[i], &staltroop) != 0 &&
staltroop != NULL)
{
staltroop->home.pos.x = zs_pos.x;
staltroop->home.pos.y = zs_pos.y;
staltroop->home.pos.z = zs_pos.z;
}
}
if (!daPy_getPlayerActorClass()->checkSpinnerRide() || mAction == ACT_DAMAGE ||
fopAcM_searchPlayerDistance(this) > l_HIO.mBreathRange)
{
mIsAppearG = false;
return;
}
if (fopAcM_searchPlayerDistance(this) < l_HIO.mGuardSpawnRange) {
mIsAppearG = true;
}
}
/* 805CC6F4-805CC80C 0015B4 0118+00 1/1 0/0 0/0 .text mTrapScale__8daB_DS_cFv */
void daB_DS_c::mTrapScale() {
f32 target_scale = 1.0f;
if (mBossPhase != 0) {
target_scale = 2.0f;
} else if (mTrapID[0] == 0) {
return;
}
for (int i = 0; i < 20; i++) {
fopAc_ac_c* trap_actor;
if (fopAcM_SearchByID(mTrapID[i], &trap_actor) != 0 && trap_actor != NULL) {
cLib_addCalc2(&trap_actor->scale.x, target_scale, 0.7f, 0.5f);
cLib_addCalc2(&trap_actor->scale.y, target_scale, 0.8f, 2.0f);
cLib_addCalc2(&trap_actor->scale.z, target_scale, 0.7f, 0.5f);
if (fabsf(trap_actor->scale.y - target_scale) < 0.1f) {
trap_actor->scale.set(target_scale, target_scale, target_scale);
}
}
}
}
/* 805CC80C-805CC8A4 0016CC 0098+00 2/2 0/0 0/0 .text mClearTrap__8daB_DS_cFb */
void daB_DS_c::mClearTrap(bool i_delete) {
for (int i = 0; i < 20; i++) {
if (mTrapID[i] == 0) {
continue;
}
fopAc_ac_c* trap_actor;
if (fopAcM_SearchByID(mTrapID[i], &trap_actor) != 0 && trap_actor != NULL) {
if (i_delete) {
fopAcM_delete(trap_actor);
} else {
trap_actor->health = 0;
}
mTrapID[i] = 0;
}
}
}
/* 805CC8A4-805CCEB4 001764 0610+00 3/3 0/0 0/0 .text mCreateTrap__8daB_DS_cFb */
void daB_DS_c::mCreateTrap(bool param_0) {
daPy_py_c* pla = daPy_getPlayerActorClass();
if (mBossPhase == 0) {
if (cLib_calcTimer(&mBirthTrapTimerF) != 0 || mPedestalFallTimer != 0 ||
mSandFallTimer != 0 || mAction == ACT_DAMAGE || mAction == ACT_OPENING_DEMO)
{
mClearTrap(true);
return;
}
} else if (pla->current.pos.y < -1300.0f || pla->current.pos.y > l_HIO.mP2AttackHeight ||
(mAction == ACT_CIRCLE && mMode >= 3 && mMode <= 4) || mOutTimer == 0 ||
daPy_getPlayerActorClass()->getDamageWaitTimer() != 0 || mAction == ACT_WAIT ||
mAction == ACT_DAMAGE || mAction == ACT_ETC_DAMAGE || mAction == ACT_HAND_ATTACK)
{
mTrapCreate = false;
mClearTrap(false);
return;
}
mTrapScale();
if (mBossPhase == 0 && !param_0 && (fopAcM_searchPlayerAngleY(this) & 0xFFF) == 0) {
return;
}
cXyz pos, vec;
cXyz trap_scale(1.0f, 1.0f, 1.0f);
u32 params;
if (mBossPhase != 0 && health <= (int)l_HIO.mP2Health / 3 * 2 && mTrapCreate) {
int i = 6;
int trap_count = 0;
for (; i < 20 && trap_count < 2; i++) {
if (mTrapID[i] != 0) {
fopAc_ac_c* actor;
if (fopAcM_SearchByID(mTrapID[i], &actor) != 0 && actor != NULL) {
continue;
}
mTrapID[i] = 0;
}
params = 0x1F5003;
params |= (int)l_HIO.mTowerTrapSpeed << 8;
int trap_create_id;
if (trap_count == 0) {
trap_create_id = l_HIO.mP2TrapCreateID1;
params |= l_HIO.mP2TrapCreateID1 << 0x18;
} else {
trap_create_id = l_HIO.mP2TrapCreateID2;
params |= l_HIO.mP2TrapCreateID2 << 0x18;
}
dPath* path = dPath_GetRoomPath(3, fopAcM_GetRoomNo(this));
if (path != NULL) {
dPnt& point = path->m_points[trap_create_id];
pos = point.m_position;
vec = pos - current.pos;
if (vec.abs() <= 200.0f) {
continue;
}
csXyz angle;
angle.x = 0;
angle.y = 0;
angle.z = 0;
mTrapID[i] = fopAcM_createChild(PROC_Obj_Lv6TogeTrap, fopAcM_GetID(this), params,
¤t.pos, fopAcM_GetRoomNo(this), &angle,
&trap_scale, -1, NULL);
trap_count++;
}
}
mTrapCreate = false;
}
trap_scale.set(0.0f, 7.0f, 0.0f);
pos.zero();
csXyz angle;
angle.y = 0;
angle.z = 0;
angle.x = 0;
pos.y = 1708.0f;
static s16 mBirthAngle01_dt[4] = {0x0000, 0x4000, 0x8000, 0xc000};
static s16 mBirthAngle02_dt[3] = {0x0000, 0x5555, 0xaaaa};
static f32 mBirthYpos02_dt[3] = {1150.0f, 350.0f, -450.0f};
if (mBossPhase == 0) {
int trap_max = 6;
if (mBackboneLevel < 2) {
trap_max = 4;
}
for (int i = 0; i < trap_max; i++) {
if (mBackboneLevel < 2) {
angle.y = mBirthAngle01_dt[i];
}