-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdll.cpp
More file actions
3956 lines (3551 loc) · 137 KB
/
dll.cpp
File metadata and controls
3956 lines (3551 loc) · 137 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
// ####################################
// # #
// # Ping of Death - Bot #
// # by #
// # Markus Klinge aka Count Floyd #
// # #
// ####################################
//
// Started from the HPB-Bot Alpha Source
// by Botman so Credits for a lot of the basic
// HL Server/Client Stuff goes to him
//
// dll.cpp
//
// Links Functions, handles Client Commands, initializes DLL and misc Stuff
#include "bot_globals.h"
#ifdef __linux__
#define sscanf_s sscanf
#define _snprintf_s snprintf
#define strncat_s strncat
#define vsnprintf_s vsnprintf
#endif
// server command handler
void PODBot_ServerCommand(void);
void PbCmdParser(edict_t* pEdict, const char* pcmd, const char* arg1, const char* arg2, const char* arg3, const char* arg4, const char* arg5);
void UserNewroundAll(void);
void GetGameDir(void);
void ShowPBKickBotMenu(edict_t* pEntity, int iMenuNum);
bool IsPBAdmin(edict_t* pEdict);
// cvars
cvar_t g_rgcvarTemp[NUM_PBCVARS] =
{
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_AIM_DAMPER_COEFFICIENT_X]), "0.22", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_AIM_DAMPER_COEFFICIENT_Y]), "0.22", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_AIM_DEVIATION_X]), "2.0", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_AIM_DEVIATION_Y]), "1.0", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_AIM_INFLUENCE_X_ON_Y]), "0.25", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_AIM_INFLUENCE_Y_ON_X]), "0.17", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_AIM_NOTARGET_SLOWDOWN_RATIO]), "0.5", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_AIM_OFFSET_DELAY]), "1.2", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_AIM_SPRING_STIFFNESS_X]), "13.0", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_AIM_SPRING_STIFFNESS_Y]), "13.0", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_AIM_TARGET_ANTICIPATION_RATIO]), "2.2", FCVAR_SERVER | FCVAR_EXTDLL}, // KWo - 04.03.2006
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_AIM_TYPE]), "4", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_AUTOKILL]), "0.0", FCVAR_SERVER | FCVAR_EXTDLL}, // KWo - 02.05.2006
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_AUTOKILLDELAY]), "45.0", FCVAR_SERVER | FCVAR_EXTDLL}, // KWo - 02.05.2006
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_BOTJOINTEAM]), "ANY", FCVAR_SERVER | FCVAR_EXTDLL}, // KWo - 16.09.2006
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_BOTQUOTAMATCH]), "0.0", FCVAR_SERVER | FCVAR_EXTDLL}, // KWo - 16.09.2006
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_CHAT]), "1", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_DANGERFACTOR]), "800", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_DEBUGLEVEL]), "0", FCVAR_SERVER | FCVAR_EXTDLL}, // KWo - 20.04.2013
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_DETAILNAMES]), "0", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_FFA]), "0", FCVAR_SERVER | FCVAR_EXTDLL}, // KWo - 04.10.2006
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_FFREV]), "0", FCVAR_SERVER | FCVAR_EXTDLL}, // The Storm - 01.07.2018
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_FIRSTHUMANRESTART]), "0", FCVAR_SERVER | FCVAR_EXTDLL}, // KWo - 04.10.2010
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_JASONMODE]), "0", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_LATENCYBOT]), "0", FCVAR_SERVER | FCVAR_EXTDLL}, // KWo - 16.05.2008
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_MAPSTARTBOTJOINDELAY]), "5", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_MAXBOTS]), "0", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_MAXBOTSKILL]), "100", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_MAXCAMPTIME]), "30", FCVAR_SERVER | FCVAR_EXTDLL}, // KWo - 30.23.2008
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_MAXWEAPONPICKUP]), "3", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_MINBOTS]), "0", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_MINBOTSKILL]), "60", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_NUMFOLLOWUSER]), "3", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_PASSWORD]), "", FCVAR_EXTDLL | FCVAR_PROTECTED},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_PASSWORDKEY]), "_pbadminpw", FCVAR_EXTDLL | FCVAR_PROTECTED},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_RADIO]), "1", FCVAR_SERVER | FCVAR_EXTDLL}, // KWo - 03.02.2007
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_RESTREQUIPAMMO]), "000000000", FCVAR_SERVER | FCVAR_EXTDLL}, // KWo - 09.03.2006
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_RESTRWEAPONS]), "00000000000000000000000000", FCVAR_SERVER | FCVAR_EXTDLL}, // KWo - 09.03.2006
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_SHOOTTHRUWALLS]), "1", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_SKIN]), "5", FCVAR_SERVER | FCVAR_EXTDLL}, // KWo - 18.11.2006
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_SPRAY]), "1", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_TIMER_GRENADE]), "0.5", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_TIMER_PICKUP]), "0.3", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_TIMER_SOUND]), "1.0", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_USESPEECH]), "1", FCVAR_SERVER | FCVAR_EXTDLL},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_VERSION]), "", FCVAR_SERVER | FCVAR_SPONLY},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_WELCOMEMSGS]), "1", FCVAR_SERVER | FCVAR_EXTDLL | FCVAR_SPONLY},
{const_cast<char*>(g_rgpszPbCvars[PBCVAR_WPTFOLDER]), "wptdefault", FCVAR_SERVER | FCVAR_EXTDLL},
};
// START of Metamod stuff
enginefuncs_t meta_engfuncs;
gamedll_funcs_t* gpGamedllFuncs;
mutil_funcs_t* gpMetaUtilFuncs;
meta_globals_t* gpMetaGlobals;
META_FUNCTIONS gMetaFunctionTable =
{
NULL, // pfnGetEntityAPI()
NULL, // pfnGetEntityAPI_Post()
GetEntityAPI2, // pfnGetEntityAPI2()
GetEntityAPI2_Post, // pfnGetEntityAPI2_Post()
NULL, // pfnGetNewDLLFunctions()
NULL, // pfnGetNewDLLFunctions_Post()
GetEngineFunctions, // pfnGetEngineFunctions()
GetEngineFunctions_Post, // pfnGetEngineFunctions_Post() KWo - 19.05.2006
// NULL, // pfnGetEngineFunctions_Post()
};
plugin_info_t Plugin_info = {
META_INTERFACE_VERSION, // interface version
"POD-Bot mm", // plugin name
PBMM_VERSION_STRING, // plugin version
__DATE__, // date of creation
"Count Floyd & Bots United", // plugin author
"http://www.bots-united.com", // plugin URL
"PODBOTMM", // plugin logtag
PT_CHANGELEVEL, // when loadable
PT_ANYTIME, // when unloadable
};
C_DLLEXPORT int Meta_Query(char* ifvers, plugin_info_t** pPlugInfo, mutil_funcs_t* pMetaUtilFuncs)
{
// this function is the first function ever called by metamod in the plugin DLL. Its purpose
// is for metamod to retrieve basic information about the plugin, such as its meta-interface
// version, for ensuring compatibility with the current version of the running metamod.
// keep track of the pointers to metamod function tables metamod gives us
gpMetaUtilFuncs = pMetaUtilFuncs;
*pPlugInfo = &Plugin_info;
// check for interface version compatibility
if (strcmp(ifvers, Plugin_info.ifvers) != 0)
{
int mmajor = 0, mminor = 0, pmajor = 0, pminor = 0;
LOG_CONSOLE(PLID, "%s: meta-interface version mismatch (metamod: %s, %s: %s)", Plugin_info.name, ifvers, Plugin_info.name, Plugin_info.ifvers);
LOG_MESSAGE(PLID, "%s: meta-interface version mismatch (metamod: %s, %s: %s)", Plugin_info.name, ifvers, Plugin_info.name, Plugin_info.ifvers);
// if plugin has later interface version, it's incompatible (update metamod)
sscanf_s(ifvers, "%d:%d", &mmajor, &mminor);
sscanf_s(META_INTERFACE_VERSION, "%d:%d", &pmajor, &pminor);
if (pmajor > mmajor || pmajor == mmajor && pminor > mminor)
{
LOG_CONSOLE(PLID, "metamod version is too old for this plugin; update metamod");
LOG_ERROR(PLID, "metamod version is too old for this plugin; update metamod");
return FALSE;
}
// if plugin has older major interface version, it's incompatible (update plugin)
else if (pmajor < mmajor)
{
LOG_CONSOLE(PLID, "metamod version is incompatible with this plugin; please find a newer version of this plugin");
LOG_ERROR(PLID, "metamod version is incompatible with this plugin; please find a newer version of this plugin");
return FALSE;
}
}
return TRUE; // tell metamod this plugin looks safe
}
C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS* pFunctionTable, meta_globals_t* pMGlobals, gamedll_funcs_t* pGamedllFuncs)
{
// this function is called when metamod attempts to load the plugin. Since it's the place
// where we can tell if the plugin will be allowed to run or not, we wait until here to make
// our initialization stuff, like registering CVARs and dedicated server commands.
// are we allowed to load this plugin now ?
if (now > Plugin_info.loadable)
{
LOG_CONSOLE(PLID, "%s: plugin NOT attaching (can't load plugin right now)", Plugin_info.name);
LOG_ERROR(PLID, "%s: plugin NOT attaching (can't load plugin right now)", Plugin_info.name);
return FALSE; // returning FALSE prevents metamod from attaching this plugin
}
// keep track of the pointers to engine function tables metamod gives us
gpMetaGlobals = pMGlobals;
memcpy(pFunctionTable, &gMetaFunctionTable, sizeof(META_FUNCTIONS));
gpGamedllFuncs = pGamedllFuncs;
// print a message to notify about plugin attaching
LOG_CONSOLE(PLID, "%s: plugin attaching", Plugin_info.name);
LOG_MESSAGE(PLID, "%s: plugin attaching", Plugin_info.name);
// ask the engine to register the server commands this plugin uses
REG_SVR_COMMAND((char*)g_rgpszPbCmds[PBCMD], PODBot_ServerCommand);
// Register CVARS
for (int i = 0; i < NUM_PBCVARS; ++i)
{
CVAR_REGISTER(&g_rgcvarTemp[i]);
g_rgcvarPointer[i] = CVAR_GET_POINTER(g_rgcvarTemp[i].name); // KWo - 07.10.2006 - thanks BAILOPAN
}
CVAR_SET_STRING(g_rgpszPbCvars[PBCVAR_VERSION], Plugin_info.version);
return TRUE; // returning TRUE enables metamod to attach this plugin
}
C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
{
// this function is called when metamod unloads the plugin. A basic check is made in order
// to prevent unloading the plugin if its processing should not be interrupted.
// is metamod allowed to unload the plugin ?
if (now > Plugin_info.unloadable && reason != PNL_CMD_FORCED)
{
LOG_CONSOLE(PLID, "%s: plugin NOT detaching (can't unload plugin right now)", Plugin_info.name);
LOG_ERROR(PLID, "%s: plugin NOT detaching (can't unload plugin right now)", Plugin_info.name);
return FALSE; // returning FALSE prevents metamod from unloading this plugin
}
PbCmdParser(g_bIsDedicatedServer ? NULL : pHostEdict, g_rgpszPbCmds[PBCMD_REMOVEBOTS], NULL, NULL, NULL, NULL, NULL); // KWo - 12.03.2012 - thanks to Immortal_BLG
// Delete all allocated Memory
BotFreeAllMemory();
return TRUE; // returning TRUE enables metamod to unload this plugin
}
// END of Metamod stuff
// If we're using MS compiler, we need to specify the export parameter...
// by Jozef Wagner - START
#if _MSC_VER > 1000
#pragma comment(linker, "/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1")
#pragma comment(linker, "/SECTION:.data,RW")
#endif
// Jozef Wagner - END
#ifndef __linux__
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
// Required DLL entry point
return TRUE;
}
#endif
static inline void SetupLightStyles(void)
{
// Setup lighting information....
// reset all light styles
for (unsigned char index(0u); index < MAX_LIGHTSTYLES; ++index)
{
cl_lightstyle[index].length = 0u;
cl_lightstyle[index].map[0u] = '\0';
}
for (unsigned short index(0u); index < MAX_LIGHTSTYLEVALUE; ++index)
d_lightstylevalue[index] = 264; // normal light value
}
static inline void R_AnimateLight(void)
{
// light animations
// 'm' is normal light, 'a' is no light, 'z' is double bright
const int i(static_cast <int> (gpGlobals->time * 10.0f));
int k;
for (unsigned char j(0u); j < MAX_LIGHTSTYLES; ++j)
{
if (cl_lightstyle[j].length == 0u)
{
d_lightstylevalue[j] = 256;
continue;
}
k = cl_lightstyle[j].map[i % cl_lightstyle[j].length] - 'a';
k *= 22;
d_lightstylevalue[j] = k;
}
}
inline void ShowMagic(void)
{
/// @todo REMOVE THIS SHIT
edict_t* const hostPlayerEdict(pHostEdict);
if (hostPlayerEdict == NULL || hostPlayerEdict->free || hostPlayerEdict->pvPrivateData == NULL || hostPlayerEdict->v.flags & FL_FAKECLIENT)
return;
char message[192];
_snprintf_s(message, sizeof message, "ShowMagic(): \"%s\"->v.light_level=%i, R_LightPoint(hostOrg)=%i\n", STRING(hostPlayerEdict->v.netname), hostPlayerEdict->v.light_level, Light::R_LightPoint(hostPlayerEdict->v.origin));
// CLIENT_PRINTF (hostPlayerEdict, print_chat, message);
if (GET_USER_MSG_ID(PLID, "TextMsg", NULL) == 0)
REG_USER_MSG("TextMsg", -1);
MESSAGE_BEGIN(MSG_ONE_UNRELIABLE, GET_USER_MSG_ID(PLID, "TextMsg", NULL), NULL, hostPlayerEdict);
WRITE_BYTE(HUD_PRINTTALK);
WRITE_STRING(message);
MESSAGE_END();
}
static inline void CallbackStartFrame(void)
{
R_AnimateLight();
/// @todo REMOVE THIS SHIT
// #pragma message ("\tWARNING: REMOVE THIS SHIT!!!")
// ShowMagic ();
}
static inline void CallbackPM_Move(playermove_t* const playerMove, const bool server)
{
// Reliability checks.
assert(playerMove != NULL);
assert(server == true); // ALWAYS SHOULD BE TRUE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Honestly this is need only once per changelevel, but....
sv_worldmodel = playerMove->physents[0u].model; // Always point at sv.worldmodel!
// Reliability check.
assert(sv_worldmodel != NULL);
}
void WINAPI GiveFnptrsToDll(enginefuncs_t* pengfuncsFromEngine, globalvars_t* pGlobals)
{
// get the engine functions from the engine...
memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t));
gpGlobals = pGlobals;
SetupLightStyles(); // KWo - 15.03.2012 - thanks to Immortal_BLG
}
void GameDLLInit(void)
{
// First function called from HL in our replacement Server DLL
unsigned char* tempbuf;
int tempsize;
g_bIsDedicatedServer = IS_DEDICATED_SERVER() > 0;
// If this is a listen server account for the Host
if (!g_bIsDedicatedServer)
g_iPeoBotsKept = 1;
// Update g_szGameDirectory
GetGameDir();
// Counter-Strike 1.6 detection
tempbuf = LOAD_FILE_FOR_ME("models/w_famas.mdl", &tempsize);
if (tempbuf != NULL)
{
g_bIsOldCS15 = FALSE;
FREE_FILE(tempbuf);
}
else
g_bIsOldCS15 = TRUE;
// Reset the bot creation tab
memset(BotCreateTab, 0, sizeof BotCreateTab);
// Get all of the user's settings from podbot.cfg
g_bBotSettings = TRUE;
g_bWeaponStrip = FALSE; // KWo - 10.03.2013
RETURN_META(MRES_IGNORED);
}
int Spawn(edict_t* pent)
{
// Something gets spawned in the game
if (strcmp(STRING(pent->v.classname), "worldspawn") == 0)
{
g_iMapType = 0; // reset g_iMapType as worldspawn is the first entity spawned
PRECACHE_SOUND((char*)STRING(ALLOC_STRING("weapons/xbow_hit1.wav"))); // waypoint add - KWo - 11.03.2012 - thanks to Immortal_BLG
PRECACHE_SOUND((char*)STRING(ALLOC_STRING("weapons/mine_activate.wav"))); // waypoint delete - KWo - 11.03.2012 - thanks to Immortal_BLG
PRECACHE_SOUND((char*)STRING(ALLOC_STRING("common/wpn_hudon.wav"))); // path add/delete done - KWo - 11.03.2012 - thanks to Immortal_BLG
PRECACHE_SOUND((char*)STRING(ALLOC_STRING("debris/bustglass1.wav"))); // waypoint error found - KWo - 11.03.2012 - thanks to Immortal_BLG
g_pSpriteTexture = PRECACHE_MODEL((char*)STRING(ALLOC_STRING("sprites/lgtning.spr"))); // KWo - 11.03.2012 - thanks to Immortal_BLG
}
else if (strcmp(STRING(pent->v.classname), "info_player_start") == 0)
{
SET_MODEL(pent, (char*)STRING(ALLOC_STRING("models/player/urban/urban.mdl"))); // KWo - 11.03.2012 - thanks to Immortal_BLG
pent->v.rendermode = kRenderTransAlpha; // set its render mode to transparency
pent->v.renderamt = 127; // set its transparency amount
pent->v.effects |= EF_NODRAW;
}
else if (strcmp(STRING(pent->v.classname), "info_player_deathmatch") == 0)
{
SET_MODEL(pent, (char*)STRING(ALLOC_STRING("models/player/terror/terror.mdl"))); // KWo - 11.03.2012 - thanks to Immortal_BLG
pent->v.rendermode = kRenderTransAlpha; // set its render mode to transparency
pent->v.renderamt = 127; // set its transparency amount
pent->v.effects |= EF_NODRAW;
}
else if (strcmp(STRING(pent->v.classname), "info_vip_start") == 0)
{
SET_MODEL(pent, (char*)STRING(ALLOC_STRING("models/player/vip/vip.mdl"))); // KWo - 11.03.2012 - thanks to Immortal_BLG
pent->v.rendermode = kRenderTransAlpha; // set its render mode to transparency
pent->v.renderamt = 127; // set its transparency amount
pent->v.effects |= EF_NODRAW;
}
// KWo - 20.06.2006 - thanks to strelomet for fixing crash on scoutzknives maps
else if (strcmp(STRING(pent->v.classname), "player_weaponstrip") == 0)
{
char szTemp[64]; // KWo - 23.12.2006
_snprintf_s(szTemp, sizeof szTemp, "%s", STRING(pent->v.target));
g_bWeaponStrip = TRUE; // KWo - 10.03.2013
if (g_bIsOldCS15) // KWo - 01.04.2013
{
if (szTemp[0] == '\0' /* && (g_iNumWaypoints) */)
{
pent->v.target = ALLOC_STRING("fake"); // KWo - 11.03.2012 - thanks to Immortal_BLG
pent->v.targetname = ALLOC_STRING("fake"); // KWo - 11.03.2012 - thanks to Immortal_BLG
}
}
else
{
REMOVE_ENTITY(pent); // KWo - 10.03.2013
RETURN_META_VALUE(MRES_SUPERCEDE, 0); // KWo - 25.03.2013
}
}
else if (strcmp(STRING(pent->v.classname), "func_vip_safetyzone") == 0
|| strcmp(STRING(pent->v.classname), "info_vip_safetyzone") == 0)
g_iMapType |= MAP_AS; // assassination map
else if (strcmp(STRING(pent->v.classname), "hostage_entity") == 0)
g_iMapType |= MAP_CS; // rescue map
else if (strcmp(STRING(pent->v.classname), "func_bomb_target") == 0
|| strcmp(STRING(pent->v.classname), "info_bomb_target") == 0)
g_iMapType |= MAP_DE; // defusion map
if (pent->v.rendermode == kRenderTransTexture && pent->v.flags & FL_WORLDBRUSH)
pent->v.flags &= ~FL_WORLDBRUSH; // clear the FL_WORLDBRUSH flag out of transparent ents
RETURN_META_VALUE(MRES_IGNORED, 0);
}
int Spawn_Post(edict_t* pent)
{
// KWo - 04.03.2006
int i;
if ((FStrEq(STRING(pent->v.classname), "func_breakable") || FStrEq(STRING(pent->v.classname), "func_pushable"))
&& IsShootableBreakable(pent) && g_iNumBreakables < MAX_BREAKABLES)
{
if (g_iNumBreakables == 0)
{
for (i = 0; i < MAX_BREAKABLES; i++) // KWo - 14.04.2013 (fixed a small mistake...)
{
BreakablesData[i].EntIndex = -1;
BreakablesData[i].classname[0] = '\0';
BreakablesData[i].origin = g_vecZero;
BreakablesData[i].target[0] = '\0';
BreakablesData[i].ignored = false;
}
}
BreakablesData[g_iNumBreakables].EntIndex = ENTINDEX(pent);
_snprintf_s(BreakablesData[g_iNumBreakables].classname, sizeof BreakablesData[g_iNumBreakables].classname, "%s", STRING(pent->v.classname));
BreakablesData[g_iNumBreakables].origin = VecBModelOrigin(pent);
_snprintf_s(BreakablesData[g_iNumBreakables].target, sizeof BreakablesData[g_iNumBreakables].target, "%s", STRING(pent->v.target));
if (pent->v.impulse > 0) // KWo - 18.05.2006
BreakablesData[g_iNumBreakables].ignored = true;
else
BreakablesData[g_iNumBreakables].ignored = false;
g_iNumBreakables++;
}
// solves the bots unable to see through certain types of glass bug.
// MAPPERS: NEVER EVER ALLOW A TRANSPARENT ENTITY TO WEAR THE FL_WORLDBRUSH FLAG !!!
// KWo - 04.03.2006 - FL_WORDBRUSH defines unbreakable glasses... - it doesn't work at all (tested on de_frosty)
if (pent->v.rendermode == kRenderTransTexture && pent->v.flags & FL_WORLDBRUSH)
pent->v.flags &= ~FL_WORLDBRUSH; // clear the FL_WORLDBRUSH flag out of transparent ents
RETURN_META_VALUE(MRES_IGNORED, 0);
}
BOOL ClientConnect(edict_t* pEntity, const char* pszName, const char* pszAddress, char szRejectReason[128])
{
// Client connects to this Server
// check if this client is the listen server client
if (FStrEq(pszAddress, "loopback"))
pHostEdict = pEntity; // save the edict of the listen server client...
RETURN_META_VALUE(MRES_IGNORED, 0);
}
void ClientDisconnect(edict_t* pEntity)
{
// Client disconnects from this Server
int i;
i = ENTINDEX(pEntity) - 1;
if (i >= 0 && i < gpGlobals->maxClients)
{
pEntity->v.light_level = 0;
// Find & remove this Client from our list of Clients connected
clients[i].welcome_time = 0.0f;
clients[i].wptmessage_time = 0.0f;
clients[i].fDeathTime = 0.0f; // KWo - 14.03.2010
memset(&clients[i], 0, sizeof(client_t));
}
// Check if its a Bot
if (bots[i].pEdict == pEntity)
{
// Delete Nodes from Pathfinding
DeleteSearchNodes(&bots[i]);
BotResetTasks(&bots[i]);
memset(&bots[i], 0, sizeof(bot_t));
bots[i].is_used = FALSE; // this slot is now free to use
bots[i].pEdict = NULL;
bots[i].f_kick_time = gpGlobals->time; // save the kicked time
}
// Check if its the Host disconnecting
if (pEntity == pHostEdict)
pHostEdict = NULL;
RETURN_META(MRES_IGNORED);
}
void ClientPutInServer(edict_t* pEntity)
{
// Client is finally put into the Server
int i;
bool bWelcome = false;
i = ENTINDEX(pEntity) - 1;
if (g_rgcvarPointer[PBCVAR_WELCOMEMSGS])
{
if (g_rgcvarPointer[PBCVAR_WELCOMEMSGS]->value > 0.0f)
bWelcome = true;
}
else
{
if (CVAR_GET_FLOAT(g_rgpszPbCvars[PBCVAR_WELCOMEMSGS]) > 0.0f)
bWelcome = true;
}
if (i >= 0 && i < 32)
{
clients[i].pEdict = pEntity;
clients[i].iFlags |= CLIENT_USED;
if (bWelcome)
{
clients[i].welcome_time = -1.0f; // KWo - 17.04.2010
clients[i].wptmessage_time = -1.0f; // KWo - 17.04.2010
clients[i].fTimeSoundLasting = 0.0f; // KWo - 15.08.2007
clients[i].fMaxTimeSoundLasting = 0.5f; // KWo - 15.08.2007
clients[i].fReloadingTime = 0.0f; // KWo - 15.08.2007
clients[i].fDeathTime = 0.0f; // KWo - 14.03.2010
}
}
RETURN_META(MRES_IGNORED);
}
void ClientCommand(edict_t* pEntity)
{
// Executed if a client typed some sort of command into the console
const char* pcmd = CMD_ARGV(0); // KWo - 17.01.2006
const char* arg1 = CMD_ARGV(1);
const char* arg2 = CMD_ARGV(2);
const char* arg3 = CMD_ARGV(3);
const char* arg4 = CMD_ARGV(4);
const char* arg5 = CMD_ARGV(5);
const char* arg6 = CMD_ARGV(6);
// const char * arg7 = CMD_ARGV(7);
// const char * arg8 = CMD_ARGV(8);
// const char * arg9 = CMD_ARGV(9);
edict_t* pSpawnPoint = NULL;
int iClientIndex = ENTINDEX(pEntity) - 1;
int iRadioCommand;
int i;
char szTemp[64];
client_t* pClient = &clients[iClientIndex];
// don't search ClientCommands of Bots or other Edicts than Admins!
if (!isFakeClientCommand && IsPBAdmin(pEntity))
{
// "pb" Check if any were the Podbot commands..
if (FStrEq(pcmd, g_rgpszPbCmds[PBCMD]))
{
PbCmdParser(pEntity, arg1, arg2, arg3, arg4, arg5, arg6);
RETURN_META(MRES_SUPERCEDE);
}
// Care for Menus instead...
else if (pClient->pUserMenu != NULL)
{
if (FStrEq(pcmd, "menuselect"))
{
// Waypoint Main Menu
if (pClient->pUserMenu == &menuWpMain)
{
UTIL_ShowMenu(pEntity, NULL); // reset menu display
if (FStrEq(arg1, "1"))
{
g_bWaypointOn = TRUE; // turn waypoints on if off
UTIL_ShowMenu(pEntity, &menuWpAdd);
}
else if (FStrEq(arg1, "2"))
{
g_bWaypointOn = TRUE; // turn waypoints on if off
UTIL_ShowMenu(pEntity, &menuWpDelete);
}
else if (FStrEq(arg1, "3"))
{
g_bWaypointOn = TRUE; // turn waypoints on if off
UTIL_ShowMenu(pEntity, &menuWpSetRadius);
}
else if (FStrEq(arg1, "4"))
{
g_bWaypointOn = TRUE; // turn waypoints on if off
UTIL_ShowMenu(pEntity, &menuWpSetFlags);
}
else if (FStrEq(arg1, "5"))
{
g_bWaypointOn = TRUE; // turn waypoints on if off
UTIL_ShowMenu(pEntity, &menuWpAddPath);
}
else if (FStrEq(arg1, "6"))
{
g_bWaypointOn = TRUE; // turn waypoints on if off
UTIL_ShowMenu(pEntity, &menuWpDeletePath);
}
else if (FStrEq(arg1, "7"))
{
if (WaypointNodesValid())
UTIL_HostPrint("All Nodes work fine !\n");
}
else if (FStrEq(arg1, "8"))
{
if (WaypointNodesValid())
{
WaypointSave();
UTIL_HostPrint("Waypoints saved!\n");
}
else
UTIL_ShowMenu(pEntity, &menuWpSave);
}
else if (FStrEq(arg1, "9"))
UTIL_ShowMenu(pEntity, &menuWpOptions1);
RETURN_META(MRES_SUPERCEDE);
}
// Waypoint Add Menu
else if (pClient->pUserMenu == &menuWpAdd)
{
UTIL_ShowMenu(pEntity, NULL); // reset menu display
if (FStrEq(arg1, "1"))
WaypointAdd(WAYPOINT_ADD_NORMAL); // normal
else if (FStrEq(arg1, "2"))
WaypointAdd(WAYPOINT_ADD_TERRORIST); // t important
else if (FStrEq(arg1, "3"))
WaypointAdd(WAYPOINT_ADD_COUNTER); // ct important
else if (FStrEq(arg1, "4"))
WaypointAdd(WAYPOINT_ADD_LADDER); // ladder
else if (FStrEq(arg1, "5"))
WaypointAdd(WAYPOINT_ADD_RESCUE); // rescue
else if (FStrEq(arg1, "6"))
WaypointAdd(WAYPOINT_ADD_CAMP_START); // camp start
else if (FStrEq(arg1, "7"))
WaypointAdd(WAYPOINT_ADD_CAMP_END); // camp end
else if (FStrEq(arg1, "8"))
WaypointAdd(WAYPOINT_ADD_GOAL); // goal
else if (FStrEq(arg1, "9"))
{
g_bLearnJumpWaypoint = TRUE;
UTIL_HostPrint("Observation on !\n");
if (g_b_cv_UseSpeech)
SERVER_COMMAND("speak \"movement check ok\"\n");
}
RETURN_META(MRES_SUPERCEDE);
}
// Waypoint Delete Menu
else if (pClient->pUserMenu == &menuWpDelete)
{
UTIL_ShowMenu(pEntity, NULL); // reset menu display
if (FStrEq(arg1, "1"))
WaypointDelete();
RETURN_META(MRES_SUPERCEDE);
}
// Waypoint SetRadius Menu
else if (pClient->pUserMenu == &menuWpSetRadius)
{
UTIL_ShowMenu(pEntity, NULL); // reset menu display
if (FStrEq(arg1, "1"))
WaypointChangeRadius(0.0f);
else if (FStrEq(arg1, "2"))
WaypointChangeRadius(8.0f);
else if (FStrEq(arg1, "3"))
WaypointChangeRadius(16.0f);
else if (FStrEq(arg1, "4"))
WaypointChangeRadius(32.0f);
else if (FStrEq(arg1, "5"))
WaypointChangeRadius(48.0f);
else if (FStrEq(arg1, "6"))
WaypointChangeRadius(64.0f);
else if (FStrEq(arg1, "7"))
WaypointChangeRadius(80.0f);
else if (FStrEq(arg1, "8"))
WaypointChangeRadius(96.0f);
else if (FStrEq(arg1, "9"))
WaypointChangeRadius(112.0f);
RETURN_META(MRES_SUPERCEDE);
}
// Waypoint SetFlags Menu
else if (pClient->pUserMenu == &menuWpSetFlags)
{
UTIL_ShowMenu(pEntity, NULL); // reset menu display
if (FStrEq(arg1, "1"))
WaypointChangeFlag(W_FL_USE_BUTTON, FLAG_TOGGLE);
else if (FStrEq(arg1, "2"))
WaypointChangeFlag(W_FL_LIFT, FLAG_TOGGLE);
else if (FStrEq(arg1, "3"))
WaypointChangeFlag(W_FL_CROUCH, FLAG_TOGGLE);
else if (FStrEq(arg1, "4"))
WaypointChangeFlag(W_FL_GOAL, FLAG_TOGGLE);
else if (FStrEq(arg1, "5"))
WaypointChangeFlag(W_FL_LADDER, FLAG_TOGGLE);
else if (FStrEq(arg1, "6"))
WaypointChangeFlag(W_FL_RESCUE, FLAG_TOGGLE);
else if (FStrEq(arg1, "7"))
WaypointChangeFlag(W_FL_CAMP, FLAG_TOGGLE);
else if (FStrEq(arg1, "8"))
WaypointChangeFlag(W_FL_NOHOSTAGE, FLAG_TOGGLE);
else if (FStrEq(arg1, "9"))
UTIL_ShowMenu(pEntity, &menuWpSetTeam);
RETURN_META(MRES_SUPERCEDE);
}
// Waypoint Set Team Menu
else if (pClient->pUserMenu == &menuWpSetTeam)
{
UTIL_ShowMenu(pEntity, NULL); // reset menu display
if (FStrEq(arg1, "1"))
{
WaypointChangeFlag(W_FL_TERRORIST, FLAG_SET);
WaypointChangeFlag(W_FL_COUNTER, FLAG_CLEAR);
}
else if (FStrEq(arg1, "2"))
{
WaypointChangeFlag(W_FL_TERRORIST, FLAG_CLEAR);
WaypointChangeFlag(W_FL_COUNTER, FLAG_SET);
}
else if (FStrEq(arg1, "3"))
{
WaypointChangeFlag(W_FL_TERRORIST, FLAG_CLEAR);
WaypointChangeFlag(W_FL_COUNTER, FLAG_CLEAR);
}
RETURN_META(MRES_SUPERCEDE);
}
// Waypoint Add Path Menu
else if (pClient->pUserMenu == &menuWpAddPath)
{
UTIL_ShowMenu(pEntity, NULL); // reset menu display
if (FStrEq(arg1, "1"))
WaypointCreatePath(PATH_OUTGOING);
else if (FStrEq(arg1, "2"))
WaypointCreatePath(PATH_INCOMING);
else if (FStrEq(arg1, "3"))
WaypointCreatePath(PATH_BOTHWAYS);
RETURN_META(MRES_SUPERCEDE);
}
// Waypoint Delete Path Menu
else if (pClient->pUserMenu == &menuWpDeletePath)
{
UTIL_ShowMenu(pEntity, NULL); // reset menu display
if (FStrEq(arg1, "1"))
WaypointDeletePath();
RETURN_META(MRES_SUPERCEDE);
}
// Waypoint Save Menu
else if (pClient->pUserMenu == &menuWpSave)
{
UTIL_ShowMenu(pEntity, NULL); // reset menu display
if (FStrEq(arg1, "1"))
{
WaypointSave();
UTIL_HostPrint("WARNING: Waypoints saved with errors!\n");
}
RETURN_META(MRES_SUPERCEDE);
}
// Waypoint Options Menu 1
else if (pClient->pUserMenu == &menuWpOptions1)
{
UTIL_ShowMenu(pEntity, NULL); // reset menu display
if (FStrEq(arg1, "1")) // wp on/off
{
g_bWaypointOn ^= TRUE; // switch variable on/off (XOR it)
if (g_bWaypointOn)
{
UTIL_HostPrint("Waypoints Editing is ON\n");
while (!FNullEnt(pSpawnPoint = FIND_ENTITY_BY_STRING(pSpawnPoint, "classname", "info_player_start")))
pSpawnPoint->v.effects &= ~EF_NODRAW;
while (!FNullEnt(pSpawnPoint = FIND_ENTITY_BY_STRING(pSpawnPoint, "classname", "info_player_deathmatch")))
pSpawnPoint->v.effects &= ~EF_NODRAW;
while (!FNullEnt(pSpawnPoint = FIND_ENTITY_BY_STRING(pSpawnPoint, "classname", "info_vip_start")))
pSpawnPoint->v.effects &= ~EF_NODRAW;
}
else
{
UTIL_HostPrint("Waypoint Editing turned OFF\n");
while (!FNullEnt(pSpawnPoint = FIND_ENTITY_BY_STRING(pSpawnPoint, "classname", "info_player_start")))
pSpawnPoint->v.effects |= EF_NODRAW;
while (!FNullEnt(pSpawnPoint = FIND_ENTITY_BY_STRING(pSpawnPoint, "classname", "info_player_deathmatch")))
pSpawnPoint->v.effects |= EF_NODRAW;
while (!FNullEnt(pSpawnPoint = FIND_ENTITY_BY_STRING(pSpawnPoint, "classname", "info_vip_start")))
pSpawnPoint->v.effects |= EF_NODRAW;
if (g_bWaypointsChanged && g_bWaypointsSaved)
{
UTIL_HostPrint("The map will restart in 5 seconds!\n");
g_fTimeRestartServer = gpGlobals->time + 4.0;
}
else if (g_bWaypointsChanged)
UTIL_HostPrint("Don't forget to SAVE your waypoints...\n");
}
}
else if (FStrEq(arg1, "2"))
{
g_bAutoWaypoint ^= TRUE; // Switch Variable on/off (XOR it)
UTIL_HostPrint("Auto-Waypointing is %s\n", g_bAutoWaypoint ? "ENABLED" : "DISABLED");
}
else if (FStrEq(arg1, "3"))
{
g_bEditNoclip ^= TRUE; // Switch Variable on/off (XOR it)
if (g_bEditNoclip)
pHostEdict->v.movetype = MOVETYPE_NOCLIP;
else
pHostEdict->v.movetype = MOVETYPE_WALK;
UTIL_HostPrint("No Clipping Cheat is %s\n", g_bEditNoclip ? "ENABLED" : "DISABLED");
}
else if (FStrEq(arg1, "4"))
{
g_bIgnoreEnemies ^= TRUE; // Switch Variable on/off (XOR it)
UTIL_HostPrint("Peace Mode is %s (Bots %signore Enemies)\n", g_bIgnoreEnemies ? "ENABLED" : "DISABLED", g_bIgnoreEnemies ? "" : "DON'T ");
}
else if (FStrEq(arg1, "5"))
{
g_bShowWpFlags ^= TRUE; // Switch Variable on/off (XOR it)
UTIL_HostPrint("Waypoint Flag display is %s\n", g_bShowWpFlags ? "ENABLED" : "DISABLED");
}
else if (FStrEq(arg1, "6"))
UTIL_ShowMenu(pEntity, &menuWpAutoPathMaxDistance);
else if (FStrEq(arg1, "7"))
WaypointCache();
else if (FStrEq(arg1, "8")) // KWo - 29.03.2008
{
if (g_iCachedWaypoint == -1)
UTIL_HostPrint("No cached waypoint to move.\n");
else if (g_iCachedWaypoint >= 0 && g_iCachedWaypoint < g_iNumWaypoints)
{
WaypointMoveToPosition();
}
}
else if (FStrEq(arg1, "9")) // KWo - 29.03.2008
{
UTIL_ShowMenu(pEntity, &menuWpOptions2);
}
RETURN_META(MRES_SUPERCEDE);
}
// Waypoint Options Menu 2
else if (pClient->pUserMenu == &menuWpOptions2)
{
UTIL_ShowMenu(pEntity, NULL); // reset menu display
if (FStrEq(arg1, "1")) // wp on/off
{
i = WaypointLookAt();
if (i >= 0)
{
_snprintf_s(szTemp, sizeof szTemp, "%d", i);
PbCmdParser(pEntity, g_rgpszPbCmds[PBCMD_DEBUGGOAL], szTemp, NULL, NULL, NULL, NULL);
}
}
else if (FStrEq(arg1, "2"))
{
if (g_iDebugGoalIndex != -1)
{
_snprintf_s(szTemp, sizeof szTemp, "%d", -1);
PbCmdParser(pEntity, g_rgpszPbCmds[PBCMD_DEBUGGOAL], szTemp, NULL, NULL, NULL, NULL);
}
}
else if (FStrEq(arg1, "8")) // KWo - 04.10.2006
{
UTIL_ShowMenu(pEntity, &menuWpOptions1);
}
RETURN_META(MRES_SUPERCEDE);
}
// Waypoint AutoPathMaxDistance Menu
else if (pClient->pUserMenu == &menuWpAutoPathMaxDistance)
{
UTIL_ShowMenu(pEntity, NULL); // reset menu display
if (FStrEq(arg1, "1"))
g_fAutoPathMaxDistance = 0.0f;
else if (FStrEq(arg1, "2"))
g_fAutoPathMaxDistance = 100.0f;
else if (FStrEq(arg1, "3"))
g_fAutoPathMaxDistance = 130.0f;
else if (FStrEq(arg1, "4"))
g_fAutoPathMaxDistance = 160.0f;
else if (FStrEq(arg1, "5"))
g_fAutoPathMaxDistance = 190.0f;
else if (FStrEq(arg1, "6"))
g_fAutoPathMaxDistance = 220.0f;
else if (FStrEq(arg1, "7"))
g_fAutoPathMaxDistance = 250.0f;
if (g_fAutoPathMaxDistance == 0.0f)
UTIL_HostPrint("Auto-path disabled\n");
else
UTIL_HostPrint("Auto-path Max Distance set to %f\n", g_fAutoPathMaxDistance);
RETURN_META(MRES_SUPERCEDE);
}
// Main PODBot Menu ?
else if (pClient->pUserMenu == &menuPODBotMain)
{
UTIL_ShowMenu(pEntity, NULL); // reset menu display
if (FStrEq(arg1, "1"))
{
PbCmdParser(pEntity, g_rgpszPbCmds[PBCMD_ADD], NULL, NULL, NULL, NULL, NULL);
}
else if (FStrEq(arg1, "2"))
UTIL_ShowMenu(pEntity, &menuPODBotAddBotSkill);
else if (FStrEq(arg1, "3"))
{
PbCmdParser(pEntity, g_rgpszPbCmds[PBCMD_KILLBOTS], NULL, NULL, NULL, NULL, NULL);
}
else if (FStrEq(arg1, "4"))
UserNewroundAll();
else if (FStrEq(arg1, "5"))
UTIL_ShowMenu(pEntity, &menuPODBotFillServerSkill);
else if (FStrEq(arg1, "6"))
ShowPBKickBotMenu(pEntity, 1);
else if (FStrEq(arg1, "7"))
{
PbCmdParser(pEntity, g_rgpszPbCmds[PBCMD_REMOVEBOTS], NULL, NULL, NULL, NULL, NULL);
}
else if (FStrEq(arg1, "8"))
UTIL_ShowMenu(pEntity, &menuPODBotWeaponMode);
RETURN_META(MRES_SUPERCEDE);
}
// Add Bot Skill menu ?
else if (pClient->pUserMenu == &menuPODBotAddBotSkill)
{
UTIL_ShowMenu(pEntity, NULL); // reset menu display
if (FStrEq(arg1, "1"))
{
_snprintf_s(g_cStoreAddbotSkill, sizeof g_cStoreAddbotSkill, "%d", RANDOM_LONG(1, 19));
UTIL_ShowMenu(pEntity, &menuPODBotAddBotPersonality);
}
else if (FStrEq(arg1, "2"))
{
_snprintf_s(g_cStoreAddbotSkill, sizeof g_cStoreAddbotSkill, "%d", RANDOM_LONG(20, 39));
UTIL_ShowMenu(pEntity, &menuPODBotAddBotPersonality);
}
else if (FStrEq(arg1, "3"))
{
_snprintf_s(g_cStoreAddbotSkill, sizeof g_cStoreAddbotSkill, "%d", RANDOM_LONG(40, 59));