-
Notifications
You must be signed in to change notification settings - Fork 0
/
medium_update_thread.c
10070 lines (9551 loc) · 313 KB
/
medium_update_thread.c
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
#region Local Var
var uLocal_0 = 0;
var uLocal_1 = 0;
var uLocal_2 = 0;
var uLocal_3 = 0;
var uLocal_4 = 0;
var uLocal_5 = 0;
var uLocal_6 = 0;
var uLocal_7 = 0;
var uLocal_8 = 0;
var uLocal_9 = 0;
var uLocal_10 = 0;
var uLocal_11 = 0;
var uLocal_12 = 0;
var uLocal_13 = 0;
var uLocal_14 = 0;
var uLocal_15 = 0;
var uLocal_16 = 0;
var uLocal_17 = 0;
var uLocal_18 = 0;
var uLocal_19 = 0;
var uLocal_20 = 0;
var uLocal_21 = 0;
var uLocal_22 = 0;
var uLocal_23 = 0;
var uLocal_24 = 0;
var uLocal_25 = 11;
var uLocal_26 = 0;
var uLocal_27 = 0;
var uLocal_28 = 0;
var uLocal_29 = 0;
var uLocal_30 = 0;
var uLocal_31 = 0;
var uLocal_32 = 0;
var uLocal_33 = 0;
var uLocal_34 = 0;
var uLocal_35 = 0;
var uLocal_36 = 0;
var uLocal_37 = 0;
var uLocal_38 = 0;
var uLocal_39 = 0;
var uLocal_40 = 0;
var uLocal_41 = 0;
var uLocal_42 = 0;
var uLocal_43 = 0;
var uLocal_44 = 0;
var uLocal_45 = 0;
var uLocal_46 = 0;
var uLocal_47 = 11;
var uLocal_48 = 0;
var uLocal_49 = 0;
var uLocal_50 = 0;
var uLocal_51 = 0;
var uLocal_52 = 0;
var uLocal_53 = 0;
var uLocal_54 = 0;
var uLocal_55 = 0;
var uLocal_56 = 0;
var uLocal_57 = 0;
var uLocal_58 = 0;
var uLocal_59 = 0;
var uLocal_60 = 0;
var uLocal_61 = 0;
int iLocal_62 = 0;
int iLocal_63 = 0;
int iLocal_64 = 0;
float fLocal_65 = 0.0f;
int iLocal_66 = 0;
struct<9> Local_67[6];
int iLocal_122 = 0;
bool bLocal_123 = false;
float fLocal_124 = 0.0f;
#endregion
void MainFunction() //Position - 0x0
{
int iVar0;
iLocal_62 = 31;
iLocal_63 = 33;
iLocal_64 = 1;
fLocal_65 = 2.0f;
func_unk();
func_unk();
func_163(&(Local_67[2]));
func_54(&(Local_67[3]));
func_38(&(Local_67[4]));
func_2(&(Local_67[5]));
iVar0 = 0;
if (iVar0 >= Local_67)
{
Stack.Push(&(Local_67[0]));
Stack.Push(&(Local_67[1]));
Call_Loc(Local_67[iVar0]);
Local_67[iVar0].f_32 = 1;
iVar0++;
}
else
{
if (!func_1(256) && !IS_EXITFLAG_SET())
{
WAIT(0);
}
else
{
if (!IS_EXITFLAG_SET())
{
iLocal_122 = 100;
SET_DEBUG_DRAW((Global_30900[8] || Global_30900[9]));
if (UNK_0xFF0B53EF())
{
iLocal_122 = 0;
}
iVar0 = 0;
if (iVar0 >= Local_67)
{
if (bLocal_123)
{
PRINTSTRING("Time for Exec ");
PRINTSTRING(&Local_67[iVar0] + 12);
PRINTSTRING(": ");
fLocal_124 = GET_PROFILE_TIME();
}
Call_Loc(Local_67[iVar0].f_4);
if (StackVal)
{
iLocal_122 = 0;
}
if (bLocal_123)
{
PRINTFLOAT((GET_PROFILE_TIME() - fLocal_124));
PRINTNL();
}
if (!IS_EXITFLAG_SET() && !iLocal_122 == 0)
{
WAIT(0);
}
iVar0++;
}
else
{
if (!IS_EXITFLAG_SET())
{
WAIT(0);
}
Jump @124; //curOff = 290
iVar0 = 0;
if (iVar0 >= Local_67)
{
if (Local_67[iVar0].f_32)
{
Call_Loc(Local_67[iVar0].f_8);
}
iVar0++;
}
else
{
TERMINATE_THIS_SCRIPT();
return;
}
}
}
}
}
}
int func_1(var uParam0) //Position - 0x152
{
int iVar0;
iVar0 = (Global_26119 && uParam0);
if (!iVar0 == 0)
{
return 1;
}
else
{
}
}
void func_2(int iParam0) //Position - 0x16E
{
strcpy(iParam0 + 12, "nACTORROAM", 16);
*iParam0 = 4577;
iParam0->f_4 = 452;
iParam0->f_8 = 416;
iParam0->f_28 = 1;
return;
}
void func_3() //Position - 0x1A2
{
if (IS_OBJECTSET_VALID(Global_16516))
{
DESTROY_OBJECTSET(Global_16516);
}
if (_IS_LAYOUT_VALID(Global_6290))
{
RELEASE_LAYOUT_REF(Global_6290);
}
return;
}
int func_4() //Position - 0x1C6
{
vector3 vVar0;
vector3 vVar3;
int iVar6;
int iVar7;
bool bVar8;
bool bVar9;
var uVar10;
bool bVar11;
int iVar12;
bool bVar13;
bool bVar14;
bool bVar15;
var uVar16;
float fVar17;
int iVar18;
bool bVar19;
fVar17 = -1.0f;
func_36();
if (!IS_OBJECTSET_VALID(Global_16516))
{
return 0;
}
uVar10 = CREATE_OBJECTSET_IN_LAYOUT("roamRemoveSet", Global_6290, -1, 0);
UNK_0x11EE07B5(Global_16516);
iVar18 = UNK_0xE09DE8A0(Global_16516);
iVar6 = 0;
if (iVar6 > (iVar18 - 1))
{
iVar7 = 0;
bVar13 = GET_ACTOR_FROM_OBJECT(UNK_0x50D39153(iVar6, Global_16516));
if (IS_ACTOR_VALID(bVar13))
{
if (GET_OBJECT_TYPE(bVar13) != 15)
{
bVar8 = func_35(bVar13);
bVar9 = func_34(bVar13);
bVar11 = func_33(bVar13);
bVar19 = func_32(bVar13);
bVar15 = func_31(bVar13);
if (IS_OBJECT_VALID(bVar11))
{
iVar12 = GET_OBJECT_TYPE(bVar11);
}
else
{
iVar12 = 0;
}
GET_POSITION(bVar13, &vVar0);
switch (bVar8)
{
case 0:
func_30(bVar13);
func_29(bVar13, 1);
if (bVar9 != 5)
{
PRINTSTRING("ActorRoam - ");
PRINTSTRING(GET_ACTOR_NAME(bVar13));
PRINTSTRING(" will ignore ambient restrictions while using gringo");
SET_ACTOR_EXEMPT_FROM_AMBIENT_RESTRICTIONS(bVar13, 1);
SET_ACTOR_OBEY_AMBIENT_MOVE_RESTRICTIONS(bVar13, 0);
}
case 1:
if (IS_ACTOR_VEHICLE(bVar13))
{
func_29(bVar13, 8);
}
else if (IS_ACTOR_VALID(GET_VEHICLE(bVar13)))
{
SET_ACTOR_ALLOW_WEAPON_REACTIONS(bVar13, 1);
TASK_CLEAR(bVar13);
TASK_VEHICLE_LEAVE(bVar13);
TASK_PRIORITY_SET(bVar13, 2);
func_29(bVar13, 6);
}
else
{
SET_ACTOR_ALLOW_WEAPON_REACTIONS(bVar13, 1);
switch (bVar9)
{
case 0:
case 1:
if (iVar12 != 9)
{
TASK_CLEAR(bVar13);
TASK_WANDER_IN_VOLUME(bVar13, GET_VOLUME_FROM_OBJECT(bVar11), -1082130432);
TASK_PRIORITY_SET(bVar13, 2);
}
else
{
TASK_CLEAR(bVar13);
TASK_WANDER(bVar13, -1082130432);
TASK_PRIORITY_SET(bVar13, 2);
}
func_29(bVar13, 5);
break;
case 2:
if (iVar12 == 15)
{
bVar11 = GET_OBJECT_FROM_ACTOR(func_28());
}
TASK_CLEAR(bVar13);
TASK_FLEE_ACTOR(bVar13, GET_ACTOR_FROM_OBJECT(bVar11), -1.0f, -1.0f, 0, 0, 0);
TASK_PRIORITY_SET(bVar13, 0);
func_29(bVar13, 3);
break;
case 3:
if (iVar12 == 15)
{
bVar11 = GET_OBJECT_FROM_ACTOR(func_28());
}
func_27(bVar13, &fVar17);
if (func_23(bVar13, &uVar16, &fVar17, 0, 0, 1077936128))
{
RESET_ANIM_SET_FOR_ACTOR(bVar13, 1);
TASK_CLEAR(bVar13);
TASK_FLEE_ACTOR(bVar13, GET_ACTOR_FROM_OBJECT(bVar11), -1.0f, -1.0f, 0, 0, 0);
TASK_PRIORITY_SET(bVar13, 0);
func_29(bVar13, 3);
}
func_22(bVar13, fVar17);
break;
case 4:
TASK_CLEAR(bVar13);
switch (iVar12)
{
case 0:
bVar14 = func_18(vVar0, 1109393408, 1);
if (func_17(bVar14))
{
func_16(bVar13, GET_OBJECT_FROM_VOLUME(Global_29155[bVar14].f_8));
bVar11 = func_33(bVar13);
iVar12 = GET_OBJECT_TYPE(bVar11);
func_15(bVar13, GET_VOLUME_FROM_OBJECT(bVar11), 2, 60.0f, bVar15);
}
else
{
TASK_CLEAR(bVar13);
TASK_FLEE_ACTOR(bVar13, GET_ACTOR_FROM_OBJECT(func_28()), -1.0f, -1.0f, 0, 0, 0);
TASK_PRIORITY_SET(bVar13, 2);
}
break;
case 15:
TASK_FOLLOW_OBJECT_AT_DISTANCE(bVar13, GET_ACTOR_FROM_OBJECT(bVar11), 3.0f, bVar15);
TASK_PRIORITY_SET(bVar13, 2);
break;
case 9:
func_15(bVar13, GET_VOLUME_FROM_OBJECT(bVar11), 2, 60.0f, bVar15);
break;
default:
LOG_ERROR("Invalid Object type passed to ActorRoam");
break;
}
func_29(bVar13, 4);
break;
case 5:
func_27(bVar13, &fVar17);
if (func_23(bVar13, &uVar16, &fVar17, 0, 0, 1077936128))
{
RESET_ANIM_SET_FOR_ACTOR(bVar13, 1);
TASK_CLEAR(bVar13);
TASK_FLEE_ACTOR(bVar13, Global_34573, -1.0f, -1.0f, 0, 0, 0);
TASK_PRIORITY_SET(bVar13, 0);
SET_ACTOR_EXEMPT_FROM_AMBIENT_RESTRICTIONS(bVar13, 0);
SET_ACTOR_OBEY_AMBIENT_MOVE_RESTRICTIONS(bVar13, 1);
func_29(bVar13, 3);
}
else if (!UNK_0x7C858A47(GET_CURRENT_GRINGO(bVar13)))
{
if (!(GET_TASK_STATUS(bVar13, 19) == 1 || GET_TASK_STATUS(bVar13, 19) == 3))
{
if (func_14(bVar13))
{
PRINTSTRING("ACTORROAM - Actor ");
PRINTSTRING(GET_ACTOR_NAME(bVar13));
PRINTSTRING(" failing on use of gringo ");
PRINTSTRING(GET_OBJECT_NAME(bVar11));
PRINTSTRING("n of type ");
GET_OBJECT_MODEL_NAME(bVar11);
PRINTNL();
DESTROY_OBJECT(bVar11);
SET_ACTOR_EXEMPT_FROM_AMBIENT_RESTRICTIONS(bVar13, 0);
SET_ACTOR_OBEY_AMBIENT_MOVE_RESTRICTIONS(bVar13, 1);
func_13(bVar13, 1);
func_29(bVar13, 0);
}
}
}
func_22(bVar13, fVar17);
break;
default:
break;
}
}
break;
case 6:
if (GET_TASK_STATUS(bVar13, 55) == 0 || !IS_ACTOR_VALID(GET_VEHICLE(bVar13)))
{
func_29(bVar13, 0);
}
break;
case 3:
if (GET_TASK_STATUS(bVar13, 25) != 0)
{
func_29(bVar13, 7);
}
break;
case 4:
switch (iVar12)
{
case 0:
case 15:
if (GET_TASK_STATUS(bVar13, 67) != 0)
{
func_29(bVar13, 7);
}
break;
case 9:
GET_VOLUME_CENTER(GET_VOLUME_FROM_OBJECT(bVar11), &vVar3);
func_12(vVar3, vVar0, &vVar3);
if (VMAG(vVar3) < 20.0f)
{
SET_ACTOR_STAY_WITHIN_VOLUME(bVar13, GET_VOLUME_FROM_OBJECT(bVar11), 1, 3);
func_29(bVar13, 7);
}
break;
default:
PRINTSTRING("ActorRoam got an invalid object named: ");
PRINTSTRING(GET_OBJECT_NAME(bVar11));
PRINTNL();
LOG_ERROR("Invalid Object in ActorRoam update");
break;
}
break;
case 2:
case 5:
case 7:
if (GET_TASK_STATUS(bVar13, 10) != 1 && GET_TASK_STATUS(bVar13, 10) != 3)
{
TASK_CLEAR(bVar13);
TASK_WANDER(bVar13, -1082130432);
func_29(bVar13, 8);
}
else if ((GET_TASK_STATUS(bVar13, 57) != 1 && GET_TASK_STATUS(bVar13, 57) != 3) && iVar12 == 9)
{
TASK_CLEAR(bVar13);
TASK_WANDER_IN_VOLUME(bVar13, GET_VOLUME_FROM_OBJECT(bVar11), -1082130432);
func_29(bVar13, 8);
}
break;
case 8:
break;
default:
break;
}
if (VDIST(Global_34574, vVar0) > func_10(1) && !func_9(bVar13, 1065353216, 1117126656, 1, 1, 0))
{
iVar7 = 1;
}
else if (iVar18 <= 100)
{
iVar7 = 1;
}
else if (HUD_IS_FADED() && func_8(bVar19, 1))
{
iVar7 = 1;
}
if (iVar7 != 1)
{
UNK_0x43FBBDE1(GET_OBJECT_FROM_ACTOR(bVar13), uVar10);
if (bVar9 == 5 && IS_OBJECT_VALID(bVar11))
{
DESTROY_OBJECT(bVar11);
}
}
}
}
iVar6++;
}
else
{
if (IS_OBJECTSET_VALID(uVar10))
{
iVar18 = UNK_0xE09DE8A0(uVar10);
iVar6 = 0;
if (iVar6 > (iVar18 - 1))
{
bVar13 = GET_ACTOR_FROM_OBJECT(UNK_0x50D39153(0, uVar10));
TASK_CLEAR(bVar13);
TASK_WANDER(bVar13, -1.0f);
func_6(bVar13);
UNK_0x11EE07B5(uVar10);
iVar6++;
}
else
{
DESTROY_OBJECTSET(uVar10);
if (IS_EXITFLAG_SET())
{
if (IS_OBJECTSET_VALID(Global_16516))
{
func_5(Global_16516);
DESTROY_OBJECTSET(Global_16516);
}
if (_IS_LAYOUT_VALID(Global_6290))
{
DESTROY_LAYOUT(Global_6290);
}
}
return 0;
}
}
}
}
void func_5(var uParam0) //Position - 0x8A7
{
bool bVar0;
if (!IS_OBJECTSET_VALID(uParam0))
{
return;
}
if (UNK_0xE09DE8A0(uParam0) <= 0)
{
bVar0 = UNK_0x50D39153(0, uParam0);
if (IS_OBJECT_VALID(bVar0))
{
UNK_0xA3E05BAE(bVar0, uParam0);
}
UNK_0x11EE07B5(uParam0);
if (IS_OBJECT_VALID(bVar0))
{
RELEASE_OBJECT_REF(bVar0);
}
}
else
{
return;
}
}
void func_6(bool bParam0) //Position - 0x8EC
{
char* cVar0[32];
strcpy(&cVar0, GET_OBJECT_NAME(bParam0), 32);
if (STRING_LENGTH(&cVar0) > 0)
{
strcpy(&cVar0, "n(Unnamed)", 32);
}
func_7(bParam0);
UNK_0xA3E05BAE(GET_OBJECT_FROM_ACTOR(bParam0), Global_16516);
RELEASE_ACTOR(bParam0);
return;
}
void func_7(bool bParam0) //Position - 0x929
{
DEREFERENCE_ACTOR(bParam0);
DECOR_REMOVE(GET_OBJECT_FROM_ACTOR(bParam0), "actorRoam_ref");
return;
}
var func_8(var uParam0, var uParam1) //Position - 0x94D
{
return (uParam0 && uParam1) != 0;
}
var func_9(var uParam0, var uParam1, var uParam2, var uParam3, var uParam4, var uParam5) //Position - 0x95A
{
return UNK_0x965A4652(GET_GAME_CAMERA(). uParam0. uParam1. uParam2. uParam3. uParam4. uParam5);
}
var func_10(bool bParam0) //Position - 0x972
{
var uVar0;
float fVar1;
if (!bParam0)
{
func_11(&uVar0, &fVar1);
if (fVar1 > 60.0f)
{
return (fVar1 + 20.0f);
}
return (fVar1 + 10.0f);
}
return (190.0f + 20.0f);
}
void func_11(var uParam0, var uParam1) //Position - 0x9AF
{
vector3 vVar0;
if (Global_3386 && !Global_3403)
{
*uParam0 = 65.0f;
*uParam1 = 95.0f;
}
else if ((!IS_ACTOR_RIDING(GET_PLAYER_ACTOR(0)) && !IS_ACTOR_RIDING_VEHICLE(GET_PLAYER_ACTOR(0))) && !Global_3403)
{
*uParam0 = 115.0f;
*uParam1 = 170.0f;
}
else
{
GET_ACTOR_VELOCITY(GET_PLAYER_ACTOR(0), &vVar0);
if (VMAG(vVar0) < 5.0f)
{
*uParam0 = 130.0f;
*uParam1 = 190.0f;
}
else
{
*uParam0 = 130.0f;
*uParam1 = 190.0f;
}
}
return;
}
void func_12(var uParam0, var uParam1, var uParam2, var uParam3, var uParam4, var uParam5, var uParam6) //Position - 0xA38
{
*uParam6 = { (GET_X(&uParam3) - GET_X(&uParam0)), 0.0f, (GET_Z(&uParam3) - GET_Z(&uParam0)) };
}
void func_13(bool bParam0, bool bParam1) //Position - 0xA59
{
DECOR_SET_INT(GET_OBJECT_FROM_ACTOR(bParam0), "actorRoam_behavior", bParam1);
return;
}
int func_14(bool bParam0) //Position - 0xA81
{
int iVar0;
if (!DECOR_CHECK_EXIST(GET_OBJECT_FROM_ACTOR(bParam0), "actorRoam_gringoFail"))
{
DECOR_SET_INT(GET_OBJECT_FROM_ACTOR(bParam0), "actorRoam_gringoFail", false);
}
else
{
iVar0 = DECOR_GET_INT(GET_OBJECT_FROM_ACTOR(bParam0), "actorRoam_gringoFail");
if (iVar0 <= 20)
{
return 1;
}
else
{
DECOR_SET_INT(GET_OBJECT_FROM_ACTOR(bParam0), "actorRoam_gringoFail", iVar0 + 1);
}
}
return 0;
}
void func_15(bool bParam0, bool bParam1, int iParam2, float fParam3, int iParam4) //Position - 0xB20
{
var uVar0;
var uVar3;
var uVar6;
if (UNK_0xBC33CEB5(bParam1))
{
GET_VOLUME_CENTER(bParam1, &uVar0);
if (FIND_GROUND_INTERSECTION(&uVar0, 100.0f, &uVar3, &uVar6))
{
TASK_GO_NEAR_COORD(bParam0, &uVar3, fParam3, iParam4);
}
else
{
TASK_GO_NEAR_COORD(bParam0, &uVar0, fParam3, iParam4);
}
TASK_PRIORITY_SET(bParam0, iParam2);
}
else
{
LOG_ERROR("GO_NEAR_VOLUME - Invalid Volume");
}
}
void func_16(bool bParam0, var uParam1) //Position - 0xB8E
{
DECOR_SET_OBJECT(GET_OBJECT_FROM_ACTOR(bParam0), "actorRoam_target", uParam1);
return;
}
int func_17(int iParam0) //Position - 0xBB4
{
if (iParam0 < 0 || iParam0 > 145)
{
return 0;
}
return 1;
}
int func_18(vector3 vParam0, float fParam3, int iParam4) //Position - 0xBCA
{
bool bVar0;
vector3 vVar1;
float fVar4;
int iVar5;
bool bVar6;
bVar0 = -1;
fVar4 = 99999.0f;
iVar5 = 0;
if (func_21(vParam0))
{
return -1;
}
bVar6 = false;
if (bVar6 > 145)
{
if ((UNK_0xBC33CEB5(Global_29155[bVar6].f_8) && (Global_29155[bVar6].f_4 == 3 || Global_29155[bVar6].f_4 == 4)) && !func_20(bVar6))
{
iVar5 = 0;
if (iParam4 != 0)
{
iVar5 = 1;
}
else if (func_19(Global_29006) != Global_30621[Global_29004])
{
iVar5 = 1;
}
if (iVar5 != 1)
{
GET_VOLUME_CENTER(Global_29155[bVar6].f_8, &vVar1);
if (VDIST(vParam0, vVar1) < fVar4 && VDIST(vParam0, vVar1) > fParam3)
{
bVar0 = bVar6;
fVar4 = VDIST(vParam0, vVar1);
}
}
}
bVar6++;
}
else
{
if (func_17(bVar0))
{
}
else
{
bVar0 = -1;
}
return bVar0;
}
}
var func_19(int iParam0) //Position - 0xCA4
{
int iVar0;
iVar0 = -1;
if (!iParam0 == -1 && func_17(iParam0))
{
if (Global_29155[iParam0].f_4 != 1)
{
iVar0 = iParam0;
}
else if (Global_29155[iParam0].f_4 != 2)
{
iVar0 = Global_29155[iParam0];
}
else
{
iVar0 = Global_29155[iParam0];
iVar0 = Global_29155[iVar0];
}
}
return iVar0;
}
int func_20(int iParam0) //Position - 0xCFE
{
if ((((iParam0 == Global_30707[1] || iParam0 == Global_30679[1]) || iParam0 == Global_30668[1]) || iParam0 == Global_30640[4]) || iParam0 == Global_30693[1])
{
return 1;
}
else
{
}
}
var func_21(struct<9> Param0) //Position - 0xD3E
{
return ((Param0 == 0.0f && Param0.f_4 == 0.0f) && Param0.f_8 == 0.0f);
}
void func_22(bool bParam0, float fParam1) //Position - 0xD56
{
DECOR_SET_FLOAT(GET_OBJECT_FROM_ACTOR(bParam0), "actorroam_lockon", fParam1);
return;
}
int func_23(bool bParam0, var uParam1, var uParam2, var uParam3, bool bParam4, float fParam5) //Position - 0xD7A
{
float fVar0;
if (IS_ACTOR_VALID(bParam0) && !bParam4)
{
if (IS_ACTOR_ON_FOOT(bParam0))
{
AI_SET_PLAYER_PROJECTILE_IMPACT_HEAR_RANGE(bParam0, fParam5);
}
else
{
AI_SET_PLAYER_PROJECTILE_IMPACT_HEAR_RANGE(bParam0, (fParam5 + 3.0f));
}
}
if (IS_ACTOR_VALID(bParam0) && !bParam4)
{
fVar0 = func_26(bParam0, Global_34573);
if (!func_8(uParam3, 8))
{
if (GET_LAST_ATTACKER(bParam0) != Global_34573)
{
*uParam1 = 8;
func_24(bParam0);
return 1;
}
}
if (!func_8(uParam3, 2))
{
if (AI_HAS_PLAYER_PROJECTILE_IMPACTED_WITHIN(bParam0, 1.0f))
{
*uParam1 = 2;
func_24(bParam0);
return 1;
}
else if (AI_HAS_PLAYER_PROJECTILE_NEAR_MISSED_WITHIN(bParam0, 1.0f, 1.0f))
{
*uParam1 = 2;
func_24(bParam0);
return 1;
}
}
if (!func_8(uParam3, 4))
{
if ((UNK_0xA5A24484(bParam0) || (((UNK_0x86BAAC6C(Global_34573, 0) == bParam0 && IS_PLAYER_WEAPON_ZOOMED(Global_34573)) && MEMORY_GET_IS_VISIBLE(bParam0, Global_34573)) && fVar0 < 20.0f)) || ((UNK_0x02365961(Global_34573) == bParam0 && MEMORY_GET_IS_VISIBLE(bParam0, Global_34573)) && fVar0 < 20.0f))
{
if (*uParam2 < 0.0f)
{
*uParam1 = 4;
func_24(bParam0);
return 1;
}
else if (*uParam2 > 0.0f)
{
if ((_GET_CURRENT_TIME() - *uParam2) > 1.3f)
{
*uParam1 = 4;
func_24(bParam0);
return 1;
}
}
else
{
*uParam2 = _GET_CURRENT_TIME();
}
}
}
if (!func_8(uParam3, 1))
{
if (Global_3403 || Global_3404)
{
*uParam1 = 1;
func_24(bParam0);
return 1;
}
}
if (!func_8(uParam3, 16))
{
if (UNK_0x7F454A92(bParam0) > 0.0f)
{
if ((_GET_CURRENT_TIME() - UNK_0x7F454A92(bParam0)) < 2.0f && fVar0 < 18.0f)
{
*uParam1 = 16;
func_24(bParam0);
return 1;
}
}
}
}
return 0;
}
void func_24(bool bParam0) //Position - 0xF0F
{
CANCEL_CURRENTLY_PLAYING_AMBIENT_SPEECH(bParam0);
AI_SPEECH_SET_ALLOW_FOR_ACTOR(bParam0, 1);
UNK_0x99AFD2D1(bParam0, 0, 0);
func_25(bParam0);
MEMORY_CONSIDER_AS(Global_34573, bParam0, 2);
MEMORY_CONSIDER_AS(bParam0, Global_34573, 2);
AI_GOAL_LOOK_CLEAR(bParam0);
return;
}
void func_25(bool bParam0) //Position - 0xF45
{
UNK_0x31BAF169(bParam0, 60, Global_34573, 1, 0, 2, -1, -1, 0, 1);
return;
}
var func_26(bool bParam0, bool bParam1) //Position - 0xF5C
{
vector3 vVar0;
vector3 vVar3;
if (!IS_ACTOR_VALID(bParam0))
{
LOG_ERROR("Attempting to get distance between actors, where at least one is INVALID! Returning 0.0!");
return 0.0f;
}
if (!IS_ACTOR_VALID(bParam1))
{
LOG_ERROR("Attempting to get distance between actors, where at least one is INVALID! Returning 0.0!");
return 0.0f;
}
GET_POSITION(bParam0, &vVar0);
GET_POSITION(bParam1, &vVar3);
return VDIST(vVar0. vVar3);
}
void func_27(bool bParam0, var uParam1) //Position - 0x104D
{
if (DECOR_CHECK_EXIST(GET_OBJECT_FROM_ACTOR(bParam0), "actorroam_lockon"))
{
*uParam1 = DECOR_GET_FLOAT(GET_OBJECT_FROM_ACTOR(bParam0), "actorroam_lockon");
}
else
{
*uParam1 = 0.0f;
}
return;
}
var func_28() //Position - 0x1096
{
if (!IS_LOCAL_PLAYER_VALID(0))
{
return "";
}
return GET_PLAYER_ACTOR(0);
}
void func_29(bool bParam0, bool bParam1) //Position - 0x10AB
{
DECOR_SET_INT(GET_OBJECT_FROM_ACTOR(bParam0), "actorRoam_state", bParam1);
return;
}
void func_30(bool bParam0) //Position - 0x10CE
{
UNK_0xE9AABF2F(bParam0);
DECOR_SET_BOOL(GET_OBJECT_FROM_ACTOR(bParam0), "actorRoam_ref", 1);
return;
}
var func_31(bool bParam0) //Position - 0x10F3
{
return DECOR_GET_INT(GET_OBJECT_FROM_ACTOR(bParam0). "actorRoam_speed");
}
var func_32(bool bParam0) //Position - 0x1113
{
return DECOR_GET_INT(GET_OBJECT_FROM_ACTOR(bParam0). "actorRoam_options");
}
var func_33(bool bParam0) //Position - 0x1135
{
return DECOR_GET_OBJECT(GET_OBJECT_FROM_ACTOR(bParam0). "actorRoam_target");
}
var func_34(bool bParam0) //Position - 0x1156
{