/
cg_local.h
4018 lines (3326 loc) · 120 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
/*
* Wolfenstein: Enemy Territory GPL Source Code
* Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company.
*
* ET: Legacy
* Copyright (C) 2012-2018 ET:Legacy team <mail@etlegacy.com>
*
* This file is part of ET: Legacy - http://www.etlegacy.com
*
* ET: Legacy 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 3 of the License, or
* (at your option) any later version.
*
* ET: Legacy 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 ET: Legacy. If not, see <http://www.gnu.org/licenses/>.
*
* In addition, Wolfenstein: Enemy Territory GPL Source Code is also
* subject to certain additional terms. You should have received a copy
* of these additional terms immediately following the terms and conditions
* of the GNU General Public License which accompanied the source code.
* If not, please request a copy in writing from id Software at the address below.
*
* id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
*/
/**
* @file cg_local.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.
*/
#ifndef INCLUDE_CG_LOCAL_H
#define INCLUDE_CG_LOCAL_H
#include "../qcommon/q_shared.h"
#include "../qcommon/q_unicode.h"
#include "../renderercommon/tr_types.h"
#include "../game/bg_public.h"
#include "cg_public.h"
#include "../ui/ui_shared.h"
#define STATS_FADE_TIME 200
#define FADE_TIME 200
#define DAMAGE_DEFLECT_TIME 100
#define DAMAGE_RETURN_TIME 400
#define LAND_DEFLECT_TIME 150
#define LAND_RETURN_TIME 300
#define STEP_TIME 200
#define DUCK_TIME 100
#define PAIN_TWITCH_TIME 200
#define ZOOM_TIME 150.0f
#define MUZZLE_FLASH_TIME 30
#define SINK_TIME 3000 ///< time for fragments to sink into ground before going away
#define PRONE_TIME 500
#define MAX_STEP_CHANGE 32
#define MAX_VERTS_ON_POLY 10
#define MAX_MARK_POLYS 256 ///< was 1024
#define STAT_MINUS 10 ///< num frame for '-' stats digit
#define NOTIFY_WIDTH 80
#define NOTIFY_HEIGHT 5
#define TEAMCHAT_WIDTH 70
#define TEAMCHAT_HEIGHT 8
#define NUM_CROSSHAIRS 16
// trails
#define STYPE_STRETCH 0
#define STYPE_REPEAT 1
#define TJFL_FADEIN (1 << 0)
#define TJFL_CROSSOVER (1 << 1)
#define TJFL_NOCULL (1 << 2)
#define TJFL_FIXDISTORT (1 << 3)
#define TJFL_SPARKHEADFLARE (1 << 4)
#define TJFL_NOPOLYMERGE (1 << 5)
// Autoaction values
#define AA_DEMORECORD 0x01
#define AA_SCREENSHOT 0x02
#define AA_STATSDUMP 0x04
// Cursor
#define CURSOR_OFFSETX 13
#define CURSOR_OFFSETY 12
// Demo controls
#define DEMO_THIRDPERSONUPDATE 0
#define DEMO_RANGEDELTA 6
#define DEMO_ANGLEDELTA 4
#ifdef FEATURE_MULTIVIEW
// MV overlay
#define MVINFO_RIGHT Ccg_WideX(SCREEN_WIDTH) - 6
#define MVINFO_TOP 8
#endif
#define MAX_WINDOW_COUNT 10
#define MAX_WINDOW_LINES 64
#define MAX_STRINGS 80
#define MAX_STRING_POOL_LENGTH 128
#define WINDOW_FONTWIDTH 8 ///< For non-true-type: width to scale from
#define WINDOW_FONTHEIGHT 8 ///< For non-true-type: height to scale from
#define WID_NONE 0x00 ///< General window
#define WID_STATS 0x01 ///< Stats (reusable due to scroll effect)
#define WID_TOPSHOTS 0x02 ///< Top/Bottom-shots
#define WID_MOTD 0x04 ///< MOTD
//#define WID_DEMOHELP 0x08 ///< Demo key control info
//#define WID_SPECHELP 0x10 ///< MV spectator key control info
#define WFX_TEXTSIZING 0x01 ///< Size the window based on text/font setting
#define WFX_FLASH 0x02 ///< Alternate between bg and b2 every half second
#define WFX_TRUETYPE 0x04 ///< Use truetype fonts for text
#define WFX_MULTIVIEW 0x08 ///< Multiview window
// These need to be last
#define WFX_FADEIN 0x10 ///< Fade the window in (and back out when closing)
#define WFX_SCROLLUP 0x20 ///< Scroll window up from the bottom (and back down when closing)
#define WFX_SCROLLDOWN 0x40 ///< Scroll window down from the top (and back up when closing)
#define WFX_SCROLLLEFT 0x80 ///< Scroll window in from the left (and back right when closing)
#define WFX_SCROLLRIGHT 0x100 ///< Scroll window in from the right (and back left when closing)
#define WSTATE_COMPLETE 0x00 ///< Window is up with startup effects complete
#define WSTATE_START 0x01 ///< Window is "initializing" w/effects
#define WSTATE_SHUTDOWN 0x02 ///< Window is shutting down with effects
#define WSTATE_OFF 0x04 ///< Window is completely shutdown
#ifdef FEATURE_MULTIVIEW
#define MV_PID 0x00FF ///< Bits available for player IDs for MultiView windows
#define MV_SELECTED 0x0100 ///< MultiView selected window flag is the 9th bit
#endif
#define ISVALIDCLIENTNUM(clientNum) ((clientNum) >= 0 && (clientNum) < MAX_CLIENTS)
/**
* @struct specLabel_s
* @typedef specLabel_t
* @brief
*/
typedef struct specLabel_s
{
float x;
float y;
float scale;
const char *text;
vec3_t origin;
int lastVisibleTime;
int lastInvisibleTime;
qboolean visible;
float alpha;
} specLabel_t;
/**
* @struct specBar_s
* @typedef specBar_t
* @brief
*/
typedef struct specBar_s
{
float x;
float y;
float w;
float h;
float fraction;
vec4_t colorStart;
vec4_t colorEnd;
vec4_t colorBack;
vec3_t origin;
int lastVisibleTime;
int lastInvisibleTime;
qboolean visible;
float alpha;
} specBar_t;
/**
* @struct cg_window_s
* @brief
*/
typedef struct
{
vec4_t colorBorder; ///< Window border color
vec4_t colorBackground; ///< Window fill color
vec4_t colorBackground2; ///< Window fill color2 (for flashing)
int curX; ///< Scrolling X position
int curY; ///< Scrolling Y position
int effects; ///< Window effects
float flashMidpoint; ///< Flashing transition point (in ms)
int flashPeriod; ///< Background flashing period (in ms)
int fontHeight; ///< For non-truetype font drawing
float fontScaleX; ///< Font scale factor
float fontScaleY; ///< Font scale factor
int fontWidth; ///< For non-truetype font drawing
float h; ///< Height
int id; ///< Window ID for special handling (i.e. stats, motd, etc.)
qboolean inuse; ///< Activity flag
int lineCount; ///< Number of lines to display
int lineHeight[MAX_WINDOW_LINES]; ///< Height property for each line
char *lineText[MAX_WINDOW_LINES]; ///< Text info
#ifdef FEATURE_MULTIVIEW
float m_x; ///< Mouse X position
float m_y; ///< Mouse Y position
int mvInfo; ///< lower 8 = player id, 9 = is_selected
#endif
int targetTime; ///< Time to complete any defined effect
int state; ///< Current state of the window
int time; ///< Current window time
float w; ///< Width
float x; ///< Target x-coordinate
///< negative values will align the window from the right minus the (window width + offset(x))
float y; ///< Target y-coordinate
///< negative values will align the window from the bottom minus the (window height + offset(y))
} cg_window_t;
/**
* @struct cg_string_s
* @brief
*/
typedef struct
{
qboolean fActive;
char str[MAX_STRING_POOL_LENGTH];
} cg_string_t;
/**
* @struct cg_windowHandler_s
* @brief
*/
typedef struct
{
int activeWindows[MAX_WINDOW_COUNT]; ///< List of active windows
int numActiveWindows; ///< Number of active windows in use
cg_window_t window[MAX_WINDOW_COUNT]; ///< Static allocation of all windows
} cg_windowHandler_t;
#ifdef FEATURE_MULTIVIEW
/**
* @struct cg_mvinfo_s
* @brief
*/
typedef struct
{
int pID; ///< Player ID
int classID; ///< Player's current class
int width; ///< Width of text box
char info[8]; ///< On-screen info (w/color coding)
qboolean fActive; ///< Overlay element is active
cg_window_t *w; ///< Window handle (may be NULL)
} cg_mvinfo_t;
#endif
//=================================================
/**
* @struct lerpFrame_s
* @brief
*/
typedef struct
{
int oldFrame;
int oldFrameTime; ///< time when ->oldFrame was exactly on
qhandle_t oldFrameModel;
int frame;
int frameTime; ///< time when ->frame will be exactly on
qhandle_t frameModel;
float backlerp;
float yawAngle;
qboolean yawing;
float pitchAngle;
qboolean pitching;
int animationNumber; ///< may include ANIM_TOGGLEBIT
int oldAnimationNumber; ///< may include ANIM_TOGGLEBIT
animation_t *animation;
int animationTime; ///< time when the first frame of the animation will be exact
// variable speed anims
vec3_t oldFramePos;
float animSpeedScale;
int oldFrameSnapshotTime;
//headAnimation_t *headAnim;
} lerpFrame_t;
/**
* @struct playerEntity_s
* @brief 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.
*
* 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
{
lerpFrame_t legs;
lerpFrame_t torso;
lerpFrame_t head;
lerpFrame_t weap; ////< autonomous weapon animations
lerpFrame_t hudhead;
int painTime;
int painDuration;
int painDirection; ///< flip from 0 to 1
int painAnimTorso;
int painAnimLegs;
int lightningFiring;
// so we can do fast tag grabbing
refEntity_t bodyRefEnt, headRefEnt, gunRefEnt, handRefEnt;
int gunRefEntFrame;
float animSpeed; ///< for manual adjustment
int lastFiredWeaponTime;
int weaponFireTime;
// visible leaning from NQ/FalkonET
int leanTime;
float leanDirection;
int leanDir;
} playerEntity_t;
//=================================================
/**
* @struct tag_s
* @typedef tag_t
* @brief
*/
typedef struct tag_s
{
vec3_t origin;
vec3_t axis[3];
} tag_t;
/**
* @struct centity_s
* @typedef centity_t
* @brief 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 overheatTime;
int previousEvent;
int previousEventSequence;
int teleportFlag;
int trailTime; ///< so missile trails can handle dropped initial packets
int miscTime;
int soundTime; ///< so looping sounds can start when triggered
playerEntity_t pe;
vec3_t rawOrigin;
vec3_t rawAngles;
// exact interpolated position of entity on this frame
vec3_t lerpOrigin;
vec3_t lerpAngles;
vec3_t lastLerpAngles; ///< for remembering the last position when a state changes
vec3_t lastLerpOrigin; ///< Added for linked trains player adjust prediction
// trail effects
int headJuncIndex;
int headJuncIndex2;
int lastTrailTime;
vec3_t fireRiseDir; ///< if standing still this will be up, otherwise it'll point away from movement dir
int lastFuseSparkTime;
// client side dlights
int dl_frame;
int dl_oldframe;
float dl_backlerp;
int dl_time;
char dl_stylestring[64];
int dl_sound;
int dl_atten;
lerpFrame_t lerpFrame;
vec3_t highlightOrigin; ///< center of the geometry. for things like corona placement on treasure
qboolean usehighlightOrigin;
refEntity_t refEnt;
int processedFrame; ///< frame we were last added to the scene
int voiceChatSprite;
int voiceChatSpriteTime;
// item highlighting
int highlightTime;
qboolean highlighted;
// spline stuff
vec3_t origin2;
splinePath_t *backspline;
float backdelta;
qboolean back;
qboolean moving;
int tankframe;
int tankparent;
tag_t mountedMG42Base;
tag_t mountedMG42Nest;
tag_t mountedMG42;
tag_t mountedMG42Player;
tag_t mountedMG42Flash;
qboolean akimboFire;
// tagconnect cleanup..
int tagParent;
char tagName[MAX_QPATH];
} centity_t;
//======================================================================
/**
* @struct markPoly_s
* @typedef markPoly_t
* @brief
*/
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];
int duration;
} markPoly_t;
/**
* @enum leType_t
* @brief
*/
typedef enum
{
LE_MARK = 0,
LE_EXPLOSION,
LE_SPRITE_EXPLOSION,
LE_FRAGMENT,
LE_MOVE_SCALE_FADE,
LE_FALL_SCALE_FADE,
LE_FADE_RGB,
LE_CONST_RGB,
LE_SCALE_FADE,
LE_SPARK,
LE_DEBRIS,
LE_BLOOD,
LE_FUSE_SPARK,
LE_MOVING_TRACER,
LE_EMITTER
} leType_t;
/**
* @enum leFlag_t
* @brief
*/
typedef enum
{
LEF_PUFF_DONT_SCALE = 0x0001 ///< do not scale size over time
, LEF_TUMBLE = 0x0002 ///< tumble over time, used for ejecting shells
, LEF_NOFADEALPHA = 0x0004 ///< sparks
, LEF_SMOKING = 0x0008 ///< smoking
, LEF_TUMBLE_SLOW = 0x0010 ///< slow down tumble on hitting ground
} leFlag_t;
/**
* @enum leMarkType_t
* @brief Fragment local entities can leave marks on walls
*/
typedef enum
{
LEMT_NONE = 0,
LEMT_BLOOD
} leMarkType_t;
/**
* @enum leBounceSoundType_t
* @brief Fragment local entities can make sounds on impacts
*/
typedef enum
{
LEBS_NONE = 0,
LEBS_BLOOD,
LEBS_ROCK,
LEBS_WOOD,
LEBS_BRASS,
LEBS_METAL,
LEBS_BONE,
LEBS_SG_BRASS
} leBounceSoundType_t;
/**
* @struct localEntity_s
* @typedef localEntity_t
* @brief Local entities are created as a result of events or predicted actions,
* and live independantly from all server transmitted entities
*/
typedef struct localEntity_s
{
struct localEntity_s *prev, *next;
leType_t leType;
int leFlags;
int startTime;
int endTime;
int fadeInTime;
float lifeRate; ///< 1.0 / (endTime - startTime)
trajectory_t pos;
trajectory_t angles;
float bounceFactor; ///< 0.0 = no bounce, 1.0 = perfect
float color[4];
float radius;
float light;
vec3_t lightColor;
leMarkType_t leMarkType; ///< mark to leave on fragment impact
leBounceSoundType_t leBounceSoundType;
refEntity_t refEntity;
int lastTrailTime;
int headJuncIndex, headJuncIndex2;
float effectWidth;
int effectFlags;
struct localEntity_s *chain; ///< Used for grouping entities (like for flamethrower junctions)
int onFireStart, onFireEnd;
int ownerNum;
int breakCount; ///< break-up this many times before we can break no more
float sizeScale;
int data1;
int data2;
} localEntity_t;
//======================================================================
/**
* @struct score_t
* @brief
*/
typedef struct
{
int client;
int score;
int ping;
int time;
int powerUps;
int team;
int scoreflags;
int respawnsLeft;
#ifdef FEATURE_RATING
// skill rating
float rating;
#endif
#ifdef FEATURE_PRESTIGE
int prestige;
#endif
} score_t;
/**
* @struct clientInfo_s
* @typedef clientInfo_t
* @brief 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
*/
typedef struct clientInfo_s
{
qboolean infoValid;
int clientNum;
char name[MAX_QPATH];
char cleanname[MAX_QPATH];
team_t team;
int botSkill; ///< OBSOLETE remove!
int score; ///< updated by score servercmds
vec3_t location; ///< location (currentOrigin casted int values!) for team mode
int health; ///< you only get this info about your teammates
int powerups; ///< so can display quad/flag status
int breathPuffTime;
int cls;
int latchedcls;
int rank;
int fireteam;
int medals[SK_NUM_SKILLS];
int skill[SK_NUM_SKILLS];
int skillpoints[SK_NUM_SKILLS]; ///< filled OOB by +wstats
#ifdef FEATURE_PRESTIGE
int deltaskillpoints[SK_NUM_SKILLS];
#endif
int disguiseClientNum;
int weapon;
int secondaryweapon;
int latchedweapon;
int latchedsecondaryweapon;
int refStatus;
int shoutcaster;
bg_character_t *character;
/// caching fireteam pointer here, better than trying to work it out all the time
fireteamData_t *fireteamData;
/// for fireteams, has been selected
qboolean selected;
// Intermission stats
float totalWeapAcc;
float totalWeapHSpct;
int kills;
int deaths;
int gibs;
int selfKills;
int teamKills;
int teamGibs;
int timeAxis;
int timeAllies;
int timePlayed;
#ifdef FEATURE_RATING
// skill rating
float rating;
float deltaRating;
#endif
#ifdef FEATURE_PRESTIGE
int prestige;
#endif
#ifdef FEATURE_MULTIVIEW
// per client MV ps info
int ammo;
int ammoclip;
int chargeTime;
qboolean fCrewgun;
int cursorHint;
int grenadeTimeLeft; ///< Actual time remaining
int grenadeTimeStart; ///< Time trigger base to compute TimeLeft
int hintTime;
int sprintTime;
int weapHeat;
int weaponState;
int weaponState_last;
#endif
} clientInfo_t;
/**
* @enum barrelType_t
* @brief
*/
typedef enum
{
W_PART_1 = 0,
W_PART_2,
W_PART_3,
W_PART_4,
W_PART_5,
W_PART_6,
W_PART_7,
W_MAX_PARTS
} barrelType_t;
/**
* @enum modelViewType_t
* @brief
*/
typedef enum
{
W_TP_MODEL = 0, ///< Third person model
W_FP_MODEL, ///< First person model
W_PU_MODEL, ///< Pickup model
W_NUM_TYPES
} modelViewType_t;
/**
* @enum soundSurface_s
* @typedef impactSurface_t
* @brief index used to identify sound to play surface hit
* wood, metal, roof, stone, glass, water, snow, flesh, carpet
*/
typedef enum soundSurface_s
{
W_SND_SURF_DEFAULT = 0, ///< default sound in case of no sound found for given surface
W_SND_SURF_FAR, ///< used sound when player is far from the origin
W_SND_SURF_METAL,
W_SND_SURF_WOOD,
W_SND_SURF_GRASS,
W_SND_SURF_GRAVEL,
W_SND_SURF_GLASS,
W_SND_SURF_SNOW,
W_SND_SURF_ROOF,
W_SND_SURF_CARPET,
W_SND_SURF_WATER,
W_SND_SURF_FLESH,
W_MAX_SND_SURF
} soundSurface_t;
/**
* @struct soundSurfaceTable_s
* @typedef soundSurfaceTable_t
* @brief Sound Surface Table
*/
typedef struct soundSurfaceTable_s
{
int surfaceType;
const char *surfaceName;
} soundSurfaceTable_t;
/**
* @struct partModel_s
* @typedef partModel_t
* @brief
*/
typedef struct partModel_s
{
char tagName[MAX_QPATH];
qhandle_t model;
qhandle_t skin[3]; ///< 0: neutral, 1: axis, 2: allied
} partModel_t;
/**
* @struct weaponModel_s
* @typedef weaponModel_t
* @brief
*/
typedef struct weaponModel_s
{
qhandle_t model;
qhandle_t skin[3]; ///< 0: neutral, 1: axis, 2: allied
} weaponModel_t;
#define MAX_WEAPON_SOUNDS 5
/**
* @struct weaponSounds_s
* @typedef weaponSounds_t
* @brief
*/
typedef struct weaponSounds_s
{
int count;
sfxHandle_t sounds[MAX_WEAPON_SOUNDS];
} weaponSounds_t;
#define MAX_IMPACT_PARTICLE 8
#define MAX_IMPACT_PARTICLE_EFFECT 2
/**
* @struct impactParticleEffect_s
* @typedef impactParticleEffect_t
* @brief
*/
typedef struct impactParticleEffect_s
{
qboolean particleEffectUsed;
qhandle_t particleEffectShader;
int particleEffectSpeed;
float particleEffectSpeedRand;
int particleEffectDuration;
int particleEffectCount;
float particleEffectRandScale;
int particleEffectWidth;
int particleEffectHeight;
float particleEffectAlpha;
} impactParticleEffect_t;
/**
* @struct impactExtraEffect_s
* @typedef impactExtraEffect_t
* @brief
*/
typedef struct impactExtraEffect_s
{
qboolean extraEffectUsed;
int extraEffectCount;
float extraEffectOriginRand;
float extraEffectVelocityRand;
float extraEffectVelocityScaling;
char extraEffectShaderName[16];
int extraEffectDuration;
float extraEffectDurationRand;
int extraEffectSizeStart;
float extraEffectSizeStartRand;
int extraEffectSizeEnd;
float extraEffectSizeEndRand;
qboolean extraEffectLightAnim;
} impactExtraEffect_t;
/**
* @struct impactParticle_s
* @typedef impactParticle_t
* @brief
*/
typedef struct impactParticle_s
{
float particleDirectionOffset;
float particleDirectionScaling;
// specific for water effect
// ripple
int waterRippleRadius;
int waterRippleLifeTime;
// splash
int waterSplashDuration;
int waterSplashLight;
vec3_t waterSplashLightColor;
qboolean waterSplashIsSprite;
// particle effect
impactParticleEffect_t particleEffect[W_MAX_SND_SURF][MAX_IMPACT_PARTICLE_EFFECT];
// particle explosion effect
// main explosion (position on missile origin)
char explosionShaderName[16];
int explosionDuration;
int explosionSizeStart;
float explosionSizeStartRand;
int explosionSizeEnd;
float explosionSizeEndRand;
qboolean explosionLightAnim;
impactExtraEffect_t extraEffect[MAX_IMPACT_PARTICLE_EFFECT];
// debris
int debrisSpeed;
float debrisSpeedRand;
int debrisDuration;
float debrisDurationRand;
int debrisCount;
int debrisCountExtra;
qboolean debrisForBullet;
} impactParticle_t;
/**
* @struct impactParticleTable_s
* @typedef impactParticleTable_t
* @brief
*/
typedef struct impactParticleTable_s
{
char impactParticleName[MAX_QPATH];
impactParticle_t impactParticle;
}impactParticleTable_t;
/**
* @struct weaponInfo_s
* @typedef weaponInfo_t
* @brief 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;
animation_t weapAnimations[MAX_WP_ANIMATIONS];
qhandle_t handsModel; ///< the hands don't actually draw, they just position the weapon
qhandle_t standModel; ///< not drawn. tags used for positioning weapons for pickup
qboolean droppedAnglesHack;
weaponModel_t weaponModel[W_NUM_TYPES];
partModel_t partModels[W_NUM_TYPES][W_MAX_PARTS];
qhandle_t flashModel[W_NUM_TYPES];
qhandle_t modModels[6]; ///< like the scope for the rifles
vec3_t flashDlightColor;
weaponSounds_t flashSound; ///< fast firing weapons randomly choose
weaponSounds_t flashEchoSound; ///< distant gun firing sound
weaponSounds_t lastShotSound; ///< sound of the last shot can be different (mauser doesn't have bolt action on last shot for example)
qhandle_t weaponIcon[2]; ///< [0] is weap icon, [1] is highlight icon
int weaponIconScale;
qhandle_t weaponSimpleIcon;
vec2_t weaponSimpleIconScale;
qhandle_t weaponCardIcon;
vec2_t weaponCardScale;
vec2_t weaponCardPointS;
vec2_t weaponCardPointT;
qhandle_t missileModel;
qhandle_t missileAlliedSkin;
qhandle_t missileAxisSkin;
sfxHandle_t missileSound;
weaponSounds_t missileFallSound;
weaponSounds_t missileBouncingSound[W_MAX_SND_SURF];
void (*missileTrailFunc)(centity_t *, const struct weaponInfo_s *wi);
float missileDlight;
vec3_t missileDlightColor;
int missileRenderfx;
void (*ejectBrassFunc)(centity_t *);
vec3_t ejectBrassOffset;
vec3_t fireRecoil; ///< kick angle
vec3_t adjustLean;
sfxHandle_t readySound; ///< an ambient sound the weapon makes when it's /not/ firing
sfxHandle_t firingSound;
sfxHandle_t overheatSound;
sfxHandle_t reloadSound;
sfxHandle_t reloadFastSound;
sfxHandle_t spinupSound; ///< sound started when fire button goes down, and stepped on when the first fire event happens
sfxHandle_t spindownSound; ///< sound called if the above is running but player doesn't follow through and fire
sfxHandle_t switchSound;
sfxHandle_t noAmmoSound;
int impactDurationCoeff;
int impactMarkMaxRange;
int impactSoundRange;
int impactSoundVolume;
float impactMarkRadius;
sfxHandle_t impactMark[W_MAX_SND_SURF];
weaponSounds_t impactSound[W_MAX_SND_SURF];
impactParticle_t *impactParticle;
} weaponInfo_t;
#define MAX_VIEWDAMAGE 8
/**
* @struct viewDamage_t
* @brief
*/
typedef struct
{
int damageTime, damageDuration;
float damageX, damageY, damageValue;
} viewDamage_t;
//======================================================================
// 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