]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - client.h
changed r_refdef.stats struct to be an array indexed by r_stat_* enums
[xonotic/darkplaces.git] / client.h
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19 */
20 // client.h
21
22 #ifndef CLIENT_H
23 #define CLIENT_H
24
25 #include "matrixlib.h"
26 #include "snd_main.h"
27
28 // NOTE: r_stat_name[] must match this indexing
29 typedef enum r_stat_e
30 {
31         r_stat_timedelta,
32         r_stat_quality,
33         r_stat_renders,
34         r_stat_entities,
35         r_stat_entities_surfaces,
36         r_stat_entities_triangles,
37         r_stat_world_leafs,
38         r_stat_world_portals,
39         r_stat_world_surfaces,
40         r_stat_world_triangles,
41         r_stat_lightmapupdates,
42         r_stat_lightmapupdatepixels,
43         r_stat_particles,
44         r_stat_drawndecals,
45         r_stat_totaldecals,
46         r_stat_draws,
47         r_stat_draws_vertices,
48         r_stat_draws_elements,
49         r_stat_lights,
50         r_stat_lights_clears,
51         r_stat_lights_scissored,
52         r_stat_lights_lighttriangles,
53         r_stat_lights_shadowtriangles,
54         r_stat_lights_dynamicshadowtriangles,
55         r_stat_bouncegrid_lights,
56         r_stat_bouncegrid_particles,
57         r_stat_bouncegrid_traces,
58         r_stat_bouncegrid_hits,
59         r_stat_bouncegrid_splats,
60         r_stat_bouncegrid_bounces,
61         r_stat_photoncache_animated,
62         r_stat_photoncache_cached,
63         r_stat_photoncache_traced,
64         r_stat_bloom,
65         r_stat_bloom_copypixels,
66         r_stat_bloom_drawpixels,
67         r_stat_indexbufferuploadcount,
68         r_stat_indexbufferuploadsize,
69         r_stat_vertexbufferuploadcount,
70         r_stat_vertexbufferuploadsize,
71         r_stat_framedatacurrent,
72         r_stat_framedatasize,
73         r_stat_animcache_vertexmesh_count,
74         r_stat_animcache_vertexmesh_vertices,
75         r_stat_animcache_vertexmesh_maxvertices,
76         r_stat_animcache_skeletal_count,
77         r_stat_animcache_skeletal_bones,
78         r_stat_animcache_skeletal_maxbones,
79         r_stat_animcache_shade_count,
80         r_stat_animcache_shade_vertices,
81         r_stat_animcache_shade_maxvertices,
82         r_stat_animcache_shape_count,
83         r_stat_animcache_shape_vertices,
84         r_stat_animcache_shape_maxvertices,
85         r_stat_batch_batches,
86         r_stat_batch_withgaps,
87         r_stat_batch_surfaces,
88         r_stat_batch_vertices,
89         r_stat_batch_triangles,
90         r_stat_batch_fast_batches,
91         r_stat_batch_fast_surfaces,
92         r_stat_batch_fast_vertices,
93         r_stat_batch_fast_triangles,
94         r_stat_batch_copytriangles_batches,
95         r_stat_batch_copytriangles_surfaces,
96         r_stat_batch_copytriangles_vertices,
97         r_stat_batch_copytriangles_triangles,
98         r_stat_batch_dynamic_batches,
99         r_stat_batch_dynamic_surfaces,
100         r_stat_batch_dynamic_vertices,
101         r_stat_batch_dynamic_triangles,
102         r_stat_batch_dynamicskeletal_batches,
103         r_stat_batch_dynamicskeletal_surfaces,
104         r_stat_batch_dynamicskeletal_vertices,
105         r_stat_batch_dynamicskeletal_triangles,
106         r_stat_batch_dynamic_batches_because_cvar,
107         r_stat_batch_dynamic_surfaces_because_cvar,
108         r_stat_batch_dynamic_vertices_because_cvar,
109         r_stat_batch_dynamic_triangles_because_cvar,
110         r_stat_batch_dynamic_batches_because_lightmapvertex,
111         r_stat_batch_dynamic_surfaces_because_lightmapvertex,
112         r_stat_batch_dynamic_vertices_because_lightmapvertex,
113         r_stat_batch_dynamic_triangles_because_lightmapvertex,
114         r_stat_batch_dynamic_batches_because_deformvertexes_autosprite,
115         r_stat_batch_dynamic_surfaces_because_deformvertexes_autosprite,
116         r_stat_batch_dynamic_vertices_because_deformvertexes_autosprite,
117         r_stat_batch_dynamic_triangles_because_deformvertexes_autosprite,
118         r_stat_batch_dynamic_batches_because_deformvertexes_autosprite2,
119         r_stat_batch_dynamic_surfaces_because_deformvertexes_autosprite2,
120         r_stat_batch_dynamic_vertices_because_deformvertexes_autosprite2,
121         r_stat_batch_dynamic_triangles_because_deformvertexes_autosprite2,
122         r_stat_batch_dynamic_batches_because_deformvertexes_normal,
123         r_stat_batch_dynamic_surfaces_because_deformvertexes_normal,
124         r_stat_batch_dynamic_vertices_because_deformvertexes_normal,
125         r_stat_batch_dynamic_triangles_because_deformvertexes_normal,
126         r_stat_batch_dynamic_batches_because_deformvertexes_wave,
127         r_stat_batch_dynamic_surfaces_because_deformvertexes_wave,
128         r_stat_batch_dynamic_vertices_because_deformvertexes_wave,
129         r_stat_batch_dynamic_triangles_because_deformvertexes_wave,
130         r_stat_batch_dynamic_batches_because_deformvertexes_bulge,
131         r_stat_batch_dynamic_surfaces_because_deformvertexes_bulge,
132         r_stat_batch_dynamic_vertices_because_deformvertexes_bulge,
133         r_stat_batch_dynamic_triangles_because_deformvertexes_bulge,
134         r_stat_batch_dynamic_batches_because_deformvertexes_move,
135         r_stat_batch_dynamic_surfaces_because_deformvertexes_move,
136         r_stat_batch_dynamic_vertices_because_deformvertexes_move,
137         r_stat_batch_dynamic_triangles_because_deformvertexes_move,
138         r_stat_batch_dynamic_batches_because_tcgen_lightmap,
139         r_stat_batch_dynamic_surfaces_because_tcgen_lightmap,
140         r_stat_batch_dynamic_vertices_because_tcgen_lightmap,
141         r_stat_batch_dynamic_triangles_because_tcgen_lightmap,
142         r_stat_batch_dynamic_batches_because_tcgen_vector,
143         r_stat_batch_dynamic_surfaces_because_tcgen_vector,
144         r_stat_batch_dynamic_vertices_because_tcgen_vector,
145         r_stat_batch_dynamic_triangles_because_tcgen_vector,
146         r_stat_batch_dynamic_batches_because_tcgen_environment,
147         r_stat_batch_dynamic_surfaces_because_tcgen_environment,
148         r_stat_batch_dynamic_vertices_because_tcgen_environment,
149         r_stat_batch_dynamic_triangles_because_tcgen_environment,
150         r_stat_batch_dynamic_batches_because_tcmod_turbulent,
151         r_stat_batch_dynamic_surfaces_because_tcmod_turbulent,
152         r_stat_batch_dynamic_vertices_because_tcmod_turbulent,
153         r_stat_batch_dynamic_triangles_because_tcmod_turbulent,
154         r_stat_batch_dynamic_batches_because_interleavedarrays,
155         r_stat_batch_dynamic_surfaces_because_interleavedarrays,
156         r_stat_batch_dynamic_vertices_because_interleavedarrays,
157         r_stat_batch_dynamic_triangles_because_interleavedarrays,
158         r_stat_batch_dynamic_batches_because_nogaps,
159         r_stat_batch_dynamic_surfaces_because_nogaps,
160         r_stat_batch_dynamic_vertices_because_nogaps,
161         r_stat_batch_dynamic_triangles_because_nogaps,
162         r_stat_batch_dynamic_batches_because_derived,
163         r_stat_batch_dynamic_surfaces_because_derived,
164         r_stat_batch_dynamic_vertices_because_derived,
165         r_stat_batch_dynamic_triangles_because_derived,
166         r_stat_count // size of array
167 }
168 r_stat_t;
169
170 // flags for rtlight rendering
171 #define LIGHTFLAG_NORMALMODE 1
172 #define LIGHTFLAG_REALTIMEMODE 2
173
174 typedef struct tridecal_s
175 {
176         // color and initial alpha value
177         float                   texcoord2f[3][2];
178         float                   vertex3f[3][3];
179         float                   color4f[3][4];
180         float                   plane[4]; // backface culling
181         // how long this decal has lived so far (the actual fade begins at cl_decals_time)
182         float                   lived;
183         // if >= 0 this indicates the decal should follow an animated triangle
184         int                             triangleindex;
185         // for visibility culling
186         int                             surfaceindex;
187         // old decals are killed to obey cl_decals_max
188         int                             decalsequence;
189 }
190 tridecal_t;
191
192 typedef struct decalsystem_s
193 {
194         dp_model_t *model;
195         double lastupdatetime;
196         int maxdecals;
197         int freedecal;
198         int numdecals;
199         tridecal_t *decals;
200         float *vertex3f;
201         float *texcoord2f;
202         float *color4f;
203         int *element3i;
204         unsigned short *element3s;
205 }
206 decalsystem_t;
207
208 typedef struct effect_s
209 {
210         int active;
211         vec3_t origin;
212         double starttime;
213         float framerate;
214         int modelindex;
215         int startframe;
216         int endframe;
217         // these are for interpolation
218         int frame;
219         double frame1time;
220         double frame2time;
221 }
222 cl_effect_t;
223
224 typedef struct beam_s
225 {
226         int             entity;
227         // draw this as lightning polygons, or a model?
228         int             lightning;
229         struct model_s  *model;
230         float   endtime;
231         vec3_t  start, end;
232 }
233 beam_t;
234
235 typedef struct rtlight_particle_s
236 {
237         float origin[3];
238         float color[3];
239 }
240 rtlight_particle_t;
241
242 typedef struct rtlight_s
243 {
244         // shadow volumes are done entirely in model space, so there are no matrices for dealing with them...  they just use the origin
245
246         // note that the world to light matrices are inversely scaled (divided) by lightradius
247
248         // core properties
249         /// matrix for transforming light filter coordinates to world coordinates
250         matrix4x4_t matrix_lighttoworld;
251         /// matrix for transforming world coordinates to light filter coordinates
252         matrix4x4_t matrix_worldtolight;
253         /// typically 1 1 1, can be lower (dim) or higher (overbright)
254         vec3_t color;
255         /// size of the light (remove?)
256         vec_t radius;
257         /// light filter
258         char cubemapname[64];
259         /// light style to monitor for brightness
260         int style;
261         /// whether light should render shadows
262         int shadow;
263         /// intensity of corona to render
264         vec_t corona;
265         /// radius scale of corona to render (1.0 means same as light radius)
266         vec_t coronasizescale;
267         /// ambient intensity to render
268         vec_t ambientscale;
269         /// diffuse intensity to render
270         vec_t diffusescale;
271         /// specular intensity to render
272         vec_t specularscale;
273         /// LIGHTFLAG_* flags
274         int flags;
275
276         // generated properties
277         /// used only for shadow volumes
278         vec3_t shadoworigin;
279         /// culling
280         vec3_t cullmins;
281         vec3_t cullmaxs;
282         // culling
283         //vec_t cullradius;
284         // squared cullradius
285         //vec_t cullradius2;
286
287         // rendering properties, updated each time a light is rendered
288         // this is rtlight->color * d_lightstylevalue
289         vec3_t currentcolor;
290         /// used by corona updates, due to occlusion query
291         float corona_visibility;
292         unsigned int corona_queryindex_visiblepixels;
293         unsigned int corona_queryindex_allpixels;
294         /// this is R_GetCubemap(rtlight->cubemapname)
295         rtexture_t *currentcubemap;
296         /// set by R_Shadow_PrepareLight to decide whether R_Shadow_DrawLight should draw it
297         qboolean draw;
298         /// these fields are set by R_Shadow_PrepareLight for later drawing
299         int cached_numlightentities;
300         int cached_numlightentities_noselfshadow;
301         int cached_numshadowentities;
302         int cached_numshadowentities_noselfshadow;
303         int cached_numsurfaces;
304         struct entity_render_s **cached_lightentities;
305         struct entity_render_s **cached_lightentities_noselfshadow;
306         struct entity_render_s **cached_shadowentities;
307         struct entity_render_s **cached_shadowentities_noselfshadow;
308         unsigned char *cached_shadowtrispvs;
309         unsigned char *cached_lighttrispvs;
310         int *cached_surfacelist;
311         // reduced light cullbox from GetLightInfo
312         vec3_t cached_cullmins;
313         vec3_t cached_cullmaxs;
314         // current shadow-caster culling planes based on view
315         // (any geometry outside these planes can not contribute to the visible
316         //  shadows in any way, and thus can be culled safely)
317         int cached_numfrustumplanes;
318         mplane_t cached_frustumplanes[5]; // see R_Shadow_ComputeShadowCasterCullingPlanes
319
320         /// static light info
321         /// true if this light should be compiled as a static light
322         int isstatic;
323         /// true if this is a compiled world light, cleared if the light changes
324         int compiled;
325         /// the shadowing mode used to compile this light
326         int shadowmode;
327         /// premade shadow volumes to render for world entity
328         shadowmesh_t *static_meshchain_shadow_zpass;
329         shadowmesh_t *static_meshchain_shadow_zfail;
330         shadowmesh_t *static_meshchain_shadow_shadowmap;
331         /// used for visibility testing (more exact than bbox)
332         int static_numleafs;
333         int static_numleafpvsbytes;
334         int *static_leaflist;
335         unsigned char *static_leafpvs;
336         /// surfaces seen by light
337         int static_numsurfaces;
338         int *static_surfacelist;
339         /// flag bits indicating which triangles of the world model should cast
340         /// shadows, and which ones should be lit
341         ///
342         /// this avoids redundantly scanning the triangles in each surface twice
343         /// for whether they should cast shadows, once in culling and once in the
344         /// actual shadowmarklist production.
345         int static_numshadowtrispvsbytes;
346         unsigned char *static_shadowtrispvs;
347         /// this allows the lighting batch code to skip backfaces andother culled
348         /// triangles not relevant for lighting
349         /// (important on big surfaces such as terrain)
350         int static_numlighttrispvsbytes;
351         unsigned char *static_lighttrispvs;
352         /// masks of all shadowmap sides that have any potential static receivers or casters
353         int static_shadowmap_receivers;
354         int static_shadowmap_casters;
355         /// particle-tracing cache for global illumination
356         int particlecache_numparticles;
357         int particlecache_maxparticles;
358         int particlecache_updateparticle;
359         rtlight_particle_t *particlecache_particles;
360
361         /// bouncegrid light info
362         float photoncolor[3];
363         float photons;
364 }
365 rtlight_t;
366
367 typedef struct dlight_s
368 {
369         // destroy light after this time
370         // (dlight only)
371         vec_t die;
372         // the entity that owns this light (can be NULL)
373         // (dlight only)
374         struct entity_render_s *ent;
375         // location
376         // (worldlight: saved to .rtlights file)
377         vec3_t origin;
378         // worldlight orientation
379         // (worldlight only)
380         // (worldlight: saved to .rtlights file)
381         vec3_t angles;
382         // dlight orientation/scaling/location
383         // (dlight only)
384         matrix4x4_t matrix;
385         // color of light
386         // (worldlight: saved to .rtlights file)
387         vec3_t color;
388         // cubemap name to use on this light
389         // (worldlight: saved to .rtlights file)
390         char cubemapname[64];
391         // make light flash while selected
392         // (worldlight only)
393         int selected;
394         // brightness (not really radius anymore)
395         // (worldlight: saved to .rtlights file)
396         vec_t radius;
397         // drop intensity this much each second
398         // (dlight only)
399         vec_t decay;
400         // intensity value which is dropped over time
401         // (dlight only)
402         vec_t intensity;
403         // initial values for intensity to modify
404         // (dlight only)
405         vec_t initialradius;
406         vec3_t initialcolor;
407         // light style which controls intensity of this light
408         // (worldlight: saved to .rtlights file)
409         int style;
410         // cast shadows
411         // (worldlight: saved to .rtlights file)
412         int shadow;
413         // corona intensity
414         // (worldlight: saved to .rtlights file)
415         vec_t corona;
416         // radius scale of corona to render (1.0 means same as light radius)
417         // (worldlight: saved to .rtlights file)
418         vec_t coronasizescale;
419         // ambient intensity to render
420         // (worldlight: saved to .rtlights file)
421         vec_t ambientscale;
422         // diffuse intensity to render
423         // (worldlight: saved to .rtlights file)
424         vec_t diffusescale;
425         // specular intensity to render
426         // (worldlight: saved to .rtlights file)
427         vec_t specularscale;
428         // LIGHTFLAG_* flags
429         // (worldlight: saved to .rtlights file)
430         int flags;
431         // linked list of world lights
432         // (worldlight only)
433         struct dlight_s *next;
434         // embedded rtlight struct for renderer
435         // (worldlight only)
436         rtlight_t rtlight;
437 }
438 dlight_t;
439
440 // this is derived from processing of the framegroupblend array
441 // note: technically each framegroupblend can produce two of these, but that
442 // never happens in practice because no one blends between more than 2
443 // framegroups at once
444 #define MAX_FRAMEBLENDS (MAX_FRAMEGROUPBLENDS * 2)
445 typedef struct frameblend_s
446 {
447         int subframe;
448         float lerp;
449 }
450 frameblend_t;
451
452 // LordHavoc: this struct is intended for the renderer but some fields are
453 // used by the client.
454 //
455 // The renderer should not rely on any changes to this struct to be persistent
456 // across multiple frames because temp entities are wiped every frame, but it
457 // is acceptable to cache things in this struct that are not critical.
458 //
459 // For example the r_cullentities_trace code does such caching.
460 typedef struct entity_render_s
461 {
462         // location
463         //vec3_t origin;
464         // orientation
465         //vec3_t angles;
466         // transform matrix for model to world
467         matrix4x4_t matrix;
468         // transform matrix for world to model
469         matrix4x4_t inversematrix;
470         // opacity (alpha) of the model
471         float alpha;
472         // size the model is shown
473         float scale;
474         // transparent sorting offset
475         float transparent_offset;
476
477         // NULL = no model
478         dp_model_t *model;
479         // number of the entity represents, or 0 for non-network entities
480         int entitynumber;
481         // literal colormap colors for renderer, if both are 0 0 0 it is not colormapped
482         vec3_t colormap_pantscolor;
483         vec3_t colormap_shirtcolor;
484         // light, particles, etc
485         int effects;
486         // qw CTF flags and other internal-use-only effect bits
487         int internaleffects;
488         // for Alias models
489         int skinnum;
490         // render flags
491         int flags;
492
493         // colormod tinting of models
494         float colormod[3];
495         float glowmod[3];
496
497         // interpolated animation - active framegroups and blend factors
498         framegroupblend_t framegroupblend[MAX_FRAMEGROUPBLENDS];
499
500         // time of last model change (for shader animations)
501         double shadertime;
502
503         // calculated by the renderer (but not persistent)
504
505         // calculated during R_AddModelEntities
506         vec3_t mins, maxs;
507         // subframe numbers (-1 if not used) and their blending scalers (0-1), if interpolation is not desired, use subframeblend[0].subframe
508         frameblend_t frameblend[MAX_FRAMEBLENDS];
509         // skeletal animation data (if skeleton.relativetransforms is not NULL, it overrides frameblend)
510         skeleton_t *skeleton;
511
512         // animation cache (pointers allocated using R_FrameData_Alloc)
513         // ONLY valid during R_RenderView!  may be NULL (not cached)
514         float *animcache_vertex3f;
515         float *animcache_normal3f;
516         float *animcache_svector3f;
517         float *animcache_tvector3f;
518         // interleaved arrays for rendering and dynamic vertex buffers for them
519         r_meshbuffer_t *animcache_vertex3fbuffer;
520         r_vertexmesh_t *animcache_vertexmesh;
521         r_meshbuffer_t *animcache_vertexmeshbuffer;
522         // gpu-skinning shader needs transforms in a certain format
523         // if this is not NULL, the other animcache variables are NULL
524         float *animcache_skeletaltransform3x4;
525
526         // current lighting from map (updated ONLY by client code, not renderer)
527         vec3_t modellight_ambient;
528         vec3_t modellight_diffuse; // q3bsp
529         vec3_t modellight_lightdir; // q3bsp
530
531         // storage of decals on this entity
532         // (note: if allowdecals is set, be sure to call R_DecalSystem_Reset on removal!)
533         int allowdecals;
534         decalsystem_t decalsystem;
535
536         // FIELDS UPDATED BY RENDERER:
537         // last time visible during trace culling
538         double last_trace_visibility;
539
540         // user wavefunc parameters (from csqc)
541         vec_t userwavefunc_param[Q3WAVEFUNC_USER_COUNT];
542 }
543 entity_render_t;
544
545 typedef struct entity_persistent_s
546 {
547         vec3_t trail_origin; // previous position for particle trail spawning
548         vec3_t oldorigin; // lerp
549         vec3_t oldangles; // lerp
550         vec3_t neworigin; // lerp
551         vec3_t newangles; // lerp
552         vec_t lerpstarttime; // lerp
553         vec_t lerpdeltatime; // lerp
554         float muzzleflash; // muzzleflash intensity, fades over time
555         float trail_time; // residual error accumulation for particle trail spawning (to keep spacing across frames)
556         qboolean trail_allowed; // set to false by teleports, true by update code, prevents bad lerps
557 }
558 entity_persistent_t;
559
560 typedef struct entity_s
561 {
562         // baseline state (default values)
563         entity_state_t state_baseline;
564         // previous state (interpolating from this)
565         entity_state_t state_previous;
566         // current state (interpolating to this)
567         entity_state_t state_current;
568
569         // used for regenerating parts of render
570         entity_persistent_t persistent;
571
572         // the only data the renderer should know about
573         entity_render_t render;
574 }
575 entity_t;
576
577 typedef struct usercmd_s
578 {
579         vec3_t  viewangles;
580
581 // intended velocities
582         float   forwardmove;
583         float   sidemove;
584         float   upmove;
585
586         vec3_t  cursor_screen;
587         vec3_t  cursor_start;
588         vec3_t  cursor_end;
589         vec3_t  cursor_impact;
590         vec3_t  cursor_normal;
591         vec_t   cursor_fraction;
592         int             cursor_entitynumber;
593
594         double time; // time the move is executed for (cl_movement: clienttime, non-cl_movement: receivetime)
595         double receivetime; // time the move was received at
596         double clienttime; // time to which server state the move corresponds to
597         int msec; // for predicted moves
598         int buttons;
599         int impulse;
600         int sequence;
601         qboolean applied; // if false we're still accumulating a move
602         qboolean predicted; // if true the sequence should be sent as 0
603
604         // derived properties
605         double frametime;
606         qboolean canjump;
607         qboolean jump;
608         qboolean crouch;
609 } usercmd_t;
610
611 typedef struct lightstyle_s
612 {
613         int             length;
614         char    map[MAX_STYLESTRING];
615 } lightstyle_t;
616
617 typedef struct scoreboard_s
618 {
619         char    name[MAX_SCOREBOARDNAME];
620         int             frags;
621         int             colors; // two 4 bit fields
622         // QW fields:
623         int             qw_userid;
624         char    qw_userinfo[MAX_USERINFO_STRING];
625         float   qw_entertime;
626         int             qw_ping;
627         int             qw_packetloss;
628         int             qw_movementloss;
629         int             qw_spectator;
630         char    qw_team[8];
631         char    qw_skin[MAX_QPATH];
632 } scoreboard_t;
633
634 typedef struct cshift_s
635 {
636         float   destcolor[3];
637         float   percent;                // 0-255
638         float   alphafade;      // (any speed)
639 } cshift_t;
640
641 #define CSHIFT_CONTENTS 0
642 #define CSHIFT_DAMAGE   1
643 #define CSHIFT_BONUS    2
644 #define CSHIFT_POWERUP  3
645 #define CSHIFT_VCSHIFT  4
646 #define NUM_CSHIFTS             5
647
648 #define NAME_LENGTH     64
649
650
651 //
652 // client_state_t should hold all pieces of the client state
653 //
654
655 #define SIGNONS         4                       // signon messages to receive before connected
656
657 typedef enum cactive_e
658 {
659         ca_uninitialized,       // during early startup
660         ca_dedicated,           // a dedicated server with no ability to start a client
661         ca_disconnected,        // full screen console with no connection
662         ca_connected            // valid netcon, talking to a server
663 }
664 cactive_t;
665
666 typedef enum qw_downloadtype_e
667 {
668         dl_none,
669         dl_single,
670         dl_skin,
671         dl_model,
672         dl_sound
673 }
674 qw_downloadtype_t;
675
676 typedef enum capturevideoformat_e
677 {
678         CAPTUREVIDEOFORMAT_AVI_I420,
679         CAPTUREVIDEOFORMAT_OGG_VORBIS_THEORA
680 }
681 capturevideoformat_t;
682
683 typedef struct capturevideostate_s
684 {
685         double startrealtime;
686         double framerate;
687         int framestep;
688         int framestepframe;
689         qboolean active;
690         qboolean realtime;
691         qboolean error;
692         int soundrate;
693         int soundchannels;
694         int frame;
695         double starttime;
696         double lastfpstime;
697         int lastfpsframe;
698         int soundsampleframe;
699         unsigned char *screenbuffer;
700         unsigned char *outbuffer;
701         char basename[MAX_QPATH];
702         int width, height;
703
704         // precomputed RGB to YUV tables
705         // converts the RGB values to YUV (see cap_avi.c for how to use them)
706         short rgbtoyuvscaletable[3][3][256];
707         unsigned char yuvnormalizetable[3][256];
708
709         // precomputed gamma ramp (only needed if the capturevideo module uses RGB output)
710         // note: to map from these values to RGB24, you have to multiply by 255.0/65535.0, then add 0.5, then cast to integer
711         unsigned short vidramp[256 * 3];
712
713         // stuff to be filled in by the video format module
714         capturevideoformat_t format;
715         const char *formatextension;
716         qfile_t *videofile;
717                 // always use this:
718                 //   cls.capturevideo.videofile = FS_OpenRealFile(va(vabuf, sizeof(vabuf), "%s.%s", cls.capturevideo.basename, cls.capturevideo.formatextension), "wb", false);
719         void (*endvideo) (void);
720         void (*videoframes) (int num);
721         void (*soundframe) (const portable_sampleframe_t *paintbuffer, size_t length);
722
723         // format specific data
724         void *formatspecific;
725 }
726 capturevideostate_t;
727
728 #define CL_MAX_DOWNLOADACKS 4
729
730 typedef struct cl_downloadack_s
731 {
732         int start, size;
733 }
734 cl_downloadack_t;
735
736 typedef struct cl_soundstats_s
737 {
738         int mixedsounds;
739         int totalsounds;
740         int latency_milliseconds;
741 }
742 cl_soundstats_t;
743
744 //
745 // the client_static_t structure is persistent through an arbitrary number
746 // of server connections
747 //
748 typedef struct client_static_s
749 {
750         cactive_t state;
751
752         // all client memory allocations go in these pools
753         mempool_t *levelmempool;
754         mempool_t *permanentmempool;
755
756 // demo loop control
757         // -1 = don't play demos
758         int demonum;
759         // list of demos in loop
760         char demos[MAX_DEMOS][MAX_DEMONAME];
761         // the actively playing demo (set by CL_PlayDemo_f)
762         char demoname[MAX_QPATH];
763
764 // demo recording info must be here, because record is started before
765 // entering a map (and clearing client_state_t)
766         qboolean demorecording;
767         fs_offset_t demo_lastcsprogssize;
768         int demo_lastcsprogscrc;
769         qboolean demoplayback;
770         qboolean demostarting; // set if currently starting a demo, to stop -demo from quitting when switching to another demo
771         qboolean timedemo;
772         // -1 = use normal cd track
773         int forcetrack;
774         qfile_t *demofile;
775         // realtime at second frame of timedemo (LordHavoc: changed to double)
776         double td_starttime;
777         int td_frames; // total frames parsed
778         double td_onesecondnexttime;
779         double td_onesecondframes;
780         double td_onesecondrealtime;
781         double td_onesecondminfps;
782         double td_onesecondmaxfps;
783         double td_onesecondavgfps;
784         int td_onesecondavgcount;
785         // LordHavoc: pausedemo
786         qboolean demopaused;
787
788         // sound mixer statistics for showsound display
789         cl_soundstats_t soundstats;
790
791         qboolean connect_trying;
792         int connect_remainingtries;
793         double connect_nextsendtime;
794         lhnetsocket_t *connect_mysocket;
795         lhnetaddress_t connect_address;
796         // protocol version of the server we're connected to
797         // (kept outside client_state_t because it's used between levels)
798         protocolversion_t protocol;
799
800 #define MAX_RCONS 16
801         int rcon_trying;
802         lhnetaddress_t rcon_addresses[MAX_RCONS];
803         char rcon_commands[MAX_RCONS][MAX_INPUTLINE];
804         double rcon_timeout[MAX_RCONS];
805         int rcon_ringpos;
806
807 // connection information
808         // 0 to SIGNONS
809         int signon;
810         // network connection
811         netconn_t *netcon;
812
813         // download information
814         // (note: qw_download variables are also used)
815         cl_downloadack_t dp_downloadack[CL_MAX_DOWNLOADACKS];
816
817         // input sequence numbers are not reset on level change, only connect
818         int movesequence;
819         int servermovesequence;
820
821         // quakeworld stuff below
822
823         // value of "qport" cvar at time of connection
824         int qw_qport;
825         // copied from cls.netcon->qw. variables every time they change, or set by demos (which have no cls.netcon)
826         int qw_incoming_sequence;
827         int qw_outgoing_sequence;
828
829         // current file download buffer (only saved when file is completed)
830         char qw_downloadname[MAX_QPATH];
831         unsigned char *qw_downloadmemory;
832         int qw_downloadmemorycursize;
833         int qw_downloadmemorymaxsize;
834         int qw_downloadnumber;
835         int qw_downloadpercent;
836         qw_downloadtype_t qw_downloadtype;
837         // transfer rate display
838         double qw_downloadspeedtime;
839         int qw_downloadspeedcount;
840         int qw_downloadspeedrate;
841         qboolean qw_download_deflate;
842
843         // current file upload buffer (for uploading screenshots to server)
844         unsigned char *qw_uploaddata;
845         int qw_uploadsize;
846         int qw_uploadpos;
847
848         // user infostring
849         // this normally contains the following keys in quakeworld:
850         // password spectator name team skin topcolor bottomcolor rate noaim msg *ver *ip
851         char userinfo[MAX_USERINFO_STRING];
852
853         // extra user info for the "connect" command
854         char connect_userinfo[MAX_USERINFO_STRING];
855
856         // video capture stuff
857         capturevideostate_t capturevideo;
858
859         // crypto channel
860         crypto_t crypto;
861
862         // ProQuake compatibility stuff
863         int proquake_servermod; // 0 = not proquake, 1 = proquake
864         int proquake_serverversion; // actual proquake server version * 10 (3.40 = 34, etc)
865         int proquake_serverflags; // 0 (PQF_CHEATFREE not supported)
866
867         // don't write-then-read csprogs.dat (useful for demo playback)
868         unsigned char *caughtcsprogsdata;
869         fs_offset_t caughtcsprogsdatasize;
870
871         int r_speeds_graph_length;
872         int r_speeds_graph_current;
873         int *r_speeds_graph_data;
874
875         // graph scales
876         int r_speeds_graph_datamin[r_stat_count];
877         int r_speeds_graph_datamax[r_stat_count];
878 }
879 client_static_t;
880
881 extern client_static_t  cls;
882
883 typedef struct client_movementqueue_s
884 {
885         double time;
886         float frametime;
887         int sequence;
888         float viewangles[3];
889         float move[3];
890         qboolean jump;
891         qboolean crouch;
892         qboolean canjump;
893 }
894 client_movementqueue_t;
895
896 //[515]: csqc
897 typedef struct
898 {
899         qboolean drawworld;
900         qboolean drawenginesbar;
901         qboolean drawcrosshair;
902 }csqc_vidvars_t;
903
904 typedef enum
905 {
906         PARTICLE_BILLBOARD = 0,
907         PARTICLE_SPARK = 1,
908         PARTICLE_ORIENTED_DOUBLESIDED = 2,
909         PARTICLE_VBEAM = 3,
910         PARTICLE_HBEAM = 4,
911         PARTICLE_INVALID = -1
912 }
913 porientation_t;
914
915 typedef enum
916 {
917         PBLEND_ALPHA = 0,
918         PBLEND_ADD = 1,
919         PBLEND_INVMOD = 2,
920         PBLEND_INVALID = -1
921 }
922 pblend_t;
923
924 typedef struct particletype_s
925 {
926         pblend_t blendmode;
927         porientation_t orientation;
928         qboolean lighting;
929 }
930 particletype_t;
931
932 typedef enum ptype_e
933 {
934         pt_dead, pt_alphastatic, pt_static, pt_spark, pt_beam, pt_rain, pt_raindecal, pt_snow, pt_bubble, pt_blood, pt_smoke, pt_decal, pt_entityparticle, pt_total
935 }
936 ptype_t;
937
938 typedef struct decal_s
939 {
940         // fields used by rendering:  (44 bytes)
941         unsigned short  typeindex;
942         unsigned short  texnum;
943         int                             decalsequence;
944         vec3_t                  org;
945         vec3_t                  normal;
946         float                   size;
947         float                   alpha; // 0-255
948         unsigned char   color[3];
949         unsigned char   unused1;
950         int                             clusterindex; // cheap culling by pvs
951
952         // fields not used by rendering: (36 bytes in 32bit, 40 bytes in 64bit)
953         float                   time2; // used for decal fade
954         unsigned int    owner; // decal stuck to this entity
955         dp_model_t                      *ownermodel; // model the decal is stuck to (used to make sure the entity is still alive)
956         vec3_t                  relativeorigin; // decal at this location in entity's coordinate space
957         vec3_t                  relativenormal; // decal oriented this way relative to entity's coordinate space
958 }
959 decal_t;
960
961 typedef struct particle_s
962 {
963         // for faster batch rendering, particles are rendered in groups by effect (resulting in less perfect sorting but far less state changes)
964
965         // fields used by rendering: (48 bytes)
966         vec3_t          sortorigin; // sort by this group origin, not particle org
967         vec3_t          org;
968         vec3_t          vel; // velocity of particle, or orientation of decal, or end point of beam
969         float           size;
970         float           alpha; // 0-255
971         float           stretch; // only for sparks
972
973         // fields not used by rendering:  (44 bytes)
974         float           stainsize;
975         float           stainalpha;
976         float           sizeincrease; // rate of size change per second
977         float           alphafade; // how much alpha reduces per second
978         float           time2; // used for snow fluttering and decal fade
979         float           bounce; // how much bounce-back from a surface the particle hits (0 = no physics, 1 = stop and slide, 2 = keep bouncing forever, 1.5 is typical)
980         float           gravity; // how much gravity affects this particle (1.0 = normal gravity, 0.0 = none)
981         float           airfriction; // how much air friction affects this object (objects with a low mass/size ratio tend to get more air friction)
982         float           liquidfriction; // how much liquid friction affects this object (objects with a low mass/size ratio tend to get more liquid friction)
983 //      float           delayedcollisions; // time that p->bounce becomes active
984         float           delayedspawn; // time that particle appears and begins moving
985         float           die; // time when this particle should be removed, regardless of alpha
986
987         // short variables grouped to save memory (4 bytes)
988         short                   angle; // base rotation of particle
989         short                   spin; // geometry rotation speed around the particle center normal
990
991         // byte variables grouped to save memory (12 bytes)
992         unsigned char   color[3];
993         unsigned char   qualityreduction; // enables skipping of this particle according to r_refdef.view.qualityreduction
994         unsigned char   typeindex;
995         unsigned char   blendmode;
996         unsigned char   orientation;
997         unsigned char   texnum;
998         unsigned char   staincolor[3];
999         signed char     staintexnum;
1000 }
1001 particle_t;
1002
1003 typedef enum cl_parsingtextmode_e
1004 {
1005         CL_PARSETEXTMODE_NONE,
1006         CL_PARSETEXTMODE_PING,
1007         CL_PARSETEXTMODE_STATUS,
1008         CL_PARSETEXTMODE_STATUS_PLAYERID,
1009         CL_PARSETEXTMODE_STATUS_PLAYERIP
1010 }
1011 cl_parsingtextmode_t;
1012
1013 typedef struct cl_locnode_s
1014 {
1015         struct cl_locnode_s *next;
1016         char *name;
1017         vec3_t mins, maxs;
1018 }
1019 cl_locnode_t;
1020
1021 typedef struct showlmp_s
1022 {
1023         qboolean        isactive;
1024         float           x;
1025         float           y;
1026         char            label[32];
1027         char            pic[128];
1028 }
1029 showlmp_t;
1030
1031 //
1032 // the client_state_t structure is wiped completely at every
1033 // server signon
1034 //
1035 typedef struct client_state_s
1036 {
1037         // true if playing in a local game and no one else is connected
1038         int islocalgame;
1039
1040         // send a clc_nop periodically until connected
1041         float sendnoptime;
1042
1043         // current input being accumulated by mouse/joystick/etc input
1044         usercmd_t cmd;
1045         // latest moves sent to the server that have not been confirmed yet
1046         usercmd_t movecmd[CL_MAX_USERCMDS];
1047
1048 // information for local display
1049         // health, etc
1050         int stats[MAX_CL_STATS];
1051         float *statsf; // points to stats[] array
1052         // last known inventory bit flags, for blinking
1053         int olditems;
1054         // cl.time of acquiring item, for blinking
1055         float item_gettime[32];
1056         // last known STAT_ACTIVEWEAPON
1057         int activeweapon;
1058         // cl.time of changing STAT_ACTIVEWEAPON
1059         float weapontime;
1060         // use pain anim frame if cl.time < this
1061         float faceanimtime;
1062         // for stair smoothing
1063         float stairsmoothz;
1064         double stairsmoothtime;
1065
1066         // color shifts for damage, powerups
1067         cshift_t cshifts[NUM_CSHIFTS];
1068         // and content types
1069         cshift_t prev_cshifts[NUM_CSHIFTS];
1070
1071 // the client maintains its own idea of view angles, which are
1072 // sent to the server each frame.  The server sets punchangle when
1073 // the view is temporarily offset, and an angle reset commands at the start
1074 // of each level and after teleporting.
1075
1076         // mviewangles is read from demo
1077         // viewangles is either client controlled or lerped from mviewangles
1078         vec3_t mviewangles[2], viewangles;
1079         // update by server, used by qc to do weapon recoil
1080         vec3_t mpunchangle[2], punchangle;
1081         // update by server, can be used by mods to kick view around
1082         vec3_t mpunchvector[2], punchvector;
1083         // update by server, used for lean+bob (0 is newest)
1084         vec3_t mvelocity[2], velocity;
1085         // update by server, can be used by mods for zooming
1086         vec_t mviewzoom[2], viewzoom;
1087         // if true interpolation the mviewangles and other interpolation of the
1088         // player is disabled until the next network packet
1089         // this is used primarily by teleporters, and when spectating players
1090         // special checking of the old fixangle[1] is used to differentiate
1091         // between teleporting and spectating
1092         qboolean fixangle[2];
1093
1094         // client movement simulation
1095         // these fields are only updated by CL_ClientMovement (called by CL_SendMove after parsing each network packet)
1096         // set by CL_ClientMovement_Replay functions
1097         qboolean movement_predicted;
1098         // if true the CL_ClientMovement_Replay function will update origin, etc
1099         qboolean movement_replay;
1100         // simulated data (this is valid even if cl.movement is false)
1101         vec3_t movement_origin;
1102         vec3_t movement_velocity;
1103         // whether the replay should allow a jump at the first sequence
1104         qboolean movement_replay_canjump;
1105
1106         // previous gun angles (for leaning effects)
1107         vec3_t gunangles_prev;
1108         vec3_t gunangles_highpass;
1109         vec3_t gunangles_adjustment_lowpass;
1110         vec3_t gunangles_adjustment_highpass;
1111         // previous gun angles (for leaning effects)
1112         vec3_t gunorg_prev;
1113         vec3_t gunorg_highpass;
1114         vec3_t gunorg_adjustment_lowpass;
1115         vec3_t gunorg_adjustment_highpass;
1116
1117 // pitch drifting vars
1118         float idealpitch;
1119         float pitchvel;
1120         qboolean nodrift;
1121         float driftmove;
1122         double laststop;
1123
1124 //[515]: added for csqc purposes
1125         float sensitivityscale;
1126         csqc_vidvars_t csqc_vidvars;    //[515]: these parms must be set to true by default
1127         qboolean csqc_wantsmousemove;
1128         qboolean csqc_paused; // vortex: int because could be flags
1129         struct model_s *csqc_model_precache[MAX_MODELS];
1130
1131         // local amount for smoothing stepups
1132         //float crouch;
1133
1134         // sent by server
1135         qboolean paused;
1136         qboolean onground;
1137         qboolean inwater;
1138
1139         // used by bob
1140         qboolean oldonground;
1141         double lastongroundtime;
1142         double hitgroundtime;
1143         float bob2_smooth;
1144         float bobfall_speed;
1145         float bobfall_swing;
1146         double calcrefdef_prevtime;
1147
1148         // don't change view angle, full screen, etc
1149         int intermission;
1150         // latched at intermission start
1151         double completed_time;
1152
1153         // the timestamp of the last two messages
1154         double mtime[2];
1155
1156         // clients view of time, time should be between mtime[0] and mtime[1] to
1157         // generate a lerp point for other data, oldtime is the previous frame's
1158         // value of time, frametime is the difference between time and oldtime
1159         // note: cl.time may be beyond cl.mtime[0] if packet loss is occuring, it
1160         // is only forcefully limited when a packet is received
1161         double time, oldtime;
1162         // how long it has been since the previous client frame in real time
1163         // (not game time, for that use cl.time - cl.oldtime)
1164         double realframetime;
1165         
1166         // fade var for fading while dead
1167         float deathfade;
1168
1169         // motionblur alpha level variable
1170         float motionbluralpha;
1171
1172         // copy of realtime from last recieved message, for net trouble icon
1173         float last_received_message;
1174
1175 // information that is static for the entire time connected to a server
1176         struct model_s *model_precache[MAX_MODELS];
1177         struct sfx_s *sound_precache[MAX_SOUNDS];
1178
1179         // FIXME: this is a lot of memory to be keeping around, this really should be dynamically allocated and freed somehow
1180         char model_name[MAX_MODELS][MAX_QPATH];
1181         char sound_name[MAX_SOUNDS][MAX_QPATH];
1182
1183         // for display on solo scoreboard
1184         char worldmessage[40]; // map title (not related to filename)
1185         // variants of map name
1186         char worldbasename[MAX_QPATH]; // %s
1187         char worldname[MAX_QPATH]; // maps/%s.bsp
1188         char worldnamenoextension[MAX_QPATH]; // maps/%s
1189         // cl_entitites[cl.viewentity] = player
1190         int viewentity;
1191         // the real player entity (normally same as viewentity,
1192         // different than viewentity if mod uses chasecam or other tricks)
1193         int realplayerentity;
1194         // this is updated to match cl.viewentity whenever it is in the clients
1195         // range, basically this is used in preference to cl.realplayerentity for
1196         // most purposes because when spectating another player it should show
1197         // their information rather than yours
1198         int playerentity;
1199         // max players that can be in this game
1200         int maxclients;
1201         // type of game (deathmatch, coop, singleplayer)
1202         int gametype;
1203
1204         // models and sounds used by engine code (particularly cl_parse.c)
1205         dp_model_t *model_bolt;
1206         dp_model_t *model_bolt2;
1207         dp_model_t *model_bolt3;
1208         dp_model_t *model_beam;
1209         sfx_t *sfx_wizhit;
1210         sfx_t *sfx_knighthit;
1211         sfx_t *sfx_tink1;
1212         sfx_t *sfx_ric1;
1213         sfx_t *sfx_ric2;
1214         sfx_t *sfx_ric3;
1215         sfx_t *sfx_r_exp3;
1216         // indicates that the file "sound/misc/talk2.wav" was found (for use by team chat messages)
1217         qboolean foundtalk2wav;
1218
1219 // refresh related state
1220
1221         // cl_entitites[0].model
1222         struct model_s *worldmodel;
1223
1224         // the gun model
1225         entity_t viewent;
1226
1227         // cd audio
1228         int cdtrack, looptrack;
1229
1230 // frag scoreboard
1231
1232         // [cl.maxclients]
1233         scoreboard_t *scores;
1234
1235         // keep track of svc_print parsing state (analyzes ping reports and status reports)
1236         cl_parsingtextmode_t parsingtextmode;
1237         int parsingtextplayerindex;
1238         // set by scoreboard code when sending ping command, this causes the next ping results to be hidden
1239         // (which could eat the wrong ping report if the player issues one
1240         //  manually, but they would still see a ping report, just a later one
1241         //  caused by the scoreboard code rather than the one they intentionally
1242         //  issued)
1243         int parsingtextexpectingpingforscores;
1244
1245         // entity database stuff
1246         // latest received entity frame numbers
1247 #define LATESTFRAMENUMS 32
1248         int latestframenumsposition;
1249         int latestframenums[LATESTFRAMENUMS];
1250         int latestsendnums[LATESTFRAMENUMS];
1251         entityframe_database_t *entitydatabase;
1252         entityframe4_database_t *entitydatabase4;
1253         entityframeqw_database_t *entitydatabaseqw;
1254
1255         // keep track of quake entities because they need to be killed if they get stale
1256         int lastquakeentity;
1257         unsigned char isquakeentity[MAX_EDICTS];
1258
1259         // bounding boxes for clientside movement
1260         vec3_t playerstandmins;
1261         vec3_t playerstandmaxs;
1262         vec3_t playercrouchmins;
1263         vec3_t playercrouchmaxs;
1264
1265         // old decals are killed based on this
1266         int decalsequence;
1267
1268         int max_entities;
1269         int max_csqcrenderentities;
1270         int max_static_entities;
1271         int max_effects;
1272         int max_beams;
1273         int max_dlights;
1274         int max_lightstyle;
1275         int max_brushmodel_entities;
1276         int max_particles;
1277         int max_decals;
1278         int max_showlmps;
1279
1280         entity_t *entities;
1281         entity_render_t *csqcrenderentities;
1282         unsigned char *entities_active;
1283         entity_t *static_entities;
1284         cl_effect_t *effects;
1285         beam_t *beams;
1286         dlight_t *dlights;
1287         lightstyle_t *lightstyle;
1288         int *brushmodel_entities;
1289         particle_t *particles;
1290         decal_t *decals;
1291         showlmp_t *showlmps;
1292
1293         int num_entities;
1294         int num_static_entities;
1295         int num_brushmodel_entities;
1296         int num_effects;
1297         int num_beams;
1298         int num_dlights;
1299         int num_particles;
1300         int num_decals;
1301         int num_showlmps;
1302
1303         double particles_updatetime;
1304         double decals_updatetime;
1305         int free_particle;
1306         int free_decal;
1307
1308         // cl_serverextension_download feature
1309         int loadmodel_current;
1310         int downloadmodel_current;
1311         int loadmodel_total;
1312         int loadsound_current;
1313         int downloadsound_current;
1314         int loadsound_total;
1315         qboolean downloadcsqc;
1316         qboolean loadcsqc;
1317         qboolean loadbegun;
1318         qboolean loadfinished;
1319
1320         // quakeworld stuff
1321
1322         // local copy of the server infostring
1323         char qw_serverinfo[MAX_SERVERINFO_STRING];
1324
1325         // time of last qw "pings" command sent to server while showing scores
1326         double last_ping_request;
1327
1328         // used during connect
1329         int qw_servercount;
1330
1331         // updated from serverinfo
1332         int qw_teamplay;
1333
1334         // unused: indicates whether the player is spectating
1335         // use cl.scores[cl.playerentity-1].qw_spectator instead
1336         //qboolean qw_spectator;
1337
1338         // last time an input packet was sent
1339         double lastpackettime;
1340
1341         // movement parameters for client prediction
1342         unsigned int moveflags;
1343         float movevars_wallfriction;
1344         float movevars_waterfriction;
1345         float movevars_friction;
1346         float movevars_timescale;
1347         float movevars_gravity;
1348         float movevars_stopspeed;
1349         float movevars_maxspeed;
1350         float movevars_spectatormaxspeed;
1351         float movevars_accelerate;
1352         float movevars_airaccelerate;
1353         float movevars_wateraccelerate;
1354         float movevars_entgravity;
1355         float movevars_jumpvelocity;
1356         float movevars_edgefriction;
1357         float movevars_maxairspeed;
1358         float movevars_stepheight;
1359         float movevars_airaccel_qw;
1360         float movevars_airaccel_qw_stretchfactor;
1361         float movevars_airaccel_sideways_friction;
1362         float movevars_airstopaccelerate;
1363         float movevars_airstrafeaccelerate;
1364         float movevars_maxairstrafespeed;
1365         float movevars_airstrafeaccel_qw;
1366         float movevars_aircontrol;
1367         float movevars_aircontrol_power;
1368         float movevars_aircontrol_penalty;
1369         float movevars_warsowbunny_airforwardaccel;
1370         float movevars_warsowbunny_accel;
1371         float movevars_warsowbunny_topspeed;
1372         float movevars_warsowbunny_turnaccel;
1373         float movevars_warsowbunny_backtosideratio;
1374         float movevars_ticrate;
1375         float movevars_airspeedlimit_nonqw;
1376
1377         // models used by qw protocol
1378         int qw_modelindex_spike;
1379         int qw_modelindex_player;
1380         int qw_modelindex_flag;
1381         int qw_modelindex_s_explod;
1382
1383         vec3_t qw_intermission_origin;
1384         vec3_t qw_intermission_angles;
1385
1386         // 255 is the most nails the QW protocol could send
1387         int qw_num_nails;
1388         vec_t qw_nails[255][6];
1389
1390         float qw_weaponkick;
1391
1392         int qw_validsequence;
1393
1394         int qw_deltasequence[QW_UPDATE_BACKUP];
1395
1396         // csqc stuff:
1397         // server entity number corresponding to a clientside entity
1398         unsigned short csqc_server2csqcentitynumber[MAX_EDICTS];
1399         qboolean csqc_loaded;
1400         vec3_t csqc_vieworigin;
1401         vec3_t csqc_viewangles;
1402         vec3_t csqc_vieworiginfromengine;
1403         vec3_t csqc_viewanglesfromengine;
1404         matrix4x4_t csqc_viewmodelmatrixfromengine;
1405         qboolean csqc_usecsqclistener;
1406         matrix4x4_t csqc_listenermatrix;
1407         char csqc_printtextbuf[MAX_INPUTLINE];
1408
1409         // collision culling data
1410         world_t world;
1411
1412         // loc file stuff (points and boxes describing locations in the level)
1413         cl_locnode_t *locnodes;
1414         // this is updated to cl.movement_origin whenever health is < 1
1415         // used by %d print in say/say_team messages if cl_locs_enable is on
1416         vec3_t lastdeathorigin;
1417
1418         // processing buffer used by R_BuildLightMap, reallocated as needed,
1419         // freed on each level change
1420         size_t buildlightmapmemorysize;
1421         unsigned char *buildlightmapmemory;
1422
1423         // used by EntityState5_ReadUpdate
1424         skeleton_t *engineskeletonobjects;
1425 }
1426 client_state_t;
1427
1428 //
1429 // cvars
1430 //
1431 extern cvar_t cl_name;
1432 extern cvar_t cl_color;
1433 extern cvar_t cl_rate;
1434 extern cvar_t cl_pmodel;
1435 extern cvar_t cl_playermodel;
1436 extern cvar_t cl_playerskin;
1437
1438 extern cvar_t rcon_password;
1439 extern cvar_t rcon_address;
1440
1441 extern cvar_t cl_upspeed;
1442 extern cvar_t cl_forwardspeed;
1443 extern cvar_t cl_backspeed;
1444 extern cvar_t cl_sidespeed;
1445
1446 extern cvar_t cl_movespeedkey;
1447
1448 extern cvar_t cl_yawspeed;
1449 extern cvar_t cl_pitchspeed;
1450
1451 extern cvar_t cl_anglespeedkey;
1452
1453 extern cvar_t cl_autofire;
1454
1455 extern cvar_t cl_shownet;
1456 extern cvar_t cl_nolerp;
1457 extern cvar_t cl_nettimesyncfactor;
1458 extern cvar_t cl_nettimesyncboundmode;
1459 extern cvar_t cl_nettimesyncboundtolerance;
1460
1461 extern cvar_t cl_pitchdriftspeed;
1462 extern cvar_t lookspring;
1463 extern cvar_t lookstrafe;
1464 extern cvar_t sensitivity;
1465
1466 extern cvar_t freelook;
1467
1468 extern cvar_t m_pitch;
1469 extern cvar_t m_yaw;
1470 extern cvar_t m_forward;
1471 extern cvar_t m_side;
1472
1473 extern cvar_t cl_autodemo;
1474 extern cvar_t cl_autodemo_nameformat;
1475 extern cvar_t cl_autodemo_delete;
1476
1477 extern cvar_t r_draweffects;
1478
1479 extern cvar_t cl_explosions_alpha_start;
1480 extern cvar_t cl_explosions_alpha_end;
1481 extern cvar_t cl_explosions_size_start;
1482 extern cvar_t cl_explosions_size_end;
1483 extern cvar_t cl_explosions_lifetime;
1484 extern cvar_t cl_stainmaps;
1485 extern cvar_t cl_stainmaps_clearonload;
1486
1487 extern cvar_t cl_prydoncursor;
1488 extern cvar_t cl_prydoncursor_notrace;
1489
1490 extern cvar_t cl_locs_enable;
1491
1492 extern client_state_t cl;
1493
1494 extern void CL_AllocLightFlash (entity_render_t *ent, matrix4x4_t *matrix, float radius, float red, float green, float blue, float decay, float lifetime, int cubemapnum, int style, int shadowenable, vec_t corona, vec_t coronasizescale, vec_t ambientscale, vec_t diffusescale, vec_t specularscale, int flags);
1495
1496 cl_locnode_t *CL_Locs_FindNearest(const vec3_t point);
1497 void CL_Locs_FindLocationName(char *buffer, size_t buffersize, vec3_t point);
1498
1499 //=============================================================================
1500
1501 //
1502 // cl_main
1503 //
1504
1505 void CL_Shutdown (void);
1506 void CL_Init (void);
1507
1508 void CL_EstablishConnection(const char *host, int firstarg);
1509
1510 void CL_Disconnect (void);
1511 void CL_Disconnect_f (void);
1512
1513 void CL_UpdateRenderEntity(entity_render_t *ent);
1514 void CL_SetEntityColormapColors(entity_render_t *ent, int colormap);
1515 void CL_UpdateViewEntities(void);
1516
1517 //
1518 // cl_input
1519 //
1520 typedef struct kbutton_s
1521 {
1522         int             down[2];                // key nums holding it down
1523         int             state;                  // low bit is down state
1524 }
1525 kbutton_t;
1526
1527 extern  kbutton_t       in_mlook, in_klook;
1528 extern  kbutton_t       in_strafe;
1529 extern  kbutton_t       in_speed;
1530
1531 void CL_InitInput (void);
1532 void CL_SendMove (void);
1533
1534 void CL_ValidateState(entity_state_t *s);
1535 void CL_MoveLerpEntityStates(entity_t *ent);
1536 void CL_LerpUpdate(entity_t *e);
1537 void CL_ParseTEnt (void);
1538 void CL_NewBeam (int ent, vec3_t start, vec3_t end, dp_model_t *m, int lightning);
1539 void CL_RelinkBeams (void);
1540 void CL_Beam_CalculatePositions (const beam_t *b, vec3_t start, vec3_t end);
1541 void CL_ClientMovement_Replay(void);
1542
1543 void CL_ClearTempEntities (void);
1544 entity_render_t *CL_NewTempEntity (double shadertime);
1545
1546 void CL_Effect(vec3_t org, int modelindex, int startframe, int framecount, float framerate);
1547
1548 void CL_ClearState (void);
1549 void CL_ExpandEntities(int num);
1550 void CL_ExpandCSQCRenderEntities(int num);
1551 void CL_SetInfo(const char *key, const char *value, qboolean send, qboolean allowstarkey, qboolean allowmodel, qboolean quiet);
1552
1553
1554 void CL_UpdateWorld (void);
1555 void CL_WriteToServer (void);
1556 void CL_Input (void);
1557 extern int cl_ignoremousemoves;
1558
1559
1560 float CL_KeyState (kbutton_t *key);
1561 const char *Key_KeynumToString (int keynum, char *buf, size_t buflength);
1562 int Key_StringToKeynum (const char *str);
1563
1564 //
1565 // cl_demo.c
1566 //
1567 void CL_StopPlayback(void);
1568 void CL_ReadDemoMessage(void);
1569 void CL_WriteDemoMessage(sizebuf_t *mesage);
1570
1571 void CL_CutDemo(unsigned char **buf, fs_offset_t *filesize);
1572 void CL_PasteDemo(unsigned char **buf, fs_offset_t *filesize);
1573
1574 void CL_NextDemo(void);
1575 void CL_Stop_f(void);
1576 void CL_Record_f(void);
1577 void CL_PlayDemo_f(void);
1578 void CL_TimeDemo_f(void);
1579
1580 //
1581 // cl_parse.c
1582 //
1583 void CL_Parse_Init(void);
1584 void CL_Parse_Shutdown(void);
1585 void CL_ParseServerMessage(void);
1586 void CL_Parse_DumpPacket(void);
1587 void CL_Parse_ErrorCleanUp(void);
1588 void QW_CL_StartUpload(unsigned char *data, int size);
1589 extern cvar_t qport;
1590 void CL_KeepaliveMessage(qboolean readmessages); // call this during loading of large content
1591
1592 //
1593 // view
1594 //
1595 void V_StartPitchDrift (void);
1596 void V_StopPitchDrift (void);
1597
1598 void V_Init (void);
1599 float V_CalcRoll (const vec3_t angles, const vec3_t velocity);
1600 void V_UpdateBlends (void);
1601 void V_ParseDamage (void);
1602
1603 //
1604 // cl_part
1605 //
1606
1607 extern cvar_t cl_particles;
1608 extern cvar_t cl_particles_quality;
1609 extern cvar_t cl_particles_size;
1610 extern cvar_t cl_particles_quake;
1611 extern cvar_t cl_particles_blood;
1612 extern cvar_t cl_particles_blood_alpha;
1613 extern cvar_t cl_particles_blood_decal_alpha;
1614 extern cvar_t cl_particles_blood_decal_scalemin;
1615 extern cvar_t cl_particles_blood_decal_scalemax;
1616 extern cvar_t cl_particles_blood_bloodhack;
1617 extern cvar_t cl_particles_bulletimpacts;
1618 extern cvar_t cl_particles_explosions_sparks;
1619 extern cvar_t cl_particles_explosions_shell;
1620 extern cvar_t cl_particles_rain;
1621 extern cvar_t cl_particles_snow;
1622 extern cvar_t cl_particles_smoke;
1623 extern cvar_t cl_particles_smoke_alpha;
1624 extern cvar_t cl_particles_smoke_alphafade;
1625 extern cvar_t cl_particles_sparks;
1626 extern cvar_t cl_particles_bubbles;
1627 extern cvar_t cl_decals;
1628 extern cvar_t cl_decals_time;
1629 extern cvar_t cl_decals_fadetime;
1630
1631 void CL_Particles_Clear(void);
1632 void CL_Particles_Init(void);
1633 void CL_Particles_Shutdown(void);
1634 particle_t *CL_NewParticle(const vec3_t sortorigin, unsigned short ptypeindex, int pcolor1, int pcolor2, int ptex, float psize, float psizeincrease, float palpha, float palphafade, float pgravity, float pbounce, float px, float py, float pz, float pvx, float pvy, float pvz, float pairfriction, float pliquidfriction, float originjitter, float velocityjitter, qboolean pqualityreduction, float lifetime, float stretch, pblend_t blendmode, porientation_t orientation, int staincolor1, int staincolor2, int staintex, float stainalpha, float stainsize, float angle, float spin, float tint[4]);
1635
1636 typedef enum effectnameindex_s
1637 {
1638         EFFECT_NONE,
1639         EFFECT_TE_GUNSHOT,
1640         EFFECT_TE_GUNSHOTQUAD,
1641         EFFECT_TE_SPIKE,
1642         EFFECT_TE_SPIKEQUAD,
1643         EFFECT_TE_SUPERSPIKE,
1644         EFFECT_TE_SUPERSPIKEQUAD,
1645         EFFECT_TE_WIZSPIKE,
1646         EFFECT_TE_KNIGHTSPIKE,
1647         EFFECT_TE_EXPLOSION,
1648         EFFECT_TE_EXPLOSIONQUAD,
1649         EFFECT_TE_TAREXPLOSION,
1650         EFFECT_TE_TELEPORT,
1651         EFFECT_TE_LAVASPLASH,
1652         EFFECT_TE_SMALLFLASH,
1653         EFFECT_TE_FLAMEJET,
1654         EFFECT_EF_FLAME,
1655         EFFECT_TE_BLOOD,
1656         EFFECT_TE_SPARK,
1657         EFFECT_TE_PLASMABURN,
1658         EFFECT_TE_TEI_G3,
1659         EFFECT_TE_TEI_SMOKE,
1660         EFFECT_TE_TEI_BIGEXPLOSION,
1661         EFFECT_TE_TEI_PLASMAHIT,
1662         EFFECT_EF_STARDUST,
1663         EFFECT_TR_ROCKET,
1664         EFFECT_TR_GRENADE,
1665         EFFECT_TR_BLOOD,
1666         EFFECT_TR_WIZSPIKE,
1667         EFFECT_TR_SLIGHTBLOOD,
1668         EFFECT_TR_KNIGHTSPIKE,
1669         EFFECT_TR_VORESPIKE,
1670         EFFECT_TR_NEHAHRASMOKE,
1671         EFFECT_TR_NEXUIZPLASMA,
1672         EFFECT_TR_GLOWTRAIL,
1673         EFFECT_SVC_PARTICLE,
1674         EFFECT_TOTAL
1675 }
1676 effectnameindex_t;
1677
1678 int CL_ParticleEffectIndexForName(const char *name);
1679 const char *CL_ParticleEffectNameForIndex(int i);
1680 void CL_ParticleEffect(int effectindex, float pcount, const vec3_t originmins, const vec3_t originmaxs, const vec3_t velocitymins, const vec3_t velocitymaxs, entity_t *ent, int palettecolor);
1681 void CL_ParticleTrail(int effectindex, float pcount, const vec3_t originmins, const vec3_t originmaxs, const vec3_t velocitymins, const vec3_t velocitymaxs, entity_t *ent, int palettecolor, qboolean spawndlight, qboolean spawnparticles, float tintmins[4], float tintmaxs[4]);
1682 void CL_ParseParticleEffect (void);
1683 void CL_ParticleCube (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, vec_t gravity, vec_t randomvel);
1684 void CL_ParticleRain (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, int type);
1685 void CL_EntityParticles (const entity_t *ent);
1686 void CL_ParticleExplosion (const vec3_t org);
1687 void CL_ParticleExplosion2 (const vec3_t org, int colorStart, int colorLength);
1688 void R_NewExplosion(const vec3_t org);
1689
1690 void Debug_PolygonBegin(const char *picname, int flags);
1691 void Debug_PolygonVertex(float x, float y, float z, float s, float t, float r, float g, float b, float a);
1692 void Debug_PolygonEnd(void);
1693
1694 #include "cl_screen.h"
1695
1696 extern qboolean sb_showscores;
1697
1698 float RSurf_FogVertex(const vec3_t p);
1699 float RSurf_FogPoint(const vec3_t p);
1700
1701 typedef enum r_viewport_type_e
1702 {
1703         R_VIEWPORTTYPE_ORTHO,
1704         R_VIEWPORTTYPE_PERSPECTIVE,
1705         R_VIEWPORTTYPE_PERSPECTIVE_INFINITEFARCLIP,
1706         R_VIEWPORTTYPE_PERSPECTIVECUBESIDE,
1707         R_VIEWPORTTYPE_TOTAL
1708 }
1709 r_viewport_type_t;
1710
1711 typedef struct r_viewport_s
1712 {
1713         matrix4x4_t cameramatrix; // from entity (transforms from camera entity to world)
1714         matrix4x4_t viewmatrix; // actual matrix for rendering (transforms to viewspace)
1715         matrix4x4_t projectmatrix; // actual projection matrix (transforms from viewspace to screen)
1716         int x;
1717         int y;
1718         int z;
1719         int width;
1720         int height;
1721         int depth;
1722         r_viewport_type_t type;
1723         float screentodepth[2]; // used by deferred renderer to calculate linear depth from device depth coordinates
1724 }
1725 r_viewport_t;
1726
1727 typedef struct r_refdef_view_s
1728 {
1729         // view information (changes multiple times per frame)
1730         // if any of these variables change then r_refdef.viewcache must be regenerated
1731         // by calling R_View_Update
1732         // (which also updates viewport, scissor, colormask)
1733
1734         // it is safe and expected to copy this into a structure on the stack and
1735         // call the renderer recursively, then restore from the stack afterward
1736         // (as long as R_View_Update is called)
1737
1738         // eye position information
1739         matrix4x4_t matrix, inverse_matrix;
1740         vec3_t origin;
1741         vec3_t forward;
1742         vec3_t left;
1743         vec3_t right;
1744         vec3_t up;
1745         int numfrustumplanes;
1746         mplane_t frustum[6];
1747         qboolean useclipplane;
1748         qboolean usecustompvs; // uses r_refdef.viewcache.pvsbits as-is rather than computing it
1749         mplane_t clipplane;
1750         float frustum_x, frustum_y;
1751         vec3_t frustumcorner[4];
1752         // if turned off it renders an ortho view
1753         int useperspective;
1754         float ortho_x, ortho_y;
1755
1756         // screen area to render in
1757         int x;
1758         int y;
1759         int z;
1760         int width;
1761         int height;
1762         int depth;
1763         r_viewport_t viewport; // note: if r_viewscale is used, the viewport.width and viewport.height may be less than width and height
1764
1765         // which color components to allow (for anaglyph glasses)
1766         int colormask[4];
1767
1768         // global RGB color multiplier for rendering
1769         float colorscale;
1770
1771         // whether to call R_ClearScreen before rendering stuff
1772         qboolean clear;
1773         // if true, don't clear or do any post process effects (bloom, etc)
1774         qboolean isoverlay;
1775         // if true, this is the MAIN view (which is, after CSQC, copied into the scene for use e.g. by r_speeds 1, showtex, prydon cursor)
1776         qboolean ismain;
1777
1778         // whether to draw r_showtris and such, this is only true for the main
1779         // view render, all secondary renders (mirrors, portals, cameras,
1780         // distortion effects, etc) omit such debugging information
1781         qboolean showdebug;
1782
1783         // these define which values to use in GL_CullFace calls to request frontface or backface culling
1784         int cullface_front;
1785         int cullface_back;
1786
1787         // render quality (0 to 1) - affects r_drawparticles_drawdistance and others
1788         float quality;
1789 }
1790 r_refdef_view_t;
1791
1792 typedef struct r_refdef_viewcache_s
1793 {
1794         // updated by gl_main_newmap()
1795         int maxentities;
1796         int world_numclusters;
1797         int world_numclusterbytes;
1798         int world_numleafs;
1799         int world_numsurfaces;
1800
1801         // these properties are generated by R_View_Update()
1802
1803         // which entities are currently visible for this viewpoint
1804         // (the used range is 0...r_refdef.scene.numentities)
1805         unsigned char *entityvisible;
1806
1807         // flag arrays used for visibility checking on world model
1808         // (all other entities have no per-surface/per-leaf visibility checks)
1809         unsigned char *world_pvsbits;
1810         unsigned char *world_leafvisible;
1811         unsigned char *world_surfacevisible;
1812         // if true, the view is currently in a leaf without pvs data
1813         qboolean world_novis;
1814 }
1815 r_refdef_viewcache_t;
1816
1817 // TODO: really think about which fields should go into scene and which one should stay in refdef [1/7/2008 Black]
1818 // maybe also refactor some of the functions to support different setting sources (ie. fogenabled, etc.) for different scenes
1819 typedef struct r_refdef_scene_s {
1820         // whether to call S_ExtraUpdate during render to reduce sound chop
1821         qboolean extraupdate;
1822
1823         // (client gameworld) time for rendering time based effects
1824         double time;
1825
1826         // the world
1827         entity_render_t *worldentity;
1828
1829         // same as worldentity->model
1830         dp_model_t *worldmodel;
1831
1832         // renderable entities (excluding world)
1833         entity_render_t **entities;
1834         int numentities;
1835         int maxentities;
1836
1837         // field of temporary entities that is reset each (client) frame
1838         entity_render_t *tempentities;
1839         int numtempentities;
1840         int maxtempentities;
1841         qboolean expandtempentities;
1842
1843         // renderable dynamic lights
1844         rtlight_t *lights[MAX_DLIGHTS];
1845         rtlight_t templights[MAX_DLIGHTS];
1846         int numlights;
1847
1848         // intensities for light styles right now, controls rtlights
1849         float rtlightstylevalue[MAX_LIGHTSTYLES];       // float fraction of base light value
1850         // 8.8bit fixed point intensities for light styles
1851         // controls intensity lightmap layers
1852         unsigned short lightstylevalue[MAX_LIGHTSTYLES];        // 8.8 fraction of base light value
1853
1854         float ambient;
1855
1856         qboolean rtworld;
1857         qboolean rtworldshadows;
1858         qboolean rtdlight;
1859         qboolean rtdlightshadows;
1860 } r_refdef_scene_t;
1861
1862 typedef struct r_refdef_s
1863 {
1864         // these fields define the basic rendering information for the world
1865         // but not the view, which could change multiple times in one rendered
1866         // frame (for example when rendering textures for certain effects)
1867
1868         // these are set for water warping before
1869         // frustum_x/frustum_y are calculated
1870         float frustumscale_x, frustumscale_y;
1871
1872         // current view settings (these get reset a few times during rendering because of water rendering, reflections, etc)
1873         r_refdef_view_t view;
1874         r_refdef_viewcache_t viewcache;
1875
1876         // minimum visible distance (pixels closer than this disappear)
1877         double nearclip;
1878         // maximum visible distance (pixels further than this disappear in 16bpp modes,
1879         // in 32bpp an infinite-farclip matrix is used instead)
1880         double farclip;
1881
1882         // fullscreen color blend
1883         float viewblend[4];
1884
1885         r_refdef_scene_t scene;
1886
1887         float fogplane[4];
1888         float fogplaneviewdist;
1889         qboolean fogplaneviewabove;
1890         float fogheightfade;
1891         float fogcolor[3];
1892         float fogrange;
1893         float fograngerecip;
1894         float fogmasktabledistmultiplier;
1895 #define FOGMASKTABLEWIDTH 1024
1896         float fogmasktable[FOGMASKTABLEWIDTH];
1897         float fogmasktable_start, fogmasktable_alpha, fogmasktable_range, fogmasktable_density;
1898         float fog_density;
1899         float fog_red;
1900         float fog_green;
1901         float fog_blue;
1902         float fog_alpha;
1903         float fog_start;
1904         float fog_end;
1905         float fog_height;
1906         float fog_fadedepth;
1907         qboolean fogenabled;
1908         qboolean oldgl_fogenable;
1909
1910         // new flexible texture height fog (overrides normal fog)
1911         char fog_height_texturename[64]; // note: must be 64 for the sscanf code
1912         unsigned char *fog_height_table1d;
1913         unsigned char *fog_height_table2d;
1914         int fog_height_tablesize; // enable
1915         float fog_height_tablescale;
1916         float fog_height_texcoordscale;
1917         char fogheighttexturename[64]; // detects changes to active fog height texture
1918
1919         int draw2dstage; // 0 = no, 1 = yes, other value = needs setting up again
1920
1921         // true during envmap command capture
1922         qboolean envmap;
1923
1924         // brightness of world lightmaps and related lighting
1925         // (often reduced when world rtlights are enabled)
1926         float lightmapintensity;
1927         // whether to draw world lights realtime, dlights realtime, and their shadows
1928         float polygonfactor;
1929         float polygonoffset;
1930         float shadowpolygonfactor;
1931         float shadowpolygonoffset;
1932
1933         // how long R_RenderView took on the previous frame
1934         double lastdrawscreentime;
1935
1936         // rendering stats for r_speeds display
1937         // (these are incremented in many places)
1938         int stats[r_stat_count];
1939 }
1940 r_refdef_t;
1941
1942 extern r_refdef_t r_refdef;
1943
1944 typedef enum waterlevel_e
1945 {
1946         WATERLEVEL_NONE,
1947         WATERLEVEL_WETFEET,
1948         WATERLEVEL_SWIMMING,
1949         WATERLEVEL_SUBMERGED
1950 }
1951 waterlevel_t;
1952
1953 typedef struct cl_clientmovement_state_s
1954 {
1955         // entity to be ignored for movement
1956         struct prvm_edict_s *self;
1957         // position
1958         vec3_t origin;
1959         vec3_t velocity;
1960         // current bounding box (different if crouched vs standing)
1961         vec3_t mins;
1962         vec3_t maxs;
1963         // currently on the ground
1964         qboolean onground;
1965         // currently crouching
1966         qboolean crouched;
1967         // what kind of water (SUPERCONTENTS_LAVA for instance)
1968         int watertype;
1969         // how deep
1970         waterlevel_t waterlevel;
1971         // weird hacks when jumping out of water
1972         // (this is in seconds and counts down to 0)
1973         float waterjumptime;
1974
1975         // user command
1976         usercmd_t cmd;
1977 }
1978 cl_clientmovement_state_t;
1979 void CL_ClientMovement_PlayerMove_Frame(cl_clientmovement_state_t *s);
1980
1981 // warpzone prediction hack (CSQC builtin)
1982 void CL_RotateMoves(const matrix4x4_t *m);
1983
1984 void CL_NewFrameReceived(int num);
1985 void CL_ParseEntityLump(char *entitystring);
1986 void CL_FindNonSolidLocation(const vec3_t in, vec3_t out, vec_t radius);
1987 void CL_RelinkLightFlashes(void);
1988 void Sbar_ShowFPS(void);
1989 void Sbar_ShowFPS_Update(void);
1990 void Host_SaveConfig(void);
1991 void Host_LoadConfig_f(void);
1992 void CL_UpdateMoveVars(void);
1993 void SCR_CaptureVideo_SoundFrame(const portable_sampleframe_t *paintbuffer, size_t length);
1994 void V_DriftPitch(void);
1995 void V_FadeViewFlashs(void);
1996 void V_CalcViewBlend(void);
1997 void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewangles, qboolean teleported, qboolean clonground, qboolean clcmdjump, float clstatsviewheight, qboolean cldead, qboolean clintermission, const vec3_t clvelocity);
1998 void V_CalcRefdef(void);
1999 void CL_Locs_Reload_f(void);
2000
2001 #endif
2002