forked from root-cause/v-decompiled-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
am_car_mod_tut.c
9609 lines (8285 loc) · 156 KB
/
am_car_mod_tut.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;
int iLocal_2 = 0;
int iLocal_3 = 0;
int iLocal_4 = 0;
int iLocal_5 = 0;
int iLocal_6 = 0;
int iLocal_7 = 0;
int iLocal_8 = 0;
int iLocal_9 = 0;
int iLocal_10 = 0;
int iLocal_11 = 0;
float fLocal_12 = 0f;
var uLocal_13 = 0;
var uLocal_14 = 0;
int iLocal_15 = 0;
char* sLocal_16 = NULL;
var uLocal_17 = 0;
var uLocal_18 = 0;
var uLocal_19 = 0;
var uLocal_20 = 0;
float fLocal_21 = 0f;
float fLocal_22 = 0f;
float fLocal_23 = 0f;
var uLocal_24 = 0;
var uLocal_25 = 0;
int iLocal_26 = 0;
float fLocal_27 = 0f;
var uLocal_28 = 0;
var uLocal_29 = 0;
var uLocal_30 = 0;
float fLocal_31 = 0f;
float fLocal_32 = 0f;
var uLocal_33 = 0;
var uLocal_34 = 0;
var uLocal_35 = 0;
var uLocal_36 = 0;
int iLocal_37 = 0;
int iLocal_38 = 0;
int iLocal_39 = 0;
int iLocal_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 = 0;
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;
float fLocal_59 = 0f;
struct<3> Local_60 = { 0, 0, 0 } ;
var uLocal_63 = 0;
var uLocal_64 = 0;
var uLocal_65 = 0;
var uLocal_66 = 0;
var uLocal_67 = 0;
var uLocal_68 = 0;
var uLocal_69 = 32;
var uLocal_70 = 0;
var uLocal_71 = 0;
var uLocal_72 = 0;
var uLocal_73 = 0;
var uLocal_74 = 0;
var uLocal_75 = 0;
var uLocal_76 = 0;
var uLocal_77 = 0;
var uLocal_78 = 0;
var uLocal_79 = 0;
var uLocal_80 = 0;
var uLocal_81 = 0;
var uLocal_82 = 0;
var uLocal_83 = 0;
var uLocal_84 = 0;
var uLocal_85 = 0;
var uLocal_86 = 0;
var uLocal_87 = 0;
var uLocal_88 = 0;
var uLocal_89 = 0;
var uLocal_90 = 0;
var uLocal_91 = 0;
var uLocal_92 = 0;
var uLocal_93 = 0;
var uLocal_94 = 0;
var uLocal_95 = 0;
var uLocal_96 = 0;
var uLocal_97 = 0;
var uLocal_98 = 0;
var uLocal_99 = 0;
var uLocal_100 = 0;
var uLocal_101 = 0;
var uLocal_102 = 32;
var uLocal_103 = 0;
var uLocal_104 = 0;
var uLocal_105 = 0;
var uLocal_106 = 0;
var uLocal_107 = 0;
var uLocal_108 = 0;
var uLocal_109 = 0;
var uLocal_110 = 0;
var uLocal_111 = 0;
var uLocal_112 = 0;
var uLocal_113 = 0;
var uLocal_114 = 0;
var uLocal_115 = 0;
var uLocal_116 = 0;
var uLocal_117 = 0;
var uLocal_118 = 0;
var uLocal_119 = 0;
var uLocal_120 = 0;
var uLocal_121 = 0;
var uLocal_122 = 0;
var uLocal_123 = 0;
var uLocal_124 = 0;
var uLocal_125 = 0;
var uLocal_126 = 0;
var uLocal_127 = 0;
var uLocal_128 = 0;
var uLocal_129 = 0;
var uLocal_130 = 0;
var uLocal_131 = 0;
var uLocal_132 = 0;
var uLocal_133 = 0;
var uLocal_134 = 0;
var uLocal_135 = 0;
var uLocal_136 = 0;
var uLocal_137 = 0;
int iLocal_138 = 0;
struct<3> Local_139[32];
int iLocal_236 = 0;
var uLocal_237 = 0;
var uLocal_238 = 0;
var uLocal_239 = 0;
var uLocal_240 = 0;
var uLocal_241 = 0;
var uLocal_242 = 0;
var uLocal_243 = 0;
int iLocal_244 = 0;
int iLocal_245 = 0;
var uLocal_246 = 0;
var uLocal_247 = 0;
struct<21> ScriptParam_0 = { 0, -1, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, -1, -1 } ;
#endregion
void __EntryFunction__()//Position - 0x0
{
iLocal_2 = 1;
iLocal_3 = 134;
iLocal_4 = 134;
iLocal_5 = 1;
iLocal_6 = 1;
iLocal_7 = 1;
iLocal_8 = 134;
iLocal_9 = 1;
iLocal_10 = 12;
iLocal_11 = 12;
fLocal_12 = 0.001f;
iLocal_15 = -1;
sLocal_16 = "NULL";
fLocal_21 = 80f;
fLocal_22 = 140f;
fLocal_23 = 180f;
iLocal_26 = 3;
fLocal_27 = 0f;
fLocal_31 = -0.0375f;
fLocal_32 = 0.17f;
iLocal_37 = 1;
iLocal_38 = 65;
iLocal_39 = 49;
iLocal_40 = 64;
fLocal_59 = ((0.05f + 0.275f) - 0.01f);
iLocal_236 = -1;
func_225(ScriptParam_0);
while (true)
{
func_224();
if (func_217())
{
func_207();
}
switch (func_206(NETWORK::PARTICIPANT_ID_TO_INT()))
{
case 0:
if (func_205() == 2)
{
Local_139[NETWORK::PARTICIPANT_ID_TO_INT() /*3*/] = 2;
}
else if (func_205() == 6)
{
Local_139[NETWORK::PARTICIPANT_ID_TO_INT() /*3*/] = 5;
}
break;
case 2:
if (func_205() == 2)
{
if (!func_204(0))
{
func_82();
}
else if (!BitTest(Local_139[NETWORK::PARTICIPANT_ID_TO_INT() /*3*/].f_2, 1))
{
func_8();
}
}
else if (func_205() == 6)
{
Local_139[NETWORK::PARTICIPANT_ID_TO_INT() /*3*/] = 5;
}
break;
case 5:
func_6(&(Local_60.f_2));
if (func_5(&(Local_60.f_2)))
{
Local_139[NETWORK::PARTICIPANT_ID_TO_INT() /*3*/] = 6;
}
break;
case 3:
Local_139[NETWORK::PARTICIPANT_ID_TO_INT() /*3*/] = 6;
case 6:
func_207();
break;
}
if (NETWORK::NETWORK_IS_HOST_OF_THIS_SCRIPT())
{
switch (func_205())
{
case 0:
Local_60.f_0 = 2;
break;
case 2:
func_3();
func_2();
if (func_1())
{
Local_60.f_0 = 6;
}
break;
case 6:
break;
}
}
}
}
int func_1()//Position - 0x1AB
{
if (BitTest(Local_60.f_1, 0))
{
return 1;
}
return 0;
}
void func_2()//Position - 0x1C1
{
if (NETWORK::NETWORK_IS_HOST_OF_THIS_SCRIPT())
{
}
}
void func_3()//Position - 0x1D0
{
int iVar0;
int iVar1;
if (NETWORK::NETWORK_IS_HOST_OF_THIS_SCRIPT())
{
if (iLocal_138 == 0)
{
MISC::CLEAR_BIT(&uLocal_237, 0);
MISC::SET_BIT(&uLocal_237, 1);
}
iVar0 = iLocal_138;
if (NETWORK::NETWORK_IS_PARTICIPANT_ACTIVE(iVar0))
{
iVar1 = NETWORK::NETWORK_GET_PLAYER_INDEX(iVar0);
if (!BitTest(Local_139[iLocal_138 /*3*/].f_2, 0))
{
MISC::CLEAR_BIT(&uLocal_237, 1);
}
if (func_4(iVar1, 0, 1))
{
if (!BitTest(Global_1845263[iLocal_138 /*877*/].f_143, 4))
{
}
}
}
iLocal_138++;
if (iLocal_138 == 32)
{
if (BitTest(uLocal_237, 1))
{
MISC::SET_BIT(&(Local_60.f_1), 0);
}
MISC::SET_BIT(&uLocal_237, 0);
iLocal_138 = 0;
}
}
}
int func_4(int iParam0, bool bParam1, bool bParam2)//Position - 0x260
{
int iVar0;
iVar0 = iParam0;
if (iVar0 != -1)
{
if (NETWORK::NETWORK_IS_PLAYER_ACTIVE(iParam0))
{
if (bParam1)
{
if (!PLAYER::IS_PLAYER_PLAYING(iParam0))
{
return 0;
}
}
if (bParam2)
{
if (iVar0 == Global_2672741.f_3)
{
return Global_2672741.f_2;
}
else if (Global_2657921[iVar0 /*463*/] != 4)
{
return 0;
}
}
return 1;
}
}
return 0;
}
int func_5(var uParam0)//Position - 0x2C0
{
if (uParam0->f_1)
{
if (MISC::ABSI(NETWORK::GET_TIME_DIFFERENCE(NETWORK::GET_NETWORK_TIME(), *uParam0)) >= 1000)
{
return 1;
}
}
return 0;
}
void func_6(var uParam0)//Position - 0x2E9
{
if (!uParam0->f_1)
{
if (NETWORK::NETWORK_IS_HOST_OF_THIS_SCRIPT())
{
func_7(uParam0, 0, 0);
}
}
}
void func_7(var uParam0, bool bParam1, bool bParam2)//Position - 0x308
{
if (uParam0->f_1 == 0)
{
if (NETWORK::NETWORK_IS_GAME_IN_PROGRESS() && !bParam1)
{
if (!bParam2)
{
*uParam0 = NETWORK::GET_NETWORK_TIME();
}
else
{
*uParam0 = NETWORK::GET_NETWORK_TIME_ACCURATE();
}
}
else
{
*uParam0 = MISC::GET_GAME_TIMER();
}
uParam0->f_1 = 1;
}
}
void func_8()//Position - 0x34D
{
if (iLocal_236 != -1)
{
func_80(iLocal_236, 0);
func_79(iLocal_236, 0);
iLocal_236 = -1;
}
MISC::SET_BIT(&(Local_139[NETWORK::PARTICIPANT_ID_TO_INT() /*3*/].f_2), 0);
MISC::SET_BIT(&(Local_139[NETWORK::PARTICIPANT_ID_TO_INT() /*3*/].f_2), 1);
func_78(10, 0);
func_77(0);
func_31(1);
func_24();
func_9(43, 1, 0);
func_9(42, 1, 0);
}
void func_9(int iParam0, bool bParam1, int iParam2)//Position - 0x3AF
{
if (bParam1)
{
if (!func_23(iParam0, 0, 0))
{
if (iParam2 && Global_101444.f_18[iParam0])
{
if (func_22(iParam0) == 3 && !func_21(iParam0))
{
func_20(iParam0);
func_19(iParam0, 0, 0);
func_11(iParam0, 1, 0);
func_10(iParam0);
}
else
{
func_19(iParam0, 1, 0);
func_10(iParam0);
}
}
else
{
func_19(iParam0, 0, 0);
func_11(iParam0, 1, 0);
func_10(iParam0);
}
}
else
{
func_11(iParam0, 1, 0);
func_10(iParam0);
}
}
else if (func_23(iParam0, 0, 0))
{
func_11(iParam0, 0, 0);
func_11(iParam0, 1, 0);
func_10(iParam0);
}
}
void func_10(int iParam0)//Position - 0x46E
{
Global_101444.f_205[iParam0] = 1;
Global_101444.f_204 = 1;
}
void func_11(int iParam0, int iParam1, bool bParam2)//Position - 0x488
{
int iVar0;
if (iParam0 == -1)
{
return;
}
if (bParam2)
{
MISC::CLEAR_BIT(&(Global_101444.f_1414[iParam0]), iParam1);
}
else if (NETWORK::NETWORK_IS_GAME_IN_PROGRESS())
{
if (func_18() == 0)
{
iVar0 = func_16(func_17(iParam0), -1);
MISC::CLEAR_BIT(&iVar0, iParam1);
func_12(func_17(iParam0), iVar0, -1, 1);
}
}
else
{
MISC::CLEAR_BIT(&(Global_114370.f_668[iParam0]), iParam1);
}
}
void func_12(int iParam0, int iParam1, int iParam2, bool bParam3)//Position - 0x4F8
{
int iVar0;
if (iParam0 != 14626)
{
iVar0 = func_13(iParam0, iParam2);
if (iVar0 != 0)
{
STATS::STAT_SET_INT(iVar0, iParam1, bParam3);
}
}
}
int func_13(int iParam0, var uParam1)//Position - 0x526
{
return STATS::_GET_STAT_HASH_FOR_CHARACTER_STAT(0, iParam0, func_14(uParam1));
}
int func_14(var uParam0)//Position - 0x53B
{
int iVar0;
int iVar1;
iVar0 = uParam0;
if (iVar0 == -1)
{
iVar1 = func_15();
if (iVar1 > -1)
{
Global_2750546 = 0;
iVar0 = iVar1;
}
else
{
iVar0 = 0;
Global_2750546 = 1;
}
}
return iVar0;
}
int func_15()//Position - 0x56F
{
return Global_1574925;
}
int func_16(int iParam0, int iParam1)//Position - 0x57B
{
int iVar0;
var uVar1;
if (iParam0 != 14626)
{
iVar0 = func_13(iParam0, iParam1);
if (STATS::STAT_GET_INT(iVar0, &uVar1, -1))
{
return uVar1;
}
}
return 0;
}
int func_17(int iParam0)//Position - 0x5AA
{
switch (iParam0)
{
case 0:
return 828;
break;
case 1:
return 829;
break;
case 2:
return 830;
break;
case 3:
return 831;
break;
case 4:
return 832;
break;
case 5:
return 833;
break;
case 6:
return 834;
break;
case 7:
return 835;
break;
case 8:
return 836;
break;
case 9:
return 837;
break;
case 10:
return 838;
break;
case 11:
return 839;
break;
case 12:
return 840;
break;
case 13:
return 841;
break;
case 14:
return 842;
break;
case 15:
return 844;
break;
case 16:
return 845;
break;
case 17:
return 846;
break;
case 18:
return 847;
break;
case 19:
return 848;
break;
case 20:
return 849;
break;
case 21:
return 850;
break;
case 22:
return 851;
break;
case 23:
return 852;
break;
case 24:
return 853;
break;
case 25:
return 854;
break;
case 26:
return 855;
break;
case 27:
return 856;
break;
case 28:
return 857;
break;
case 29:
return 858;
break;
case 30:
return 859;
break;
case 31:
return 860;
break;
case 32:
return 861;
break;
case 33:
return 862;
break;
case 34:
return 863;
break;
case 35:
return 864;
break;
case 36:
return 865;
break;
case 37:
return 866;
break;
case 38:
return 867;
break;
case 39:
return 868;
break;
case 40:
return 872;
break;
case 41:
return 873;
break;
case 42:
return 874;
break;
case 43:
return 875;
break;
case 44:
return 12725;
break;
case 45:
return 3811;
break;
case 46:
return 5386;
break;
case 47:
return 6158;
break;
case 48:
return 7235;
break;
case 49:
return 7881;
break;
case 52:
return 8917;
break;
case 50:
return 8268;
break;
case 51:
return 8270;
break;
case 53:
return 9557;
break;
case 54:
return 9633;
break;
case 55:
return 9848;
break;
case 56:
return 9917;
break;
case 57:
return 9919;
break;
case 58:
return 11435;
break;
case 59:
return 11846;
break;
case 60:
return 11903;
break;
default:
break;
}
return 14626;
}
int func_18()//Position - 0x952
{
return Global_32828;
}
void func_19(int iParam0, int iParam1, bool bParam2)//Position - 0x95D
{
int iVar0;
if (iParam0 == -1)
{
return;
}
if (bParam2)
{
MISC::SET_BIT(&(Global_101444.f_1414[iParam0]), iParam1);
}
else if (NETWORK::NETWORK_IS_GAME_IN_PROGRESS())
{
if (func_18() == 0)
{
iVar0 = func_16(func_17(iParam0), -1);
MISC::SET_BIT(&iVar0, iParam1);
func_12(func_17(iParam0), iVar0, -1, 1);
}
}
else
{
MISC::SET_BIT(&(Global_114370.f_668[iParam0]), iParam1);
}
}
void func_20(int iParam0)//Position - 0x9CD
{
if (Global_101444.f_18[iParam0])
{
func_19(iParam0, 10, 1);
func_19(iParam0, 19, 1);
}
}
bool func_21(int iParam0)//Position - 0x9F4
{
return func_23(iParam0, 5, 1);
}
int func_22(int iParam0)//Position - 0xA04
{
switch (iParam0)
{
case -1:
return 6;
break;
case 0:
return 0;
break;
case 1:
return 0;
break;
case 2:
return 0;
break;
case 3:
return 0;
break;
case 4:
return 0;
break;
case 5:
return 0;
break;
case 6:
return 0;
break;
case 50:
return 0;
break;
case 7:
return 1;
break;
case 8:
return 1;
break;
case 9:
return 1;
break;
case 10:
return 1;
break;
case 11:
return 1;
break;
case 12:
return 1;
break;
case 13:
return 1;
break;
case 14:
return 1;
break;
case 15:
return 1;
break;
case 16:
return 1;
break;
case 17:
return 1;
break;
case 18:
return 1;
break;
case 19:
return 1;
break;
case 20:
return 1;
break;
case 21:
return 1;
break;
case 22:
return 2;
break;
case 23:
return 2;
break;
case 24:
return 2;
break;
case 25:
return 2;
break;
case 26:
return 2;
break;
case 27:
return 2;
break;
case 28:
return 3;
break;
case 29:
return 3;
break;
case 30:
return 3;
break;
case 31:
return 3;
break;
case 32:
return 3;
break;
case 33:
return 3;
break;
case 34: