/
cg_local.h
2181 lines (1703 loc) · 67.6 KB
/
cg_local.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
Copyright (C) 2000-2009 Darklegion Development
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 80
#define MAX_MARK_POLYS 2048
#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 5
#define MAX_PARTICLES_PER_EJECTOR 5
#define MAX_BASEPARTICLE_SYSTEMS 384
#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 96
#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;
vec3_t 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;
int physicsRadius;
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, nonseg, weapon;
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;
typedef struct buildableCache_s
{
vec3_t cachedOrigin; // If either the cached entity origin or the
vec3_t cachedNormal; // cached surfNormal change the cache is invalid
vec3_t axis[ 3 ];
vec3_t origin;
} buildableCache_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
qboolean buildableIdleAnim; //to check if new idle anim
particleSystem_t *buildablePS;
buildableStatus_t buildableStatus;
buildableCache_t buildableCache; // so we don't recalculate things
float lastBuildableHealth;
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[ LEVEL2_AREAZAP_MAX_TARGETS ];
int level2ZapTime;
trailSystem_t *muzzleTS; //used for the tesla and reactor
int muzzleTSDeathTime;
qboolean valid;
qboolean oldValid;
int invisibleTime;
qboolean invisible;
struct centity_s *nextLocation;
} 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 ];
team_t team;
int score; // updated by score servercmds
int location; // location index for team mode
int health; // you only get this info about your teammates
int upgrade;
int curWeaponClass; // sends current weapon for H, current class for A
// 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 ];
char voice[ MAX_VOICE_NAME_LEN ];
int voiceTime;
char chatText[ MAX_SAY_TEXT ];
int chatDurationTime;
int chatTeam;
} clientInfo_t;
typedef struct weaponInfoMode_s
{
float flashDlight;
vec3_t flashDlightColor;
sfxHandle_t flashSound[ 4 ]; // fast firing weapons randomly choose
qboolean continuousFlash;
float flashQuake;
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;
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
float impactQuake;
} 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;
qhandle_t weaponModel3rdPerson;
qhandle_t barrelModel3rdPerson;
qhandle_t flashModel3rdPerson;
animation_t animations[ MAX_WEAPON_ANIMATIONS ];
qboolean noDrift;
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 16384
#define MAX_CONSOLE_LINES 64
// 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 )
// After this many msec the crosshair name fades out completely
#define CROSSHAIR_CLIENT_TIMEOUT 1000
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