forked from Bots-United/HPB-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot_combat.cpp
1946 lines (1665 loc) · 73.1 KB
/
bot_combat.cpp
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
//
// HPB bot - botman's High Ping Bastard bot
//
// (http://planethalflife.com/botman/)
//
// bot_combat.cpp
//
#ifndef _WIN32
#include <string.h>
#endif
#include <extdll.h>
#include <dllapi.h>
#include <h_export.h>
#include <meta_api.h>
#include "bot.h"
#include "bot_func.h"
#include "bot_weapons.h"
extern int mod_id;
extern bot_weapon_t weapon_defs[MAX_WEAPONS];
extern bool b_observer_mode;
extern int team_allies[4];
extern edict_t *pent_info_ctfdetect;
extern bool is_team_play;
extern bool checked_teamplay;
extern int num_logos;
FILE *fp;
int tfc_max_armor[10] = {0, 50, 50, 200, 120, 100, 300, 150, 100, 50};
edict_t *holywars_saint = NULL;
int halo_status = HW_WAIT_SPAWN;
int holywars_gamemode = 0; // 0=deathmatch, 1=halo, 2=instagib
float react_delay_min[3][5] = {
{0.01, 0.02, 0.03, 0.04, 0.05},
{0.07, 0.09, 0.12, 0.14, 0.17},
{0.10, 0.12, 0.15, 0.18, 0.21}};
float react_delay_max[3][5] = {
{0.04, 0.06, 0.08, 0.10, 0.12},
{0.11, 0.14, 0.18, 0.21, 0.25},
{0.15, 0.18, 0.22, 0.25, 0.30}};
float aim_tracking_x_scale[5] = {5.0, 4.0, 3.2, 2.5, 2.0};
float aim_tracking_y_scale[5] = {5.0, 4.0, 3.2, 2.5, 2.0};
typedef struct
{
int iId; // the weapon ID value
char weapon_name[64]; // name of the weapon when selecting it
int skill_level; // bot skill must be less than or equal to this value
float primary_min_distance; // 0 = no minimum
float primary_max_distance; // 9999 = no maximum
float secondary_min_distance; // 0 = no minimum
float secondary_max_distance; // 9999 = no maximum
int use_percent; // times out of 100 to use this weapon when available
bool can_use_underwater; // can use this weapon underwater
int primary_fire_percent; // times out of 100 to use primary fire
int min_primary_ammo; // minimum ammout of primary ammo needed to fire
int min_secondary_ammo; // minimum ammout of seconday ammo needed to fire
bool primary_fire_hold; // hold down primary fire button to use?
bool secondary_fire_hold; // hold down secondary fire button to use?
bool primary_fire_charge; // charge weapon using primary fire?
bool secondary_fire_charge; // charge weapon using secondary fire?
float primary_charge_delay; // time to charge weapon
float secondary_charge_delay; // time to charge weapon
} bot_weapon_select_t;
typedef struct
{
int iId;
float primary_base_delay;
float primary_min_delay[5];
float primary_max_delay[5];
float secondary_base_delay;
float secondary_min_delay[5];
float secondary_max_delay[5];
} bot_fire_delay_t;
// weapons are stored in priority order, most desired weapon should be at
// the start of the array and least desired should be at the end
bot_weapon_select_t valve_weapon_select[] = {
{VALVE_WEAPON_CROWBAR, "weapon_crowbar", 2, 0.0, 50.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{VALVE_WEAPON_HANDGRENADE, "weapon_handgrenade", 5, 250.0, 750.0, 0.0, 0.0,
30, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{VALVE_WEAPON_SNARK, "weapon_snark", 5, 150.0, 500.0, 0.0, 0.0,
50, FALSE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{VALVE_WEAPON_EGON, "weapon_egon", 5, 0.0, 9999.0, 0.0, 0.0,
100, FALSE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{VALVE_WEAPON_GAUSS, "weapon_gauss", 5, 0.0, 9999.0, 0.0, 9999.0,
100, FALSE, 80, 1, 10, FALSE, FALSE, FALSE, TRUE, 0.0, 0.8},
{VALVE_WEAPON_SHOTGUN, "weapon_shotgun", 5, 30.0, 150.0, 30.0, 150.0,
100, FALSE, 70, 1, 2, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{VALVE_WEAPON_PYTHON, "weapon_357", 5, 30.0, 700.0, 0.0, 0.0,
100, FALSE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{VALVE_WEAPON_HORNETGUN, "weapon_hornetgun", 5, 30.0, 1000.0, 30.0, 1000.0,
100, TRUE, 50, 1, 4, FALSE, TRUE, FALSE, FALSE, 0.0, 0.0},
{VALVE_WEAPON_MP5, "weapon_9mmAR", 5, 0.0, 250.0, 300.0, 600.0,
100, FALSE, 90, 1, 1, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{VALVE_WEAPON_CROSSBOW, "weapon_crossbow", 5, 100.0, 1000.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{VALVE_WEAPON_RPG, "weapon_rpg", 5, 300.0, 9999.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{VALVE_WEAPON_GLOCK, "weapon_9mmhandgun", 5, 0.0, 1200.0, 0.0, 1200.0,
100, TRUE, 70, 1, 1, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
/* terminator */
{0, "", 0, 0.0, 0.0, 0.0, 0.0, 0, TRUE, 0, 1, 1, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0}
};
bot_weapon_select_t tfc_weapon_select[] = {
{TF_WEAPON_AXE, "tf_weapon_axe", 5, 0.0, 50.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{TF_WEAPON_KNIFE, "tf_weapon_knife", 5, 0.0, 40.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{TF_WEAPON_SPANNER, "tf_weapon_spanner", 5, 0.0, 40.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{TF_WEAPON_MEDIKIT, "tf_weapon_medikit", 5, 0.0, 40.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{TF_WEAPON_SNIPERRIFLE, "tf_weapon_sniperrifle", 5, 300.0, 9999.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, TRUE, FALSE, 1.0, 0.0},
{TF_WEAPON_FLAMETHROWER, "tf_weapon_flamethrower", 5, 100.0, 500.0, 0.0, 0.0,
100, FALSE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{TF_WEAPON_AC, "tf_weapon_ac", 5, 50.0, 1000.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{TF_WEAPON_GL, "tf_weapon_gl", 5, 300.0, 900.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{TF_WEAPON_RPG, "tf_weapon_rpg", 5, 300.0, 900.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{TF_WEAPON_IC, "tf_weapon_ic", 5, 300.0, 800.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{TF_WEAPON_TRANQ, "tf_weapon_tranq", 5, 40.0, 1000.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{TF_WEAPON_RAILGUN, "tf_weapon_railgun", 5, 40.0, 800.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{TF_WEAPON_SUPERNAILGUN, "tf_weapon_superng", 5, 40.0, 800.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{TF_WEAPON_SUPERSHOTGUN, "tf_weapon_supershotgun", 5, 40.0, 500.0, 0.0, 0.0,
100, TRUE, 100, 2, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{TF_WEAPON_AUTORIFLE, "tf_weapon_autorifle", 5, 0.0, 800.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{TF_WEAPON_SHOTGUN, "tf_weapon_shotgun", 5, 40.0, 400.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{TF_WEAPON_NAILGUN, "tf_weapon_ng", 5, 40.0, 600.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
/* terminator */
{0, "", 0, 0.0, 0.0, 0.0, 0.0, 0, TRUE, 0, 1, 1, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0}
};
bot_weapon_select_t cs_weapon_select[] = {
{CS_WEAPON_KNIFE, "weapon_knife", 5, 0.0, 50.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_M4A1, "weapon_m4a1", 5, 0.0, 1500.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_SG552, "weapon_sg552", 5, 0.0, 1200.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_P90, "weapon_p90", 5, 0.0, 1000.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_MP5NAVY, "weapon_mp5navy", 5, 0.0, 1000.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_AK47, "weapon_ak47", 5, 0.0, 1500.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_AUG, "weapon_aug", 5, 0.0, 1500.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_MAC10, "weapon_mac10", 5, 0.0, 600.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_UMP45, "weapon_ump45", 5, 0.0, 800.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_XM1014, "weapon_xm1014", 5, 0.0, 400.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_AWP, "weapon_awp", 5, 0.0, 3500.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_G3SG1, "weapon_g3sg1", 5, 0.0, 3500.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_M249, "weapon_m249", 5, 0.0, 1000.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_M3, "weapon_m3", 5, 0.0, 500.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_TMP, "weapon_tmp", 5, 0.0, 800.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_SCOUT, "weapon_scout", 5, 0.0, 3500.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_DEAGLE, "weapon_deagle", 5, 0.0, 900.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_USP, "weapon_usp", 5, 0.0, 1200.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_P228, "weapon_p228", 5, 0.0, 900.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_GLOCK18, "weapon_glock18", 5, 0.0, 1200.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_ELITE, "weapon_usp", 5, 0.0, 900.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{CS_WEAPON_FIVESEVEN, "weapon_fiveseven", 5, 0.0, 900.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
/* terminator */
{0, "", 0, 0.0, 0.0, 0.0, 0.0, 0, TRUE, 0, 1, 1, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0}
};
bot_weapon_select_t gearbox_weapon_select[] = {
{GEARBOX_WEAPON_PIPEWRENCH, "weapon_pipewrench", 3, 0.0, 50.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_KNIFE, "weapon_knife", 4, 0.0, 50.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_CROWBAR, "weapon_crowbar", 2, 0.0, 50.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_DISPLACER, "weapon_displacer", 5, 100.0, 1000.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_SPORELAUNCHER, "weapon_sporelauncher", 5, 500.0, 1000.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_SHOCKRIFLE, "weapon_shockrifle", 5, 50.0, 800.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_SNIPERRIFLE, "weapon_sniperrifle", 5, 50.0, 2500.0, 0.0, 0.0,
100, FALSE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_HANDGRENADE, "weapon_handgrenade", 5, 250.0, 750.0, 0.0, 0.0,
30, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_SNARK, "weapon_snark", 5, 150.0, 500.0, 0.0, 0.0,
50, FALSE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_EGON, "weapon_egon", 5, 0.0, 9999.0, 0.0, 0.0,
100, FALSE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_GAUSS, "weapon_gauss", 5, 0.0, 9999.0, 0.0, 9999.0,
100, FALSE, 80, 1, 10, FALSE, FALSE, FALSE, TRUE, 0.0, 0.8},
{GEARBOX_WEAPON_M249, "weapon_m249", 5, 0.0, 400.0, 0.0, 0.0,
100, FALSE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_SHOTGUN, "weapon_shotgun", 5, 30.0, 150.0, 30.0, 150.0,
100, FALSE, 70, 1, 2, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_EAGLE, "weapon_eagle", 5, 0.0, 1200.0, 0.0, 0.0,
100, FALSE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_PYTHON, "weapon_357", 5, 30.0, 700.0, 0.0, 0.0,
100, FALSE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_HORNETGUN, "weapon_hornetgun", 5, 30.0, 1000.0, 30.0, 1000.0,
100, TRUE, 50, 1, 4, FALSE, TRUE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_MP5, "weapon_9mmAR", 5, 0.0, 250.0, 300.0, 600.0,
100, FALSE, 90, 1, 1, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_CROSSBOW, "weapon_crossbow", 5, 100.0, 1000.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_RPG, "weapon_rpg", 5, 300.0, 9999.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{GEARBOX_WEAPON_GLOCK, "weapon_9mmhandgun", 5, 0.0, 1200.0, 0.0, 1200.0,
100, TRUE, 70, 1, 1, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
/* terminator */
{0, "", 0, 0.0, 0.0, 0.0, 0.0, 0, TRUE, 0, 1, 1, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0}
};
bot_weapon_select_t frontline_weapon_select[] = {
{FLF_WEAPON_HEGRENADE, "weapon_hegrenade", 3, 200.0, 1000.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{FLF_WEAPON_FLASHBANG, "weapon_flashbang", 3, 100.0, 800.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
// {FLF_WEAPON_KNIFE, "weapon_knife", 3, 0.0, 60.0, 0.0, 0.0,
// 100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{FLF_WEAPON_HK21, "weapon_hk21", 5, 0.0, 900.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{FLF_WEAPON_UMP45, "weapon_ump45", 5, 0.0, 900.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{FLF_WEAPON_FAMAS, "weapon_famas", 5, 0.0, 500.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{FLF_WEAPON_MSG90, "weapon_msg90", 5, 0.0, 2500.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{FLF_WEAPON_SAKO, "weapon_sako", 5, 0.0, 1800.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{FLF_WEAPON_MP5A2, "weapon_mp5a2", 5, 0.0, 900.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{FLF_WEAPON_AK5, "weapon_ak5", 5, 0.0, 900.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{FLF_WEAPON_RS202M2, "weapon_rs202m2", 5, 0.0, 900.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{FLF_WEAPON_MP5SD, "weapon_mp5sd", 5, 0.0, 900.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{FLF_WEAPON_M4, "weapon_m4", 5, 0.0, 900.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{FLF_WEAPON_SPAS12, "weapon_spas12", 5, 0.0, 900.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{FLF_WEAPON_MAC10, "weapon_mac10", 5, 0.0, 500.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{FLF_WEAPON_BERETTA, "weapon_beretta", 5, 0.0, 1200.0, 0.0, 1200.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{FLF_WEAPON_MK23, "weapon_mk23", 5, 0.0, 1200.0, 0.0, 1200.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
/* terminator */
{0, "", 0, 0.0, 0.0, 0.0, 0.0, 0, TRUE, 0, 1, 1, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0}
};
bot_weapon_select_t holywars_weapon_select[] = {
{HW_WEAPON_JACKHAMMER, "weapon_jackhammer", 5, 0.0, 50.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{HW_WEAPON_MACHINEGUN, "weapon_machinegun", 5, 50.0, 1500.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{HW_WEAPON_RAILGUN, "weapon_railgun", 5, 50.0, 9999.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{HW_WEAPON_DOUBLESHOTGUN, "weapon_doubleshotgun", 5, 50.0, 1000.0, 0.0, 0.0,
100, TRUE, 100, 3, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{HW_WEAPON_ROCKETLAUNCHER, "weapon_rocketlauncher", 5, 50.0, 1500.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
/* terminator */
{0, "", 0, 0.0, 0.0, 0.0, 0.0, 0, TRUE, 0, 1, 1, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0}
};
bot_weapon_select_t dmc_weapon_select[] = {
{DMC_WEAPON_AXE, "weapon_axe", 2, 0.0, 50.0, 0.0, 0.0,
100, TRUE, 100, 0, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{DMC_WEAPON_LIGHTNING, "weapon_lightning", 5, 30.0, 1500.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{DMC_WEAPON_ROCKET1, "weapon_rocket1", 5, 150.0, 1000.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{DMC_WEAPON_SUPERNAIL, "weapon_supernail", 5, 50.0, 400.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{DMC_WEAPON_DOUBLESHOTGUN, "weapon_doubleshotgun", 5, 50.0, 250.0, 0.0, 0.0,
100, TRUE, 100, 2, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{DMC_WEAPON_GRENADE1, "weapon_grenade1", 5, 200.0, 800.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
{DMC_WEAPON_NAILGUN, "weapon_nailgun", 5, 50.0, 400.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, TRUE, FALSE, FALSE, FALSE, 0.0, 0.0},
{DMC_WEAPON_SHOTGUN, "weapon_shotgun", 5, 0.0, 250.0, 0.0, 0.0,
100, TRUE, 100, 1, 0, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0},
/* terminator */
{0, "", 0, 0.0, 0.0, 0.0, 0.0, 0, TRUE, 0, 1, 1, FALSE, FALSE, FALSE, FALSE, 0.0, 0.0}
};
// weapon firing delay based on skill (min and max delay for each weapon)
// THESE MUST MATCH THE SAME ORDER AS THE WEAPON SELECT ARRAY!!!
bot_fire_delay_t valve_fire_delay[] = {
{VALVE_WEAPON_CROWBAR,
0.3, {0.0, 0.2, 0.3, 0.4, 0.6}, {0.1, 0.3, 0.5, 0.7, 1.0},
0.0, {0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0}},
{VALVE_WEAPON_HAN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, 0.3, 0.5, 0.7, 1.0},
0.0, {0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0}},
{DMC_WEAPON_SUPERNAIL,
0.0, {0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0},
0.0, {0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0}},
{DMC_WEAPON_DOUBLESHOTGUN,
0.7, {0.0, 0.1, 0.1, 0.2, 0.3}, {0.1, 0.2, 0.3, 0.5, 0.7},
0.0, {0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0}},
{DMC_WEAPON_GRENADE1,
0.6, {0.0, 0.1, 0.2, 0.3, 0.4}, {0.1, 0.2, 0.3, 0.5, 0.7},
0.0, {0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0}},
{DMC_WEAPON_NAILGUN,
0.0, {0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0},
0.0, {0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0}},
{DMC_WEAPON_SHOTGUN,
0.5, {0.0, 0.2, 0.3, 0.4, 0.6}, {0.1, 0.3, 0.5, 0.7, 1.0},
0.0, {0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0}},
/* terminator */
{0, 0.0, {0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0},
0.0, {0.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 0.0}}
};
void BotCheckTeamplay(void)
{
float f_team_play = 0.0;
// is this TFC or Counter-Strike?
if ((mod_id == TFC_DLL) || (mod_id == CSTRIKE_DLL) ||
((mod_id == GEARBOX_DLL) && (pent_info_ctfdetect != NULL)) ||
(mod_id == FRONTLINE_DLL))
f_team_play = 1.0;
else
f_team_play = CVAR_GET_FLOAT("mp_teamplay"); // teamplay enabled?
if (f_team_play > 0.0)
is_team_play = TRUE;
else
is_team_play = FALSE;
checked_teamplay = TRUE;
}
edict_t *BotFindEnemy( bot_t *pBot )
{
static bool flag=TRUE;
edict_t *pent = NULL;
edict_t *pNewEnemy;
float nearestdistance;
int i;
edict_t *pEdict = pBot->pEdict;
if (pBot->pBotEnemy != NULL) // does the bot already have an enemy?
{
// if the enemy is dead?
if (!IsAlive(pBot->pBotEnemy)) // is the enemy dead?, assume bot killed it
{
// the enemy is dead, jump for joy about 10% of the time
if (RANDOM_LONG(1, 100) <= 10)
pEdict->v.button |= IN_JUMP;
// check if waiting to throw grenade...
if (pBot->f_gren_throw_time >= gpGlobals->time)
BotGrenadeThrow(pBot); // throw the grenade
// don't have an enemy anymore so null out the pointer...
pBot->pBotEnemy = NULL;
}
else // enemy is still alive
{
Vector vecEnd;
int player_team, bot_team;
vecEnd = pBot->pBotEnemy->v.origin + pBot->pBotEnemy->v.view_ofs;
if (!checked_teamplay) // check for team play...
BotCheckTeamplay();
if (mod_id == TFC_DLL)
{
player_team = UTIL_GetTeam(pBot->pBotEnemy);
bot_team = UTIL_GetTeam(pEdict);
}
// is this bot a medic and is the player on the bot's team?
if ((mod_id == TFC_DLL) &&
(pEdict->v.playerclass == TFC_CLASS_MEDIC) &&
FVisible( vecEnd, pEdict ) &&
((bot_team == player_team) ||
(team_allies[bot_team] & (1<<player_team))))
{
if (pBot->f_medic_check_health_time <= gpGlobals->time)
{
pBot->f_medic_check_health_time = gpGlobals->time + 5.0;
pBot->f_heal_percent = RANDOM_FLOAT(90.0, 120.0);
}
if ((pBot->pBotEnemy->v.health / pBot->pBotEnemy->v.max_health) * 100.0 >
pBot->f_heal_percent)
{
pBot->pBotEnemy = NULL; // player is healed, null out pointer
}
else
{
// if teammate is still visible, keep it
// face the enemy
Vector v_enemy = pBot->pBotEnemy->v.origin - pEdict->v.origin;
Vector bot_angles = UTIL_VecToAngles( v_enemy );
pEdict->v.ideal_yaw = bot_angles.y;
BotFixIdealYaw(pEdict);
// keep track of when we last saw an enemy
pBot->f_bot_see_enemy_time = gpGlobals->time;
return (pBot->pBotEnemy);
}
}
else if (FInViewCone( &vecEnd, pEdict ) &&
FVisible( vecEnd, pEdict ))
{
// if enemy is still visible and in field of view, keep it
// face the enemy
Vector v_enemy = pBot->pBotEnemy->v.origin - pEdict->v.origin;
Vector bot_angles = UTIL_VecToAngles( v_enemy );
pEdict->v.ideal_yaw = bot_angles.y;
BotFixIdealYaw(pEdict);
// keep track of when we last saw an enemy
pBot->f_bot_see_enemy_time = gpGlobals->time;
return (pBot->pBotEnemy);
}
else // enemy has gone out of bot's line of sight
{
// check if waiting to throw grenade...
if (pBot->f_gren_throw_time >= gpGlobals->time)
BotGrenadeThrow( pBot ); // throw the grenade
}
}
}
pent = NULL;
pNewEnemy = NULL;
nearestdistance = 1500;
pBot->enemy_attack_count = 0; // don't limit number of attacks
if (mod_id == TFC_DLL)
{
Vector vecEnd;
if (pEdict->v.playerclass == TFC_CLASS_MEDIC)
{
// search the world for players...
for (i = 1; i <= gpGlobals->maxClients; i++)
{
edict_t *pPlayer = INDEXENT(i);
// skip invalid players and skip self (i.e. this bot)
if ((pPlayer) && (!pPlayer->free) && (pPlayer != pEdict))
{
// skip this player if not alive (i.e. dead or dying)
if (!IsAlive(pPlayer))
continue;
if ((b_observer_mode) && !(pPlayer->v.flags & FL_FAKECLIENT) && !(pPlayer->v.flags & FL_THIRDPARTYBOT))
continue;
int player_team = UTIL_GetTeam(pPlayer);
int bot_team = UTIL_GetTeam(pEdict);
// don't target your enemies...
if ((bot_team != player_team) &&
!(team_allies[bot_team] & (1<<player_team)))
continue;
// check if player needs to be healed...
if ((pPlayer->v.health / pPlayer->v.max_health) > 0.80)
continue; // health greater than 70% so ignore
vecEnd = pPlayer->v.origin + pPlayer->v.view_ofs;
// see if bot can see the player...
if (FInViewCone( &vecEnd, pEdict ) &&
FVisible( vecEnd, pEdict ))
{
float distance = (pPlayer->v.origin - pEdict->v.origin).Length();
if (distance < nearestdistance)
{
nearestdistance = distance;
pNewEnemy = pPlayer;
pBot->pBotUser = NULL; // don't follow user when enemy found
}
}
}
}
}
else if ((pEdict->v.playerclass == TFC_CLASS_ENGINEER) &&
(pBot->m_rgAmmo[weapon_defs[TF_WEAPON_SPANNER].iAmmo1] >= 20))
{
// search the world for players...
for (i = 1; i <= gpGlobals->maxClients; i++)
{
edict_t *pPlayer = INDEXENT(i);
// skip invalid players and skip self (i.e. this bot)
if ((pPlayer) && (!pPlayer->free) && (pPlayer != pEdict))
{
// skip this player if not alive (i.e. dead or dying)
if (!IsAlive(pPlayer))
continue;
if ((b_observer_mode) && !(pPlayer->v.flags & FL_FAKECLIENT) && !(pPlayer->v.flags & FL_THIRDPARTYBOT))
continue;
int player_team = UTIL_GetTeam(pPlayer);
int bot_team = UTIL_GetTeam(pEdict);
// don't target your enemies...
if ((bot_team != player_team) &&
!(team_allies[bot_team] & (1<<player_team)))
continue;
// don't try to add armor to other engineers...
if (pPlayer->v.playerclass == TFC_CLASS_ENGINEER)
continue;
// check if player needs armor repaired...
if (pPlayer->v.armorvalue >= tfc_max_armor[pPlayer->v.playerclass])
continue;
vecEnd = pPlayer->v.origin + pPlayer->v.view_ofs;
// see if bot can see the player...
if (FInViewCone( &vecEnd, pEdict ) &&
FVisible( vecEnd, pEdict ))
{
float distance = (pPlayer->v.origin - pEdict->v.origin).Length();
if (distance < nearestdistance)
{
nearestdistance = distance;
pNewEnemy = pPlayer;
pBot->enemy_attack_count = 3; // give them 3 whacks
pBot->pBotUser = NULL; // don't follow user when enemy found
}
}
}
}
}
if (pNewEnemy == NULL)
{
while ((pent = UTIL_FindEntityByClassname( pent, "building_sentrygun" )) != NULL)
{
int sentry_team = -1;
int bot_team = UTIL_GetTeam(pEdict);
bool upgrade_sentry = FALSE;
if (pent->v.colormap == 0xA096)
sentry_team = 0; // blue team's sentry
else if (pent->v.colormap == 0x04FA)
sentry_team = 1; // red team's sentry
else if (pent->v.colormap == 0x372D)
sentry_team = 2; // yellow team's sentry
else if (pent->v.colormap == 0x6E64)
sentry_team = 3; // green team's sentry
// check if this sentry gun is on bot's team or allies team...
if ((bot_team == sentry_team) ||
(team_allies[bot_team] & (1<<sentry_team)))
{
float health_percent = (pent->v.health / pent->v.max_health) * 100;
// check if this player is an engineer AND
// has enough metal AND sentry gun's health is low AND
// it's time to check for upgrading sentry guns
if ((pEdict->v.playerclass == TFC_CLASS_ENGINEER) &&
(pBot->m_rgAmmo[weapon_defs[TF_WEAPON_SPANNER].iAmmo1] >= 130) &&
(health_percent <= 80.0) &&
(pBot->f_other_sentry_time <= gpGlobals->time))
{
upgrade_sentry = TRUE;
}
else
continue; // skip this sentry gun
}
vecEnd = pent->v.origin + pent->v.view_ofs;
// is this sentry gun visible?
if (FInViewCone( &vecEnd, pEdict ) &&
FVisible( vecEnd, pEdict ))
{
float distance = (pent->v.origin - pEdict->v.origin).Length();
// is this the closest sentry gun?
if (distance < nearestdistance)
{
nearestdistance = distance;
pNewEnemy = pent;
if (upgrade_sentry)
{
pBot->enemy_attack_count = 3; // give them 3 whacks
pBot->f_other_sentry_time = gpGlobals->time + RANDOM_FLOAT(20.0, 30.0);
}
pBot->pBotUser = NULL; // don't follow user when enemy found
}
}
}
}
}
if (pNewEnemy == NULL)
{
edict_t *pMonster = NULL;
Vector vecEnd;
nearestdistance = 9999;
// search the world for monsters...
while (!FNullEnt (pMonster = UTIL_FindEntityInSphere (pMonster, pEdict->v.origin, 1000)))
{
if (!(pMonster->v.flags & FL_MONSTER))
continue; // discard anything that is not a monster
if (!IsAlive (pMonster))
continue; // discard dead or dying monsters
// TFC specific checks
if (mod_id == TFC_DLL)
{
if (strncmp ("building_", STRING (pMonster->v.classname), 9) == 0)
continue; // TFC: skip sentry guns and dispensers
if (strcmp ("monster_miniturret", STRING (pMonster->v.classname)) == 0)