-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathg_local.h
More file actions
1389 lines (1189 loc) · 39.2 KB
/
Copy pathg_local.h
File metadata and controls
1389 lines (1189 loc) · 39.2 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
/*
Copyright (C) 2000 Shane Powell
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//
// q2admin
//
// g_local.h
//
// copyright 2000 Shane Powell
//
// g_local.h -- local definitions for game module
#include "q_shared.h"
// define GAME_INCLUDE so that game.h does not define the
// short, server-visible gclient_t and edict_t structures,
// because we define the full size ones in this file
#define GAME_INCLUDE
#include "game.h"
#include <ctype.h>
/* Use our local regex.c and .h on Windows but
Posix library regex on *nix systems.
This makes it 64-bit clean on GNU Linux */
/* Added __GNUC__ condition for MinGW64 to use its own regex lib. //QW// */
#if defined _WIN32 && !defined __GNUC__
#include "regex.h"
#else
#include <regex.h>
#endif
//*** UPDATE START ***
#define PRIVATE_COMMANDS 8
#define ALLOWED_MAXCMDS 50
#define ALLOWED_MAXCMDS_SAFETY 45
#define TIMERS_MAX 4
//*** UPDATE END ***
// maximum length of random strings used to check for hacked quake2.exe
#define RANDOM_STRING_LENGTH 20
// the "gameversion" client command will print this plus compile date
#define GAMEVERSION "baseq2"
// protocol bytes that can be directly added to messages
#define svc_muzzleflash 1
#define svc_muzzleflash2 2
#define svc_temp_entity 3
#define svc_layout 4
#define svc_inventory 5
//==================================================================
// view pitching times
#define DAMAGE_TIME 0.5
#define FALL_TIME 0.3
// edict->spawnflags
// these are set with checkboxes on each entity in the map editor
#define SPAWNFLAG_NOT_EASY 0x00000100
#define SPAWNFLAG_NOT_MEDIUM 0x00000200
#define SPAWNFLAG_NOT_HARD 0x00000400
#define SPAWNFLAG_NOT_DEATHMATCH 0x00000800
#define SPAWNFLAG_NOT_COOP 0x00001000
// edict->flags
#define FL_FLY 0x00000001
#define FL_SWIM 0x00000002 // implied immunity to drowining
#define FL_IMMUNE_LASER 0x00000004
#define FL_INWATER 0x00000008
#define FL_GODMODE 0x00000010
#define FL_NOTARGET 0x00000020
#define FL_IMMUNE_SLIME 0x00000040
#define FL_IMMUNE_LAVA 0x00000080
#define FL_PARTIALGROUND 0x00000100 // not all corners are valid
#define FL_WATERJUMP 0x00000200 // player jumping out of water
#define FL_TEAMSLAVE 0x00000400 // not the first on the team
#define FL_NO_KNOCKBACK 0x00000800
#define FL_POWER_ARMOR 0x00001000 // power armor (if any) is active
#define FL_RESPAWN 0x80000000 // used for item respawning
#define FRAMETIME 0.1
// memory tags to allow dynamic memory to be cleaned up
#define TAG_GAME 765 // clear when unloading the dll
#define TAG_LEVEL 766 // clear when loading a new level
#define MELEE_DISTANCE 80
#define BODY_QUEUE_SIZE 8
typedef enum
{
DAMAGE_NO,
DAMAGE_YES, // will take damage if hit
DAMAGE_AIM // auto targeting recognizes this
}
damage_t;
typedef enum
{
WEAPON_READY,
WEAPON_ACTIVATING,
WEAPON_DROPPING,
WEAPON_FIRING
}
weaponstate_t;
typedef enum
{
AMMO_BULLETS,
AMMO_SHELLS,
AMMO_ROCKETS,
AMMO_GRENADES,
AMMO_CELLS,
AMMO_SLUGS
}
ammo_t;
//deadflag
#define DEAD_NO 0
#define DEAD_DYING 1
#define DEAD_DEAD 2
#define DEAD_RESPAWNABLE 3
//range
#define RANGE_MELEE 0
#define RANGE_NEAR 1
#define RANGE_MID 2
#define RANGE_FAR 3
//gib types
#define GIB_ORGANIC 0
#define GIB_METALLIC 1
//monster ai flags
#define AI_STAND_GROUND 0x00000001
#define AI_TEMP_STAND_GROUND 0x00000002
#define AI_SOUND_TARGET 0x00000004
#define AI_LOST_SIGHT 0x00000008
#define AI_PURSUIT_LAST_SEEN 0x00000010
#define AI_PURSUE_NEXT 0x00000020
#define AI_PURSUE_TEMP 0x00000040
#define AI_HOLD_FRAME 0x00000080
#define AI_GOOD_GUY 0x00000100
#define AI_BRUTAL 0x00000200
#define AI_NOSTEP 0x00000400
#define AI_DUCKED 0x00000800
#define AI_COMBAT_POINT 0x00001000
#define AI_MEDIC 0x00002000
#define AI_RESURRECTING 0x00004000
//monster attack state
#define AS_STRAIGHT 1
#define AS_SLIDING 2
#define AS_MELEE 3
#define AS_MISSILE 4
// armor types
#define ARMOR_NONE 0
#define ARMOR_JACKET 1
#define ARMOR_COMBAT 2
#define ARMOR_BODY 3
#define ARMOR_SHARD 4
// power armor types
#define POWER_ARMOR_NONE 0
#define POWER_ARMOR_SCREEN 1
#define POWER_ARMOR_SHIELD 2
// handedness values
#define RIGHT_HANDED 0
#define LEFT_HANDED 1
#define CENTER_HANDED 2
// game.serverflags values
#define SFL_CROSS_TRIGGER_1 0x00000001
#define SFL_CROSS_TRIGGER_2 0x00000002
#define SFL_CROSS_TRIGGER_3 0x00000004
#define SFL_CROSS_TRIGGER_4 0x00000008
#define SFL_CROSS_TRIGGER_5 0x00000010
#define SFL_CROSS_TRIGGER_6 0x00000020
#define SFL_CROSS_TRIGGER_7 0x00000040
#define SFL_CROSS_TRIGGER_8 0x00000080
#define SFL_CROSS_TRIGGER_MASK 0x000000ff
// noise types for PlayerNoise
#define PNOISE_SELF 0
#define PNOISE_WEAPON 1
#define PNOISE_IMPACT 2
// edict->movetype values
typedef enum
{
MOVETYPE_NONE, // never moves
MOVETYPE_NOCLIP, // origin and angles change with no interaction
MOVETYPE_PUSH, // no clip to world, push on box contact
MOVETYPE_STOP, // no clip to world, stops on box contact
MOVETYPE_WALK, // gravity
MOVETYPE_STEP, // gravity, special edge handling
MOVETYPE_FLY,
MOVETYPE_TOSS, // gravity
MOVETYPE_FLYMISSILE, // extra size to monsters
MOVETYPE_BOUNCE
}
movetype_t;
// this structure is left intact through an entire game
// it should be initialized at dll load time, and read/written to
// the server.ssv file for savegames
typedef struct
{
char helpmessage1[512];
char helpmessage2[512];
int helpchanged; // flash F1 icon if non 0, play sound
// and increment only if 1, 2, or 3
gclient_t *clients; // [maxclients]
// can't store spawnpoint in level, because
// it would get overwritten by the savegame restore
char spawnpoint[512]; // needed for coop respawns
// store latched cvars here that we want to get at often
int maxclients;
int maxentities;
// cross level triggers
int serverflags;
// items
int num_items;
qboolean autosaved;
}
game_locals_t;
// this structure is cleared as each map is entered
// it is read/written to the level.sav file for savegames
typedef struct
{
int framenum;
float time;
char level_name[MAX_QPATH]; // the descriptive name (Outer Base, etc)
char mapname[MAX_QPATH]; // the server name (base1, etc)
char nextmap[MAX_QPATH]; // go here when fraglimit is hit
// intermission state
float intermissiontime; // time the intermission was started
char *changemap;
int exitintermission;
vec3_t intermission_origin;
vec3_t intermission_angle;
edict_t *sight_client; // changed once each frame for coop games
edict_t *sight_entity;
int sight_entity_framenum;
edict_t *sound_entity;
int sound_entity_framenum;
edict_t *sound2_entity;
int sound2_entity_framenum;
int pic_health;
int total_secrets;
int found_secrets;
int total_goals;
int found_goals;
int total_monsters;
int killed_monsters;
edict_t *current_entity; // entity running from G_RunFrame
int body_que; // dead bodies
int power_cubes; // ugly necessity for coop
}
level_locals_t;
extern game_locals_t game;
extern level_locals_t level;
extern game_import_t gi;
extern game_export_t globals;
extern edict_t *g_edicts;
#define FOFS(x) (int)&(((edict_t *)0)->x)
#define STOFS(x) (int)&(((spawn_temp_t *)0)->x)
#define LLOFS(x) (int)&(((level_locals_t *)0)->x)
#define CLOFS(x) (int)&(((gclient_t *)0)->x)
#define random() ((rand () & 0x7fff) / ((float)0x7fff))
#define crandom() (2.0 * (random() - 0.5))
#define world (&g_edicts[0])
// item spawnflags
#define ITEM_TRIGGER_SPAWN 0x00000001
#define ITEM_NO_TOUCH 0x00000002
// 6 bits reserved for editor flags
// 8 bits used as power cube id bits for coop games
#define DROPPED_ITEM 0x00010000
#define DROPPED_PLAYER_ITEM 0x00020000
#define ITEM_TARGETS_USED 0x00040000
// fields are needed for spawning from the entity string
// and saving / loading games
#define FFL_SPAWNTEMP 1
typedef enum {
F_INT,
F_FLOAT,
F_LSTRING, // string on disk, pointer in memory, TAG_LEVEL
F_GSTRING, // string on disk, pointer in memory, TAG_GAME
F_VECTOR,
F_ANGLEHACK,
F_EDICT, // index on disk, pointer in memory
F_ITEM, // index on disk, pointer in memory
F_CLIENT, // index on disk, pointer in memory
F_IGNORE
}
fieldtype_t;
typedef struct
{
char *name;
int ofs;
fieldtype_t type;
int flags;
}
field_t;
// damage flags
#define DAMAGE_RADIUS 0x00000001 // damage was indirect
#define DAMAGE_NO_ARMOR 0x00000002 // armour does not protect from this damage
#define DAMAGE_ENERGY 0x00000004 // damage is from an energy based weapon
#define DAMAGE_NO_KNOCKBACK 0x00000008 // do not affect velocity, just view angles
#define DAMAGE_BULLET 0x00000010 // damage is from a bullet (used for ricochets)
#define DAMAGE_NO_PROTECTION 0x00000020 // armor, shields, invulnerability, and godmode have no effect
#define DEFAULT_BULLET_HSPREAD 300
#define DEFAULT_BULLET_VSPREAD 500
#define DEFAULT_SHOTGUN_HSPREAD 1000
#define DEFAULT_SHOTGUN_VSPREAD 500
#define DEFAULT_DEATHMATCH_SHOTGUN_COUNT 12
#define DEFAULT_SHOTGUN_COUNT 12
#define DEFAULT_SSHOTGUN_COUNT 20
//============================================================================
// client_t->anim_priority
#define ANIM_BASIC 0 // stand / run
#define ANIM_WAVE 1
#define ANIM_JUMP 2
#define ANIM_PAIN 3
#define ANIM_ATTACK 4
#define ANIM_DEATH 5
// this structure is cleared on each PutClientInServer(),
// except for 'client->pers'
struct gclient_s
{
// known to server
player_state_t ps; // communicated by server to clients
int ping;
};
struct edict_s
{
entity_state_t s;
struct gclient_s *client; // NULL if not a player
// the server expects the first part
// of gclient_s to be a player_state_t
// but the rest of it is opaque
qboolean inuse;
int linkcount;
// FIXME: move these fields to a server private sv_entity_t
link_t area; // linked to a division node or leaf
int num_clusters; // if -1, use headnode instead
int clusternums[MAX_ENT_CLUSTERS];
int headnode; // unused if num_clusters != -1
int areanum, areanum2;
//================================
int svflags;
vec3_t mins, maxs;
vec3_t absmin, absmax, size;
solid_t solid;
int clipmask;
edict_t *owner;
// DO NOT MODIFY ANYTHING ABOVE THIS, THE SERVER
// EXPECTS THE FIELDS IN THAT ORDER!
//================================
};
// zbot detector global stuff
struct chatflood_s
{
qboolean chatFloodProtect;
int chatFloodProtectNum;
int chatFloodProtectSec;
int chatFloodProtectSilence;
};
#define MAXIMPULSESTOTEST 256
#define RANDCHAR() (random() < 0.3) ? '0' + (int)(9.9 * random()) : 'A' + (int)(26.9 * random())
#define BANLISTFILE "q2adminban.txt"
#define CFGFILE "q2admin.txt"
#define DEFAULTVOTECOMMAND "vote"
#define DEFAULTRECONNECTMSG "Please wait to be reconnected to the server - this is normal for this level of bot protection.\nThe fastest way to do this is not to change any client info e.g. your name or skin."
#define DEFAULTUSERDISPLAY "%s is using a client side proxy."
#define DEFAULTTSDISPLAY "%s is using a speed cheat."
#define DEFAULTHACKDISPLAY "%s is using a modified client."
#define DEFAULTSKINCRASHMSG "%s tried to crash the server."
#define DEFAULTFLOODMSG "%s changed names too many times."
#define DEFAULTCHATFLOODMSG "%s is making too much noise."
#define DEFAULTSKINFLOODMSG "%s changed skin too many times."
#define DEFAULTCL_PITCHSPEED_KICKMSG "cl_pitchspeed changes not allowed on this server."
#define DEFAULTCL_ANGLESPEEDKEY_KICKMSG "cl_anglespeedkey changes not allowed on this server."
#define DEFAULTBANMSG "You are banned from this server!"
#define DEFAULTCHABANMSG "Message banned."
#define DEFAULTLOCKOUTMSG "This server is currently locked."
typedef struct banstruct
{
regex_t *r;
qboolean exclude;
byte type;
byte loadType;
byte ip[4];
byte subnetmask;
char nick[80];
char password[80];
char *msg;
long maxnumberofconnects;
long numberofconnects;
long bannum;
float timeout;
struct chatflood_s floodinfo;
struct banstruct *next;
}
baninfo_t;
#define NOTUSED 0
#define NICKALL 1
#define NICKEQ 2
#define NICKLIKE 3
#define NICKRE 4
#define NICKBLANK 5
#define LT_PERM 1
#define LT_TEMP 2
typedef struct chatbanstruct
{
regex_t *r;
byte type;
byte loadType;
long bannum;
char chat[256];
char *msg;
struct chatbanstruct *next;
} chatbaninfo_t;
#define CNOTUSED 0
#define CHATLIKE 1
#define CHATRE 2
typedef struct cmdqueue_s
{
byte command;
float timeout;
unsigned long data;
char *str;
} CMDQUEUE;
//*** UPDATE START ***
typedef struct timers_s
{
char action[256];
int start;
} timers_t;
//*** UPDATE END ***
typedef struct proxyinfo_s
{
qboolean admin;
unsigned char retries;
unsigned char rbotretries;
CMDQUEUE cmdQueue[ALLOWED_MAXCMDS]; // command queue - UPDATE
int maxCmds;
unsigned long clientcommand; // internal proxy commands
char teststr[9];
int charindex;
//long logfilereadpos;
int logfilenum;
long logfilecheckpos;
char buffer[256]; // log buffer
char ipaddress[40];
byte ipaddressBinary[4];
byte impulse;
byte inuse;
char name[16];
char skin[40]; // skin/model information.
int rate;
int maxfps;
int cl_pitchspeed;
float cl_anglespeedkey;
baninfo_t *baninfo;
long namechangetimeout;
int namechangecount;
long skinchangetimeout;
int skinchangecount;
long chattimeout;
int chatcount;
char userinfo[MAX_INFO_STRING + 45];
FILE *stuffFile;
int impulsesgenerated;
char lastcmd[8192];
struct chatflood_s floodinfo;
short zbc_angles[2][2];
int zbc_tog;
int zbc_jitter;
float zbc_jitter_time;
float zbc_jitter_last;
int votescast;
int votetimeout;
int msg;
// used to test the alias (and connect) command with random strings
char hack_teststring1[RANDOM_STRING_LENGTH+1];
char hack_teststring2[RANDOM_STRING_LENGTH+1];
char hack_teststring3[RANDOM_STRING_LENGTH+1];
char hack_timescale[RANDOM_STRING_LENGTH+1];
int hacked_disconnect;
byte hacked_disconnect_ip[4];
int checked_hacked_exe;
// used to test the variables check list
char hack_checkvar[RANDOM_STRING_LENGTH+1];
int checkvar_idx;
//*** UPDATE START ***
char gl_driver[256];
int gl_driver_changes;
int pmodver;
int pmod;
int pmod_noreply_count;
int pcmd_noreply_count;
int pver;
int q2a_admin;
int q2a_bypass;
int msec_count;
int msec_last;
int frames_count;
int msec_bad;
float msec_start;
int done_server_and_blocklist;
int userinfo_changed_count;
int userinfo_changed_start;
int private_command;
int timescale;
qboolean show_fps;
qboolean vid_restart;
qboolean private_command_got[PRIVATE_COMMANDS];
char serverip[16];
char cmdlist_stored[256];
unsigned int cmdlist;
int cmdlist_timeout;
int userid;
int newcmd_timeout;
timers_t timers[TIMERS_MAX];
int blocklist;
int speedfreeze;
int enteredgame;
//*** UPDATE END ***
} proxyinfo_t;
typedef struct
{
byte inuse;
char name[16];
} proxyreconnectinfo_t;
#define MAXDETECTRETRIES 3
#define CCMD_STARTUPTEST 0x000001
#define CCMD_ZPROXYCHECK2 0x000002
#define CCMD_ZBOTDETECTED 0x000004
#define CCMD_BANNED 0x000008
#define CCMD_NCSILENCE 0x000010
#define CCMD_KICKED 0x000020
#define CCMD_SELECTED 0x000040
#define CCMD_CSILENCE 0x000080
#define CCMD_PCSILENCE 0x000100
#define CCMD_VOTED 0x000200
#define CCMD_VOTEYES 0x000400
#define CCMD_NITRO2PROXY 0x000800
#define CCMD_RATBOTDETECT 0x001000
#define CCMD_RATBOTDETECTNAME 0x002000
#define CCMD_ZBOTCLEAR 0x004000
#define CCMD_RBOTCLEAR 0x008000
#define CCMD_SCSILENCE 0x010000
#define CCMD_RECONNECT 0x020000
#define CCMD_ALIASCHECKSTARTED 0x040000
#define CCMD_WAITFORALIASREPLY1 0x080000
#define CCMD_WAITFORALIASREPLY2 0x100000
#define CCMD_WAITFORCONNECTREPLY 0x200000
#define CCMD_REMEMBERHACK 0x400000
#define CCMD_CLIENTOVERFLOWED 0x800000
#define LEVELCHANGE_KEEP (CCMD_SCSILENCE | CCMD_CSILENCE | CCMD_PCSILENCE | CCMD_ZBOTDETECTED | CCMD_KICKED | CCMD_NITRO2PROXY | CCMD_ZBOTCLEAR | CCMD_RBOTCLEAR | CCMD_BANNED | CCMD_RECONNECT | CCMD_REMEMBERHACK )
#define BANCHECK (CCMD_BANNED | CCMD_RECONNECT)
enum _commands
{
QCMD_STARTUP,
QCMD_STARTUPTEST,
QCMD_CLEAR,
QCMD_DISCONNECT,
QCMD_CUSTOM,
QCMD_ZPROXYCHECK1,
QCMD_ZPROXYCHECK2,
QCMD_DISPLOGFILE,
QCMD_DISPLOGFILELIST,
QCMD_DISPLOGEVENTLIST,
QCMD_CONNECTCMD,
QCMD_LOGTOFILE1,
QCMD_LOGTOFILE2,
QCMD_LOGTOFILE3,
QCMD_GETIPALT,
QCMD_RESTART,
QCMD_CLIPTOMAXRATE,
QCMD_CLIPTOMINRATE,
QCMD_SETUPMAXFPS,
QCMD_FORCEUDATAUPDATE,
QCMD_SETMAXFPS,
QCMD_SETMINFPS,
QCMD_DISPBANS,
QCMD_DISPLRCONS,
QCMD_DISPFLOOD,
QCMD_DISPSPAWN,
QCMD_DISPVOTE,
QCMD_DISPDISABLE,
QCMD_CHANGENAME,
QCMD_CHANGESKIN,
QCMD_BAN,
QCMD_DISPCHATBANS,
QCMD_STUFFCLIENT,
QCMD_TESTADMIN,
QCMD_TESTADMIN2, // UPDATE
QCMD_TESTADMIN3, // UPDATE
QCMD_RUNVOTECMD,
QCMD_TESTRATBOT,
QCMD_TESTRATBOT2,
QCMD_TESTRATBOT3,
QCMD_TESTRATBOT4,
QCMD_LETRATBOTQUIT,
QCMD_TESTTIMESCALE,
QCMD_TESTSTANDARDPROXY,
QCMD_TESTALIASCMD1,
QCMD_TESTALIASCMD2,
QCMD_SETUPCL_PITCHSPEED,
QCMD_FORCEUDATAUPDATEPS,
QCMD_SETUPCL_ANGLESPEEDKEY,
QCMD_FORCEUDATAUPDATEAS,
QCMD_RECONNECT,
QCMD_KICK,
QCMD_MSGDISCONNECT,
QCMD_DISPCHECKVAR,
QCMD_CHECKVARTESTS,
//*** UPDATE START ***
QCMD_AUTH,
QCMD_PMODVERTIMEOUT,
QCMD_PMODVERTIMEOUT_INGAME,
QCMD_SHOWMOTD,
QCMD_EXECMAPCFG,
QCMD_PRIVATECOMMAND,
QCMD_GL_CHECK,
QCMD_SETUPTIMESCALE,
QCMD_SETTIMESCALE,
QCMD_SPAMBYPASS,
QCMD_GETCMDQUEUE,
QCMD_TESTCMDQUEUE
//*** UPDATE END ***
};
enum zb_logtypesenum
{
LT_ZBOT,
LT_ZBOTIMPULSES,
LT_IMPULSES,
LT_NAMECHANGE,
LT_SKINCHANGE,
LT_CHATBAN,
LT_CLIENTCONNECT,
LT_CLIENTBEGIN,
LT_CLIENTDISCONNECT,
LT_CLIENTKICK,
LT_CLIENTCMDS,
LT_CLIENTLRCON,
LT_BAN,
LT_CHAT,
LT_SERVERSTART,
LT_SERVERINIT,
LT_SERVEREND,
LT_INTERNALWARN,
LT_PERFORMANCEMONITOR,
LT_DISABLECMD,
LT_ENTITYCREATE,
LT_ENTITYDELETE,
LT_INVALIDIP,
LT_ADMINLOG, // UPDATE
LT_CLIENTUSERINFO, // UPDATE
LT_PRIVATELOG, // UPDATE
};
#define IW_UNEXCEPTEDCMD 1
#define IW_UNKNOWNCMD 2
#define IW_ZBOTDETECT 3
#define IW_STARTUP 4
#define IW_STARTUPTEST 5
#define IW_ZBOTTEST 6
#define IW_OVERFLOWDETECT 7
#define IW_STARTUPFAIL 8
#define IW_Q2ADMINCFGLOAD 9
#define IW_LOGSETUPLOAD 10
#define IW_BANSETUPLOAD 11
#define IW_LRCONSETUPLOAD 12
#define IW_FLOODSETUPLOAD 13
#define IW_SPAWNSETUPLOAD 14
#define IW_VOTESETUPLOAD 15
#define IW_ZBCHECK 16
#define IW_DISABLESETUPLOAD 17
#define IW_CHECKVARSETUPLOAD 18
#define IW_INVALIDIPADDRESS 19
#define MINIMUMTIMEOUT 5
/* //QwazyWabbit//
proxyinfo[client].retries is unsigned char
and MAXSTARTTRY was set at 500. Let's set
it to something reachable for that type.
Note: MAXDETECTRETRIES for RatBot detection
is much smaller. I have no idea what's
appropriate here, the 500 value goes back to
sources dating back to 2005. I don't know
why this is hard coded. It should have been
a configuration variable. */
#define MAXSTARTTRY 20
#define getEntOffset(ent) (((char *)ent - (char *)globals.edicts) / globals.edict_size)
#define getEnt(entnum) (edict_t *)((char *)globals.edicts + (globals.edict_size * (entnum)))
// where the command can't be run?
#define CMDWHERE_CFGFILE 0x01
#define CMDWHERE_CLIENTCONSOLE 0x02
#define CMDWHERE_SERVERCONSOLE 0x04
// type of command
#define CMDTYPE_NONE 0
#define CMDTYPE_LOGICAL 1
#define CMDTYPE_NUMBER 2
#define CMDTYPE_STRING 3
typedef void CMDRUNFUNC(int startarg, edict_t *ent, int client);
typedef void CMDINITFUNC(char *arg);
typedef struct
{
char *cmdname;
byte cmdwhere;
byte cmdtype;
void *datapoint;
CMDRUNFUNC *runfunc;
CMDINITFUNC *initfunc;
} zbotcmd_t;
extern game_import_t gi;
extern game_export_t globals;
extern game_export_t *dllglobals;
extern cvar_t *rcon_password, *gamedir, *maxclients, *logfile, *rconpassword, *port, *q2admintxt, *q2adminbantxt; // UPDATE
extern char dllname[512];
extern char zbotuserdisplay[256];
extern char timescaleuserdisplay[256];
extern char hackuserdisplay[256];
extern char skincrashmsg[256];
extern char defaultreconnectmessage[256];
extern char moddir[256];
extern qboolean soloadlazy;
extern qboolean dllloaded;
extern qboolean quake2dirsupport;
extern qboolean zbotdetect;
extern qboolean displayzbotuser;
extern qboolean displaynamechange;
extern qboolean dopversion;
extern qboolean disconnectuserimpulse;
extern qboolean disconnectuser;
extern qboolean mapcfgexec;
extern qboolean checkClientIpAddress;
extern qboolean votecountnovotes;
extern int votepasspercent;
extern int voteminclients;
extern int clientMaxVoteTimeout;
extern int clientMaxVotes;
extern int numofdisplays;
extern int maximpulses;
extern byte impulsesToKickOn[MAXIMPULSESTOTEST];
extern byte maxImpulses;
extern qboolean displayimpulses;
//r1ch 2005-01-26 disable hugely buggy commands BEGIN
/*extern qboolean play_team_enable;
extern qboolean play_all_enable;
extern qboolean play_person_enable;*/
//r1ch 2005-01-26 disable hugely buggy commands END
extern qboolean printmessageonplaycmds;
extern qboolean say_person_enable;
extern qboolean say_group_enable;
extern qboolean extendedsay_enable;
extern qboolean spawnentities_enable;
extern qboolean spawnentities_internal_enable;
extern qboolean vote_enable;
extern qboolean consolechat_disable;
extern qboolean gamemaptomap;
extern qboolean banOnConnect;
extern qboolean lockDownServer;
extern qboolean serverinfoenable;
extern int clientVoteTimeout;
extern int clientRemindTimeout;
extern int randomwaitreporttime;
extern int proxy_bwproxy;
extern int proxy_nitro2;
extern int q2adminrunmode;
extern int maxMsgLevel;
extern char *zbotversion;
extern char zbotmotd[256];
extern char motd[4096];
extern char clientVoteCommand[256];
extern int maxrateallowed;
extern int minrateallowed;
extern int maxfpsallowed;
extern int minfpsallowed;
extern int zbc_jittermax;
extern int zbc_jittertime;
extern int zbc_jittermove;
#define ZBOT_TESTSTRING1 "q2startxx\n"
#define ZBOT_TESTSTRING_TEST1 "q2startxx"
#define ZBOT_TESTSTRING_TEST2 "q2exx"
#define ZBOT_TESTSTRING_TEST3 ".please.disconnect.all.bots"
#define ZBOT_TESTSTRING_TEST1_OLD "q2start"
#define ZBOT_TESTSTRING_TEST2_OLD "q2e"
extern char zbot_teststring1[];
extern char zbot_teststring_test1[];
extern char zbot_teststring_test2[];
extern char zbot_teststring_test3[];
extern char zbot_testchar1;
extern char zbot_testchar2;
extern char testchars[];
extern int testcharslength;
extern int q2adminrunmode;
extern int maxclientsperframe;
extern int framesperprocess;
extern char buffer[0x10000];
extern char buffer2[256];
extern char adminpassword[256];
extern char customServerCmd[256];
extern char customClientCmd[256];
extern char customClientCmdConnect[256];
extern char customServerCmdConnect[256];
//r1ch 2005-01-27 insecure lrcon fix BEGIN
extern qboolean rcon_insecure;
//r1ch 2005-01-27 insecure lrcon fix END
extern qboolean rcon_random_password;
extern qboolean zbc_enable;
extern qboolean nameChangeFloodProtect;
extern qboolean skinChangeFloodProtect;
extern char nameChangeFloodProtectMsg[256];
extern char skinChangeFloodProtectMsg[256];
extern char chatFloodProtectMsg[256];
extern int maxlrcon_cmds;
extern int lrcon_timeout;
extern int logfilecheckcount;
extern int nameChangeFloodProtectNum;
extern int nameChangeFloodProtectSec;
extern int nameChangeFloodProtectSilence;
extern int skinChangeFloodProtectNum;
extern int skinChangeFloodProtectSec;
extern int skinChangeFloodProtectSilence;
extern struct chatflood_s floodinfo;
extern baninfo_t *banhead;
extern chatbaninfo_t *cbanhead;
extern qboolean IPBanning_Enable;
extern qboolean NickBanning_Enable;
extern qboolean ChatBanning_Enable;
extern qboolean kickOnNameChange;
extern qboolean disablecmds_enable;
extern qboolean checkvarcmds_enable;
extern qboolean swap_attack_use;
extern qboolean timescaledetect;
extern char defaultBanMsg[256];
extern char defaultChatBanMsg[256];
extern char *currentBanMsg;
extern proxyinfo_t *proxyinfo;
extern proxyinfo_t *proxyinfoBase;
extern proxyreconnectinfo_t *reconnectproxyinfo;
extern zbotcmd_t zbotCommands[];
extern int clientsidetimeout;
extern int zbotdetectactivetimeout;
extern int lframenum;
extern float ltime;
extern char *impulsemessages[];
extern char cmdpassedvote[2048];
extern char cl_pitchspeed_kickmsg[256];
extern char cl_anglespeedkey_kickmsg[256];
extern qboolean cl_pitchspeed_enable;
extern qboolean cl_pitchspeed_kick;
extern qboolean cl_pitchspeed_display;
extern qboolean cl_anglespeedkey_enable;
extern qboolean cl_anglespeedkey_kick;
extern qboolean cl_anglespeedkey_display;
extern qboolean filternonprintabletext;
extern char lockoutmsg[256];
extern char gmapname[MAX_QPATH];
extern char reconnect_address[256];
extern char serverip[256]; // UPDATE
extern char lanip[256]; // UPDATE
extern int reconnect_time;
extern int reconnect_checklevel;
extern int entity_classname_offset;
extern int checkvar_poll_time;