forked from richard-allen/q2pro
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathg_local.h
More file actions
3132 lines (2658 loc) · 93.5 KB
/
Copy pathg_local.h
File metadata and controls
3132 lines (2658 loc) · 93.5 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
//-----------------------------------------------------------------------------
// g_local.h -- local definitions for game module
//
// $Id: g_local.h,v 1.68 2004/04/08 23:19:51 slicerdw Exp $
//
//-----------------------------------------------------------------------------
// $Log: g_local.h,v $
// Revision 1.68 2004/04/08 23:19:51 slicerdw
// Optimized some code, added a couple of features and fixed minor bugs
//
// Revision 1.67 2003/06/15 21:43:53 igor
// added IRC client
//
// Revision 1.66 2003/06/15 15:34:32 igor
// - removed the zcam code from this branch (see other branch)
// - added fixes from 2.72 (source only) version
// - resetted version number to 2.72
// - This version should be exactly like the release 2.72 - just with a few
// more fixes (which whoever did the source only variant didn't get because
// he didn't use the CVS as he should. Shame on him.
//
// Revision 1.65 2002/09/04 11:23:09 ra
// Added zcam to TNG and bumped version to 3.0
//
// Revision 1.64 2002/04/01 15:16:06 freud
// Stats code redone, tng_stats now much more smarter. Removed a few global
// variables regarding stats code and added kevlar hits to stats.
//
// Revision 1.63 2002/03/30 17:20:59 ra
// New cvar use_buggy_bandolier to control behavior of dropping bando and grenades
//
// Revision 1.62 2002/03/28 13:30:36 freud
// Included time played in ghost.
//
// Revision 1.61 2002/03/28 12:10:11 freud
// Removed unused variables (compiler warnings).
// Added cvar mm_allowlock.
//
// Revision 1.60 2002/03/28 11:46:03 freud
// stat_mode 2 and timelimit 0 did not show stats at end of round.
// Added lock/unlock.
// A fix for use_oldspawns 1, crash bug.
//
// Revision 1.59 2002/03/25 23:35:19 freud
// Ghost code, use_ghosts and more stuff..
//
// Revision 1.58 2002/03/25 18:32:11 freud
// I'm being too productive.. New ghost command needs testing.
//
// Revision 1.57 2002/03/24 22:45:53 freud
// New spawn code again, bad commit last time..
//
// Revision 1.56 2002/02/19 10:28:43 freud
// Added to %D hit in the kevlar vest and kevlar helmet, also body for handcannon
// and shotgun.
//
// Revision 1.55 2002/02/19 09:32:47 freud
// Removed PING PONGs from CVS, not fit for release.
//
// Revision 1.54 2002/02/18 20:21:36 freud
// Added PING PONG mechanism for timely disconnection of clients. This is
// based on a similar scheme as the scheme used by IRC. The client has
// cvar ping_timeout seconds to reply or will be disconnected.
//
// Revision 1.53 2002/02/18 13:55:35 freud
// Added last damaged players %P
//
// Revision 1.52 2002/02/17 20:10:09 freud
// Better naming of auto_items is auto_equip, requested by Deathwatch.
//
// Revision 1.51 2002/02/17 20:01:32 freud
// Fixed stat_mode overflows, finally.
// Added 2 new cvars:
// auto_join (0|1), enables auto joining teams from previous map.
// auto_items (0|1), enables weapon and items caching between maps.
//
// Revision 1.50 2002/02/01 17:49:56 freud
// Heavy changes in stats code. Removed lots of variables and replaced them
// with int arrays of MODs. This cleaned tng_stats.c up a whole lots and
// everything looks well, might need more testing.
//
// Revision 1.49 2002/01/24 02:24:56 deathwatch
// Major update to Stats code (thanks to Freud)
// new cvars:
// stats_afterround - will display the stats after a round ends or map ends
// stats_endmap - if on (1) will display the stats scoreboard when the map ends
//
// Revision 1.48 2001/12/24 18:06:05 slicerdw
// changed dynamic check for darkmatch only
//
// Revision 1.46 2001/12/23 21:19:41 deathwatch
// Updated stats with location and average
// cleaned it up a bit as well
//
// Revision 1.45 2001/12/23 16:30:50 ra
// 2.5 ready. New stats from Freud. HC and shotgun gibbing seperated.
//
// Revision 1.44 2001/12/09 14:02:11 slicerdw
// Added gl_clear check -> video_check_glclear cvar
//
// Revision 1.43 2001/11/07 11:41:37 igor_rock
// removed unused variables stats_shots_hd and stats_shots_m
//
// Revision 1.42 2001/10/18 12:55:35 deathwatch
// Added roundtimeleft
//
// Revision 1.41 2001/09/30 03:09:34 ra
// Removed new stats at end of rounds and created a new command to
// do the same functionality. Command is called "time"
//
// Revision 1.40 2001/09/29 19:54:04 ra
// Made a CVAR to turn off extratimingstats
//
// Revision 1.39 2001/09/28 13:48:34 ra
// I ran indent over the sources. All .c and .h files reindented.
//
// Revision 1.38 2001/09/28 13:44:23 slicerdw
// Several Changes / improvements
//
// Revision 1.37 2001/09/02 20:33:34 deathwatch
// Added use_classic and fixed an issue with ff_afterround, also updated version
// nr and cleaned up some commands.
//
// Updated the VC Project to output the release build correctly.
//
// Revision 1.36 2001/08/20 00:41:15 slicerdw
// Added a new scoreboard for Teamplay with stats ( when map ends )
//
// Revision 1.35 2001/08/18 17:14:04 deathwatch
// Flashlight Added (not done yet, needs to prevent DEAD ppl from using it,
// the glow should be white and a bit smaller if possible and the daiper needs
// to be gone. Also, it should only work in 'darkmatch' I guess and it should
// make a sound when you turn it on/off.
//
// Revision 1.34 2001/08/18 01:28:06 deathwatch
// Fixed some stats stuff, added darkmatch + day_cycle, cleaned up several files, restructured ClientCommand
//
// Revision 1.33 2001/08/17 21:31:37 deathwatch
// Added support for stats
//
// Revision 1.32 2001/08/15 14:50:48 slicerdw
// Added Flood protections to Radio & Voice, Fixed the sniper bug AGAIN
//
// Revision 1.31 2001/08/06 14:38:45 ra
// Adding UVtime for ctf
//
// Revision 1.30 2001/08/06 03:00:49 ra
// Added FF after rounds. Please someone look at the EVIL if statments for me :)
//
// Revision 1.29 2001/07/16 18:28:46 ra
// Changed a 40 second hard limit on mapvoting into a cvar.
//
// Revision 1.28 2001/06/25 11:59:20 slicerdw
// Small Fix
//
// Revision 1.27 2001/06/25 11:44:47 slicerdw
// New Video Check System - video_check and video_check_lockpvs no longer latched
//
// Revision 1.26 2001/06/22 16:34:05 slicerdw
// Finished Matchmode Basics, now with admins, Say command tweaked...
//
// Revision 1.25 2001/06/21 00:05:30 slicerdw
// New Video Check System done - might need some revision but works..
//
// Revision 1.22 2001/06/20 07:21:21 igor_rock
// added use_warnings to enable/disable time/frags left msgs
// added use_rewards to enable/disable eimpressive, excellent and accuracy msgs
// change the configfile prefix for modes to "mode_" instead "../mode-" because
// they don't have to be in the q2 dir for doewnload protection (action dir is sufficient)
// and the "-" is bad in filenames because of linux command line parameters start with "-"
//
// Revision 1.21 2001/06/19 18:56:38 deathwatch
// New Last killed target system
//
// Revision 1.20 2001/06/18 12:36:40 igor_rock
// added new irvision mode (with reddish screen and alpha blend) and corresponding
// new cvar "new_irvision" to enable the new mode
//
// Revision 1.19 2001/06/13 08:39:13 igor_rock
// changed "cvote" to "use_cvote" (like the other votecvars)
//
// Revision 1.18 2001/06/13 08:00:25 igor_rock
// corrected stupid error (wrong changes committed)
//
// Revision 1.17 2001/06/13 07:55:17 igor_rock
// Re-Added a_match.h and a_match.c
// Added CTF Header for a_ctf.h and a_ctf.c
//
// Revision 1.16 2001/06/01 19:18:42 slicerdw
// Added Matchmode Code
//
// Revision 1.15 2001/05/31 16:58:14 igor_rock
// conflicts resolved
//
// Revision 1.14.2.4 2001/05/25 18:59:52 igor_rock
// Added CTF Mode completly :)
// Support for .flg files is still missing, but with "real" CTF maps like
// tq2gtd1 the ctf works fine.
// (I hope that all other modes still work, just tested DM and teamplay)
//
// Revision 1.14.2.3 2001/05/20 18:54:19 igor_rock
// added original ctf code snippets from zoid. lib compilesand runs but
// doesn't function the right way.
// Jsut committing these to have a base to return to if something wents
// awfully wrong.
//
// Revision 1.14.2.2 2001/05/20 15:54:43 igor_rock
// added ctf variables and include, "ctf_team" (zoid) changes to "team" (aq2:tng)
//
// Revision 1.14.2.1 2001/05/20 15:17:31 igor_rock
// removed the old ctf code completly
//
// Revision 1.14 2001/05/14 21:10:16 igor_rock
// added wp_flags support (and itm_flags skeleton - doesn't disturb in the moment)
//
// Revision 1.13 2001/05/13 01:23:01 deathwatch
// Added Single Barreled Handcannon mode, made the menus and scoreboards
// look nicer and made the voice command a bit less loud.
//
// Revision 1.12 2001/05/12 21:19:51 ra
//
//
// Added punishkills.
//
// Revision 1.11 2001/05/12 20:58:22 ra
//
//
// Adding public mapvoting and kickvoting. Its controlable via cvar's mv_public
// and vk_public (both default off)
//
// Revision 1.10 2001/05/12 13:48:58 mort
// Fixed CTF ForceSpawn bug
//
// Revision 1.9 2001/05/11 16:07:25 mort
// Various CTF bits and pieces...
//
// Revision 1.8 2001/05/11 12:21:19 slicerdw
// Commented old Location support ( ADF ) With the ML/ETE Compatible one
//
// Revision 1.6 2001/05/08 12:55:43 igor_rock
// added inlcude file <ctype.h>
//
// Revision 1.5 2001/05/07 22:03:15 slicerdw
// Added sv stuffcmd
//
// Revision 1.4 2001/05/07 21:18:34 slicerdw
// Added Video Checking System
//
// Revision 1.3 2001/05/07 08:32:17 mort
// Basic CTF code
// No spawns etc
// Just the cvars and flag entity
//
// Revision 1.2 2001/05/07 02:05:36 ra
//
//
// Added tkok command to forgive teamkills.
//
// Revision 1.1.1.1 2001/05/06 17:29:25 igor_rock
// This is the PG Bund Edition V1.25 with all stuff laying around here...
//
//-----------------------------------------------------------------------------
#include <ctype.h>
#include "shared/shared.h"
#include "q_ghud.h"
#include <stddef.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 "shared/game.h"
#include "shared/gameext.h"
#include "a_team.h"
#include "a_game.h"
#include "a_menu.h"
#include "a_radio.h"
#include "a_xcmds.h"
#include "a_xgame.h"
#include "tng_ini.h"
#include "a_tourney.h"
#include "a_xvote.h"
#include "a_xmenu.h"
#include "a_vote.h"
#include "a_match.h"
#include "tng_stats.h" // Adding TNG Stats File
#include "tng_irc.h"
#include "tng_balancer.h"
#include "tng_jump.h"
#include "g_grapple.h"
#include "p_antilag.h"
#if AQTION_CURL
#include "tng_net.h"
#endif
#ifndef NO_BOTS
//#include "acesrc/botnav.h"
#include "botlib/botlib.h"
#endif
// 9b15 commit from upstream -- using player_state_old_t instead of player_state_new_t
typedef struct gclient_s gclient_t;
#define getEnt(entnum) (edict_t *)((char *)globals.edicts + (globals.edict_size * entnum)) //AQ:TNG Slicer - This was missing
#define GAMEVERSION "action" // the "gameversion" client command will print this plus compile date
#define G_FEATURES (GMF_CLIENTNUM | GMF_PROPERINUSE | GMF_MVDSPEC | GMF_WANT_ALL_DISCONNECTS | GMF_VARIABLE_FPS)
// 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
#define svc_sound 9
#define svc_stufftext 11
#define svc_configstring 13
// These are mapped to the enum svc_ops_t in protocol.h q2pro
// If these need adjusted in q2pro, adjust them here too
// Warning: this breaks backwards compatbility with earlier versions of AQtion if you change it
#define svc_extend 30
#define svc_userstatistic 31
//==================================================================
#define MASK_VOLUME 1
#define MASK_ATTENUATION 2
#define MASK_POSITION 4
#define MASK_ENTITY_CHANNEL 8
#define MASK_TIMEOFS 16
// view pitching times
#define DAMAGE_TIME 0.5f
#define FALL_TIME 0.3f
// edict->spawnflags
// these are set with checkboxes on each entity in the map editor
#define SPAWNFLAG_NOT_EASY BIT(8)
#define SPAWNFLAG_NOT_MEDIUM BIT(9)
#define SPAWNFLAG_NOT_HARD BIT(10)
#define SPAWNFLAG_NOT_DEATHMATCH BIT(11)
#define SPAWNFLAG_NOT_COOP BIT(12)
#define SPAWNFLAG_ONLY_BOTLIB_SPAWN BIT(13) // Only BOTLIB bots will spawn here
// edict->flags
#define FL_FLY BIT(0)
#define FL_SWIM BIT(1) // implied immunity to drowining
#define FL_IMMUNE_LASER BIT(2)
#define FL_INWATER BIT(3)
#define FL_GODMODE BIT(4)
#define FL_NOTARGET BIT(5)
#define FL_IMMUNE_SLIME BIT(6)
#define FL_IMMUNE_LAVA BIT(7)
#define FL_PARTIALGROUND BIT(8) // not all corners are valid
#define FL_WATERJUMP BIT(9) // player jumping out of water
#define FL_TEAMSLAVE BIT(10) // not the first on the team
#define FL_NO_KNOCKBACK BIT(11)
#define FL_POWER_ARMOR BIT(12) // power armor (if any) is active
#define FL_NO_DAMAGE_EFFECTS BIT(20) // no damage effects
#define FL_ACCELERATE BIT(29) // accelerative movement
#define FL_RESPAWN BIT(31) // used for item respawning
// edict->client->pers.spec_flags
#define SPECFL_KILLFEED BIT(0)
#define SPECFL_SPECHUD BIT(1)
#define SPECFL_SPECHUD_NEW BIT(2)
// variable server FPS
#ifndef NO_FPS
#define HZ game.framerate // (int)sv_fps->value
#define FRAMETIME game.frametime
#define FRAMEDIV game.framediv // (sv_fps / 10)
#define FRAMESYNC !(level.framenum % game.framediv)
#else
#define HZ BASE_FRAMERATE
#define FRAMETIME BASE_FRAMETIME_1000
#define FRAMEDIV 1
#define FRAMESYNC 1
#endif
#define KEYFRAME(x) (level.framenum + (x) - (level.framenum % FRAMEDIV))
#define NEXT_FRAME(ent, func) \
((ent)->think = (func), (ent)->nextthink = level.framenum + 1)
#define NEXT_KEYFRAME(ent, func) \
((ent)->think = (func), (ent)->nextthink = KEYFRAME(FRAMEDIV))
// 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,
WEAPON_END_MAG,
WEAPON_RELOADING,
WEAPON_BURSTING,
WEAPON_BUSY, // used by sniper rifle when engaging zoom, if I want to make laser sight toggle on/off this could be used for that too...
WEAPON_BANDAGING
}
weaponstate_t;
typedef enum
{
AMMO_BULLETS,
AMMO_SHELLS,
AMMO_ROCKETS,
AMMO_GRENADES,
AMMO_CELLS,
AMMO_SLUGS
}
ammo_t;
#ifndef NO_BOTS
// g_spawn.c
typedef enum
{
BOT_NOMOVE = BIT(0), // Bot will not move from their spawnpoint, but will still shoot enemy entities
BOT_NOSHOOT = BIT(1), // Bot will not shoot enemy entities, but will still move/interact and behave as if they were
BOT_NORESPAWN = BIT(2), // Bot never respawns (does not use the player respawn method)
BOT_IGNORE_PLAYERS = BIT(3), // Bot ignores players
BOT_IGNORE_BOTS = BIT(4), // Bot ignores other bots
}
bot_spawn_behavior_t;
#endif
#define BOT_DUMMY (BOT_NOMOVE | BOT_NOSHOOT)
#define BOT_IGNORE_ALL (BOT_IGNORE_PLAYERS | BOT_IGNORE_BOTS)
/*
The combination of BOT_IGNORE_PLAYERS and BOT_IGNORE_BOTS (BOT_IGNORE_ALL) should make the bot navigate freely,
but otherwise do nothing.
The difference between that and BOT_NOSHOOT is that the BOT_NOSHOOT bot will interact (avoid, strafe around, etc) with the player
as if they were going to attack, but does not
*/
//tng_net.c
typedef enum {
SERVER_WARMING_UP = BIT(0), // 1
DEATH_MSG = BIT(1), // 2
CHAT_MSG = BIT(2), // 4
AWARD_MSG = BIT(3), // 8
SERVER_MSG = BIT(4), // 16
MATCH_START_MSG = BIT(5), // 32
MATCH_END_MSG = BIT(6), // 64
PICKUP_REQ_MSG = BIT(7), // 128
NOTIFY_MAX = BIT(8) // 256 (enable all)
} Discord_Notifications;
// Default messages
#define MM_MATCH_END_MSG "Matchmode Results"
#define DM_MATCH_END_MSG "Deathmatch Results"
#define MM_3_MIN_WARN "3 minutes remaining in the map"
#define PICKUP_GAME_REQUEST "A pickup game has been started"
#define TP_MATCH_START_MSG "Match is about to begin!"
#define TP_MATCH_END_MSG "Match has ended!"
//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 BIT(0)
#define AI_TEMP_STAND_GROUND BIT(1)
#define AI_SOUND_TARGET BIT(2)
#define AI_LOST_SIGHT BIT(3)
#define AI_PURSUIT_LAST_SEEN BIT(4)
#define AI_PURSUE_NEXT BIT(5)
#define AI_PURSUE_TEMP BIT(6)
#define AI_HOLD_FRAME BIT(7)
#define AI_GOOD_GUY BIT(8)
#define AI_BRUTAL BIT(9)
#define AI_NOSTEP BIT(10)
#define AI_DUCKED BIT(11)
#define AI_COMBAT_POINT BIT(12)
#define AI_MEDIC BIT(13)
#define AI_RESURRECTING BIT(14)
//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 BIT(0)
#define SFL_CROSS_TRIGGER_2 BIT(1)
#define SFL_CROSS_TRIGGER_3 BIT(2)
#define SFL_CROSS_TRIGGER_4 BIT(3)
#define SFL_CROSS_TRIGGER_5 BIT(4)
#define SFL_CROSS_TRIGGER_6 BIT(5)
#define SFL_CROSS_TRIGGER_7 BIT(6)
#define SFL_CROSS_TRIGGER_8 BIT(7)
#define SFL_CROSS_TRIGGER_MASK (BIT(8) - 1)
// 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_TOSS_NOPUSH, // gravity, don't get pushed by doors/plats
MOVETYPE_FLYMISSILE, // extra size to monsters
MOVETYPE_BOUNCE,
MOVETYPE_BLOOD
}
movetype_t;
typedef struct
{
int base_count;
int max_count;
float normal_protection;
float energy_protection;
int armor;
}
gitem_armor_t;
// gitem_t->flags
#define IT_WEAPON 1 // use makes active weapon
#define IT_AMMO 2
#define IT_ARMOR 4
#define IT_STAY_COOP 8
#define IT_KEY 16
#define IT_POWERUP 32
#define IT_ITEM 64
#define IT_FLAG 128
// weapon names
/*
bind 2 "use M3 Super 90 Assault Shotgun;"
bind 3 "use MP5/10 Submachinegun"
bind 4 "use Handcannon"
bind 5 "use M4 Assault Rifle"
bind 6 "use Sniper Rifle"
*/
#define MK23_NAME "MK23 Pistol"
#define MP5_NAME "MP5/10 Submachinegun"
#define M4_NAME "M4 Assault Rifle"
#define M3_NAME "M3 Super 90 Assault Shotgun"
#define HC_NAME "Handcannon"
#define SNIPER_NAME "Sniper Rifle"
#define DUAL_NAME "Dual MK23 Pistols"
#define KNIFE_NAME "Combat Knife"
#define GRENADE_NAME "M26 Fragmentation Grenade"
#define MK23_AMMO_NAME "Pistol Magazine"
#define MP5_AMMO_NAME "MP5 Magazine"
#define M4_AMMO_NAME "M4 Magazine"
#define SHOTGUN_AMMO_NAME "12 Gauge Shells"
#define SNIPER_AMMO_NAME "AP Sniper Ammo"
#define SIL_NAME "Silencer"
#define SLIP_NAME "Stealth Slippers"
#define BAND_NAME "Bandolier"
#define KEV_NAME "Kevlar Vest"
#define HELM_NAME "Kevlar Helmet"
#define LASER_NAME "Lasersight"
#define C_KIT_NAME "Commando Kit"
#define S_KIT_NAME "Stealth Kit"
#define A_KIT_NAME "Assassin Kit"
#define C_KIT_NAME_FULL "Commando Kit (Bandolier + Helm)"
#define S_KIT_NAME_FULL "Stealth Kit (Slippers + Silencer)"
#define A_KIT_NAME_FULL "Assassin Kit (Laser + Silencer)"
#define NO_NUM 0
#define MK23_NUM 1
#define MP5_NUM 2
#define M4_NUM 3
#define M3_NUM 4
#define HC_NUM 5
#define SNIPER_NUM 6
#define DUAL_NUM 7
#define KNIFE_NUM 8
#define GRENADE_NUM 9
#define SIL_NUM 10
#define SLIP_NUM 11
#define BAND_NUM 12
#define KEV_NUM 13
#define LASER_NUM 14
#define HELM_NUM 15
#define MK23_ANUM 16
#define MP5_ANUM 17
#define M4_ANUM 18
#define SHELL_ANUM 19
#define SNIPER_ANUM 20
#define FLAG_T1_NUM 21
#define FLAG_T2_NUM 22
#define GRAPPLE_NUM 23
#define ITEM_MAX_NUM 24
#define C_KIT_NUM 25
#define S_KIT_NUM 26
#define A_KIT_NUM 27
#define KIT_MAX_NUM 28
#define WEAPON_COUNT 9
#define ITEM_COUNT 6
#define AMMO_COUNT 5
#define KIT_COUNT 3
#define WEAPON_FIRST 1
#define WEAPON_MAX WEAPON_FIRST+WEAPON_COUNT
#define ITEM_FIRST WEAPON_MAX
#define ITEM_MAX ITEM_FIRST+ITEM_COUNT
#define AMMO_FIRST ITEM_MAX
#define AMMO_MAX AMMO_FIRST+AMMO_COUNT
#define KIT_FIRST C_KIT_NUM
#define KIT_MAX KIT_MAX_NUM
//AQ2:TNG - Igor adding wp_flags/itm_flags
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define WPF_MASK ((1 << WEAPON_COUNT) - 1)
#define WPF_DEFAULT 511 //WPF_MASK
#define WPF_DEFAULT_STR TOSTRING(WPF_DEFAULT)
#define WPF_ALLOWED(typeNum) ((int)wp_flags->value & items[typeNum].flag)
#define ITF_MASK ((1 << ITEM_COUNT) - 1)
#define ITF_DEFAULT 63 //ITF_MASK
#define ITF_DEFAULT_STR TOSTRING(ITF_DEFAULT)
#define ITF_ALLOWED(typeNum) ((int)itm_flags->value & items[typeNum].flag)
#define MAX_SPAWNS 512 // max DM spawn points supported
// High Scores support from OpenFFA
#define MAX_HIGH_SCORES 10
typedef struct highscore_s
{
char name[MAX_CLIENT_NAME];
int score;
float fragsper;
float accuracy;
time_t time;
} highscore_t;
//AQ2:TNG End adding flags
typedef struct itemList_s
{
int index;
int flag;
} itemList_t;
extern itemList_t items[ITEM_MAX_NUM];
// sniper modes
#define SNIPER_1X 0
#define SNIPER_2X 1
#define SNIPER_4X 2
#define SNIPER_6X 3
#define SNIPER_MODE_MAX 4
//TempFile sniper zoom moved to constants
#define SNIPER_FOV1 90
#define SNIPER_FOV2 45
#define SNIPER_FOV4 20
#define SNIPER_FOV6 10
#define GRENADE_IDLE_FIRST 40
#define GRENADE_IDLE_LAST 69
#define GRENADE_THROW_FIRST 4
#define GRENADE_THROW_LAST 9 // throw it on frame 8?
// these should be server variables, when I get around to it
//#define UNIQUE_WEAPONS_ALLOWED 2
//#define UNIQUE_ITEMS_ALLOWED 1
#define SPEC_WEAPON_RESPAWN 1
#define BANDAGE_TIME 27 // 10 = 1 second
#define ENHANCED_BANDAGE_TIME 10
#define BLEED_TIME 10 // 10 = 1 second is time for losing 1 health at slowest bleed rate
// Igor's back in Time to hard grenades :-)
#define GRENADE_DAMRAD_CLASSIC 170
#define GRENADE_DAMRAD 250
typedef struct gitem_s
{
char *classname; // spawning name
qboolean (*pickup) (struct edict_s * ent, struct edict_s * other);
void (*use) (struct edict_s * ent, struct gitem_s * item);
void (*drop) (struct edict_s * ent, struct gitem_s * item);
void (*weaponthink) (struct edict_s * ent);
char *pickup_sound;
char *world_model;
int world_model_flags;
char *view_model;
// client side info
char *icon;
char *pickup_name; // for printing on pickup
int count_width; // number of digits to display by icon
int quantity; // for ammo how much, for weapons how much is used per shot
char *ammo; // for weapons
int flags; // IT_* flags
void *info;
int tag;
char *precaches; // string of all models, sounds, and images this item will use
int typeNum;
}
gitem_t;
typedef struct precache_s {
struct precache_s *next;
void (*func)(void);
} precache_t;
/*
* LRCON (Limited Remote Console) data structures
*/
#define MAX_LRCON_CVARS 32
#define MAX_LRCON_MODES 16
/* LRCON state - tracks current server claim */
typedef struct {
qboolean claimed; /* Is server currently claimed? */
char claimer_name[16]; /* Name of current claimer */
char claimer_ip[64]; /* IP address of current claimer */
int claim_time; /* Frame number when claimed */
edict_t *claimer_ent; /* Pointer to claimer entity (NULL if disconnected) */
} lrcon_state_t;
/* Server mode definition */
typedef struct {
char name[64]; /* Mode name (e.g., "teamdm", "ctf") */
char command[256]; /* Config command to execute (e.g., "exec cfg/teamdm.cfg") */
} lrcon_mode_t;
/* LRCON configuration */
typedef struct {
qboolean enabled; /* Is LRCON enabled? */
qboolean quit_on_empty; /* Quit server when last player leaves? */
int allowed_cvars_count; /* Number of whitelisted cvars */
char allowed_cvars[MAX_LRCON_CVARS][64]; /* Whitelisted cvar names */
int modes_count; /* Number of available modes */
lrcon_mode_t modes[MAX_LRCON_MODES]; /* Available server modes */
} lrcon_config_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
{
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;
int serverfeatures;
int framerate;
float frametime;
int framediv;
// items
int num_items;
// stats
char matchid[MAX_QPATH];
int gamemode;
int gamemodeflags;
int roundNum;
qboolean ai_ent_found;
int bot_count;
// API-related
int srv_announce_timeout;
//q2pro protocol extensions
cs_remap_t csr;
precache_t *precaches;
// High Scores support from OpenFFA
char dir[MAX_OSPATH]; // where variable data is stored
// Bot personalities loaded
#ifndef NO_BOTS
char bot_file_path[MAX_QPATH];
int used_bot_personalities;
#endif
#if AQTION_CURL
// Discord Webhook limits
qboolean time_warning_sent; // This is set to true when the time warning has been sent, resets every map
#endif
// LRCON configuration
lrcon_config_t lrcon_config;
// Matchmode carryover scores (persist across map changes)
int carryover_scores[TEAM_TOP];
qboolean carryover_active; // true if we're on map 2 with carried-over scores
}
game_locals_t;
// Map features, utilized by / requires bot_personality to be enabled
typedef struct map_features_s
{
float volume;
float openness;
float water_amt;
float lava_amt;
float slime_amt;
} map_features_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
//+
char tempmap[MAX_QPATH]; //PG BUND
// intermission state
int intermission_framenum; // time the intermission was started
int intermission_exit;
vec3_t intermission_origin;
vec3_t intermission_angle;
// high scores from OpenFFA
highscore_t scores[MAX_HIGH_SCORES];
int numscores;
time_t record; // not zero if scores updated
char *changemap;
char statusbar[1024]; //MAX is 1536 = (MAX_QPATH * (CS_AIRACCEL - CS_STATUSBAR))
char spec_statusbar[1024];
int spec_statusbar_lastupdate;
int pic_health;
int pic_items[ITEM_MAX_NUM];
int pic_weapon_ammo[WEAPON_MAX];
int pic_sniper_mode[SNIPER_MODE_MAX];
int pic_teamskin[TEAM_TOP];
int pic_teamtag;
int pic_ctf_teamtag[TEAM_TOP];
int pic_ctf_flagbase[TEAM_TOP];
int pic_ctf_flagtaken[TEAM_TOP];
int pic_ctf_flagdropped[TEAM_TOP];
int snd_fry;
int snd_lights;
int snd_camera;
int snd_action;
int snd_teamwins[TEAM_TOP];
int snd_silencer;
int snd_headshot;
int snd_vesthit;
int snd_knifethrow;
int snd_kick;
int snd_noammo;
int snd_grenhead;
int snd_grenhelm;
int snd_grenbody;
int model_null;
int model_lsight;
#ifdef AQTION_EXTENSION
int model_arrow;
#endif
edict_t *current_entity; // entity running from G_RunFrame
int body_que; // dead bodies
int specspawn; // determines if initial spawning has occured
int realFramenum; //when game paused, framenum stays the same
int pauseFrames;
int timeoutFrames;
float matchTime;
float emptyTime;
int abandonFrames; // Countdown for abandon forfeit
int weapon_sound_framenum;
int pic_teamplay_timer_icon;
int pic_leaderskin[TEAM_TOP];
int pic_esp_teamtag[TEAM_TOP];
int pic_esp_teamicon[TEAM_TOP];
int pic_esp_leadericon[TEAM_TOP];
int pic_esp_respawn_icon;
// Point of interest
vec3_t poi_origin;
vec3_t poi_angle;
// tng_net.c
int lc_recently_sent[NOTIFY_MAX]; // Used to prevent spamming of the endpoint
// Map features
map_features_t map_features;
// LRCON state
lrcon_state_t lrcon;
}