forked from zeldaret/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathd_a_e_mf.cpp
More file actions
3346 lines (2872 loc) · 115 KB
/
d_a_e_mf.cpp
File metadata and controls
3346 lines (2872 loc) · 115 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
/**
* @file d_a_e_mf.cpp
*
*/
#include "d/dolzel_rel.h"
#include "d/actor/d_a_e_mf.h"
#include "d/d_cc_d.h"
#include "Z2AudioLib/Z2Instances.h"
#include "f_op/f_op_actor_enemy.h"
#include "d/d_bomb.h"
#include "f_op/f_op_kankyo_mng.h"
#include "d/actor/d_a_horse.h"
#include "d/d_com_inf_game.h"
class daE_MF_HIO_c : public JORReflexible {
public:
/* 8070A70C */ daE_MF_HIO_c();
/* 80713464 */ virtual ~daE_MF_HIO_c() {}
void genMessage(JORMContext*);
/* 0x04 */ s8 field_0x4;
/* 0x08 */ f32 model_size; // 基本サイズ
/* 0x0C */ f32 movement_speed; // 移動速度
/* 0x10 */ f32 dash_speed; // 突進速度
/* 0x14 */ f32 battle_init_range; // 戦闘開始範囲
/* 0x18 */ f32 attack_init_range; // 攻撃開始範囲
/* 0x1C */ s16 field_0x1c; // 防御静止間
/* 0x1E */ s16 field_0x1e; // 魂抜間 弱
/* 0x20 */ s16 field_0x20; // 魂抜間 強
/* 0x22 */ u8 field_0x22;
/* 0x23 */ u8 invulnerable; // 不死身
};
enum Action {
/* 0x00 */ ACTION_NORMAL = 0,
/* 0x03 */ ACTION_FIGHT_RUN = 3,
/* 0x05 */ ACTION_ATTACK = 5,
/* 0x06 */ ACTION_TAIL_ATTACK = 6,
/* 0x07 */ ACTION_GUARD = 7,
/* 0x08 */ ACTION_JUMP = 8,
/* 0x09 */ ACTION_STAY = 9,
/* 0x0A */ ACTION_OTOREAC = 10,
/* 0x0B */ ACTION_BOMB_ACTION = 11,
/* 0x0C */ ACTION_DRAWBACK = 12,
/* 0x0D */ ACTION_WOLFBITE = 13,
/* 0x14 */ ACTION_S_DAMAGE = 20,
/* 0x15 */ ACTION_DAMAGE = 21,
/* 0x17 */ ACTION_BACKDROP = 23,
/* 0x18 */ ACTION_WATER = 24,
/* 0x19 */ ACTION_GAKEJUMP = 25,
};
enum Animation {
/* 0x04 */ ANM_ATTACK_TAIL_01 = 4,
/* 0x05 */ ANM_ATTACK_TAIL_02,
/* 0x06 */ ANM_ATTACK_TAIL_03,
/* 0x07 */ ANM_ATTACK_00,
/* 0x08 */ ANM_ATTACK_01,
/* 0x09 */ ANM_BLOWNOFF,
/* 0x0A */ ANM_BRUSH_LEFT_UP,
/* 0x0B */ ANM_BRUSH_RIGHT_UP,
/* 0x0C */ ANM_DAMAGE_W,
/* 0x0D */ ANM_DIE_LEFT,
/* 0x0E */ ANM_DIE_LEFT_UP,
/* 0x0F */ ANM_DIE_RIGHT,
/* 0x10 */ ANM_DIE_RIGHT_UP,
/* 0x11 */ ANM_DIE_W,
/* 0x12 */ ANM_DRAWBACK,
/* 0x13 */ ANM_DROWNED_A,
/* 0x14 */ ANM_DROWNED_B,
/* 0x15 */ ANM_FIND,
/* 0x16 */ ANM_GUARD,
/* 0x17 */ ANM_HANGED,
/* 0x18 */ ANM_HANGED_DAMAGE,
/* 0x19 */ ANM_HANGED_BRUSH,
/* 0x1A */ ANM_HANGED_WAIT,
/* 0x1B */ ANM_JUMP_A,
/* 0x1C */ ANM_JUMP_B,
/* 0x1D */ ANM_JUMP_C,
/* 0x1E */ ANM_RUN,
/* 0x1F */ ANM_WAIT_01,
/* 0x20 */ ANM_WAIT_02,
/* 0x21 */ ANM_WAIT_03,
/* 0x22 */ ANM_WAIT_04,
/* 0x23 */ ANM_WALK,
};
/* 8070A70C-8070A77C 0000EC 0070+00 1/1 0/0 0/0 .text __ct__12daE_MF_HIO_cFv */
daE_MF_HIO_c::daE_MF_HIO_c() {
field_0x4 = -1;
model_size = 1.3f;
movement_speed = 8.0f;
dash_speed = 28.0f;
battle_init_range = 300.0f;
attack_init_range = 350.0f;
field_0x1c = 3;
field_0x1e = 40;
field_0x20 = 80;
field_0x22 = 1;
invulnerable = 0;
}
/* 8070A77C-8070A82C 00015C 00B0+00 2/2 0/0 0/0 .text mf_disappear__FP10e_mf_class */
static void mf_disappear(e_mf_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
cXyz sp1c, sp28;
MTXCopy(i_this->mpModelMorf->getModel()->getAnmMtx(2), *calc_mtx);
sp1c.set(0.0f, 0.0f, 0.0f);
MtxPosition(&sp1c, &sp28);
fopAcM_createDisappear(a_this, &sp28, 13, 0, 36);
fopAcM_delete(a_this);
int swBit = fopAcM_GetParam(a_this) >> 24;
if (swBit != 0xFF) {
dComIfGs_onSwitch(swBit, fopAcM_GetRoomNo(a_this));
}
}
/* 8070A82C-8070A8D8 00020C 00AC+00 16/16 0/0 0/0 .text anm_init__FP10e_mf_classifUcf */
static void anm_init(e_mf_class* i_this, int i_anmID, f32 i_morf, u8 i_attr, f32 i_rate) {
i_this->mpModelMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("E_mf", i_anmID), i_attr, i_morf,
i_rate, 0.0f, -1.0f);
i_this->mAnmID = i_anmID;
}
/* 8070A8D8-8070AD94 0002B8 04BC+00 1/1 0/0 0/0 .text nodeCallBack__FP8J3DJointi */
static int nodeCallBack(J3DJoint* i_joint, int param_2) {
if (param_2 == 0) {
int jointNo = i_joint->getJntNo();
J3DModel* model = j3dSys.getModel();
e_mf_class* i_this = (e_mf_class*)model->getUserArea();
if (i_this != NULL) {
MTXCopy(model->getAnmMtx(jointNo), *calc_mtx);
if (jointNo != 0) {
if (jointNo == 22) {
cMtx_YrotM(*calc_mtx, i_this->field_0x812);
cMtx_ZrotM(*calc_mtx, i_this->field_0x7d0 + (i_this->field_0x810 - i_this->field_0x742[2].x));
} else if (jointNo == 23) {
cMtx_YrotM(*calc_mtx, i_this->field_0x7da);
} else if (jointNo == 24) {
cMtx_ZrotM(*calc_mtx, i_this->field_0x7dc[0]);
} else if (jointNo == 27) {
cMtx_YrotM(*calc_mtx, i_this->field_0x7dc[1]);
} else if (jointNo == 28) {
cMtx_ZrotM(*calc_mtx, i_this->field_0x7dc[2]);
} else if (jointNo == 2) {
cMtx_YrotM(*calc_mtx, (i_this->field_0x6da / 2) + (i_this->field_0x742[1].y + - i_this->field_0x6d6));
cMtx_ZrotM(*calc_mtx, i_this->field_0x742[1].x + i_this->field_0x7cc[1]);
} else if (jointNo == 3 || jointNo == 4) {
cMtx_YrotM(*calc_mtx, i_this->field_0x742[0].y + (i_this->field_0x6da - i_this->field_0x6d6));
cMtx_ZrotM(*calc_mtx, i_this->field_0x7cc[0] + (i_this->field_0x742[0].x - i_this->field_0x6d8));
} else if (jointNo == 11) {
cMtx_ZrotM(*calc_mtx, i_this->field_0x742[3].y + i_this->field_0x7d2);
} else if (jointNo == 12) {
cMtx_ZrotM(*calc_mtx, i_this->field_0x742[4].y + i_this->field_0x7d4);
} else if (jointNo == 17) {
cMtx_ZrotM(*calc_mtx, i_this->field_0x742[5].y + i_this->field_0x7d6);
} else if (jointNo == 18) {
cMtx_ZrotM(*calc_mtx, i_this->field_0x742[6].y + i_this->field_0x7d8);
} else if (jointNo >= 31 && jointNo <= 34) {
cMtx_YrotM(*calc_mtx, i_this->field_0x742[jointNo - 2].x + i_this->field_0x806);
cMtx_ZrotM(*calc_mtx, i_this->field_0x742[jointNo - 3].z);
}
}
if (i_this->field_0x7ea != 0) {
if ((jointNo & 1) != 0) {
cMtx_YrotM(*calc_mtx, i_this->field_0x7ea);
} else if ((jointNo & 2) != 0) {
cMtx_XrotM(*calc_mtx, i_this->field_0x7ea);
} else if ((jointNo & 4) != 0) {
cMtx_ZrotM(*calc_mtx, i_this->field_0x7ea);
}
}
model->setAnmMtx(jointNo, *calc_mtx);
MTXCopy(*calc_mtx, J3DSys::mCurrentMtx);
if (jointNo == 0) {
MTXCopy(model->getAnmMtx(jointNo), *calc_mtx);
cMtx_YrotM(*calc_mtx, 0);
cMtx_XrotM(*calc_mtx, 0);
cMtx_ZrotM(*calc_mtx, 0);
model->setAnmMtx(jointNo, *calc_mtx);
MTXCopy(*calc_mtx, J3DSys::mCurrentMtx);
}
if (jointNo == 0) {
MTXCopy(model->getAnmMtx(jointNo), *calc_mtx);
cMtx_YrotM(*calc_mtx, 0);
cMtx_XrotM(*calc_mtx, 0);
cMtx_ZrotM(*calc_mtx, 0);
model->setAnmMtx(jointNo, *calc_mtx);
MTXCopy(*calc_mtx, J3DSys::mCurrentMtx);
}
}
}
return 1;
}
/* 8070AD94-8070B03C 000774 02A8+00 1/0 0/0 0/0 .text daE_MF_Draw__FP10e_mf_class */
static int daE_MF_Draw(e_mf_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
if (i_this->field_0x728 != 0) {
return 1;
}
J3DModel* model = i_this->mpModelMorf->getModel();
g_env_light.settingTevStruct(0, &a_this->current.pos, &a_this->tevStr);
g_env_light.setLightTevColorType_MAJI(model, &a_this->tevStr);
J3DModelData* modelData;
J3DMaterial* matNode_p;
if (i_this->field_0x6a4 != 0) {
modelData = model->getModelData();
for (u16 i = 0; i < modelData->getMaterialNum(); i++) {
matNode_p = modelData->getMaterialNodePointer(i);
matNode_p->getTevColor(0)->r = i_this->field_0x6a8;
matNode_p->getTevColor(0)->g = i_this->field_0x6a8;
matNode_p->getTevColor(0)->b = i_this->field_0x6a8;
}
}
i_this->mpModelMorf->entryDL();
if (i_this->field_0x6a4 != 0) {
modelData = model->getModelData();
for (u16 i = 0; i < modelData->getMaterialNum(); i++) {
matNode_p = modelData->getMaterialNodePointer(i);
matNode_p->getTevColor(0)->r = 0;
matNode_p->getTevColor(0)->g = 0;
matNode_p->getTevColor(0)->b = 0;
}
}
g_env_light.setLightTevColorType_MAJI(i_this->mpAxeModel, &a_this->tevStr);
mDoExt_modelUpdateDL(i_this->mpAxeModel);
g_env_light.setLightTevColorType_MAJI(i_this->mpShieldModel, &a_this->tevStr);
mDoExt_modelUpdateDL(i_this->mpShieldModel);
cXyz sp50;
sp50.set(a_this->current.pos.x, a_this->current.pos.y + 50.0f, a_this->current.pos.z);
i_this->mShadowKey = dComIfGd_setShadow(i_this->mShadowKey, 1, model, &sp50, 1150.0f, 0.0f,
a_this->current.pos.y, i_this->mObjAcch.GetGroundH(),
i_this->mObjAcch.m_gnd, &a_this->tevStr, 0, 1.0f,
dDlst_shadowControl_c::getSimpleTex());
dComIfGd_addRealShadow(i_this->mShadowKey, i_this->mpAxeModel);
dComIfGd_addRealShadow(i_this->mShadowKey, i_this->mpShieldModel);
return 1;
}
/* 8070B03C-8070B114 000A1C 00D8+00 2/2 0/0 0/0 .text other_bg_check__FP10e_mf_classP10fopAc_ac_c */
static BOOL other_bg_check(e_mf_class* i_this, fopAc_ac_c* i_actor) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
dBgS_LinChk lin_chk;
cXyz start, end;
end = i_actor->current.pos;
end.y += 100.0f;
start = a_this->current.pos;
start.y = a_this->eyePos.y;
lin_chk.Set(&start, &end, a_this);
if (dComIfG_Bgsp().LineCross(&lin_chk)) {
return TRUE;
}
return FALSE;
}
/* 8070B114-8070B1EC 000AF4 00D8+00 1/1 0/0 0/0 .text other_bg_check2__FP10e_mf_classP4cXyz */
static BOOL other_bg_check2(e_mf_class* i_this, cXyz* param_2) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
dBgS_LinChk lin_chk;
cXyz start, end;
end = *param_2;
end.y += 100.0f;
start = a_this->current.pos;
start.y = a_this->eyePos.y;
lin_chk.Set(&start, &end, a_this);
if (dComIfG_Bgsp().LineCross(&lin_chk)) {
return TRUE;
}
return FALSE;
}
u8 l_initHIO;
/* 80713F74-80713F98 000054 0024+00 9/10 0/0 0/0 .bss l_HIO */
daE_MF_HIO_c l_HIO;
/* 80713F98-80713FC0 000078 0028+00 2/2 0/0 0/0 .bss target_info */
fopAc_ac_c* target_info[10];
/* 80713FC0-80713FC4 0000A0 0004+00 2/2 0/0 0/0 .bss target_info_count */
int target_info_count;
/* 8070B1EC-8070B268 000BCC 007C+00 1/1 0/0 0/0 .text s_b_sub__FPvPv */
static void* s_b_sub(void* i_actor, void* i_data) {
if (fopAcM_IsActor(i_actor) && dBomb_c::checkBombActor((fopAc_ac_c*)i_actor) && !((dBomb_c*)i_actor)->checkStateExplode() && target_info_count < 10) {
target_info[target_info_count] = (fopAc_ac_c*)i_actor;
target_info_count++;
}
return NULL;
}
/* 8070B268-8070B6E0 000C48 0478+00 2/2 0/0 0/0 .text search_bomb__FP10e_mf_classi */
static dBomb_c* search_bomb(e_mf_class* i_this, BOOL param_2) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
dBomb_c* bomb;
target_info_count = 0;
for (int i = 0; i < 10; i++) {
target_info[i] = NULL;
}
fpcM_Search(s_b_sub, i_this);
f32 threshold = 50.0f;
if (target_info_count != 0) {
cXyz sp44, sp50, sp5c;
for (int i = 0; i < target_info_count;) {
bomb = (dBomb_c*)target_info[i];
sp44.x = bomb->current.pos.x - a_this->eyePos.x;
sp44.y = 50.0f + bomb->current.pos.y - a_this->eyePos.y;
sp44.z = bomb->current.pos.z - a_this->eyePos.z;
sp50.x = bomb->current.pos.x - a_this->current.pos.x;
sp50.y = bomb->current.pos.y - a_this->current.pos.y;
sp50.z = bomb->current.pos.z - a_this->current.pos.z;
if (sp44.abs() < threshold && !(sp50.abs() > i_this->mPlayerDistance + 30.0f) && (!other_bg_check(i_this, bomb) || !param_2)) {
if (param_2) {
if (fabsf(50.0f + bomb->current.pos.y - a_this->eyePos.y) <= 300.0f) {
s16 sVar1 = a_this->shape_angle.y - cM_atan2s(sp44.x, sp44.z);
if (sVar1 < 0) {
sVar1 = -1 * sVar1;
}
if ((u16)sVar1 < 20000) {
return bomb;
}
cMtx_YrotS(*calc_mtx, -a_this->shape_angle.y);
MtxPosition(&sp44, &sp5c);
if (fabsf(sp5c.x) < 500.0f && fabsf(sp5c.y) < 300.0f && sp5c.z > -125.0f && sp5c.z < 500.0f) {
return bomb;
}
}
} else {
return bomb;
}
}
i++;
if (i == target_info_count) {
i = 0;
threshold += 50.0f;
if (threshold > 1500.0f) {
return NULL;
}
}
}
} else {
return NULL;
}
return NULL;
}
/* 8070B6E0-8070B704 0010C0 0024+00 4/4 0/0 0/0 .text bomb_view_check__FP10e_mf_class */
static dBomb_c* bomb_view_check(e_mf_class* i_this) {
return search_bomb(i_this, TRUE);
}
/* 8070B704-8070B728 0010E4 0024+00 1/1 0/0 0/0 .text bomb_check__FP10e_mf_class */
static dBomb_c* bomb_check(e_mf_class* i_this) {
return search_bomb(i_this, FALSE);
}
/* 8070B728-8070B76C 001108 0044+00 1/1 0/0 0/0 .text player_way_check__FP10e_mf_class */
static BOOL player_way_check(e_mf_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
s16 sVar1 = a_this->shape_angle.y - dComIfGp_getPlayer(0)->shape_angle.y;
if ((int)sVar1 < 0) {
sVar1 = -sVar1;
}
if (((u32)sVar1 & 0xFFFF) < 0x6000) {
return FALSE;
}
return TRUE;
}
/* 8070B76C-8070B848 00114C 00DC+00 4/4 0/0 0/0 .text pl_check__FP10e_mf_classfs */
static int pl_check(e_mf_class* i_this, f32 param_2, s16 param_3) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
if (i_this->mPlayerDistance < param_2) {
s16 sVar1 = a_this->shape_angle.y - i_this->mYAngleToPlayer;
if (sVar1 < param_3 && sVar1 > (s16)-param_3 && !other_bg_check(i_this, player)) {
return 1;
}
}
for (int i = 0; i <= 2; i++) {
if (i_this->field_0xa7c[i].ChkCoHit() != 0) {
if (player == dCc_GetAc(i_this->field_0xa7c[i].GetCoHitObj()->GetAc())) {
return 2;
}
}
}
return 0;
}
/* 8070B848-8070B950 001228 0108+00 3/3 0/0 0/0 .text move_gake_check__FP10e_mf_classfSc */
static BOOL move_gake_check(e_mf_class* i_this, f32 param_2, s8 param_3) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
dBgS_GndChk gnd_chk;
cXyz sp84, sp90;
cMtx_YrotS(*calc_mtx, a_this->shape_angle.y);
sp84.x = 0.0f;
sp84.y = 100.0f;
if (param_3 != 0) {
sp84.z = -param_2;
} else {
sp84.z = param_2;
}
MtxPosition(&sp84, &sp90);
sp90 += a_this->current.pos;
gnd_chk.SetPos(&sp90);
if (a_this->current.pos.y - dComIfG_Bgsp().GroundCross(&gnd_chk) > 300.0f) {
return TRUE;
}
return FALSE;
}
/* 8070B950-8070BB10 001330 01C0+00 1/1 0/0 0/0 .text jump_pos_check__FP10e_mf_classP4cXyz */
static BOOL jump_pos_check(e_mf_class* i_this, cXyz* param_2) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
dBgS_GndChk gnd_chk;
cXyz sp94, spa0;
f32 fVar1 = 300.0f;
cMtx_YrotS(*calc_mtx, i_this->mYAngleToPlayer);
sp94.x = 0.0f;
sp94.y = 200.0f;
int i = 0;
while (i < 10) {
sp94.z = fVar1;
MtxPosition(&sp94, &spa0);
spa0 += a_this->current.pos;
gnd_chk.SetPos(&spa0);
spa0.y = dComIfG_Bgsp().GroundCross(&gnd_chk);
if ((a_this->current.pos.y - spa0.y) < 200.0f) {
*param_2 = spa0;
sp94.z += 200.0f;
MtxPosition(&sp94, &spa0);
spa0 += a_this->current.pos;
gnd_chk.SetPos(&spa0);
spa0.y = dComIfG_Bgsp().GroundCross(&gnd_chk);
if ((a_this->current.pos.y - spa0.y) < 200.0f) {
*param_2 = spa0;
}
return TRUE;
}
fVar1 += 50.0f;
i++;
}
return FALSE;
}
/* 8070BB10-8070BF94 0014F0 0484+00 2/1 0/0 0/0 .text e_mf_stay__FP10e_mf_class */
static void e_mf_stay(e_mf_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
cXyz sp30;
i_this->field_0x6d4 = 5;
switch (i_this->field_0x5b4) {
case 0:
anm_init(i_this, ANM_WAIT_01, 10.0f, 2, cM_rndF(0.1f) + 0.9f);
i_this->field_0x5b4 = 1;
// fallthrough
case 1:
if (fopAcM_otoCheck(a_this, 2000.0f) || daPy_getPlayerActorClass()->checkWolfBark()) {
SND_INFLUENCE* sound = dKy_Sound_get();
sp30 = sound->position - a_this->current.pos;
if (cM_atan2s(sp30.y, JMAFastSqrt(sp30.x * sp30.x + sp30.z * sp30.z)) > 0x1000) {
i_this->field_0x5b4 = 5;
} else {
i_this->field_0x5b4 = 2;
}
i_this->field_0x6c0[0] = cM_rndF(10.0f) + 10.0f;
i_this->field_0x718 = sound->position;
}
break;
case 2:
if (i_this->field_0x6c0[0] == 0) {
anm_init(i_this, ANM_FIND, 3.0f, 0, 1.5f);
i_this->mSound.startCreatureVoice(Z2SE_EN_MF_V_FIND, -1);
i_this->field_0x5b4 = 3;
}
break;
case 3:
if (i_this->mpModelMorf->isStop()) {
if (other_bg_check2(i_this, &i_this->field_0x718)) {
i_this->field_0x6c0[0] = cM_rndF(10.0f) + 20.0f;
i_this->field_0x5b4 = 4;
} else {
i_this->mAction = 10;
i_this->field_0x5b4 = 0;
}
}
break;
case 4:
if (i_this->field_0x6c0[0] == 0) {
i_this->field_0x5b4 = 10;
i_this->field_0x6c0[0] = cM_rndF(10.0f) + 30.0f;
anm_init(i_this, ANM_WAIT_03, 5.0f, 2, 1.5f);
}
break;
case 5:
if (i_this->field_0x6c0[0] == 0) {
anm_init(i_this, ANM_FIND, 3.0f, 0, 1.5f);
i_this->mSound.startCreatureVoice(Z2SE_EN_MF_V_FIND, -1);
i_this->field_0x5b4 = 6;
}
break;
case 6:
if (i_this->mpModelMorf->isStop()) {
i_this->field_0x6c0[0] = cM_rndF(10.0f) + 20.0f;
i_this->field_0x5b4 = 7;
}
break;
case 7:
if (i_this->field_0x6c0[0] == 0) {
i_this->field_0x5b4 = 10;
i_this->field_0x6c0[0] = cM_rndF(40.0f) + 50.0f;
anm_init(i_this, ANM_WAIT_04, 5.0f, 2, 1.3f);
i_this->mpModelMorf->setFrame(cM_rndF(75.0f));
}
break;
case 8:
if (i_this->mpModelMorf->isStop()) {
i_this->field_0x5b4 = 0;
}
break;
case 10:
if (i_this->field_0x6c0[0] == 0) {
i_this->field_0x5b4 = 0;
}
}
if ((i_this->field_0x6ac & 15) == 0) {
if (pl_check(i_this, i_this->field_0x6b8, 0x4000) != 0) {
i_this->mAction = 3;
i_this->field_0x5b4 = -10;
i_this->field_0x6c0[0] = 60;
} else if (bomb_view_check(i_this) != NULL) {
i_this->mAction = 11;
i_this->field_0x5b4 = 0;
}
}
}
/* 8070BF94-8070C2C4 001974 0330+00 1/1 0/0 0/0 .text e_mf_otoreac__FP10e_mf_class */
static void e_mf_otoreac(e_mf_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
cXyz sp40, sp4c;
f32 fVar1 = 0.0f;
i_this->field_0x6d4 = 2;
switch (i_this->field_0x5b4) {
case 0:
anm_init(i_this, ANM_WAIT_01, 10.0f, 2, cM_rndF(0.2f) + 1.5f);
i_this->field_0x6c0[0] = cM_rndF(10.0f) + 20.0f;
i_this->field_0x5b4 = 1;
// fallthrough
case 1:
if (i_this->field_0x6c0[0] == 0) {
anm_init(i_this, ANM_RUN, 5.0f, 2, cM_rndFX(0.05f) + 1.0f);
i_this->field_0x5b4 = 2;
}
break;
case 2:
fVar1 = l_HIO.dash_speed;
if ((i_this->field_0x6ac & 3) == 0) {
if ((i_this->field_0x6ac & 4) != 0) {
i_this->field_0x10c4 = 1;
} else {
i_this->field_0x10c4 = 2;
}
}
sp40 = i_this->field_0x718 - a_this->current.pos;
cLib_addCalcAngleS2(&a_this->current.angle.y, cM_atan2s(sp40.x, sp40.z), 2, 0xC00);
if (sp40.abs() < 250.0f || i_this->mObjAcch.ChkWallHit() != 0) {
i_this->mAction = 0;
i_this->field_0x5b4 = 0;
i_this->field_0x6c0[0] = cM_rndF(50.0f) + 50.0f;
anm_init(i_this, ANM_WAIT_03, 10.0f, 2, 1.0f);
}
break;
}
cLib_addCalc2(&a_this->speedF, fVar1, 1.0f, 5.0f);
if ((i_this->field_0x6ac & 15) == 0) {
if (pl_check(i_this, i_this->field_0x6b8, 0x4000) != 0) {
i_this->mAction = 3;
i_this->field_0x5b4 = -10;
i_this->field_0x6c0[0] = 60;
} else if (bomb_view_check(i_this) != NULL) {
i_this->mAction = 11;
i_this->field_0x5b4 = 0;
}
}
}
/* 8070C2C4-8070C7C4 001CA4 0500+00 2/1 0/0 0/0 .text e_mf_bomb_action__FP10e_mf_class */
static void e_mf_bomb_action(e_mf_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
s16 sVar2;
cXyz sp3c, sp48;
dBomb_c* bomb = bomb_check(i_this);
if (bomb == NULL) {
i_this->mAction = 3;
i_this->field_0x5b4 = 0;
return;
}
sp3c.x = bomb->current.pos.x - a_this->current.pos.x;
sp3c.z = bomb->current.pos.z - a_this->current.pos.z;
s16 sVar1 = cM_atan2s(sp3c.x, sp3c.z);
f32 fVar1 = 0.0f;
switch (i_this->field_0x5b4) {
case 0:
anm_init(i_this, ANM_FIND, 3.0f, 0, 1.5f);
i_this->mSound.startCreatureVoice(Z2SE_EN_MF_V_FIND_BOMB, -1);
i_this->field_0x5b4 = 1;
break;
case 1:
if (i_this->mpModelMorf->isStop()) {
i_this->field_0x5b4 = 2;
}
break;
case 2:
i_this->field_0x5b4 = 3;
anm_init(i_this, ANM_WAIT_01, 5.0f, 2, 1.0f);
i_this->field_0x6c0[1] = cM_rndF(10.0f) + 10.0f;
// fallthrough
case 3:
if (i_this->field_0x6c0[1] == 0 && bomb->speedF < 0.1f) {
i_this->field_0x5b4 = 4;
anm_init(i_this, ANM_RUN, 5.0f, 2, cM_rndFX(0.05f) + 1.0f);
}
break;
case 4:
if (bomb->speedF < 0.1f && !bomb->checkStateCarry() && JMAFastSqrt(sp3c.x * sp3c.x + sp3c.z * sp3c.z) < 250.0f) {
sVar2 = i_this->mYAngleToPlayer - a_this->shape_angle.y;
if (sVar2 < 0x4000 && sVar2 > -0x4000) {
i_this->field_0x5b4 = 10;
break;
}
}
sVar1 += 0x8000;
fVar1 = l_HIO.dash_speed;
if (JMAFastSqrt(sp3c.x * sp3c.x + sp3c.z * sp3c.z) > 600.0f) {
i_this->field_0x5b4 = 5;
anm_init(i_this, ANM_WAIT_01, 5.0f, 2, 1.0f);
}
break;
case 5:
i_this->mSound.startCreatureSoundLevel(Z2SE_EN_MF_V_LOOK_BOMB, 0, -1);
sVar1 = i_this->mYAngleToPlayer;
if (JMAFastSqrt(sp3c.x * sp3c.x + sp3c.z * sp3c.z) < 500.0f) {
i_this->field_0x5b4 = 2;
}
break;
case 10:
i_this->field_0x6d2 = 0;
fVar1 = l_HIO.dash_speed;
if (JMAFastSqrt(sp3c.x * sp3c.x + sp3c.z * sp3c.z) < 100.0f) {
i_this->field_0x6c0[0] = 20;
i_this->field_0x5b4 = 11;
anm_init(i_this, ANM_RUN, 5.0f, 0, cM_rndFX(0.05f) + 1.0f);
i_this->mSound.startCreatureVoice(Z2SE_EN_MF_V_KICK_BOMB, -1);
}
if (bomb->speedF > 0.1f) {
i_this->field_0x5b4 = 2;
}
break;
case 11:
i_this->field_0x6d2 = 0;
sVar1 = i_this->mYAngleToPlayer;
if (i_this->field_0x6c0[0] >= 10) {
cMtx_YrotS(*calc_mtx, sVar1);
sp3c.x = -30.0f;
sp3c.y = 0.0f;
sp3c.z = 60.0f;
MtxPosition(&sp3c, &sp48);
sp48 += a_this->current.pos;
cLib_addCalc2(&bomb->current.pos.x, sp48.x, 1.0f, 15.0f);
cLib_addCalc2(&bomb->current.pos.z, sp48.z, 1.0f, 15.0f);
if (i_this->field_0x6c0[0] == 10) {
bomb->speedF = 30.0f;
bomb->speed.y = 30.0f;
bomb->current.angle.y = a_this->shape_angle.y;
}
}
if (i_this->field_0x6c0[0] == 0) {
anm_init(i_this, ANM_WAIT_01, 5.0f, 2, 1.0f);
i_this->field_0x5b4 = 5;
}
}
cLib_addCalc2(&a_this->speedF, fVar1, 1.0f, 5.0f);
cLib_addCalcAngleS2(&a_this->current.angle.y, sVar1, 4, 0x1000);
i_this->field_0x6d4 = 2;
i_this->field_0x718 = bomb->current.pos;
}
/* 8070C7C4-8070CB1C 0021A4 0358+00 1/1 0/0 0/0 .text e_mf_normal__FP10e_mf_class */
static void e_mf_normal(e_mf_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
cXyz sp44, sp50;
f32 fVar1 = 0.0f;
s16 sVar1 = 0x4000;
s16 sVar2, sVar3;
switch (i_this->field_0x5b4) {
case 0:
case 1:
case 2:
if (i_this->field_0x6c0[0] == 0) {
if (fopAcM_wayBgCheck(a_this, 200.0f, 50.0f) || move_gake_check(i_this, 200.0f, 0)) {
sVar2 = cM_rndFX(10000.0f) + 32768.0f;
i_this->field_0x6c0[1] = 40;
} else {
sp50.x = a_this->home.pos.x + cM_rndFX(600.0f);
sp50.y = a_this->home.pos.y;
sp50.z = a_this->home.pos.z + cM_rndFX(600.0f);
sp44 = sp50 - a_this->current.pos;
sVar2 = cM_atan2s(sp44.x, sp44.z) - a_this->current.angle.y;
if (sVar2 > 0x3000) {
sVar2 = 0x3000;
} else if (sVar2 < -0x3000) {
sVar2 = -0x3000;
}
}
i_this->field_0x5d4 = a_this->current.angle.y + sVar2;
anm_init(i_this, ANM_WALK, 10.0f, 2, 1.0f);
i_this->field_0x5b4 = 3;
i_this->field_0x6c0[0] = cM_rndF(100.0f) + 100.0f;
} else {
sVar1 = 0x7000;
}
break;
case 3:
fVar1 = l_HIO.movement_speed;
sVar2 = a_this->current.angle.y;
cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x5d4, 2, 0x400);
sVar3 = a_this->current.angle.y - i_this->field_0x5d4;
if (sVar3 > 0x1000 || sVar3 < -0x1000) {
fVar1 = 0.0f;
}
sVar2 -= a_this->current.angle.y;
sVar2 *= 2;
if (sVar2 > 0x1000) {
sVar2 = 0x1000;
} else if (sVar2 < -0x1000) {
sVar2 = -0x1000;
}
cLib_addCalcAngleS2(&i_this->field_0x806, sVar2, 2, 0x400);
if (i_this->field_0x6c0[0] == 0 ||
(i_this->field_0x6c0[1] == 0 && (fopAcM_wayBgCheck(a_this, 200.0f, 50.0f) || move_gake_check(i_this, 200.0f, 0)))) {
i_this->field_0x5b4 = 2;
i_this->field_0x6c0[0] = cM_rndF(100.0f) + 50.0f;
anm_init(i_this, ANM_WAIT_03, 10.0f, 2, 1.0f);
}
break;
}
cLib_addCalc2(&a_this->speedF, fVar1, 1.0f, 3.0f);
BOOL bVar1 = fopAcM_otoCheck(a_this, 2000.0f) | daPy_getPlayerActorClass()->checkWolfBark();
if ((i_this->field_0x6ac & 15) == 0 || bVar1) {
if (bVar1 || pl_check(i_this, i_this->field_0x6b8, sVar1) != 0) {
i_this->mAction = 3;
i_this->field_0x5b4 = -10;
i_this->field_0x6c0[0] = 60;
}
if (bomb_view_check(i_this) != NULL) {
i_this->mAction = 11;
i_this->field_0x5b4 = 0;
}
}
}
/* 8070CB1C-8070CCB8 0024FC 019C+00 1/1 0/0 0/0 .text e_mf_drawback__FP10e_mf_class */
static void e_mf_drawback(e_mf_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
fopAc_ac_c* player = dComIfGp_getPlayer(0);
switch (i_this->field_0x5b4) {
case 0:
anm_init(i_this, ANM_DRAWBACK, 5.0f, 0, 1.0f);
i_this->field_0x5b4 = 1;
a_this->speedF = -5.0f;
i_this->field_0x6c8 = 10;
i_this->mSound.startCreatureVoice(Z2SE_EN_MF_V_DRAWBACK, -1);
i_this->field_0x5d4 = player->shape_angle.y + 0x8000;
i_this->field_0x6c0[0] = 50;
break;
case 1:
a_this->onHeadLockFlg();
cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x5d4, 4, 0x400);
cLib_addCalc0(&a_this->speedF, 1.0f, 0.1f);
if (i_this->mpModelMorf->isStop() || i_this->field_0x6c0[0] == 0) {
i_this->mAction = 3;
i_this->field_0x5b4 = 0;
i_this->mSound.startCreatureVoice(Z2SE_EN_MF_V_AWAKE, -1);
}
break;
}
if (move_gake_check(i_this, 50.0f, 1)) {
i_this->mAction = 23;
i_this->field_0x5b4 = 0;
}
}
/* 8070CCB8-8070D090 002698 03D8+00 1/1 0/0 0/0 .text e_mf_wolfbite__FP10e_mf_class */
static void e_mf_wolfbite(e_mf_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
i_this->field_0x6c8 = 10;
cLib_addCalc0(&a_this->speedF, 1.0f, 2.0f);
switch (i_this->field_0x5b4) {
case 0:
anm_init(i_this, ANM_HANGED, 3.0f, 0, 1.0f);
i_this->field_0x5b4 = 1;
i_this->mSound.startCreatureVoice(Z2SE_EN_MF_V_DRAWBACK, -1);
a_this->health -= 10;
i_this->field_0x10b8 = 0;
break;
case 1:
if (i_this->mpModelMorf->isStop()) {
anm_init(i_this, ANM_HANGED_WAIT, 3.0f, 2, 1.0f);
i_this->field_0x5b4 = 2;
}
break;
case 2:
if (i_this->mAnmID == ANM_HANGED_DAMAGE) {
if (i_this->mpModelMorf->isStop()) {
anm_init(i_this, ANM_HANGED_WAIT, 3.0f, 2, 1.0f);
}
}
if (a_this->health <= 0 || a_this->checkWolfBiteDamage()) {
a_this->offWolfBiteDamage();
anm_init(i_this, ANM_HANGED_DAMAGE, 2.0f, 0, 1.0f);
a_this->health -= 10;
if (a_this->health <= 0) {
player->offWolfEnemyHangBite();
i_this->field_0x730 = (a_this->shape_angle.y - 0x8000) - player->shape_angle.y;
i_this->field_0x72c = 150.0f;
i_this->mAction = 21;
i_this->field_0x5b4 = 0;
i_this->field_0x704.y = player->shape_angle.y + 0x8000;
a_this->speed.y = 0.0f;
i_this->field_0x6e4 = -1.0f;
i_this->field_0x808 = 50;
i_this->mSound.startCollisionSE(Z2SE_HIT_WOLFBITE, 32);
i_this->field_0x6f0 = 1;
i_this->field_0x6c8 = 1000;
i_this->mSound.startCreatureVoice(Z2SE_EN_MF_V_DEATH, -1);
return;
}
i_this->field_0x10b8++;
if (i_this->field_0x10b8 >= 4) {
player->offWolfEnemyHangBite();
anm_init(i_this, ANM_HANGED_BRUSH, 3.0f, 0, 1.0f);
i_this->field_0x5b4 = 3;
}
i_this->mSound.startCollisionSE(Z2SE_HIT_WOLFBITE, 30);
i_this->mSound.startCreatureVoice(Z2SE_EN_MF_V_DAMAGE, -1);
}
if (!player->checkWolfEnemyHangBiteOwn(a_this)) {
anm_init(i_this, ANM_HANGED_BRUSH, 3.0f, 0, 1.0f);
i_this->field_0x5b4 = 3;
}
break;
case 3:
if (i_this->mpModelMorf->isStop()) {
i_this->mAction = 3;
i_this->field_0x5b4 = 0;
i_this->mSound.startCreatureVoice(Z2SE_EN_MF_V_AWAKE, -1);
}
}
}
/* 8070D090-8070D0D0 002A70 0040+00 1/1 0/0 0/0 .text way_check__FP10e_mf_class */
static int way_check(e_mf_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
s16 sVar1 = a_this->shape_angle.y - i_this->mYAngleToPlayer;
if (sVar1 <= 0x4000 && sVar1 >= -0x4000) {
return 0;
}
if (sVar1 < 0) {
return 1;
}
return 2;
}
/* 8070D0D0-8070D2C8 002AB0 01F8+00 1/1 0/0 0/0 .text shot_s_sub__FPvPv */
static void* shot_s_sub(void* i_actor, void* i_data) {
e_mf_class* i_this = (e_mf_class*)i_data;
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
if ((fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_ARROW && (fopAcM_GetParam(i_actor) == 1 || fopAcM_GetParam(i_actor) == 2)) ||
fopAcM_GetName(i_actor) == PROC_BOOMERANG && dComIfGp_checkPlayerStatus0(0, 0x80000) == 0 && daPy_py_c::checkBoomerangCharge() && fopAcM_GetParam(i_actor) == 1) {
cXyz sp28(a_this->current.pos - ((fopAc_ac_c*)i_actor)->current.pos);
if (sp28.abs() < 1000.0f) {
return i_actor;
}
}
if (dComIfGp_checkPlayerStatus0(0, 0x400) != 0 && i_this->mPlayerDistance < 1000.0f) {
return dComIfGp_getPlayer(0);
}
return NULL;