2 Copyright (C) 1996-1997 Id Software, Inc.
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.
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.
13 See the GNU General Public License for more details.
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.
25 #include "matrixlib.h"
30 // NOTE: r_stat_name[] must match this indexing
37 r_stat_entities_surfaces,
38 r_stat_entities_triangles,
41 r_stat_world_surfaces,
42 r_stat_world_triangles,
43 r_stat_lightmapupdates,
44 r_stat_lightmapupdatepixels,
49 r_stat_draws_vertices,
50 r_stat_draws_elements,
53 r_stat_lights_scissored,
54 r_stat_lights_lighttriangles,
55 r_stat_lights_shadowtriangles,
56 r_stat_lights_dynamicshadowtriangles,
57 r_stat_bouncegrid_lights,
58 r_stat_bouncegrid_particles,
59 r_stat_bouncegrid_traces,
60 r_stat_bouncegrid_hits,
61 r_stat_bouncegrid_splats,
62 r_stat_bouncegrid_bounces,
63 r_stat_photoncache_animated,
64 r_stat_photoncache_cached,
65 r_stat_photoncache_traced,
67 r_stat_bloom_copypixels,
68 r_stat_bloom_drawpixels,
69 r_stat_rendertargets_used,
70 r_stat_rendertargets_pixels,
71 r_stat_indexbufferuploadcount,
72 r_stat_indexbufferuploadsize,
73 r_stat_vertexbufferuploadcount,
74 r_stat_vertexbufferuploadsize,
75 r_stat_framedatacurrent,
77 r_stat_bufferdatacurrent_vertex, // R_BUFFERDATA_ types are added to this index
78 r_stat_bufferdatacurrent_index16,
79 r_stat_bufferdatacurrent_index32,
80 r_stat_bufferdatacurrent_uniform,
81 r_stat_bufferdatasize_vertex, // R_BUFFERDATA_ types are added to this index
82 r_stat_bufferdatasize_index16,
83 r_stat_bufferdatasize_index32,
84 r_stat_bufferdatasize_uniform,
85 r_stat_animcache_skeletal_count,
86 r_stat_animcache_skeletal_bones,
87 r_stat_animcache_skeletal_maxbones,
88 r_stat_animcache_shade_count,
89 r_stat_animcache_shade_vertices,
90 r_stat_animcache_shade_maxvertices,
91 r_stat_animcache_shape_count,
92 r_stat_animcache_shape_vertices,
93 r_stat_animcache_shape_maxvertices,
95 r_stat_batch_withgaps,
96 r_stat_batch_surfaces,
97 r_stat_batch_vertices,
98 r_stat_batch_triangles,
99 r_stat_batch_fast_batches,
100 r_stat_batch_fast_surfaces,
101 r_stat_batch_fast_vertices,
102 r_stat_batch_fast_triangles,
103 r_stat_batch_copytriangles_batches,
104 r_stat_batch_copytriangles_surfaces,
105 r_stat_batch_copytriangles_vertices,
106 r_stat_batch_copytriangles_triangles,
107 r_stat_batch_dynamic_batches,
108 r_stat_batch_dynamic_surfaces,
109 r_stat_batch_dynamic_vertices,
110 r_stat_batch_dynamic_triangles,
111 r_stat_batch_dynamicskeletal_batches,
112 r_stat_batch_dynamicskeletal_surfaces,
113 r_stat_batch_dynamicskeletal_vertices,
114 r_stat_batch_dynamicskeletal_triangles,
115 r_stat_batch_dynamic_batches_because_cvar,
116 r_stat_batch_dynamic_surfaces_because_cvar,
117 r_stat_batch_dynamic_vertices_because_cvar,
118 r_stat_batch_dynamic_triangles_because_cvar,
119 r_stat_batch_dynamic_batches_because_lightmapvertex,
120 r_stat_batch_dynamic_surfaces_because_lightmapvertex,
121 r_stat_batch_dynamic_vertices_because_lightmapvertex,
122 r_stat_batch_dynamic_triangles_because_lightmapvertex,
123 r_stat_batch_dynamic_batches_because_deformvertexes_autosprite,
124 r_stat_batch_dynamic_surfaces_because_deformvertexes_autosprite,
125 r_stat_batch_dynamic_vertices_because_deformvertexes_autosprite,
126 r_stat_batch_dynamic_triangles_because_deformvertexes_autosprite,
127 r_stat_batch_dynamic_batches_because_deformvertexes_autosprite2,
128 r_stat_batch_dynamic_surfaces_because_deformvertexes_autosprite2,
129 r_stat_batch_dynamic_vertices_because_deformvertexes_autosprite2,
130 r_stat_batch_dynamic_triangles_because_deformvertexes_autosprite2,
131 r_stat_batch_dynamic_batches_because_deformvertexes_normal,
132 r_stat_batch_dynamic_surfaces_because_deformvertexes_normal,
133 r_stat_batch_dynamic_vertices_because_deformvertexes_normal,
134 r_stat_batch_dynamic_triangles_because_deformvertexes_normal,
135 r_stat_batch_dynamic_batches_because_deformvertexes_wave,
136 r_stat_batch_dynamic_surfaces_because_deformvertexes_wave,
137 r_stat_batch_dynamic_vertices_because_deformvertexes_wave,
138 r_stat_batch_dynamic_triangles_because_deformvertexes_wave,
139 r_stat_batch_dynamic_batches_because_deformvertexes_bulge,
140 r_stat_batch_dynamic_surfaces_because_deformvertexes_bulge,
141 r_stat_batch_dynamic_vertices_because_deformvertexes_bulge,
142 r_stat_batch_dynamic_triangles_because_deformvertexes_bulge,
143 r_stat_batch_dynamic_batches_because_deformvertexes_move,
144 r_stat_batch_dynamic_surfaces_because_deformvertexes_move,
145 r_stat_batch_dynamic_vertices_because_deformvertexes_move,
146 r_stat_batch_dynamic_triangles_because_deformvertexes_move,
147 r_stat_batch_dynamic_batches_because_tcgen_lightmap,
148 r_stat_batch_dynamic_surfaces_because_tcgen_lightmap,
149 r_stat_batch_dynamic_vertices_because_tcgen_lightmap,
150 r_stat_batch_dynamic_triangles_because_tcgen_lightmap,
151 r_stat_batch_dynamic_batches_because_tcgen_vector,
152 r_stat_batch_dynamic_surfaces_because_tcgen_vector,
153 r_stat_batch_dynamic_vertices_because_tcgen_vector,
154 r_stat_batch_dynamic_triangles_because_tcgen_vector,
155 r_stat_batch_dynamic_batches_because_tcgen_environment,
156 r_stat_batch_dynamic_surfaces_because_tcgen_environment,
157 r_stat_batch_dynamic_vertices_because_tcgen_environment,
158 r_stat_batch_dynamic_triangles_because_tcgen_environment,
159 r_stat_batch_dynamic_batches_because_tcmod_turbulent,
160 r_stat_batch_dynamic_surfaces_because_tcmod_turbulent,
161 r_stat_batch_dynamic_vertices_because_tcmod_turbulent,
162 r_stat_batch_dynamic_triangles_because_tcmod_turbulent,
163 r_stat_batch_dynamic_batches_because_nogaps,
164 r_stat_batch_dynamic_surfaces_because_nogaps,
165 r_stat_batch_dynamic_vertices_because_nogaps,
166 r_stat_batch_dynamic_triangles_because_nogaps,
167 r_stat_batch_dynamic_batches_because_derived,
168 r_stat_batch_dynamic_surfaces_because_derived,
169 r_stat_batch_dynamic_vertices_because_derived,
170 r_stat_batch_dynamic_triangles_because_derived,
171 r_stat_batch_entitycache_count,
172 r_stat_batch_entitycache_surfaces,
173 r_stat_batch_entitycache_vertices,
174 r_stat_batch_entitycache_triangles,
175 r_stat_batch_entityanimate_count,
176 r_stat_batch_entityanimate_surfaces,
177 r_stat_batch_entityanimate_vertices,
178 r_stat_batch_entityanimate_triangles,
179 r_stat_batch_entityskeletal_count,
180 r_stat_batch_entityskeletal_surfaces,
181 r_stat_batch_entityskeletal_vertices,
182 r_stat_batch_entityskeletal_triangles,
183 r_stat_batch_entitystatic_count,
184 r_stat_batch_entitystatic_surfaces,
185 r_stat_batch_entitystatic_vertices,
186 r_stat_batch_entitystatic_triangles,
187 r_stat_batch_entitycustom_count,
188 r_stat_batch_entitycustom_surfaces,
189 r_stat_batch_entitycustom_vertices,
190 r_stat_batch_entitycustom_triangles,
191 r_stat_count // size of array
195 // flags for rtlight rendering
196 #define LIGHTFLAG_NORMALMODE 1
197 #define LIGHTFLAG_REALTIMEMODE 2
199 typedef struct tridecal_s
201 // color and initial alpha value
202 float texcoord2f[3][2];
203 float vertex3f[3][3];
205 float plane[4]; // backface culling
206 // how long this decal has lived so far (the actual fade begins at cl_decals_time)
208 // if >= 0 this indicates the decal should follow an animated triangle
210 // for visibility culling
212 // old decals are killed to obey cl_decals_max
213 unsigned int decalsequence;
217 typedef struct decalsystem_s
220 double lastupdatetime;
229 unsigned short *element3s;
233 typedef struct effect_s
242 // these are for interpolation
249 typedef struct beam_s
252 // draw this as lightning polygons, or a model?
254 struct model_s *model;
260 typedef struct rtlight_particle_s
267 typedef struct rtlight_s
269 // note that the world to light matrices are inversely scaled (divided) by lightradius
272 /// matrix for transforming light filter coordinates to world coordinates
273 matrix4x4_t matrix_lighttoworld;
274 /// matrix for transforming world coordinates to light filter coordinates
275 matrix4x4_t matrix_worldtolight;
276 /// typically 1 1 1, can be lower (dim) or higher (overbright)
278 /// size of the light (remove?)
281 char cubemapname[64];
282 /// light style to monitor for brightness
284 /// whether light should render shadows (see castshadows for whether it actually does this frame)
286 /// intensity of corona to render
288 /// radius scale of corona to render (1.0 means same as light radius)
289 vec_t coronasizescale;
290 /// ambient intensity to render
292 /// diffuse intensity to render
294 /// specular intensity to render
296 /// LIGHTFLAG_* flags
299 // generated properties
300 /// used only for casting shadows
305 /// when r_shadow_culllights_trace is set, this is refreshed by each successful trace.
308 // rendering properties, updated each time a light is rendered
309 // this is rtlight->color * d_lightstylevalue
311 /// used by corona updates, due to occlusion query
312 float corona_visibility;
313 unsigned int corona_queryindex_visiblepixels;
314 unsigned int corona_queryindex_allpixels;
315 /// this is R_GetCubemap(rtlight->cubemapname)
316 rtexture_t *currentcubemap;
317 /// set by R_Shadow_PrepareLight to decide whether R_Shadow_DrawLight should draw it
319 /// set by R_Shadow_PrepareLight to indicate whether R_Shadow_DrawShadowMaps should do anything
321 /// these fields are set by R_Shadow_PrepareLight for later drawing
322 int cached_numlightentities;
323 int cached_numlightentities_noselfshadow;
324 int cached_numshadowentities;
325 int cached_numshadowentities_noselfshadow;
326 int cached_numsurfaces;
327 struct entity_render_s **cached_lightentities;
328 struct entity_render_s **cached_lightentities_noselfshadow;
329 struct entity_render_s **cached_shadowentities;
330 struct entity_render_s **cached_shadowentities_noselfshadow;
331 unsigned char *cached_shadowtrispvs;
332 unsigned char *cached_lighttrispvs;
333 int *cached_surfacelist;
334 // reduced light cullbox from GetLightInfo
335 vec3_t cached_cullmins;
336 vec3_t cached_cullmaxs;
337 // current shadow-caster culling planes based on view
338 // (any geometry outside these planes can not contribute to the visible
339 // shadows in any way, and thus can be culled safely)
340 int cached_numfrustumplanes;
341 mplane_t cached_frustumplanes[5]; // see R_Shadow_ComputeShadowCasterCullingPlanes
343 /// static light info
344 /// true if this light should be compiled as a static light
346 /// true if this is a compiled world light, cleared if the light changes
348 /// the size that this light should have (assuming no scene LOD kicking in to reduce it)
349 int shadowmapsidesize;
350 /// position of this light in the shadowmap atlas
351 int shadowmapatlasposition[2];
352 /// size of one side of this light in the shadowmap atlas (for omnidirectional shadowmaps this is the min corner of a 2x3 arrangement, or a 4x3 arrangement in the case of noselfshadow entities being present)
353 int shadowmapatlassidesize;
354 /// optimized and culled mesh to render for world entity shadows
355 shadowmesh_t *static_meshchain_shadow_shadowmap;
356 /// used for visibility testing (more exact than bbox)
358 int static_numleafpvsbytes;
359 int *static_leaflist;
360 unsigned char *static_leafpvs;
361 /// surfaces seen by light
362 int static_numsurfaces;
363 int *static_surfacelist;
364 /// flag bits indicating which triangles of the world model should cast
365 /// shadows, and which ones should be lit
367 /// this avoids redundantly scanning the triangles in each surface twice
368 /// for whether they should cast shadows, once in culling and once in the
369 /// actual shadowmarklist production.
370 int static_numshadowtrispvsbytes;
371 unsigned char *static_shadowtrispvs;
372 /// this allows the lighting batch code to skip backfaces andother culled
373 /// triangles not relevant for lighting
374 /// (important on big surfaces such as terrain)
375 int static_numlighttrispvsbytes;
376 unsigned char *static_lighttrispvs;
377 /// masks of all shadowmap sides that have any potential static receivers or casters
378 int static_shadowmap_receivers;
379 int static_shadowmap_casters;
380 /// particle-tracing cache for global illumination
381 int particlecache_numparticles;
382 int particlecache_maxparticles;
383 int particlecache_updateparticle;
384 rtlight_particle_t *particlecache_particles;
386 /// bouncegrid light info
387 float bouncegrid_photoncolor[3];
388 float bouncegrid_photons;
390 int bouncegrid_traces;
391 float bouncegrid_effectiveradius;
395 typedef struct dlight_s
397 // destroy light after this time
400 // the entity that owns this light (can be NULL)
402 struct entity_render_s *ent;
404 // (worldlight: saved to .rtlights file)
406 // worldlight orientation
408 // (worldlight: saved to .rtlights file)
410 // dlight orientation/scaling/location
414 // (worldlight: saved to .rtlights file)
416 // cubemap name to use on this light
417 // (worldlight: saved to .rtlights file)
418 char cubemapname[64];
419 // make light flash while selected
422 // brightness (not really radius anymore)
423 // (worldlight: saved to .rtlights file)
425 // drop intensity this much each second
428 // intensity value which is dropped over time
431 // initial values for intensity to modify
435 // light style which controls intensity of this light
436 // (worldlight: saved to .rtlights file)
439 // (worldlight: saved to .rtlights file)
442 // (worldlight: saved to .rtlights file)
444 // radius scale of corona to render (1.0 means same as light radius)
445 // (worldlight: saved to .rtlights file)
446 vec_t coronasizescale;
447 // ambient intensity to render
448 // (worldlight: saved to .rtlights file)
450 // diffuse intensity to render
451 // (worldlight: saved to .rtlights file)
453 // specular intensity to render
454 // (worldlight: saved to .rtlights file)
457 // (worldlight: saved to .rtlights file)
459 // linked list of world lights
461 struct dlight_s *next;
462 // embedded rtlight struct for renderer
468 // this is derived from processing of the framegroupblend array
469 // note: technically each framegroupblend can produce two of these, but that
470 // never happens in practice because no one blends between more than 2
471 // framegroups at once
472 #define MAX_FRAMEBLENDS (MAX_FRAMEGROUPBLENDS * 2)
473 typedef struct frameblend_s
480 // LadyHavoc: this struct is intended for the renderer but some fields are
481 // used by the client.
483 // The renderer should not rely on any changes to this struct to be persistent
484 // across multiple frames because temp entities are wiped every frame, but it
485 // is acceptable to cache things in this struct that are not critical.
487 // For example the r_cullentities_trace code does such caching.
488 typedef struct entity_render_s
494 // transform matrix for model to world
496 // transform matrix for world to model
497 matrix4x4_t inversematrix;
498 // opacity (alpha) of the model
500 // size the model is shown
502 // transparent sorting offset
503 float transparent_offset;
507 // number of the entity represents, or 0 for non-network entities
509 // literal colormap colors for renderer, if both are 0 0 0 it is not colormapped
510 vec3_t colormap_pantscolor;
511 vec3_t colormap_shirtcolor;
512 // light, particles, etc
514 // qw CTF flags and other internal-use-only effect bits
521 // colormod tinting of models
525 // interpolated animation - active framegroups and blend factors
526 framegroupblend_t framegroupblend[MAX_FRAMEGROUPBLENDS];
528 // time of last model change (for shader animations)
531 // calculated by the renderer (but not persistent)
533 // calculated during R_AddModelEntities
535 // subframe numbers (-1 if not used) and their blending scalers (0-1), if interpolation is not desired, use subframeblend[0].subframe
536 frameblend_t frameblend[MAX_FRAMEBLENDS];
537 // skeletal animation data (if skeleton.relativetransforms is not NULL, it overrides frameblend)
538 skeleton_t *skeleton;
540 // animation cache (pointers allocated using R_FrameData_Alloc)
541 // ONLY valid during R_RenderView! may be NULL (not cached)
542 float *animcache_vertex3f;
543 r_meshbuffer_t *animcache_vertex3f_vertexbuffer;
544 int animcache_vertex3f_bufferoffset;
545 float *animcache_normal3f;
546 r_meshbuffer_t *animcache_normal3f_vertexbuffer;
547 int animcache_normal3f_bufferoffset;
548 float *animcache_svector3f;
549 r_meshbuffer_t *animcache_svector3f_vertexbuffer;
550 int animcache_svector3f_bufferoffset;
551 float *animcache_tvector3f;
552 r_meshbuffer_t *animcache_tvector3f_vertexbuffer;
553 int animcache_tvector3f_bufferoffset;
554 // gpu-skinning shader needs transforms in a certain format, we have to
555 // upload this to a uniform buffer for the shader to use, and also keep a
556 // backup copy in system memory for the dynamic batch fallback code
557 // if this is not NULL, the other animcache variables are NULL
558 float *animcache_skeletaltransform3x4;
559 r_meshbuffer_t *animcache_skeletaltransform3x4buffer;
560 int animcache_skeletaltransform3x4offset;
561 int animcache_skeletaltransform3x4size;
563 // CL_UpdateEntityShading reads these fields
564 // used only if RENDER_CUSTOMIZEDMODELLIGHT is set
565 vec3_t custommodellight_ambient;
566 vec3_t custommodellight_diffuse;
567 vec3_t custommodellight_lightdir;
568 // CSQC entities get their shading from the root of their attachment chain
569 float custommodellight_origin[3];
571 // derived lighting parameters (CL_UpdateEntityShading)
573 // used by MATERIALFLAG_FULLBRIGHT which is MATERIALFLAG_MODELLIGHT with
574 // this as ambient color, along with MATERIALFLAG_NORTLIGHT
575 float render_fullbright[3];
576 // color tint for the base pass glow textures if any
577 float render_glowmod[3];
578 // MATERIALFLAG_MODELLIGHT uses these parameters
579 float render_modellight_ambient[3];
580 float render_modellight_diffuse[3];
581 float render_modellight_lightdir_world[3];
582 float render_modellight_lightdir_local[3];
583 float render_modellight_specular[3];
584 // lightmap rendering (not MATERIALFLAG_MODELLIGHT)
585 float render_lightmap_ambient[3];
586 float render_lightmap_diffuse[3];
587 float render_lightmap_specular[3];
588 // rtlights use these colors for the materials on this entity
589 float render_rtlight_diffuse[3];
590 float render_rtlight_specular[3];
591 // ignore lightmap and use fixed lighting settings on this entity (e.g. FULLBRIGHT)
592 qbool render_modellight_forced;
593 // do not process per pixel lights on this entity at all (like MATERIALFLAG_NORTLIGHT)
594 qbool render_rtlight_disabled;
595 // use the 3D lightmap from q3bsp on this entity
596 qbool render_lightgrid;
598 // storage of decals on this entity
599 // (note: if allowdecals is set, be sure to call R_DecalSystem_Reset on removal!)
601 decalsystem_t decalsystem;
603 // FIELDS UPDATED BY RENDERER:
604 // last time visible during trace culling
605 double last_trace_visibility;
607 // user wavefunc parameters (from csqc)
608 vec_t userwavefunc_param[Q3WAVEFUNC_USER_COUNT];
612 typedef struct entity_persistent_s
614 vec3_t trail_origin; // previous position for particle trail spawning
615 vec3_t oldorigin; // lerp
616 vec3_t oldangles; // lerp
617 vec3_t neworigin; // lerp
618 vec3_t newangles; // lerp
619 vec_t lerpstarttime; // lerp
620 vec_t lerpdeltatime; // lerp
621 float muzzleflash; // muzzleflash intensity, fades over time
622 float trail_time; // residual error accumulation for particle trail spawning (to keep spacing across frames)
623 qbool trail_allowed; // set to false by teleports, true by update code, prevents bad lerps
627 typedef struct entity_s
629 // baseline state (default values)
630 entity_state_t state_baseline;
631 // previous state (interpolating from this)
632 entity_state_t state_previous;
633 // current state (interpolating to this)
634 entity_state_t state_current;
636 // used for regenerating parts of render
637 entity_persistent_t persistent;
639 // the only data the renderer should know about
640 entity_render_t render;
644 typedef struct usercmd_s
648 // intended velocities
653 vec3_t cursor_screen;
656 vec3_t cursor_impact;
657 vec3_t cursor_normal;
658 vec_t cursor_fraction;
659 int cursor_entitynumber;
661 double time; // time the move is executed for (cl_movement: clienttime, non-cl_movement: receivetime)
662 double receivetime; // time the move was received at
663 double clienttime; // time to which server state the move corresponds to
664 int msec; // for predicted moves
667 unsigned int sequence;
668 qbool applied; // if false we're still accumulating a move
669 qbool predicted; // if true the sequence should be sent as 0
671 // derived properties
678 typedef struct lightstyle_s
681 char map[MAX_STYLESTRING];
684 typedef struct scoreboard_s
686 char name[MAX_SCOREBOARDNAME];
688 int colors; // two 4 bit fields
691 char qw_userinfo[MAX_USERINFO_STRING];
698 char qw_skin[MAX_QPATH];
701 typedef struct cshift_s
704 float percent; // 0-255
705 float alphafade; // (any speed)
708 #define CSHIFT_CONTENTS 0
709 #define CSHIFT_DAMAGE 1
710 #define CSHIFT_BONUS 2
711 #define CSHIFT_POWERUP 3
712 #define CSHIFT_VCSHIFT 4
713 #define NUM_CSHIFTS 5
715 #define NAME_LENGTH 64
719 // client_state_t should hold all pieces of the client state
722 #define SIGNONS 4 // signon messages to receive before connected
724 typedef enum cactive_e
726 ca_uninitialized, // during early startup
727 ca_dedicated, // a dedicated server with no ability to start a client
728 ca_disconnected, // full screen console with no connection
729 ca_connected // valid netcon, talking to a server
733 typedef enum qw_downloadtype_e
743 #define CL_MAX_DOWNLOADACKS 4
745 typedef struct cl_downloadack_s
751 typedef struct cl_soundstats_s
755 int latency_milliseconds;
760 // the client_static_t structure is persistent through an arbitrary number
761 // of server connections
763 typedef struct client_static_s
767 // all client memory allocations go in these pools
768 mempool_t *levelmempool;
769 mempool_t *permanentmempool;
772 // -1 = don't play demos
774 // list of demos in loop
775 char demos[MAX_DEMOS][MAX_DEMONAME];
776 // the actively playing demo (set by CL_PlayDemo_f)
777 char demoname[MAX_QPATH];
779 // demo recording info must be here, because record is started before
780 // entering a map (and clearing client_state_t)
782 fs_offset_t demo_lastcsprogssize;
783 int demo_lastcsprogscrc;
785 qbool demostarting; // set if currently starting a demo, to stop -demo from quitting when switching to another demo
787 // -1 = use normal cd track
790 // realtime at second frame of timedemo (LadyHavoc: changed to double)
792 int td_frames; // total frames parsed
793 double td_onesecondnexttime;
794 double td_onesecondframes;
795 double td_onesecondrealtime;
796 double td_onesecondminfps;
797 double td_onesecondmaxfps;
798 double td_onesecondavgfps;
799 int td_onesecondavgcount;
800 // LadyHavoc: pausedemo
803 // sound mixer statistics for showsound display
804 cl_soundstats_t soundstats;
806 qbool connect_trying;
807 int connect_remainingtries;
808 double connect_nextsendtime;
809 lhnetsocket_t *connect_mysocket;
810 lhnetaddress_t connect_address;
811 lhnetaddress_t rcon_address;
812 // protocol version of the server we're connected to
813 // (kept outside client_state_t because it's used between levels)
814 protocolversion_t protocol;
818 lhnetaddress_t rcon_addresses[MAX_RCONS];
819 char rcon_commands[MAX_RCONS][MAX_INPUTLINE];
820 double rcon_timeout[MAX_RCONS];
823 // connection information
826 // network connection
829 // download information
830 // (note: qw_download variables are also used)
831 cl_downloadack_t dp_downloadack[CL_MAX_DOWNLOADACKS];
833 // input sequence numbers are not reset on level change, only connect
834 unsigned int servermovesequence;
836 // quakeworld stuff below
838 // value of "qport" cvar at time of connection
840 // copied from cls.netcon->qw. variables every time they change, or set by demos (which have no cls.netcon)
841 unsigned int qw_incoming_sequence;
842 unsigned int qw_outgoing_sequence;
844 // current file download buffer (only saved when file is completed)
845 char qw_downloadname[MAX_QPATH];
846 unsigned char *qw_downloadmemory;
847 int qw_downloadmemorycursize;
848 int qw_downloadmemorymaxsize;
849 int qw_downloadnumber;
850 int qw_downloadpercent;
851 qw_downloadtype_t qw_downloadtype;
852 // transfer rate display
853 double qw_downloadspeedtime;
854 int qw_downloadspeedcount;
855 int qw_downloadspeedrate;
856 qbool qw_download_deflate;
858 // current file upload buffer (for uploading screenshots to server)
859 unsigned char *qw_uploaddata;
864 // this normally contains the following keys in quakeworld:
865 // password spectator name team skin topcolor bottomcolor rate noaim msg *ver *ip
866 char userinfo[MAX_USERINFO_STRING];
868 // extra user info for the "connect" command
869 char connect_userinfo[MAX_USERINFO_STRING];
871 #ifdef CONFIG_VIDEO_CAPTURE
872 // video capture stuff
873 capturevideostate_t capturevideo;
879 // ProQuake compatibility stuff
880 int proquake_servermod; // 0 = not proquake, 1 = proquake
881 int proquake_serverversion; // actual proquake server version * 10 (3.40 = 34, etc)
882 int proquake_serverflags; // 0 (PQF_CHEATFREE not supported)
884 // don't write-then-read csprogs.dat (useful for demo playback)
885 unsigned char *caughtcsprogsdata;
886 fs_offset_t caughtcsprogsdatasize;
888 int r_speeds_graph_length;
889 int r_speeds_graph_current;
890 int *r_speeds_graph_data;
893 int r_speeds_graph_datamin[r_stat_count];
894 int r_speeds_graph_datamax[r_stat_count];
898 extern client_static_t cls;
904 qbool drawenginesbar;
910 PARTICLE_BILLBOARD = 0,
912 PARTICLE_ORIENTED_DOUBLESIDED = 2,
915 PARTICLE_INVALID = -1
928 typedef struct particletype_s
931 porientation_t orientation;
938 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
942 typedef struct particle_s
944 // for faster batch rendering, particles are rendered in groups by effect (resulting in less perfect sorting but far less state changes)
946 // fields used by rendering: (48 bytes)
947 vec3_t sortorigin; // sort by this group origin, not particle org
949 vec3_t vel; // velocity of particle, or orientation of decal, or end point of beam
951 float alpha; // 0-255
952 float stretch; // only for sparks
954 // fields not used by rendering: (44 bytes)
957 float sizeincrease; // rate of size change per second
958 float alphafade; // how much alpha reduces per second
959 float time2; // used for snow fluttering and decal fade
960 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)
961 float gravity; // how much gravity affects this particle (1.0 = normal gravity, 0.0 = none)
962 float airfriction; // how much air friction affects this object (objects with a low mass/size ratio tend to get more air friction)
963 float liquidfriction; // how much liquid friction affects this object (objects with a low mass/size ratio tend to get more liquid friction)
964 // float delayedcollisions; // time that p->bounce becomes active
965 float delayedspawn; // time that particle appears and begins moving
966 float die; // time when this particle should be removed, regardless of alpha
968 // short variables grouped to save memory (4 bytes)
969 short angle; // base rotation of particle
970 short spin; // geometry rotation speed around the particle center normal
972 // byte variables grouped to save memory (12 bytes)
973 unsigned char color[3];
974 unsigned char qualityreduction; // enables skipping of this particle according to r_refdef.view.qualityreduction
975 unsigned char typeindex;
976 unsigned char blendmode;
977 unsigned char orientation;
978 unsigned char texnum;
979 unsigned char staincolor[3];
980 signed char staintexnum;
984 typedef enum cl_parsingtextmode_e
986 CL_PARSETEXTMODE_NONE,
987 CL_PARSETEXTMODE_PING,
988 CL_PARSETEXTMODE_STATUS,
989 CL_PARSETEXTMODE_STATUS_PLAYERID,
990 CL_PARSETEXTMODE_STATUS_PLAYERIP
992 cl_parsingtextmode_t;
994 typedef struct cl_locnode_s
996 struct cl_locnode_s *next;
1002 typedef struct showlmp_s
1013 // the client_state_t structure is wiped completely at every
1016 typedef struct client_state_s
1018 // true if playing in a local game and no one else is connected
1021 // send a clc_nop periodically until connected
1024 // current input being accumulated by mouse/joystick/etc input
1026 // latest moves sent to the server that have not been confirmed yet
1027 usercmd_t movecmd[CL_MAX_USERCMDS];
1029 // information for local display
1031 int stats[MAX_CL_STATS];
1032 float *statsf; // points to stats[] array
1033 // last known inventory bit flags, for blinking
1035 // cl.time of acquiring item, for blinking
1036 float item_gettime[32];
1037 // last known STAT_ACTIVEWEAPON
1039 // cl.time of changing STAT_ACTIVEWEAPON
1041 // use pain anim frame if cl.time < this
1043 // for stair smoothing
1045 double stairsmoothtime;
1047 // color shifts for damage, powerups
1048 cshift_t cshifts[NUM_CSHIFTS];
1049 // and content types
1050 cshift_t prev_cshifts[NUM_CSHIFTS];
1052 // the client maintains its own idea of view angles, which are
1053 // sent to the server each frame. The server sets punchangle when
1054 // the view is temporarily offset, and an angle reset commands at the start
1055 // of each level and after teleporting.
1057 // mviewangles is read from demo
1058 // viewangles is either client controlled or lerped from mviewangles
1059 vec3_t mviewangles[2], viewangles;
1060 // update by server, used by qc to do weapon recoil
1061 vec3_t mpunchangle[2], punchangle;
1062 // update by server, can be used by mods to kick view around
1063 vec3_t mpunchvector[2], punchvector;
1064 // update by server, used for lean+bob (0 is newest)
1065 vec3_t mvelocity[2], velocity;
1066 // update by server, can be used by mods for zooming
1067 vec_t mviewzoom[2], viewzoom;
1068 // if true interpolation the mviewangles and other interpolation of the
1069 // player is disabled until the next network packet
1070 // this is used primarily by teleporters, and when spectating players
1071 // special checking of the old fixangle[1] is used to differentiate
1072 // between teleporting and spectating
1075 // client movement simulation
1076 // these fields are only updated by CL_ClientMovement (called by CL_SendMove after parsing each network packet)
1077 // set by CL_ClientMovement_Replay functions
1078 qbool movement_predicted;
1079 // if true the CL_ClientMovement_Replay function will update origin, etc
1080 qbool movement_replay;
1081 // simulated data (this is valid even if cl.movement is false)
1082 vec3_t movement_origin;
1083 vec3_t movement_velocity;
1084 // whether the replay should allow a jump at the first sequence
1085 qbool movement_replay_canjump;
1087 // previous gun angles (for leaning effects)
1088 vec3_t gunangles_prev;
1089 vec3_t gunangles_highpass;
1090 vec3_t gunangles_adjustment_lowpass;
1091 vec3_t gunangles_adjustment_highpass;
1092 // previous gun angles (for leaning effects)
1094 vec3_t gunorg_highpass;
1095 vec3_t gunorg_adjustment_lowpass;
1096 vec3_t gunorg_adjustment_highpass;
1098 // pitch drifting vars
1105 //[515]: added for csqc purposes
1106 float sensitivityscale;
1107 csqc_vidvars_t csqc_vidvars; //[515]: these parms must be set to true by default
1108 qbool csqc_wantsmousemove;
1109 struct model_s *csqc_model_precache[MAX_MODELS];
1111 // local amount for smoothing stepups
1121 double lastongroundtime;
1122 double hitgroundtime;
1124 float bobfall_speed;
1125 float bobfall_swing;
1126 double calcrefdef_prevtime;
1128 // don't change view angle, full screen, etc
1130 // latched at intermission start
1131 double completed_time;
1133 // the timestamp of the last two messages
1136 // clients view of time, time should be between mtime[0] and mtime[1] to
1137 // generate a lerp point for other data, oldtime is the previous frame's
1138 // value of time, frametime is the difference between time and oldtime
1139 // note: cl.time may be beyond cl.mtime[0] if packet loss is occuring, it
1140 // is only forcefully limited when a packet is received
1141 double time, oldtime;
1142 // how long it has been since the previous client frame in real time
1143 // (not game time, for that use cl.time - cl.oldtime)
1144 double realframetime;
1146 // fade var for fading while dead
1149 // motionblur alpha level variable
1150 float motionbluralpha;
1152 // copy of realtime from last recieved message, for net trouble icon
1153 float last_received_message;
1155 // information that is static for the entire time connected to a server
1156 struct model_s *model_precache[MAX_MODELS];
1157 struct sfx_s *sound_precache[MAX_SOUNDS];
1159 // FIXME: this is a lot of memory to be keeping around, this really should be dynamically allocated and freed somehow
1160 char model_name[MAX_MODELS][MAX_QPATH];
1161 char sound_name[MAX_SOUNDS][MAX_QPATH];
1163 // for display on solo scoreboard
1164 char worldmessage[40]; // map title (not related to filename)
1165 // variants of map name
1166 char worldbasename[MAX_QPATH]; // %s
1167 char worldname[MAX_QPATH]; // maps/%s.bsp
1168 char worldnamenoextension[MAX_QPATH]; // maps/%s
1169 // cl_entitites[cl.viewentity] = player
1171 // the real player entity (normally same as viewentity,
1172 // different than viewentity if mod uses chasecam or other tricks)
1173 int realplayerentity;
1174 // this is updated to match cl.viewentity whenever it is in the clients
1175 // range, basically this is used in preference to cl.realplayerentity for
1176 // most purposes because when spectating another player it should show
1177 // their information rather than yours
1179 // max players that can be in this game
1181 // type of game (deathmatch, coop, singleplayer)
1184 // models and sounds used by engine code (particularly cl_parse.c)
1185 dp_model_t *model_bolt;
1186 dp_model_t *model_bolt2;
1187 dp_model_t *model_bolt3;
1188 dp_model_t *model_beam;
1190 sfx_t *sfx_knighthit;
1196 // indicates that the file "sound/misc/talk2.wav" was found (for use by team chat messages)
1197 qbool foundteamchatsound;
1199 // refresh related state
1201 // cl_entitites[0].model
1202 struct model_s *worldmodel;
1208 int cdtrack, looptrack;
1213 scoreboard_t *scores;
1215 // keep track of svc_print parsing state (analyzes ping reports and status reports)
1216 cl_parsingtextmode_t parsingtextmode;
1217 int parsingtextplayerindex;
1218 // set by scoreboard code when sending ping command, this causes the next ping results to be hidden
1219 // (which could eat the wrong ping report if the player issues one
1220 // manually, but they would still see a ping report, just a later one
1221 // caused by the scoreboard code rather than the one they intentionally
1223 int parsingtextexpectingpingforscores;
1225 // entity database stuff
1226 // latest received entity frame numbers
1227 #define LATESTFRAMENUMS 32
1228 int latestframenumsposition;
1229 int latestframenums[LATESTFRAMENUMS];
1230 unsigned int latestsendnums[LATESTFRAMENUMS];
1231 entityframe_database_t *entitydatabase;
1232 entityframe4_database_t *entitydatabase4;
1233 entityframeqw_database_t *entitydatabaseqw;
1235 // keep track of quake entities because they need to be killed if they get stale
1236 int lastquakeentity;
1237 unsigned char isquakeentity[MAX_EDICTS];
1239 // bounding boxes for clientside movement
1240 vec3_t playerstandmins;
1241 vec3_t playerstandmaxs;
1242 vec3_t playercrouchmins;
1243 vec3_t playercrouchmaxs;
1245 // old decals are killed based on this
1246 unsigned int decalsequence;
1249 int max_csqcrenderentities;
1250 int max_static_entities;
1255 int max_brushmodel_entities;
1260 entity_render_t *csqcrenderentities;
1261 unsigned char *entities_active;
1262 entity_t *static_entities;
1263 cl_effect_t *effects;
1266 lightstyle_t *lightstyle;
1267 int *brushmodel_entities;
1268 particle_t *particles;
1269 showlmp_t *showlmps;
1272 int num_static_entities;
1273 int num_brushmodel_entities;
1281 double particles_updatetime;
1282 double decals_updatetime;
1286 // cl_serverextension_download feature
1287 int loadmodel_current;
1288 int downloadmodel_current;
1289 int loadmodel_total;
1290 int loadsound_current;
1291 int downloadsound_current;
1292 int loadsound_total;
1300 // local copy of the server infostring
1301 char qw_serverinfo[MAX_SERVERINFO_STRING];
1303 // time of last qw "pings" command sent to server while showing scores
1304 double last_ping_request;
1306 // used during connect
1309 // updated from serverinfo
1312 // unused: indicates whether the player is spectating
1313 // use cl.scores[cl.playerentity-1].qw_spectator instead
1314 //qbool qw_spectator;
1316 // last time an input packet was sent
1317 double lastpackettime;
1319 // movement parameters for client prediction
1320 unsigned int moveflags;
1321 float movevars_wallfriction;
1322 float movevars_waterfriction;
1323 float movevars_friction;
1324 float movevars_timescale;
1325 float movevars_gravity;
1326 float movevars_stopspeed;
1327 float movevars_maxspeed;
1328 float movevars_spectatormaxspeed;
1329 float movevars_accelerate;
1330 float movevars_airaccelerate;
1331 float movevars_wateraccelerate;
1332 float movevars_entgravity;
1333 float movevars_jumpvelocity;
1334 float movevars_edgefriction;
1335 float movevars_maxairspeed;
1336 float movevars_stepheight;
1337 float movevars_airaccel_qw;
1338 float movevars_airaccel_qw_stretchfactor;
1339 float movevars_airaccel_sideways_friction;
1340 float movevars_airstopaccelerate;
1341 float movevars_airstrafeaccelerate;
1342 float movevars_maxairstrafespeed;
1343 float movevars_airstrafeaccel_qw;
1344 float movevars_aircontrol;
1345 float movevars_aircontrol_power;
1346 float movevars_aircontrol_penalty;
1347 float movevars_warsowbunny_airforwardaccel;
1348 float movevars_warsowbunny_accel;
1349 float movevars_warsowbunny_topspeed;
1350 float movevars_warsowbunny_turnaccel;
1351 float movevars_warsowbunny_backtosideratio;
1352 float movevars_ticrate;
1353 float movevars_airspeedlimit_nonqw;
1355 // models used by qw protocol
1356 int qw_modelindex_spike;
1357 int qw_modelindex_player;
1358 int qw_modelindex_flag;
1359 int qw_modelindex_s_explod;
1361 vec3_t qw_intermission_origin;
1362 vec3_t qw_intermission_angles;
1364 // 255 is the most nails the QW protocol could send
1366 vec_t qw_nails[255][6];
1368 float qw_weaponkick;
1370 unsigned int qw_validsequence;
1372 unsigned int qw_deltasequence[QW_UPDATE_BACKUP];
1375 // server entity number corresponding to a clientside entity
1376 unsigned short csqc_server2csqcentitynumber[MAX_EDICTS];
1378 vec3_t csqc_vieworigin;
1379 vec3_t csqc_viewangles;
1380 vec3_t csqc_vieworiginfromengine;
1381 vec3_t csqc_viewanglesfromengine;
1382 matrix4x4_t csqc_viewmodelmatrixfromengine;
1383 qbool csqc_usecsqclistener;
1384 matrix4x4_t csqc_listenermatrix;
1385 char csqc_printtextbuf[MAX_INPUTLINE];
1387 // collision culling data
1390 // loc file stuff (points and boxes describing locations in the level)
1391 cl_locnode_t *locnodes;
1392 // this is updated to cl.movement_origin whenever health is < 1
1393 // used by %d print in say/say_team messages if cl_locs_enable is on
1394 vec3_t lastdeathorigin;
1396 // processing buffer used by R_BuildLightMap, reallocated as needed,
1397 // freed on each level change
1398 size_t buildlightmapmemorysize;
1399 unsigned char *buildlightmapmemory;
1401 // used by EntityState5_ReadUpdate
1402 skeleton_t *engineskeletonobjects;
1409 extern cvar_t cl_name;
1410 extern cvar_t cl_color;
1411 extern cvar_t cl_rate;
1412 extern cvar_t cl_rate_burstsize;
1413 extern cvar_t cl_pmodel;
1414 extern cvar_t cl_playermodel;
1415 extern cvar_t cl_playerskin;
1417 extern cvar_t rcon_password;
1418 extern cvar_t rcon_address;
1420 extern cvar_t cl_upspeed;
1421 extern cvar_t cl_forwardspeed;
1422 extern cvar_t cl_backspeed;
1423 extern cvar_t cl_sidespeed;
1425 extern cvar_t cl_movespeedkey;
1427 extern cvar_t cl_yawspeed;
1428 extern cvar_t cl_pitchspeed;
1430 extern cvar_t cl_anglespeedkey;
1432 extern cvar_t cl_autofire;
1434 extern cvar_t cl_shownet;
1435 extern cvar_t cl_nolerp;
1436 extern cvar_t cl_nettimesyncfactor;
1437 extern cvar_t cl_nettimesyncboundmode;
1438 extern cvar_t cl_nettimesyncboundtolerance;
1440 extern cvar_t cl_pitchdriftspeed;
1441 extern cvar_t lookspring;
1442 extern cvar_t lookstrafe;
1443 extern cvar_t sensitivity;
1445 extern cvar_t freelook;
1447 extern cvar_t m_pitch;
1448 extern cvar_t m_yaw;
1449 extern cvar_t m_forward;
1450 extern cvar_t m_side;
1452 extern cvar_t cl_autodemo;
1453 extern cvar_t cl_autodemo_nameformat;
1454 extern cvar_t cl_autodemo_delete;
1456 extern cvar_t r_draweffects;
1458 extern cvar_t cl_explosions_alpha_start;
1459 extern cvar_t cl_explosions_alpha_end;
1460 extern cvar_t cl_explosions_size_start;
1461 extern cvar_t cl_explosions_size_end;
1462 extern cvar_t cl_explosions_lifetime;
1463 extern cvar_t cl_stainmaps;
1464 extern cvar_t cl_stainmaps_clearonload;
1466 extern cvar_t cl_prydoncursor;
1467 extern cvar_t cl_prydoncursor_notrace;
1469 extern cvar_t cl_locs_enable;
1471 extern client_state_t cl;
1473 extern void CL_AllocLightFlash (entity_render_t *ent, matrix4x4_t *matrix, float radius, float red, float green, float blue, float decay, float lifetime, char *cubemapname, int style, int shadowenable, vec_t corona, vec_t coronasizescale, vec_t ambientscale, vec_t diffusescale, vec_t specularscale, int flags);
1475 cl_locnode_t *CL_Locs_FindNearest(const vec3_t point);
1476 void CL_Locs_FindLocationName(char *buffer, size_t buffersize, vec3_t point);
1478 //=============================================================================
1484 double CL_Frame(double time);
1486 void CL_Shutdown (void);
1487 void CL_Init (void);
1489 void CL_EstablishConnection(const char *host, int firstarg);
1491 void CL_Disconnect (void);
1492 void CL_Disconnect_f(cmd_state_t *cmd);
1494 void CL_UpdateRenderEntity(entity_render_t *ent);
1495 void CL_SetEntityColormapColors(entity_render_t *ent, int colormap);
1496 void CL_UpdateViewEntities(void);
1501 typedef struct kbutton_s
1503 int down[2]; // key nums holding it down
1504 int state; // low bit is down state
1508 extern kbutton_t in_mlook, in_klook;
1509 extern kbutton_t in_strafe;
1510 extern kbutton_t in_speed;
1512 void CL_InitInput (void);
1513 void CL_SendMove (void);
1515 void CL_ValidateState(entity_state_t *s);
1516 void CL_MoveLerpEntityStates(entity_t *ent);
1517 void CL_LerpUpdate(entity_t *e);
1518 void CL_ParseTEnt (void);
1519 void CL_NewBeam (int ent, vec3_t start, vec3_t end, dp_model_t *m, int lightning);
1520 void CL_RelinkBeams (void);
1521 void CL_Beam_CalculatePositions (const beam_t *b, vec3_t start, vec3_t end);
1522 void CL_ClientMovement_Replay(void);
1524 void CL_ClearTempEntities (void);
1525 entity_render_t *CL_NewTempEntity (double shadertime);
1527 void CL_Effect(vec3_t org, dp_model_t *model, int startframe, int framecount, float framerate);
1529 void CL_ClearState (void);
1530 void CL_ExpandEntities(int num);
1531 void CL_ExpandCSQCRenderEntities(int num);
1532 void CL_SetInfo(const char *key, const char *value, qbool send, qbool allowstarkey, qbool allowmodel, qbool quiet);
1535 void CL_UpdateWorld (void);
1536 void CL_WriteToServer (void);
1537 void CL_Input (void);
1538 extern int cl_ignoremousemoves;
1541 float CL_KeyState (kbutton_t *key);
1546 /// adds the string as a clc_stringcmd to the client message.
1547 /// (used when there is no reason to generate a local command to do it)
1548 void CL_ForwardToServer (const char *s);
1550 /// adds the current command line as a clc_stringcmd to the client message.
1551 /// things like godmode, noclip, etc, are commands directed to the server,
1552 /// so when they are typed in at the console, they will need to be forwarded.
1553 void CL_ForwardToServer_f (cmd_state_t *cmd);
1554 void CL_InitCommands(void);
1560 void CL_StopPlayback(void);
1561 void CL_ReadDemoMessage(void);
1562 void CL_WriteDemoMessage(sizebuf_t *mesage);
1564 void CL_CutDemo(unsigned char **buf, fs_offset_t *filesize);
1565 void CL_PasteDemo(unsigned char **buf, fs_offset_t *filesize);
1567 void CL_NextDemo(void);
1568 void CL_Stop_f(cmd_state_t *cmd);
1569 void CL_Record_f(cmd_state_t *cmd);
1570 void CL_PlayDemo_f(cmd_state_t *cmd);
1571 void CL_TimeDemo_f(cmd_state_t *cmd);
1573 void CL_Demo_Init(void);
1578 void CL_Parse_Init(void);
1579 void CL_Parse_Shutdown(void);
1580 void CL_ParseServerMessage(void);
1581 void CL_Parse_DumpPacket(void);
1582 void CL_Parse_ErrorCleanUp(void);
1583 void QW_CL_StartUpload(unsigned char *data, int size);
1584 extern cvar_t qport;
1585 void CL_KeepaliveMessage(qbool readmessages); // call this during loading of large content
1591 extern cvar_t cl_particles;
1592 extern cvar_t cl_particles_quality;
1593 extern cvar_t cl_particles_size;
1594 extern cvar_t cl_particles_quake;
1595 extern cvar_t cl_particles_blood;
1596 extern cvar_t cl_particles_blood_alpha;
1597 extern cvar_t cl_particles_blood_decal_alpha;
1598 extern cvar_t cl_particles_blood_decal_scalemin;
1599 extern cvar_t cl_particles_blood_decal_scalemax;
1600 extern cvar_t cl_particles_blood_bloodhack;
1601 extern cvar_t cl_particles_bulletimpacts;
1602 extern cvar_t cl_particles_explosions_sparks;
1603 extern cvar_t cl_particles_explosions_shell;
1604 extern cvar_t cl_particles_rain;
1605 extern cvar_t cl_particles_snow;
1606 extern cvar_t cl_particles_smoke;
1607 extern cvar_t cl_particles_smoke_alpha;
1608 extern cvar_t cl_particles_smoke_alphafade;
1609 extern cvar_t cl_particles_sparks;
1610 extern cvar_t cl_particles_bubbles;
1611 extern cvar_t cl_decals;
1612 extern cvar_t cl_decals_time;
1613 extern cvar_t cl_decals_fadetime;
1615 void CL_Particles_Clear(void);
1616 void CL_Particles_Init(void);
1617 void CL_Particles_Shutdown(void);
1618 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, qbool 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]);
1620 typedef enum effectnameindex_s
1624 EFFECT_TE_GUNSHOTQUAD,
1626 EFFECT_TE_SPIKEQUAD,
1627 EFFECT_TE_SUPERSPIKE,
1628 EFFECT_TE_SUPERSPIKEQUAD,
1630 EFFECT_TE_KNIGHTSPIKE,
1631 EFFECT_TE_EXPLOSION,
1632 EFFECT_TE_EXPLOSIONQUAD,
1633 EFFECT_TE_TAREXPLOSION,
1635 EFFECT_TE_LAVASPLASH,
1636 EFFECT_TE_SMALLFLASH,
1641 EFFECT_TE_PLASMABURN,
1643 EFFECT_TE_TEI_SMOKE,
1644 EFFECT_TE_TEI_BIGEXPLOSION,
1645 EFFECT_TE_TEI_PLASMAHIT,
1651 EFFECT_TR_SLIGHTBLOOD,
1652 EFFECT_TR_KNIGHTSPIKE,
1653 EFFECT_TR_VORESPIKE,
1654 EFFECT_TR_NEHAHRASMOKE,
1655 EFFECT_TR_NEXUIZPLASMA,
1656 EFFECT_TR_GLOWTRAIL,
1657 EFFECT_SVC_PARTICLE,
1662 int CL_ParticleEffectIndexForName(const char *name);
1663 const char *CL_ParticleEffectNameForIndex(int i);
1664 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);
1665 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, qbool spawndlight, qbool spawnparticles, float tintmins[4], float tintmaxs[4], float fade);
1666 void CL_ParticleBox(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, qbool spawndlight, qbool spawnparticles, float tintmins[4], float tintmaxs[4], float fade);
1667 void CL_ParseParticleEffect (void);
1668 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);
1669 void CL_ParticleRain (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, int type);
1670 void CL_EntityParticles (const entity_t *ent);
1671 void CL_ParticleExplosion (const vec3_t org);
1672 void CL_ParticleExplosion2 (const vec3_t org, int colorStart, int colorLength);
1674 #include "cl_screen.h"
1676 extern qbool sb_showscores;
1678 typedef enum waterlevel_e
1682 WATERLEVEL_SWIMMING,
1683 WATERLEVEL_SUBMERGED
1687 typedef struct cl_clientmovement_state_s
1689 // entity to be ignored for movement
1690 struct prvm_edict_s *self;
1694 // current bounding box (different if crouched vs standing)
1697 // currently on the ground
1699 // currently crouching
1701 // what kind of water (SUPERCONTENTS_LAVA for instance)
1704 waterlevel_t waterlevel;
1705 // weird hacks when jumping out of water
1706 // (this is in seconds and counts down to 0)
1707 float waterjumptime;
1712 cl_clientmovement_state_t;
1713 void CL_ClientMovement_PlayerMove_Frame(cl_clientmovement_state_t *s);
1715 // warpzone prediction hack (CSQC builtin)
1716 void CL_RotateMoves(const matrix4x4_t *m);
1718 typedef enum meshname_e {
1719 MESH_SCENE, // CSQC R_PolygonBegin, potentially also engine particles and debug stuff
1723 extern entity_t cl_meshentities[NUM_MESHENTITIES];
1724 extern dp_model_t cl_meshentitymodels[NUM_MESHENTITIES];
1725 extern const char *cl_meshentitynames[NUM_MESHENTITIES];
1726 #define CL_Mesh_Scene() (&cl_meshentitymodels[MESH_SCENE])
1727 #define CL_Mesh_UI() (&cl_meshentitymodels[MESH_UI])
1728 void CL_MeshEntities_Scene_Clear(void);
1729 void CL_MeshEntities_Scene_AddRenderEntity(void);
1730 void CL_MeshEntities_Scene_FinalizeRenderEntity(void);
1731 void CL_UpdateEntityShading(void);
1733 void CL_NewFrameReceived(int num);
1734 void CL_ParseEntityLump(char *entitystring);
1735 void CL_FindNonSolidLocation(const vec3_t in, vec3_t out, vec_t radius);
1736 void CL_RelinkLightFlashes(void);
1737 void CL_Beam_AddPolygons(const beam_t *b);
1738 void CL_UpdateMoveVars(void);
1739 void CL_Locs_Reload_f(cmd_state_t *cmd);