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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
|
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
Copyright (C) 2000-2006 Tim Angus
This file is part of Tremulous.
Tremulous 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.
Tremulous 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 Tremulous; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#include "../qcommon/q_shared.h"
#include "../renderer/tr_types.h"
#include "../game/bg_public.h"
#include "cg_public.h"
#include "../ui/ui_shared.h"
// The entire cgame module is unloaded and reloaded on each level change,
// so there is NO persistant data between levels on the client side.
// If you absolutely need something stored, it can either be kept
// by the server in the server stored userinfos, or stashed in a cvar.
#define CG_FONT_THRESHOLD 0.1
#define POWERUP_BLINKS 5
#define POWERUP_BLINK_TIME 1000
#define FADE_TIME 200
#define PULSE_TIME 200
#define DAMAGE_DEFLECT_TIME 100
#define DAMAGE_RETURN_TIME 400
#define DAMAGE_TIME 500
#define LAND_DEFLECT_TIME 150
#define LAND_RETURN_TIME 300
#define DUCK_TIME 100
#define PAIN_TWITCH_TIME 200
#define WEAPON_SELECT_TIME 1400
#define ITEM_SCALEUP_TIME 1000
#define ZOOM_TIME 150
#define ITEM_BLOB_TIME 200
#define MUZZLE_FLASH_TIME 20
#define SINK_TIME 1000 // time for fragments to sink into ground before going away
#define ATTACKER_HEAD_TIME 10000
#define REWARD_TIME 3000
#define PULSE_SCALE 1.5 // amount to scale up the icons when activating
#define MAX_STEP_CHANGE 32
#define MAX_VERTS_ON_POLY 10
#define MAX_MARK_POLYS 256
#define STAT_MINUS 10 // num frame for '-' stats digit
#define ICON_SIZE 48
#define CHAR_WIDTH 32
#define CHAR_HEIGHT 48
#define TEXT_ICON_SPACE 4
// very large characters
#define GIANT_WIDTH 32
#define GIANT_HEIGHT 48
#define NUM_CROSSHAIRS 10
#define TEAM_OVERLAY_MAXNAME_WIDTH 12
#define TEAM_OVERLAY_MAXLOCATION_WIDTH 16
typedef enum
{
FOOTSTEP_NORMAL,
FOOTSTEP_FLESH,
FOOTSTEP_METAL,
FOOTSTEP_SPLASH,
FOOTSTEP_CUSTOM,
FOOTSTEP_NONE,
FOOTSTEP_TOTAL
} footstep_t;
typedef enum
{
IMPACTSOUND_DEFAULT,
IMPACTSOUND_METAL,
IMPACTSOUND_FLESH
} impactSound_t;
typedef enum
{
JPS_OFF,
JPS_DESCENDING,
JPS_HOVERING,
JPS_ASCENDING
} jetPackState_t;
//======================================================================
// when changing animation, set animationTime to frameTime + lerping time
// The current lerp will finish out, then it will lerp to the new animation
typedef struct
{
int oldFrame;
int oldFrameTime; // time when ->oldFrame was exactly on
int frame;
int frameTime; // time when ->frame will be exactly on
float backlerp;
float yawAngle;
qboolean yawing;
float pitchAngle;
qboolean pitching;
int animationNumber; // may include ANIM_TOGGLEBIT
animation_t *animation;
int animationTime; // time when the first frame of the animation will be exact
} lerpFrame_t;
//======================================================================
//attachment system
typedef enum
{
AT_STATIC,
AT_TAG,
AT_CENT,
AT_PARTICLE
} attachmentType_t;
//forward declaration for particle_t
struct particle_s;
typedef struct attachment_s
{
attachmentType_t type;
qboolean attached;
qboolean staticValid;
qboolean tagValid;
qboolean centValid;
qboolean particleValid;
qboolean hasOffset;
vec3_t offset;
vec3_t lastValidAttachmentPoint;
//AT_STATIC
vec3_t origin;
//AT_TAG
refEntity_t re; //FIXME: should be pointers?
refEntity_t parent; //
qhandle_t model;
char tagName[ MAX_STRING_CHARS ];
//AT_CENT
int centNum;
//AT_PARTICLE
struct particle_s *particle;
} attachment_t;
//======================================================================
//particle system stuff
#define MAX_PARTICLE_FILES 128
#define MAX_PS_SHADER_FRAMES 32
#define MAX_PS_MODELS 8
#define MAX_EJECTORS_PER_SYSTEM 4
#define MAX_PARTICLES_PER_EJECTOR 4
#define MAX_BASEPARTICLE_SYSTEMS 192
#define MAX_BASEPARTICLE_EJECTORS MAX_BASEPARTICLE_SYSTEMS*MAX_EJECTORS_PER_SYSTEM
#define MAX_BASEPARTICLES MAX_BASEPARTICLE_EJECTORS*MAX_PARTICLES_PER_EJECTOR
#define MAX_PARTICLE_SYSTEMS 48
#define MAX_PARTICLE_EJECTORS MAX_PARTICLE_SYSTEMS*MAX_EJECTORS_PER_SYSTEM
#define MAX_PARTICLES MAX_PARTICLE_EJECTORS*5
#define PARTICLES_INFINITE -1
#define PARTICLES_SAME_AS_INITIAL -2
//COMPILE TIME STRUCTURES
typedef enum
{
PMT_STATIC,
PMT_STATIC_TRANSFORM,
PMT_TAG,
PMT_CENT_ANGLES,
PMT_NORMAL
} pMoveType_t;
typedef enum
{
PMD_LINEAR,
PMD_POINT
} pDirType_t;
typedef struct pMoveValues_u
{
pDirType_t dirType;
//PMD_LINEAR
vec3_t dir;
float dirRandAngle;
//PMD_POINT
vec3_t point;
float pointRandAngle;
float mag;
float magRandFrac;
float parentVelFrac;
float parentVelFracRandFrac;
} pMoveValues_t;
typedef struct pLerpValues_s
{
int delay;
float delayRandFrac;
float initial;
float initialRandFrac;
float final;
float finalRandFrac;
float randFrac;
} pLerpValues_t;
//particle template
typedef struct baseParticle_s
{
vec3_t displacement;
float randDisplacement;
float normalDisplacement;
pMoveType_t velMoveType;
pMoveValues_t velMoveValues;
pMoveType_t accMoveType;
pMoveValues_t accMoveValues;
int lifeTime;
float lifeTimeRandFrac;
float bounceFrac;
float bounceFracRandFrac;
qboolean bounceCull;
char bounceMarkName[ MAX_QPATH ];
qhandle_t bounceMark;
float bounceMarkRadius;
float bounceMarkRadiusRandFrac;
float bounceMarkCount;
float bounceMarkCountRandFrac;
char bounceSoundName[ MAX_QPATH ];
qhandle_t bounceSound;
float bounceSoundCount;
float bounceSoundCountRandFrac;
pLerpValues_t radius;
pLerpValues_t alpha;
pLerpValues_t rotation;
qboolean dynamicLight;
pLerpValues_t dLightRadius;
byte dLightColor[ 3 ];
int colorDelay;
float colorDelayRandFrac;
byte initialColor[ 3 ];
byte finalColor[ 3 ];
char childSystemName[ MAX_QPATH ];
qhandle_t childSystemHandle;
char onDeathSystemName[ MAX_QPATH ];
qhandle_t onDeathSystemHandle;
char childTrailSystemName[ MAX_QPATH ];
qhandle_t childTrailSystemHandle;
//particle invariant stuff
char shaderNames[ MAX_PS_SHADER_FRAMES ][ MAX_QPATH ];
qhandle_t shaders[ MAX_PS_SHADER_FRAMES ];
int numFrames;
float framerate;
char modelNames[ MAX_PS_MODELS ][ MAX_QPATH ];
qhandle_t models[ MAX_PS_MODELS ];
int numModels;
animation_t modelAnimation;
qboolean overdrawProtection;
qboolean realLight;
qboolean cullOnStartSolid;
float scaleWithCharge;
} baseParticle_t;
//ejector template
typedef struct baseParticleEjector_s
{
baseParticle_t *particles[ MAX_PARTICLES_PER_EJECTOR ];
int numParticles;
pLerpValues_t eject; //zero period indicates creation of all particles at once
int totalParticles; //can be infinite
float totalParticlesRandFrac;
} baseParticleEjector_t;
//particle system template
typedef struct baseParticleSystem_s
{
char name[ MAX_QPATH ];
baseParticleEjector_t *ejectors[ MAX_EJECTORS_PER_SYSTEM ];
int numEjectors;
qboolean thirdPersonOnly;
qboolean registered; //whether or not the assets for this particle have been loaded
} baseParticleSystem_t;
//RUN TIME STRUCTURES
typedef struct particleSystem_s
{
baseParticleSystem_t *class;
attachment_t attachment;
qboolean valid;
qboolean lazyRemove; //mark this system for later removal
//for PMT_NORMAL
qboolean normalValid;
vec3_t normal;
int charge;
} particleSystem_t;
typedef struct particleEjector_s
{
baseParticleEjector_t *class;
particleSystem_t *parent;
pLerpValues_t ejectPeriod;
int count;
int totalParticles;
int nextEjectionTime;
qboolean valid;
} particleEjector_t;
//used for actual particle evaluation
typedef struct particle_s
{
baseParticle_t *class;
particleEjector_t *parent;
int birthTime;
int lifeTime;
float bounceMarkRadius;
int bounceMarkCount;
int bounceSoundCount;
qboolean atRest;
vec3_t origin;
vec3_t velocity;
pMoveType_t accMoveType;
pMoveValues_t accMoveValues;
int lastEvalTime;
int nextChildTime;
pLerpValues_t radius;
pLerpValues_t alpha;
pLerpValues_t rotation;
pLerpValues_t dLightRadius;
int colorDelay;
qhandle_t model;
lerpFrame_t lf;
vec3_t lastAxis[ 3 ];
qboolean valid;
int frameWhenInvalidated;
int sortKey;
} particle_t;
//======================================================================
//trail system stuff
#define MAX_TRAIL_FILES 128
#define MAX_BEAMS_PER_SYSTEM 4
#define MAX_BASETRAIL_SYSTEMS 64
#define MAX_BASETRAIL_BEAMS MAX_BASETRAIL_SYSTEMS*MAX_BEAMS_PER_SYSTEM
#define MAX_TRAIL_SYSTEMS 32
#define MAX_TRAIL_BEAMS MAX_TRAIL_SYSTEMS*MAX_BEAMS_PER_SYSTEM
#define MAX_TRAIL_BEAM_NODES 128
#define MAX_TRAIL_BEAM_JITTERS 4
typedef enum
{
TBTT_STRETCH,
TBTT_REPEAT
} trailBeamTextureType_t;
typedef struct baseTrailJitter_s
{
float magnitude;
int period;
} baseTrailJitter_t;
//beam template
typedef struct baseTrailBeam_s
{
int numSegments;
float frontWidth;
float backWidth;
float frontAlpha;
float backAlpha;
byte frontColor[ 3 ];
byte backColor[ 3 ];
// the time it takes for a segment to vanish (single attached only)
int segmentTime;
// the time it takes for a beam to fade out (double attached only)
int fadeOutTime;
char shaderName[ MAX_QPATH ];
qhandle_t shader;
trailBeamTextureType_t textureType;
//TBTT_STRETCH
float frontTextureCoord;
float backTextureCoord;
//TBTT_REPEAT
float repeatLength;
qboolean clampToBack;
qboolean realLight;
int numJitters;
baseTrailJitter_t jitters[ MAX_TRAIL_BEAM_JITTERS ];
qboolean jitterAttachments;
} baseTrailBeam_t;
//trail system template
typedef struct baseTrailSystem_s
{
char name[ MAX_QPATH ];
baseTrailBeam_t *beams[ MAX_BEAMS_PER_SYSTEM ];
int numBeams;
int lifeTime;
qboolean thirdPersonOnly;
qboolean registered; //whether or not the assets for this trail have been loaded
} baseTrailSystem_t;
typedef struct trailSystem_s
{
baseTrailSystem_t *class;
attachment_t frontAttachment;
attachment_t backAttachment;
int birthTime;
int destroyTime;
qboolean valid;
} trailSystem_t;
typedef struct trailBeamNode_s
{
vec3_t refPosition;
vec3_t position;
int timeLeft;
float textureCoord;
float halfWidth;
byte alpha;
byte color[ 3 ];
vec2_t jitters[ MAX_TRAIL_BEAM_JITTERS ];
struct trailBeamNode_s *prev;
struct trailBeamNode_s *next;
qboolean used;
} trailBeamNode_t;
typedef struct trailBeam_s
{
baseTrailBeam_t *class;
trailSystem_t *parent;
trailBeamNode_t nodePool[ MAX_TRAIL_BEAM_NODES ];
trailBeamNode_t *nodes;
int lastEvalTime;
qboolean valid;
int nextJitterTimes[ MAX_TRAIL_BEAM_JITTERS ];
} trailBeam_t;
//======================================================================
// player entities need to track more information
// than any other type of entity.
// note that not every player entity is a client entity,
// because corpses after respawn are outside the normal
// client numbering range
// smoothing of view and model for WW transitions
#define MAXSMOOTHS 32
typedef struct
{
float time;
float timeMod;
vec3_t rotAxis;
float rotAngle;
} smooth_t;
typedef struct
{
lerpFrame_t legs, torso, flag, nonseg;
int painTime;
int painDirection; // flip from 0 to 1
// machinegun spinning
float barrelAngle;
int barrelTime;
qboolean barrelSpinning;
vec3_t lastNormal;
vec3_t lastAxis[ 3 ];
smooth_t sList[ MAXSMOOTHS ];
} playerEntity_t;
typedef struct lightFlareStatus_s
{
float lastRadius; //caching of likely flare radius
float lastRatio; //caching of likely flare ratio
int lastTime; //last time flare was visible/occluded
qboolean status; //flare is visble?
} lightFlareStatus_t;
typedef struct buildableStatus_s
{
int lastTime; // Last time status was visible
qboolean visible; // Status is visble?
} buildableStatus_t;
//=================================================
// centity_t have a direct corespondence with gentity_t in the game, but
// only the entityState_t is directly communicated to the cgame
typedef struct centity_s
{
entityState_t currentState; // from cg.frame
entityState_t nextState; // from cg.nextFrame, if available
qboolean interpolate; // true if next is valid to interpolate to
qboolean currentValid; // true if cg.frame holds this entity
int muzzleFlashTime; // move to playerEntity?
int muzzleFlashTime2; // move to playerEntity?
int muzzleFlashTime3; // move to playerEntity?
int previousEvent;
int teleportFlag;
int trailTime; // so missile trails can handle dropped initial packets
int dustTrailTime;
int miscTime;
int snapShotTime; // last time this entity was found in a snapshot
playerEntity_t pe;
int errorTime; // decay the error from this time
vec3_t errorOrigin;
vec3_t errorAngles;
qboolean extrapolated; // false if origin / angles is an interpolation
vec3_t rawOrigin;
vec3_t rawAngles;
vec3_t beamEnd;
// exact interpolated position of entity on this frame
vec3_t lerpOrigin;
vec3_t lerpAngles;
lerpFrame_t lerpFrame;
buildableAnimNumber_t buildableAnim; //persistant anim number
buildableAnimNumber_t oldBuildableAnim; //to detect when new anims are set
particleSystem_t *buildablePS;
buildableStatus_t buildableStatus;
float lastBuildableHealthScale;
int lastBuildableDamageSoundTime;
lightFlareStatus_t lfs;
qboolean doorState;
qboolean animInit;
qboolean animPlaying;
qboolean animLastState;
particleSystem_t *muzzlePS;
qboolean muzzlePsTrigger;
particleSystem_t *jetPackPS;
jetPackState_t jetPackState;
particleSystem_t *entityPS;
qboolean entityPSMissing;
trailSystem_t *level2ZapTS[ 3 ];
int level2ZapTime;
trailSystem_t *muzzleTS; //used for the tesla and reactor
int muzzleTSDeathTime;
qboolean valid;
qboolean oldValid;
} centity_t;
//======================================================================
typedef struct markPoly_s
{
struct markPoly_s *prevMark, *nextMark;
int time;
qhandle_t markShader;
qboolean alphaFade; // fade alpha instead of rgb
float color[ 4 ];
poly_t poly;
polyVert_t verts[ MAX_VERTS_ON_POLY ];
} markPoly_t;
//======================================================================
typedef struct
{
int client;
int score;
int ping;
int time;
int team;
weapon_t weapon;
upgrade_t upgrade;
} score_t;
// each client has an associated clientInfo_t
// that contains media references necessary to present the
// client model and other color coded effects
// this is regenerated each time a client's configstring changes,
// usually as a result of a userinfo (name, model, etc) change
#define MAX_CUSTOM_SOUNDS 32
typedef struct
{
qboolean infoValid;
char name[ MAX_QPATH ];
pTeam_t team;
vec3_t color1;
vec3_t color2;
int score; // updated by score servercmds
int location; // location index for team mode
int health; // you only get this info about your teammates
int armor;
int curWeapon;
int handicap;
int medkitUsageTime;
int invulnerabilityStartTime;
int invulnerabilityStopTime;
int breathPuffTime;
// when clientinfo is changed, the loading of models/skins/sounds
// can be deferred until you are dead, to prevent hitches in
// gameplay
char modelName[ MAX_QPATH ];
char skinName[ MAX_QPATH ];
qboolean newAnims; // true if using the new mission pack animations
qboolean fixedlegs; // true if legs yaw is always the same as torso yaw
qboolean fixedtorso; // true if torso never changes yaw
qboolean nonsegmented; // true if model is Q2 style nonsegmented
vec3_t headOffset; // move head in icon views
footstep_t footsteps;
gender_t gender; // from model
qhandle_t legsModel;
qhandle_t legsSkin;
qhandle_t torsoModel;
qhandle_t torsoSkin;
qhandle_t headModel;
qhandle_t headSkin;
qhandle_t nonSegModel; //non-segmented model system
qhandle_t nonSegSkin; //non-segmented model system
qhandle_t modelIcon;
animation_t animations[ MAX_PLAYER_TOTALANIMATIONS ];
sfxHandle_t sounds[ MAX_CUSTOM_SOUNDS ];
sfxHandle_t customFootsteps[ 4 ];
sfxHandle_t customMetalFootsteps[ 4 ];
} clientInfo_t;
typedef struct weaponInfoMode_s
{
float flashDlight;
vec3_t flashDlightColor;
sfxHandle_t flashSound[ 4 ]; // fast firing weapons randomly choose
qboolean continuousFlash;
qhandle_t missileModel;
sfxHandle_t missileSound;
float missileDlight;
vec3_t missileDlightColor;
int missileRenderfx;
qboolean usesSpriteMissle;
qhandle_t missileSprite;
int missileSpriteSize;
float missileSpriteCharge;
qhandle_t missileParticleSystem;
qhandle_t missileTrailSystem;
qboolean missileRotates;
qboolean missileAnimates;
int missileAnimStartFrame;
int missileAnimNumFrames;
int missileAnimFrameRate;
int missileAnimLooping;
sfxHandle_t firingSound;
qboolean loopFireSound;
qhandle_t muzzleParticleSystem;
qboolean alwaysImpact;
qhandle_t impactParticleSystem;
qhandle_t impactMark;
qhandle_t impactMarkSize;
sfxHandle_t impactSound[ 4 ]; //random impact sound
sfxHandle_t impactFleshSound[ 4 ]; //random impact sound
} weaponInfoMode_t;
// each WP_* weapon enum has an associated weaponInfo_t
// that contains media references necessary to present the
// weapon and its effects
typedef struct weaponInfo_s
{
qboolean registered;
char *humanName;
qhandle_t handsModel; // the hands don't actually draw, they just position the weapon
qhandle_t weaponModel;
qhandle_t barrelModel;
qhandle_t flashModel;
vec3_t weaponMidpoint; // so it will rotate centered instead of by tag
qhandle_t weaponIcon;
qhandle_t ammoIcon;
qhandle_t crossHair;
int crossHairSize;
sfxHandle_t readySound;
qboolean disableIn3rdPerson;
weaponInfoMode_t wim[ WPM_NUM_WEAPONMODES ];
} weaponInfo_t;
typedef struct upgradeInfo_s
{
qboolean registered;
char *humanName;
qhandle_t upgradeIcon;
} upgradeInfo_t;
typedef struct
{
qboolean looped;
qboolean enabled;
sfxHandle_t sound;
} sound_t;
typedef struct
{
qhandle_t models[ MAX_BUILDABLE_MODELS ];
animation_t animations[ MAX_BUILDABLE_ANIMATIONS ];
//same number of sounds as animations
sound_t sounds[ MAX_BUILDABLE_ANIMATIONS ];
} buildableInfo_t;
#define MAX_REWARDSTACK 10
#define MAX_SOUNDBUFFER 20
//======================================================================
typedef struct
{
vec3_t alienBuildablePos[ MAX_GENTITIES ];
int alienBuildableTimes[ MAX_GENTITIES ];
int numAlienBuildables;
vec3_t humanBuildablePos[ MAX_GENTITIES ];
int numHumanBuildables;
vec3_t alienClientPos[ MAX_CLIENTS ];
int numAlienClients;
vec3_t humanClientPos[ MAX_CLIENTS ];
int numHumanClients;
int lastUpdateTime;
vec3_t origin;
vec3_t vangles;
} entityPos_t;
typedef struct
{
int time;
int length;
} consoleLine_t;
#define MAX_CONSOLE_TEXT 8192
#define MAX_CONSOLE_LINES 32
// all cg.stepTime, cg.duckTime, cg.landTime, etc are set to cg.time when the action
// occurs, and they will have visible effects for #define STEP_TIME or whatever msec after
#define MAX_PREDICTED_EVENTS 16
#define NUM_SAVED_STATES ( CMD_BACKUP + 2 )
typedef struct
{
int clientFrame; // incremented each frame
int clientNum;
qboolean demoPlayback;
qboolean levelShot; // taking a level menu screenshot
int deferredPlayerLoading;
qboolean loading; // don't defer players at initial startup
qboolean intermissionStarted; // don't play voice rewards, because game will end shortly
// there are only one or two snapshot_t that are relevent at a time
int latestSnapshotNum; // the number of snapshots the client system has received
int latestSnapshotTime; // the time from latestSnapshotNum, so we don't need to read the snapshot yet
snapshot_t *snap; // cg.snap->serverTime <= cg.time
snapshot_t *nextSnap; // cg.nextSnap->serverTime > cg.time, or NULL
snapshot_t activeSnapshots[ 2 ];
float frameInterpolation; // (float)( cg.time - cg.frame->serverTime ) /
// (cg.nextFrame->serverTime - cg.frame->serverTime)
qboolean thisFrameTeleport;
qboolean nextFrameTeleport;
int frametime; // cg.time - cg.oldTime
int time; // this is the time value that the client
// is rendering at.
int oldTime; // time at last frame, used for missile trails and prediction checking
int physicsTime; // either cg.snap->time or cg.nextSnap->time
int timelimitWarnings; // 5 min, 1 min, overtime
int fraglimitWarnings;
qboolean mapRestart; // set on a map restart to set back the weapon
qboolean renderingThirdPerson; // during deaths, chasecams, etc
// prediction state
qboolean hyperspace; // true if prediction has hit a trigger_teleport
playerState_t predictedPlayerState;
pmoveExt_t pmext;
centity_t predictedPlayerEntity;
qboolean validPPS; // clear until the first call to CG_PredictPlayerState
int predictedErrorTime;
vec3_t predictedError;
int eventSequence;
int predictableEvents[MAX_PREDICTED_EVENTS];
float stepChange; // for stair up smoothing
int stepTime;
float duckChange; // for duck viewheight smoothing
int duckTime;
float landChange; // for landing hard
int landTime;
// input state sent to server
int weaponSelect;
// auto rotating items
vec3_t autoAngles;
vec3_t autoAxis[ 3 ];
vec3_t autoAnglesFast;
vec3_t autoAxisFast[ 3 ];
// view rendering
refdef_t refdef;
vec3_t refdefViewAngles; // will be converted to refdef.viewaxis
// zoom key
qboolean zoomed;
int zoomTime;
float zoomSensitivity;
// information screen text during loading
char infoScreenText[ MAX_STRING_CHARS ];
// scoreboard
int scoresRequestTime;
int numScores;
int selectedScore;
int teamScores[ 2 ];
score_t scores[MAX_CLIENTS];
qboolean showScores;
qboolean scoreBoardShowing;
int scoreFadeTime;
char killerName[ MAX_NAME_LENGTH ];
char spectatorList[ MAX_STRING_CHARS ]; // list of names
int spectatorLen; // length of list
float spectatorWidth; // width in device units
int spectatorTime; // next time to offset
int spectatorPaintX; // current paint x
int spectatorPaintX2; // current paint x
int spectatorOffset; // current offset from start
int spectatorPaintLen; // current offset from start
// centerprinting
int centerPrintTime;
int centerPrintCharWidth;
int centerPrintY;
char centerPrint[ 1024 ];
int centerPrintLines;
// low ammo warning state
int lowAmmoWarning; // 1 = low, 2 = empty
// kill timers for carnage reward
int lastKillTime;
// crosshair client ID
int crosshairClientNum;
int crosshairClientTime;
// powerup active flashing
int powerupActive;
int powerupTime;
// attacking player
int attackerTime;
int voiceTime;
// reward medals
int rewardStack;
int rewardTime;
int rewardCount[ MAX_REWARDSTACK ];
qhandle_t rewardShader[ MAX_REWARDSTACK ];
qhandle_t rewardSound[ MAX_REWARDSTACK ];
// sound buffer mainly for announcer sounds
int soundBufferIn;
int soundBufferOut;
int soundTime;
qhandle_t soundBuffer[ MAX_SOUNDBUFFER ];
// for voice chat buffer
int voiceChatTime;
int voiceChatBufferIn;
int voiceChatBufferOut;
// warmup countdown
int warmup;
int warmupCount;
//==========================
int itemPickup;
int itemPickupTime;
int itemPickupBlendTime; // the pulse around the crosshair is timed seperately
int weaponSelectTime;
int weaponAnimation;
int weaponAnimationTime;
// blend blobs
float damageTime;
float damageX, damageY, damageValue;
// status bar head
float headYaw;
float headEndPitch;
float headEndYaw;
int headEndTime;
float headStartPitch;
float headStartYaw;
int headStartTime;
// view movement
float v_dmg_time;
float v_dmg_pitch;
float v_dmg_roll;
vec3_t kick_angles; // weapon kicks
vec3_t kick_origin;
// temp working variables for player view
float bobfracsin;
int bobcycle;
float xyspeed;
int nextOrbitTime;
// development tool
refEntity_t testModelEntity;
refEntity_t testModelBarrelEntity;
char testModelName[MAX_QPATH];
char testModelBarrelName[MAX_QPATH];
qboolean testGun;
int spawnTime; // fovwarp
int weapon1Time; // time when BUTTON_ATTACK went t->f f->t
int weapon2Time; // time when BUTTON_ATTACK2 went t->f f->t
int weapon3Time; // time when BUTTON_USE_HOLDABLE went t->f f->t
qboolean weapon1Firing;
qboolean weapon2Firing;
qboolean weapon3Firing;
int boostedTime;
int poisonedTime;
vec3_t lastNormal; // view smoothage
vec3_t lastVangles; // view smoothage
smooth_t sList[ MAXSMOOTHS ]; // WW smoothing
int forwardMoveTime; // for struggling
int rightMoveTime;
int upMoveTime;
float charModelFraction; // loading percentages
float mediaFraction;
float buildablesFraction;
int lastBuildAttempt;
int lastEvolveAttempt;
char consoleText[ MAX_CONSOLE_TEXT ];
consoleLine_t consoleLines[ MAX_CONSOLE_LINES ];
int numConsoleLines;
particleSystem_t *poisonCloudPS;
float painBlendValue;
float painBlendTarget;
float healBlendValue;
int lastHealth;
int lastPredictedCommand;
int lastServerTime;
playerState_t savedPmoveStates[ NUM_SAVED_STATES ];
int stateHead, stateTail;
int ping;
float chargeMeterAlpha;
float chargeMeterValue;
int nextWeaponClickTime;
} cg_t;
// all of the model, shader, and sound references that are
// loaded at gamestate time are stored in cgMedia_t
// Other media that can be tied to clients, weapons, or items are
// stored in the clientInfo_t, itemInfo_t, weaponInfo_t, and powerupInfo_t
typedef struct
{
qhandle_t charsetShader;
qhandle_t whiteShader;
qhandle_t outlineShader;
qhandle_t level2ZapTS;
qhandle_t balloonShader;
qhandle_t connectionShader;
qhandle_t viewBloodShader;
qhandle_t tracerShader;
qhandle_t crosshairShader[ WP_NUM_WEAPONS ];
qhandle_t backTileShader;
qhandle_t creepShader;
qhandle_t scannerShader;
qhandle_t scannerBlipShader;
qhandle_t scannerLineShader;
qhandle_t numberShaders[ 11 ];
qhandle_t shadowMarkShader;
qhandle_t wakeMarkShader;
// buildable shaders
qhandle_t greenBuildShader;
qhandle_t redBuildShader;
qhandle_t humanSpawningShader;
// disconnect
qhandle_t disconnectPS;
qhandle_t disconnectSound;
// sounds
sfxHandle_t tracerSound;
sfxHandle_t weaponEmptyClick;
sfxHandle_t selectSound;
sfxHandle_t footsteps[ FOOTSTEP_TOTAL ][ 4 ];
sfxHandle_t talkSound;
sfxHandle_t alienTalkSound;
sfxHandle_t humanTalkSound;
sfxHandle_t landSound;
sfxHandle_t fallSound;
sfxHandle_t turretSpinupSound;
sfxHandle_t hardBounceSound1;
sfxHandle_t hardBounceSound2;
sfxHandle_t voteNow;
sfxHandle_t votePassed;
sfxHandle_t voteFailed;
sfxHandle_t watrInSound;
sfxHandle_t watrOutSound;
sfxHandle_t watrUnSound;
sfxHandle_t jetpackDescendSound;
sfxHandle_t jetpackIdleSound;
sfxHandle_t jetpackAscendSound;
qhandle_t jetPackDescendPS;
qhandle_t jetPackHoverPS;
qhandle_t jetPackAscendPS;
sfxHandle_t medkitUseSound;
sfxHandle_t alienStageTransition;
sfxHandle_t humanStageTransition;
sfxHandle_t alienOvermindAttack;
sfxHandle_t alienOvermindDying;
sfxHandle_t alienOvermindSpawns;
sfxHandle_t alienBuildableExplosion;
sfxHandle_t alienBuildableDamage;
sfxHandle_t alienBuildablePrebuild;
sfxHandle_t humanBuildableExplosion;
sfxHandle_t humanBuildablePrebuild;
sfxHandle_t humanBuildableDamage[ 4 ];
sfxHandle_t alienL1Grab;
sfxHandle_t alienL4ChargePrepare;
sfxHandle_t alienL4ChargeStart;
qhandle_t cursor;
qhandle_t selectCursor;
qhandle_t sizeCursor;
//light armour
qhandle_t larmourHeadSkin;
qhandle_t larmourLegsSkin;
qhandle_t larmourTorsoSkin;
qhandle_t jetpackModel;
qhandle_t jetpackFlashModel;
qhandle_t battpackModel;
sfxHandle_t repeaterUseSound;
sfxHandle_t buildableRepairSound;
sfxHandle_t buildableRepairedSound;
qhandle_t poisonCloudPS;
qhandle_t alienEvolvePS;
qhandle_t alienAcidTubePS;
sfxHandle_t alienEvolveSound;
qhandle_t humanBuildableDamagedPS;
qhandle_t humanBuildableDestroyedPS;
qhandle_t alienBuildableDamagedPS;
qhandle_t alienBuildableDestroyedPS;
qhandle_t alienBleedPS;
qhandle_t humanBleedPS;
qhandle_t teslaZapTS;
qhandle_t massDriverTS;
sfxHandle_t lCannonWarningSound;
sfxHandle_t lCannonWarningSound2;
qhandle_t buildWeaponTimerPie[ 8 ];
qhandle_t upgradeClassIconShader;
} cgMedia_t;
typedef struct
{
qhandle_t frameShader;
qhandle_t overlayShader;
qhandle_t noPowerShader;
qhandle_t markedShader;
vec4_t healthSevereColor;
vec4_t healthHighColor;
vec4_t healthElevatedColor;
vec4_t healthGuardedColor;
vec4_t healthLowColor;
int frameHeight;
int frameWidth;
int healthPadding;
int overlayHeight;
int overlayWidth;
float verticalMargin;
float horizontalMargin;
vec4_t foreColor;
vec4_t backColor;
qboolean loaded;
} buildStat_t;
// The client game static (cgs) structure hold everything
// loaded or calculated from the gamestate. It will NOT
// be cleared when a tournement restart is done, allowing
// all clients to begin playing instantly
typedef struct
{
gameState_t gameState; // gamestate from server
glconfig_t glconfig; // rendering configuration
float screenXScale; // derived from glconfig
float screenYScale;
float screenXBias;
int serverCommandSequence; // reliable command stream counter
int processedSnapshotNum; // the number of snapshots cgame has requested
qboolean localServer; // detected on startup by checking sv_running
// parsed from serverinfo
int timelimit;
int maxclients;
char mapname[ MAX_QPATH ];
qboolean markDeconstruct; // Whether or not buildables are marked
int voteTime;
int voteYes;
int voteNo;
qboolean voteModified; // beep whenever changed
char voteString[ MAX_STRING_TOKENS ];
int teamVoteTime[ 2 ];
int teamVoteYes[ 2 ];
int teamVoteNo[ 2 ];
qboolean teamVoteModified[ 2 ]; // beep whenever changed
char teamVoteString[ 2 ][ MAX_STRING_TOKENS ];
int levelStartTime;
int scores1, scores2; // from configstrings
qboolean newHud;
int alienBuildPoints;
int alienBuildPointsTotal;
int humanBuildPoints;
int humanBuildPointsTotal;
int humanBuildPointsPowered;
int alienStage;
int humanStage;
int alienKills;
int humanKills;
int alienNextStageThreshold;
int humanNextStageThreshold;
//
// locally derived information from gamestate
//
qhandle_t gameModels[ MAX_MODELS ];
qhandle_t gameShaders[ MAX_GAME_SHADERS ];
qhandle_t gameParticleSystems[ MAX_GAME_PARTICLE_SYSTEMS ];
sfxHandle_t gameSounds[ MAX_SOUNDS ];
int numInlineModels;
qhandle_t inlineDrawModel[ MAX_MODELS ];
vec3_t inlineModelMidpoints[ MAX_MODELS ];
clientInfo_t clientinfo[ MAX_CLIENTS ];
// corpse info
clientInfo_t corpseinfo[ MAX_CLIENTS ];
int cursorX;
int cursorY;
qboolean eventHandling;
qboolean mouseCaptured;
qboolean sizingHud;
void *capturedItem;
qhandle_t activeCursor;
buildStat_t alienBuildStat;
buildStat_t humanBuildStat;
// media
cgMedia_t media;
} cgs_t;
//==============================================================================
extern cgs_t cgs;
extern cg_t cg;
extern centity_t cg_entities[ MAX_GENTITIES ];
extern displayContextDef_t cgDC;
extern weaponInfo_t cg_weapons[ 32 ];
extern upgradeInfo_t cg_upgrades[ 32 ];
extern buildableInfo_t cg_buildables[ BA_NUM_BUILDABLES ];
extern markPoly_t cg_markPolys[ MAX_MARK_POLYS ];
extern vmCvar_t cg_centertime;
extern vmCvar_t cg_runpitch;
extern vmCvar_t cg_runroll;
extern vmCvar_t cg_bobup;
extern vmCvar_t cg_bobpitch;
extern vmCvar_t cg_bobroll;
extern vmCvar_t cg_swingSpeed;
extern vmCvar_t cg_shadows;
extern vmCvar_t cg_gibs;
extern vmCvar_t cg_drawTimer;
extern vmCvar_t cg_drawClock;
extern vmCvar_t cg_drawFPS;
extern vmCvar_t cg_drawDemoState;
extern vmCvar_t cg_drawSnapshot;
extern vmCvar_t cg_draw3dIcons;
extern vmCvar_t cg_drawIcons;
extern vmCvar_t cg_drawAmmoWarning;
extern vmCvar_t cg_drawChargeBar;
extern vmCvar_t cg_drawCrosshair;
extern vmCvar_t cg_drawCrosshairNames;
extern vmCvar_t cg_drawRewards;
extern vmCvar_t cg_drawTeamOverlay;
extern vmCvar_t cg_teamOverlayUserinfo;
extern vmCvar_t cg_crosshairX;
extern vmCvar_t cg_crosshairY;
extern vmCvar_t cg_crosshairSize;
extern vmCvar_t cg_drawStatus;
extern vmCvar_t cg_draw2D;
extern vmCvar_t cg_animSpeed;
extern vmCvar_t cg_debugAnim;
extern vmCvar_t cg_debugPosition;
extern vmCvar_t cg_debugEvents;
extern vmCvar_t cg_teslaTrailTime;
extern vmCvar_t cg_railTrailTime;
extern vmCvar_t cg_errorDecay;
extern vmCvar_t cg_nopredict;
extern vmCvar_t cg_debugMove;
extern vmCvar_t cg_noPlayerAnims;
extern vmCvar_t cg_showmiss;
extern vmCvar_t cg_footsteps;
extern vmCvar_t cg_addMarks;
extern vmCvar_t cg_brassTime;
extern vmCvar_t cg_gun_frame;
extern vmCvar_t cg_gun_x;
extern vmCvar_t cg_gun_y;
extern vmCvar_t cg_gun_z;
extern vmCvar_t cg_drawGun;
extern vmCvar_t cg_viewsize;
extern vmCvar_t cg_tracerChance;
extern vmCvar_t cg_tracerWidth;
extern vmCvar_t cg_tracerLength;
extern vmCvar_t cg_autoswitch;
extern vmCvar_t cg_ignore;
extern vmCvar_t cg_simpleItems;
extern vmCvar_t cg_fov;
extern vmCvar_t cg_zoomFov;
extern vmCvar_t cg_thirdPersonRange;
extern vmCvar_t cg_thirdPersonAngle;
extern vmCvar_t cg_thirdPerson;
extern vmCvar_t cg_stereoSeparation;
extern vmCvar_t cg_lagometer;
extern vmCvar_t cg_drawAttacker;
extern vmCvar_t cg_synchronousClients;
extern vmCvar_t cg_stats;
extern vmCvar_t cg_forceModel;
extern vmCvar_t cg_buildScript;
extern vmCvar_t cg_paused;
extern vmCvar_t cg_blood;
extern vmCvar_t cg_deferPlayers;
extern vmCvar_t cg_drawFriend;
extern vmCvar_t cg_teamChatsOnly;
extern vmCvar_t cg_noVoiceChats;
extern vmCvar_t cg_noVoiceText;
extern vmCvar_t cg_scorePlum;
extern vmCvar_t cg_smoothClients;
extern vmCvar_t pmove_fixed;
extern vmCvar_t pmove_msec;
extern vmCvar_t cg_cameraOrbit;
extern vmCvar_t cg_cameraOrbitDelay;
extern vmCvar_t cg_timescaleFadeEnd;
extern vmCvar_t cg_timescaleFadeSpeed;
extern vmCvar_t cg_timescale;
extern vmCvar_t cg_cameraMode;
extern vmCvar_t cg_smallFont;
extern vmCvar_t cg_bigFont;
extern vmCvar_t cg_noTaunt;
extern vmCvar_t cg_noProjectileTrail;
extern vmCvar_t cg_oldRail;
extern vmCvar_t cg_oldRocket;
extern vmCvar_t cg_oldPlasma;
extern vmCvar_t cg_trueLightning;
extern vmCvar_t cg_drawSurfNormal;
extern vmCvar_t cg_drawBBOX;
extern vmCvar_t cg_debugAlloc;
extern vmCvar_t cg_wwSmoothTime;
extern vmCvar_t cg_wwFollow;
extern vmCvar_t cg_wwToggle;
extern vmCvar_t cg_depthSortParticles;
extern vmCvar_t cg_bounceParticles;
extern vmCvar_t cg_consoleLatency;
extern vmCvar_t cg_lightFlare;
extern vmCvar_t cg_debugParticles;
extern vmCvar_t cg_debugTrails;
extern vmCvar_t cg_debugPVS;
extern vmCvar_t cg_disableWarningDialogs;
extern vmCvar_t cg_disableScannerPlane;
extern vmCvar_t cg_tutorial;
extern vmCvar_t cg_painBlendUpRate;
extern vmCvar_t cg_painBlendDownRate;
extern vmCvar_t cg_painBlendMax;
extern vmCvar_t cg_painBlendScale;
extern vmCvar_t cg_painBlendZoom;
extern vmCvar_t cg_stickySpec;
extern vmCvar_t ui_currentClass;
extern vmCvar_t ui_carriage;
extern vmCvar_t ui_stages;
extern vmCvar_t ui_dialog;
extern vmCvar_t ui_voteActive;
extern vmCvar_t ui_alienTeamVoteActive;
extern vmCvar_t ui_humanTeamVoteActive;
extern vmCvar_t cg_debugRandom;
extern vmCvar_t cg_optimizePrediction;
extern vmCvar_t cg_projectileNudge;
//
// cg_main.c
//
const char *CG_ConfigString( int index );
const char *CG_Argv( int arg );
void QDECL CG_Printf( const char *msg, ... );
void QDECL CG_Error( const char *msg, ... );
void CG_StartMusic( void );
int CG_PlayerCount( void );
void CG_UpdateCvars( void );
int CG_CrosshairPlayer( void );
int CG_LastAttacker( void );
void CG_LoadMenus( const char *menuFile );
void CG_KeyEvent( int key, qboolean down );
void CG_MouseEvent( int x, int y );
void CG_EventHandling( int type );
void CG_SetScoreSelection( void *menu );
void CG_BuildSpectatorString( void );
qboolean CG_FileExists( char *filename );
void CG_RemoveNotifyLine( void );
void CG_AddNotifyText( void );
//
// cg_view.c
//
void CG_addSmoothOp( vec3_t rotAxis, float rotAngle, float timeMod ); //TA
void CG_TestModel_f( void );
void CG_TestGun_f( void );
void CG_TestModelNextFrame_f( void );
void CG_TestModelPrevFrame_f( void );
void CG_TestModelNextSkin_f( void );
void CG_TestModelPrevSkin_f( void );
void CG_AddBufferedSound( sfxHandle_t sfx );
void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demoPlayback );
//
// cg_drawtools.c
//
void CG_DrawPlane( vec3_t origin, vec3_t down, vec3_t right, qhandle_t shader );
void CG_AdjustFrom640( float *x, float *y, float *w, float *h );
void CG_FillRect( float x, float y, float width, float height, const float *color );
void CG_DrawPic( float x, float y, float width, float height, qhandle_t hShader );
void CG_DrawFadePic( float x, float y, float width, float height, vec4_t fcolor,
vec4_t tcolor, float amount, qhandle_t hShader );
int CG_DrawStrlen( const char *str );
float *CG_FadeColor( int startMsec, int totalMsec );
void CG_TileClear( void );
void CG_ColorForHealth( vec4_t hcolor );
void CG_GetColorForHealth( int health, int armor, vec4_t hcolor );
void CG_DrawRect( float x, float y, float width, float height, float size, const float *color );
void CG_DrawSides(float x, float y, float w, float h, float size);
void CG_DrawTopBottom(float x, float y, float w, float h, float size);
qboolean CG_WorldToScreen( vec3_t point, float *x, float *y );
char *CG_KeyBinding( const char *bind );
//
// cg_draw.c
//
extern int sortedTeamPlayers[ TEAM_MAXOVERLAY ];
extern int numSortedTeamPlayers;
void CG_AddLagometerFrameInfo( void );
void CG_AddLagometerSnapshotInfo( snapshot_t *snap );
void CG_CenterPrint( const char *str, int y, int charWidth );
void CG_DrawActive( stereoFrame_t stereoView );
void CG_OwnerDraw( float x, float y, float w, float h, float text_x,
float text_y, int ownerDraw, int ownerDrawFlags,
int align, int textalign, int textvalign, float special,
float scale, vec4_t color,
qhandle_t shader, int textStyle );
float CG_GetValue(int ownerDraw);
void CG_RunMenuScript(char **args);
void CG_SetPrintString( int type, const char *p );
void CG_GetTeamColor( vec4_t *color );
const char *CG_GetKillerText( void );
void CG_Text_PaintChar( float x, float y, float width, float height, float scale,
float s, float t, float s2, float t2, qhandle_t hShader );
void CG_DrawLoadingScreen( void );
void CG_UpdateMediaFraction( float newFract );
void CG_ResetPainBlend( void );
void CG_DrawField( float x, float y, int width, float cw, float ch, int value );
//
// cg_players.c
//
void CG_Player( centity_t *cent );
void CG_Corpse( centity_t *cent );
void CG_ResetPlayerEntity( centity_t *cent );
void CG_NewClientInfo( int clientNum );
void CG_PrecacheClientInfo( pClass_t class, char *model, char *skin );
sfxHandle_t CG_CustomSound( int clientNum, const char *soundName );
void CG_PlayerDisconnect( vec3_t org );
void CG_Bleed( vec3_t origin, vec3_t normal, int entityNum );
//
// cg_buildable.c
//
void CG_GhostBuildable( buildable_t buildable );
void CG_Buildable( centity_t *cent );
void CG_BuildableStatusParse( const char *filename, buildStat_t *bs );
void CG_DrawBuildableStatus( void );
void CG_InitBuildables( void );
void CG_HumanBuildableExplosion( vec3_t origin, vec3_t dir );
void CG_AlienBuildableExplosion( vec3_t origin, vec3_t dir );
//
// cg_animation.c
//
void CG_RunLerpFrame( lerpFrame_t *lf );
//
// cg_animmapobj.c
//
void CG_AnimMapObj( centity_t *cent );
void CG_ModelDoor( centity_t *cent );
//
// cg_predict.c
//
#define MAGIC_TRACE_HACK -2
void CG_BuildSolidList( void );
int CG_PointContents( const vec3_t point, int passEntityNum );
void CG_Trace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs,
const vec3_t end, int skipNumber, int mask );
void CG_CapTrace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs,
const vec3_t end, int skipNumber, int mask );
void CG_BiSphereTrace( trace_t *result, const vec3_t start, const vec3_t end,
const float startRadius, const float endRadius, int skipNumber, int mask );
void CG_PredictPlayerState( void );
//
// cg_events.c
//
void CG_CheckEvents( centity_t *cent );
void CG_EntityEvent( centity_t *cent, vec3_t position );
void CG_PainEvent( centity_t *cent, int health );
//
// cg_ents.c
//
void CG_DrawBoundingBox( vec3_t origin, vec3_t mins, vec3_t maxs );
void CG_SetEntitySoundPosition( centity_t *cent );
void CG_AddPacketEntities( void );
void CG_Beam( centity_t *cent );
void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out );
void CG_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
qhandle_t parentModel, char *tagName );
void CG_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
qhandle_t parentModel, char *tagName );
//
// cg_weapons.c
//
void CG_NextWeapon_f( void );
void CG_PrevWeapon_f( void );
void CG_Weapon_f( void );
void CG_InitUpgrades( void );
void CG_RegisterUpgrade( int upgradeNum );
void CG_InitWeapons( void );
void CG_RegisterWeapon( int weaponNum );
void CG_FireWeapon( centity_t *cent, weaponMode_t weaponMode );
void CG_MissileHitWall( weapon_t weapon, weaponMode_t weaponMode, int clientNum,
vec3_t origin, vec3_t dir, impactSound_t soundType, int charge );
void CG_MissileHitPlayer( weapon_t weapon, weaponMode_t weaponMode, vec3_t origin, vec3_t dir, int entityNum, int charge );
void CG_Bullet( vec3_t origin, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum );
void CG_ShotgunFire( entityState_t *es );
void CG_MassDriverFire( entityState_t *es );
void CG_AddViewWeapon (playerState_t *ps);
void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent );
void CG_DrawItemSelect( rectDef_t *rect, vec4_t color );
void CG_DrawItemSelectText( rectDef_t *rect, float scale, int textStyle );
//
// cg_scanner.c
//
void CG_UpdateEntityPositions( void );
void CG_Scanner( rectDef_t *rect, qhandle_t shader, vec4_t color );
void CG_AlienSense( rectDef_t *rect );
//
// cg_marks.c
//
void CG_InitMarkPolys( void );
void CG_AddMarks( void );
void CG_ImpactMark( qhandle_t markShader,
const vec3_t origin, const vec3_t dir,
float orientation,
float r, float g, float b, float a,
qboolean alphaFade,
float radius, qboolean temporary );
//
// cg_snapshot.c
//
void CG_ProcessSnapshots( void );
//
// cg_consolecmds.c
//
qboolean CG_ConsoleCommand( void );
void CG_InitConsoleCommands( void );
qboolean CG_RequestScores( void );
//
// cg_servercmds.c
//
void CG_ExecuteNewServerCommands( int latestSequence );
void CG_ParseServerinfo( void );
void CG_SetConfigValues( void );
void CG_ShaderStateChanged(void);
//
// cg_playerstate.c
//
void CG_Respawn( void );
void CG_TransitionPlayerState( playerState_t *ps, playerState_t *ops );
void CG_CheckChangedPredictableEvents( playerState_t *ps );
//
// cg_mem.c
//
void CG_InitMemory( void );
void *CG_Alloc( int size );
void CG_Free( void *ptr );
void CG_DefragmentMemory( void );
//
// cg_attachment.c
//
qboolean CG_AttachmentPoint( attachment_t *a, vec3_t v );
qboolean CG_AttachmentDir( attachment_t *a, vec3_t v );
qboolean CG_AttachmentAxis( attachment_t *a, vec3_t axis[ 3 ] );
qboolean CG_AttachmentVelocity( attachment_t *a, vec3_t v );
int CG_AttachmentCentNum( attachment_t *a );
qboolean CG_Attached( attachment_t *a );
void CG_AttachToPoint( attachment_t *a );
void CG_AttachToCent( attachment_t *a );
void CG_AttachToTag( attachment_t *a );
void CG_AttachToParticle( attachment_t *a );
void CG_SetAttachmentPoint( attachment_t *a, vec3_t v );
void CG_SetAttachmentCent( attachment_t *a, centity_t *cent );
void CG_SetAttachmentTag( attachment_t *a, refEntity_t parent,
qhandle_t model, char *tagName );
void CG_SetAttachmentParticle( attachment_t *a, particle_t *p );
void CG_SetAttachmentOffset( attachment_t *a, vec3_t v );
//
// cg_particles.c
//
void CG_LoadParticleSystems( void );
qhandle_t CG_RegisterParticleSystem( char *name );
particleSystem_t *CG_SpawnNewParticleSystem( qhandle_t psHandle );
void CG_DestroyParticleSystem( particleSystem_t **ps );
qboolean CG_IsParticleSystemInfinite( particleSystem_t *ps );
qboolean CG_IsParticleSystemValid( particleSystem_t **ps );
void CG_SetParticleSystemNormal( particleSystem_t *ps, vec3_t normal );
void CG_AddParticles( void );
void CG_ParticleSystemEntity( centity_t *cent );
void CG_TestPS_f( void );
void CG_DestroyTestPS_f( void );
//
// cg_trails.c
//
void CG_LoadTrailSystems( void );
qhandle_t CG_RegisterTrailSystem( char *name );
trailSystem_t *CG_SpawnNewTrailSystem( qhandle_t psHandle );
void CG_DestroyTrailSystem( trailSystem_t **ts );
qboolean CG_IsTrailSystemValid( trailSystem_t **ts );
void CG_AddTrails( void );
void CG_TestTS_f( void );
void CG_DestroyTestTS_f( void );
//
// cg_ptr.c
//
int CG_ReadPTRCode( void );
void CG_WritePTRCode( int code );
//
// cg_tutorial.c
//
const char *CG_TutorialText( void );
//
//===============================================
//
// system traps
// These functions are how the cgame communicates with the main game system
//
// print message on the local console
void trap_Print( const char *fmt );
// abort the game
void trap_Error( const char *fmt );
// milliseconds should only be used for performance tuning, never
// for anything game related. Get time from the CG_DrawActiveFrame parameter
int trap_Milliseconds( void );
// console variable interaction
void trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags );
void trap_Cvar_Update( vmCvar_t *vmCvar );
void trap_Cvar_Set( const char *var_name, const char *value );
void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
// ServerCommand and ConsoleCommand parameter access
int trap_Argc( void );
void trap_Argv( int n, char *buffer, int bufferLength );
void trap_Args( char *buffer, int bufferLength );
void trap_LiteralArgs( char *buffer, int bufferLength );
// filesystem access
// returns length of file
int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
void trap_FS_Read( void *buffer, int len, fileHandle_t f );
void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
void trap_FS_FCloseFile( fileHandle_t f );
void trap_FS_Seek( fileHandle_t f, long offset, fsOrigin_t origin ); // fsOrigin_t
int trap_FS_GetFileList( const char *path, const char *extension,
char *listbuf, int bufsize );
// add commands to the local console as if they were typed in
// for map changing, etc. The command is not executed immediately,
// but will be executed in order the next time console commands
// are processed
void trap_SendConsoleCommand( const char *text );
// register a command name so the console can perform command completion.
// FIXME: replace this with a normal console command "defineCommand"?
void trap_AddCommand( const char *cmdName );
// send a string to the server over the network
void trap_SendClientCommand( const char *s );
// force a screen update, only used during gamestate load
void trap_UpdateScreen( void );
// model collision
void trap_CM_LoadMap( const char *mapname );
int trap_CM_NumInlineModels( void );
clipHandle_t trap_CM_InlineModel( int index ); // 0 = world, 1+ = bmodels
clipHandle_t trap_CM_TempBoxModel( const vec3_t mins, const vec3_t maxs );
int trap_CM_PointContents( const vec3_t p, clipHandle_t model );
int trap_CM_TransformedPointContents( const vec3_t p, clipHandle_t model, const vec3_t origin, const vec3_t angles );
void trap_CM_BoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
const vec3_t mins, const vec3_t maxs,
clipHandle_t model, int brushmask );
void trap_CM_TransformedBoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
const vec3_t mins, const vec3_t maxs,
clipHandle_t model, int brushmask,
const vec3_t origin, const vec3_t angles );
void trap_CM_CapsuleTrace( trace_t *results, const vec3_t start, const vec3_t end,
const vec3_t mins, const vec3_t maxs,
clipHandle_t model, int brushmask );
void trap_CM_TransformedCapsuleTrace( trace_t *results, const vec3_t start, const vec3_t end,
const vec3_t mins, const vec3_t maxs,
clipHandle_t model, int brushmask,
const vec3_t origin, const vec3_t angles );
void trap_CM_BiSphereTrace( trace_t *results, const vec3_t start,
const vec3_t end, float startRad, float endRad,
clipHandle_t model, int mask );
void trap_CM_TransformedBiSphereTrace( trace_t *results, const vec3_t start,
const vec3_t end, float startRad, float endRad,
clipHandle_t model, int mask,
const vec3_t origin );
// Returns the projection of a polygon onto the solid brushes in the world
int trap_CM_MarkFragments( int numPoints, const vec3_t *points,
const vec3_t projection,
int maxPoints, vec3_t pointBuffer,
int maxFragments, markFragment_t *fragmentBuffer );
// normal sounds will have their volume dynamically changed as their entity
// moves and the listener moves
void trap_S_StartSound( vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx );
void trap_S_StopLoopingSound( int entnum );
// a local sound is always played full volume
void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum );
void trap_S_ClearLoopingSounds( qboolean killall );
void trap_S_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx );
void trap_S_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx );
void trap_S_UpdateEntityPosition( int entityNum, const vec3_t origin );
// respatialize recalculates the volumes of sound as they should be heard by the
// given entityNum and position
void trap_S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater );
sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed ); // returns buzz if not found
void trap_S_StartBackgroundTrack( const char *intro, const char *loop ); // empty name stops music
void trap_S_StopBackgroundTrack( void );
void trap_R_LoadWorldMap( const char *mapname );
// all media should be registered during level startup to prevent
// hitches during gameplay
qhandle_t trap_R_RegisterModel( const char *name ); // returns rgb axis if not found
qhandle_t trap_R_RegisterSkin( const char *name ); // returns all white if not found
qhandle_t trap_R_RegisterShader( const char *name ); // returns all white if not found
qhandle_t trap_R_RegisterShaderNoMip( const char *name ); // returns all white if not found
// a scene is built up by calls to R_ClearScene and the various R_Add functions.
// Nothing is drawn until R_RenderScene is called.
void trap_R_ClearScene( void );
void trap_R_AddRefEntityToScene( const refEntity_t *re );
// polys are intended for simple wall marks, not really for doing
// significant construction
void trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts );
void trap_R_AddPolysToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts, int numPolys );
void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b );
void trap_R_AddAdditiveLightToScene( const vec3_t org, float intensity, float r, float g, float b );
int trap_R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir );
void trap_R_RenderScene( const refdef_t *fd );
void trap_R_SetColor( const float *rgba ); // NULL = 1,1,1,1
void trap_R_DrawStretchPic( float x, float y, float w, float h,
float s1, float t1, float s2, float t2, qhandle_t hShader );
void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs );
int trap_R_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame,
float frac, const char *tagName );
void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset );
// The glconfig_t will not change during the life of a cgame.
// If it needs to change, the entire cgame will be restarted, because
// all the qhandle_t are then invalid.
void trap_GetGlconfig( glconfig_t *glconfig );
// the gamestate should be grabbed at startup, and whenever a
// configstring changes
void trap_GetGameState( gameState_t *gamestate );
// cgame will poll each frame to see if a newer snapshot has arrived
// that it is interested in. The time is returned seperately so that
// snapshot latency can be calculated.
void trap_GetCurrentSnapshotNumber( int *snapshotNumber, int *serverTime );
// a snapshot get can fail if the snapshot (or the entties it holds) is so
// old that it has fallen out of the client system queue
qboolean trap_GetSnapshot( int snapshotNumber, snapshot_t *snapshot );
// retrieve a text command from the server stream
// the current snapshot will hold the number of the most recent command
// qfalse can be returned if the client system handled the command
// argc() / argv() can be used to examine the parameters of the command
qboolean trap_GetServerCommand( int serverCommandNumber );
// returns the most recent command number that can be passed to GetUserCmd
// this will always be at least one higher than the number in the current
// snapshot, and it may be quite a few higher if it is a fast computer on
// a lagged connection
int trap_GetCurrentCmdNumber( void );
qboolean trap_GetUserCmd( int cmdNumber, usercmd_t *ucmd );
// used for the weapon select and zoom
void trap_SetUserCmdValue( int stateValue, float sensitivityScale );
// aids for VM testing
void testPrintInt( char *string, int i );
void testPrintFloat( char *string, float f );
int trap_MemoryRemaining( void );
void trap_R_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font);
qboolean trap_Key_IsDown( int keynum );
int trap_Key_GetCatcher( void );
void trap_Key_SetCatcher( int catcher );
int trap_Key_GetKey( const char *binding );
void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen );
void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen );
void trap_Key_SetBinding( int keynum, const char *binding );
void trap_Key_SetOverstrikeMode( qboolean state );
qboolean trap_Key_GetOverstrikeMode( void );
int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits );
e_status trap_CIN_StopCinematic( int handle );
e_status trap_CIN_RunCinematic( int handle );
void trap_CIN_DrawCinematic( int handle );
void trap_CIN_SetExtents( int handle, int x, int y, int w, int h );
void trap_SnapVector( float *v );
int trap_RealTime( qtime_t *tm );
qboolean trap_loadCamera( const char *name );
void trap_startCamera( int time );
qboolean trap_getCameraInfo( int time, vec3_t *origin, vec3_t *angles );
qboolean trap_GetEntityToken( char *buffer, int bufferSize );
int trap_GetDemoState( void );
int trap_GetDemoPos( void );
void trap_GetDemoName( char *buffer, int size );
// cg_drawCrosshair settings
#define CROSSHAIR_ALWAYSOFF 0
#define CROSSHAIR_RANGEDONLY 1
#define CROSSHAIR_ALWAYSON 2
|