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"
31 // NOTE: r_stat_name[] must match this indexing
38 r_stat_entities_surfaces,
39 r_stat_entities_triangles,
42 r_stat_world_surfaces,
43 r_stat_world_triangles,
44 r_stat_lightmapupdates,
45 r_stat_lightmapupdatepixels,
50 r_stat_draws_vertices,
51 r_stat_draws_elements,
54 r_stat_lights_scissored,
55 r_stat_lights_lighttriangles,
56 r_stat_lights_shadowtriangles,
57 r_stat_lights_dynamicshadowtriangles,
58 r_stat_bouncegrid_lights,
59 r_stat_bouncegrid_particles,
60 r_stat_bouncegrid_traces,
61 r_stat_bouncegrid_hits,
62 r_stat_bouncegrid_splats,
63 r_stat_bouncegrid_bounces,
64 r_stat_photoncache_animated,
65 r_stat_photoncache_cached,
66 r_stat_photoncache_traced,
68 r_stat_bloom_copypixels,
69 r_stat_bloom_drawpixels,
70 r_stat_rendertargets_used,
71 r_stat_rendertargets_pixels,
72 r_stat_indexbufferuploadcount,
73 r_stat_indexbufferuploadsize,
74 r_stat_vertexbufferuploadcount,
75 r_stat_vertexbufferuploadsize,
76 r_stat_framedatacurrent,
78 r_stat_bufferdatacurrent_vertex, // R_BUFFERDATA_ types are added to this index
79 r_stat_bufferdatacurrent_index16,
80 r_stat_bufferdatacurrent_index32,
81 r_stat_bufferdatacurrent_uniform,
82 r_stat_bufferdatasize_vertex, // R_BUFFERDATA_ types are added to this index
83 r_stat_bufferdatasize_index16,
84 r_stat_bufferdatasize_index32,
85 r_stat_bufferdatasize_uniform,
86 r_stat_animcache_skeletal_count,
87 r_stat_animcache_skeletal_bones,
88 r_stat_animcache_skeletal_maxbones,
89 r_stat_animcache_shade_count,
90 r_stat_animcache_shade_vertices,
91 r_stat_animcache_shade_maxvertices,
92 r_stat_animcache_shape_count,
93 r_stat_animcache_shape_vertices,
94 r_stat_animcache_shape_maxvertices,
96 r_stat_batch_withgaps,
97 r_stat_batch_surfaces,
98 r_stat_batch_vertices,
99 r_stat_batch_triangles,
100 r_stat_batch_fast_batches,
101 r_stat_batch_fast_surfaces,
102 r_stat_batch_fast_vertices,
103 r_stat_batch_fast_triangles,
104 r_stat_batch_copytriangles_batches,
105 r_stat_batch_copytriangles_surfaces,
106 r_stat_batch_copytriangles_vertices,
107 r_stat_batch_copytriangles_triangles,
108 r_stat_batch_dynamic_batches,
109 r_stat_batch_dynamic_surfaces,
110 r_stat_batch_dynamic_vertices,
111 r_stat_batch_dynamic_triangles,
112 r_stat_batch_dynamicskeletal_batches,
113 r_stat_batch_dynamicskeletal_surfaces,
114 r_stat_batch_dynamicskeletal_vertices,
115 r_stat_batch_dynamicskeletal_triangles,
116 r_stat_batch_dynamic_batches_because_cvar,
117 r_stat_batch_dynamic_surfaces_because_cvar,
118 r_stat_batch_dynamic_vertices_because_cvar,
119 r_stat_batch_dynamic_triangles_because_cvar,
120 r_stat_batch_dynamic_batches_because_lightmapvertex,
121 r_stat_batch_dynamic_surfaces_because_lightmapvertex,
122 r_stat_batch_dynamic_vertices_because_lightmapvertex,
123 r_stat_batch_dynamic_triangles_because_lightmapvertex,
124 r_stat_batch_dynamic_batches_because_deformvertexes_autosprite,
125 r_stat_batch_dynamic_surfaces_because_deformvertexes_autosprite,
126 r_stat_batch_dynamic_vertices_because_deformvertexes_autosprite,
127 r_stat_batch_dynamic_triangles_because_deformvertexes_autosprite,
128 r_stat_batch_dynamic_batches_because_deformvertexes_autosprite2,
129 r_stat_batch_dynamic_surfaces_because_deformvertexes_autosprite2,
130 r_stat_batch_dynamic_vertices_because_deformvertexes_autosprite2,
131 r_stat_batch_dynamic_triangles_because_deformvertexes_autosprite2,
132 r_stat_batch_dynamic_batches_because_deformvertexes_normal,
133 r_stat_batch_dynamic_surfaces_because_deformvertexes_normal,
134 r_stat_batch_dynamic_vertices_because_deformvertexes_normal,
135 r_stat_batch_dynamic_triangles_because_deformvertexes_normal,
136 r_stat_batch_dynamic_batches_because_deformvertexes_wave,
137 r_stat_batch_dynamic_surfaces_because_deformvertexes_wave,
138 r_stat_batch_dynamic_vertices_because_deformvertexes_wave,
139 r_stat_batch_dynamic_triangles_because_deformvertexes_wave,
140 r_stat_batch_dynamic_batches_because_deformvertexes_bulge,
141 r_stat_batch_dynamic_surfaces_because_deformvertexes_bulge,
142 r_stat_batch_dynamic_vertices_because_deformvertexes_bulge,
143 r_stat_batch_dynamic_triangles_because_deformvertexes_bulge,
144 r_stat_batch_dynamic_batches_because_deformvertexes_move,
145 r_stat_batch_dynamic_surfaces_because_deformvertexes_move,
146 r_stat_batch_dynamic_vertices_because_deformvertexes_move,
147 r_stat_batch_dynamic_triangles_because_deformvertexes_move,
148 r_stat_batch_dynamic_batches_because_tcgen_lightmap,
149 r_stat_batch_dynamic_surfaces_because_tcgen_lightmap,
150 r_stat_batch_dynamic_vertices_because_tcgen_lightmap,
151 r_stat_batch_dynamic_triangles_because_tcgen_lightmap,
152 r_stat_batch_dynamic_batches_because_tcgen_vector,
153 r_stat_batch_dynamic_surfaces_because_tcgen_vector,
154 r_stat_batch_dynamic_vertices_because_tcgen_vector,
155 r_stat_batch_dynamic_triangles_because_tcgen_vector,
156 r_stat_batch_dynamic_batches_because_tcgen_environment,
157 r_stat_batch_dynamic_surfaces_because_tcgen_environment,
158 r_stat_batch_dynamic_vertices_because_tcgen_environment,
159 r_stat_batch_dynamic_triangles_because_tcgen_environment,
160 r_stat_batch_dynamic_batches_because_tcmod_turbulent,
161 r_stat_batch_dynamic_surfaces_because_tcmod_turbulent,
162 r_stat_batch_dynamic_vertices_because_tcmod_turbulent,
163 r_stat_batch_dynamic_triangles_because_tcmod_turbulent,
164 r_stat_batch_dynamic_batches_because_nogaps,
165 r_stat_batch_dynamic_surfaces_because_nogaps,
166 r_stat_batch_dynamic_vertices_because_nogaps,
167 r_stat_batch_dynamic_triangles_because_nogaps,
168 r_stat_batch_dynamic_batches_because_derived,
169 r_stat_batch_dynamic_surfaces_because_derived,
170 r_stat_batch_dynamic_vertices_because_derived,
171 r_stat_batch_dynamic_triangles_because_derived,
172 r_stat_batch_entitycache_count,
173 r_stat_batch_entitycache_surfaces,
174 r_stat_batch_entitycache_vertices,
175 r_stat_batch_entitycache_triangles,
176 r_stat_batch_entityanimate_count,
177 r_stat_batch_entityanimate_surfaces,
178 r_stat_batch_entityanimate_vertices,
179 r_stat_batch_entityanimate_triangles,
180 r_stat_batch_entityskeletal_count,
181 r_stat_batch_entityskeletal_surfaces,
182 r_stat_batch_entityskeletal_vertices,
183 r_stat_batch_entityskeletal_triangles,
184 r_stat_batch_entitystatic_count,
185 r_stat_batch_entitystatic_surfaces,
186 r_stat_batch_entitystatic_vertices,
187 r_stat_batch_entitystatic_triangles,
188 r_stat_batch_entitycustom_count,
189 r_stat_batch_entitycustom_surfaces,
190 r_stat_batch_entitycustom_vertices,
191 r_stat_batch_entitycustom_triangles,
192 r_stat_count // size of array
196 // flags for rtlight rendering
197 #define LIGHTFLAG_NORMALMODE 1
198 #define LIGHTFLAG_REALTIMEMODE 2
200 typedef struct tridecal_s
202 // color and initial alpha value
203 float texcoord2f[3][2];
204 float vertex3f[3][3];
206 float plane[4]; // backface culling
207 // how long this decal has lived so far (the actual fade begins at cl_decals_time)
209 // if >= 0 this indicates the decal should follow an animated triangle
211 // for visibility culling
213 // old decals are killed to obey cl_decals_max
214 unsigned int decalsequence;
218 typedef struct decalsystem_s
221 double lastupdatetime;
230 unsigned short *element3s;
234 typedef struct effect_s
243 // these are for interpolation
250 typedef struct beam_s
253 // draw this as lightning polygons, or a model?
255 struct model_s *model;
261 typedef struct rtlight_particle_s
268 typedef struct rtlight_s
270 // note that the world to light matrices are inversely scaled (divided) by lightradius
273 /// matrix for transforming light filter coordinates to world coordinates
274 matrix4x4_t matrix_lighttoworld;
275 /// matrix for transforming world coordinates to light filter coordinates
276 matrix4x4_t matrix_worldtolight;
277 /// typically 1 1 1, can be lower (dim) or higher (overbright)
279 /// size of the light (remove?)
282 char cubemapname[64];
283 /// light style to monitor for brightness
285 /// whether light should render shadows (see castshadows for whether it actually does this frame)
287 /// intensity of corona to render
289 /// radius scale of corona to render (1.0 means same as light radius)
290 vec_t coronasizescale;
291 /// ambient intensity to render
293 /// diffuse intensity to render
295 /// specular intensity to render
297 /// LIGHTFLAG_* flags
300 // generated properties
301 /// used only for casting shadows
306 /// when r_shadow_culllights_trace is set, this is refreshed by each successful trace.
309 // rendering properties, updated each time a light is rendered
310 // this is rtlight->color * d_lightstylevalue
312 /// used by corona updates, due to occlusion query
313 float corona_visibility;
314 unsigned int corona_queryindex_visiblepixels;
315 unsigned int corona_queryindex_allpixels;
316 /// this is R_GetCubemap(rtlight->cubemapname)
317 rtexture_t *currentcubemap;
318 /// set by R_Shadow_PrepareLight to decide whether R_Shadow_DrawLight should draw it
320 /// set by R_Shadow_PrepareLight to indicate whether R_Shadow_DrawShadowMaps should do anything
322 /// these fields are set by R_Shadow_PrepareLight for later drawing
323 int cached_numlightentities;
324 int cached_numlightentities_noselfshadow;
325 int cached_numshadowentities;
326 int cached_numshadowentities_noselfshadow;
327 int cached_numsurfaces;
328 struct entity_render_s **cached_lightentities;
329 struct entity_render_s **cached_lightentities_noselfshadow;
330 struct entity_render_s **cached_shadowentities;
331 struct entity_render_s **cached_shadowentities_noselfshadow;
332 unsigned char *cached_shadowtrispvs;
333 unsigned char *cached_lighttrispvs;
334 int *cached_surfacelist;
335 // reduced light cullbox from GetLightInfo
336 vec3_t cached_cullmins;
337 vec3_t cached_cullmaxs;
338 // current shadow-caster culling planes based on view
339 // (any geometry outside these planes can not contribute to the visible
340 // shadows in any way, and thus can be culled safely)
341 int cached_numfrustumplanes;
342 mplane_t cached_frustumplanes[5]; // see R_Shadow_ComputeShadowCasterCullingPlanes
344 /// static light info
345 /// true if this light should be compiled as a static light
347 /// true if this is a compiled world light, cleared if the light changes
349 /// the size that this light should have (assuming no scene LOD kicking in to reduce it)
350 int shadowmapsidesize;
351 /// position of this light in the shadowmap atlas
352 int shadowmapatlasposition[2];
353 /// 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)
354 int shadowmapatlassidesize;
355 /// optimized and culled mesh to render for world entity shadows
356 shadowmesh_t *static_meshchain_shadow_shadowmap;
357 /// used for visibility testing (more exact than bbox)
359 int static_numleafpvsbytes;
360 int *static_leaflist;
361 unsigned char *static_leafpvs;
362 /// surfaces seen by light
363 int static_numsurfaces;
364 int *static_surfacelist;
365 /// flag bits indicating which triangles of the world model should cast
366 /// shadows, and which ones should be lit
368 /// this avoids redundantly scanning the triangles in each surface twice
369 /// for whether they should cast shadows, once in culling and once in the
370 /// actual shadowmarklist production.
371 int static_numshadowtrispvsbytes;
372 unsigned char *static_shadowtrispvs;
373 /// this allows the lighting batch code to skip backfaces andother culled
374 /// triangles not relevant for lighting
375 /// (important on big surfaces such as terrain)
376 int static_numlighttrispvsbytes;
377 unsigned char *static_lighttrispvs;
378 /// masks of all shadowmap sides that have any potential static receivers or casters
379 int static_shadowmap_receivers;
380 int static_shadowmap_casters;
381 /// particle-tracing cache for global illumination
382 int particlecache_numparticles;
383 int particlecache_maxparticles;
384 int particlecache_updateparticle;
385 rtlight_particle_t *particlecache_particles;
387 /// bouncegrid light info
388 float bouncegrid_photoncolor[3];
389 float bouncegrid_photons;
391 int bouncegrid_traces;
392 float bouncegrid_effectiveradius;
396 typedef struct dlight_s
398 // destroy light after this time
401 // the entity that owns this light (can be NULL)
403 struct entity_render_s *ent;
405 // (worldlight: saved to .rtlights file)
407 // worldlight orientation
409 // (worldlight: saved to .rtlights file)
411 // dlight orientation/scaling/location
415 // (worldlight: saved to .rtlights file)
417 // cubemap name to use on this light
418 // (worldlight: saved to .rtlights file)
419 char cubemapname[64];
420 // make light flash while selected
423 // brightness (not really radius anymore)
424 // (worldlight: saved to .rtlights file)
426 // drop intensity this much each second
429 // intensity value which is dropped over time
432 // initial values for intensity to modify
436 // light style which controls intensity of this light
437 // (worldlight: saved to .rtlights file)
440 // (worldlight: saved to .rtlights file)
443 // (worldlight: saved to .rtlights file)
445 // radius scale of corona to render (1.0 means same as light radius)
446 // (worldlight: saved to .rtlights file)
447 vec_t coronasizescale;
448 // ambient intensity to render
449 // (worldlight: saved to .rtlights file)
451 // diffuse intensity to render
452 // (worldlight: saved to .rtlights file)
454 // specular intensity to render
455 // (worldlight: saved to .rtlights file)
458 // (worldlight: saved to .rtlights file)
460 // linked list of world lights
462 struct dlight_s *next;
463 // embedded rtlight struct for renderer
469 // this is derived from processing of the framegroupblend array
470 // note: technically each framegroupblend can produce two of these, but that
471 // never happens in practice because no one blends between more than 2
472 // framegroups at once
473 #define MAX_FRAMEBLENDS (MAX_FRAMEGROUPBLENDS * 2)
474 typedef struct frameblend_s
481 // LadyHavoc: this struct is intended for the renderer but some fields are
482 // used by the client.
484 // The renderer should not rely on any changes to this struct to be persistent
485 // across multiple frames because temp entities are wiped every frame, but it
486 // is acceptable to cache things in this struct that are not critical.
488 // For example the r_cullentities_trace code does such caching.
489 typedef struct entity_render_s
495 // transform matrix for model to world
497 // transform matrix for world to model
498 matrix4x4_t inversematrix;
499 // opacity (alpha) of the model
501 // size the model is shown
503 // transparent sorting offset
504 float transparent_offset;
508 // number of the entity represents, or 0 for non-network entities
510 // literal colormap colors for renderer, if both are 0 0 0 it is not colormapped
511 vec3_t colormap_pantscolor;
512 vec3_t colormap_shirtcolor;
513 // light, particles, etc
515 // qw CTF flags and other internal-use-only effect bits
522 // colormod tinting of models
526 // interpolated animation - active framegroups and blend factors
527 framegroupblend_t framegroupblend[MAX_FRAMEGROUPBLENDS];
529 // time of last model change (for shader animations)
532 // calculated by the renderer (but not persistent)
534 // calculated during R_AddModelEntities
536 // subframe numbers (-1 if not used) and their blending scalers (0-1), if interpolation is not desired, use subframeblend[0].subframe
537 frameblend_t frameblend[MAX_FRAMEBLENDS];
538 // skeletal animation data (if skeleton.relativetransforms is not NULL, it overrides frameblend)
539 skeleton_t *skeleton;
541 // animation cache (pointers allocated using R_FrameData_Alloc)
542 // ONLY valid during R_RenderView! may be NULL (not cached)
543 float *animcache_vertex3f;
544 r_meshbuffer_t *animcache_vertex3f_vertexbuffer;
545 int animcache_vertex3f_bufferoffset;
546 float *animcache_normal3f;
547 r_meshbuffer_t *animcache_normal3f_vertexbuffer;
548 int animcache_normal3f_bufferoffset;
549 float *animcache_svector3f;
550 r_meshbuffer_t *animcache_svector3f_vertexbuffer;
551 int animcache_svector3f_bufferoffset;
552 float *animcache_tvector3f;
553 r_meshbuffer_t *animcache_tvector3f_vertexbuffer;
554 int animcache_tvector3f_bufferoffset;
555 // gpu-skinning shader needs transforms in a certain format, we have to
556 // upload this to a uniform buffer for the shader to use, and also keep a
557 // backup copy in system memory for the dynamic batch fallback code
558 // if this is not NULL, the other animcache variables are NULL
559 float *animcache_skeletaltransform3x4;
560 r_meshbuffer_t *animcache_skeletaltransform3x4buffer;
561 int animcache_skeletaltransform3x4offset;
562 int animcache_skeletaltransform3x4size;
564 // CL_UpdateEntityShading reads these fields
565 // used only if RENDER_CUSTOMIZEDMODELLIGHT is set
566 vec3_t custommodellight_ambient;
567 vec3_t custommodellight_diffuse;
568 vec3_t custommodellight_lightdir;
569 // CSQC entities get their shading from the root of their attachment chain
570 float custommodellight_origin[3];
572 // derived lighting parameters (CL_UpdateEntityShading)
574 // used by MATERIALFLAG_FULLBRIGHT which is MATERIALFLAG_MODELLIGHT with
575 // this as ambient color, along with MATERIALFLAG_NORTLIGHT
576 float render_fullbright[3];
577 // color tint for the base pass glow textures if any
578 float render_glowmod[3];
579 // MATERIALFLAG_MODELLIGHT uses these parameters
580 float render_modellight_ambient[3];
581 float render_modellight_diffuse[3];
582 float render_modellight_lightdir_world[3];
583 float render_modellight_lightdir_local[3];
584 float render_modellight_specular[3];
585 // lightmap rendering (not MATERIALFLAG_MODELLIGHT)
586 float render_lightmap_ambient[3];
587 float render_lightmap_diffuse[3];
588 float render_lightmap_specular[3];
589 // rtlights use these colors for the materials on this entity
590 float render_rtlight_diffuse[3];
591 float render_rtlight_specular[3];
592 // ignore lightmap and use fixed lighting settings on this entity (e.g. FULLBRIGHT)
593 qbool render_modellight_forced;
594 // do not process per pixel lights on this entity at all (like MATERIALFLAG_NORTLIGHT)
595 qbool render_rtlight_disabled;
596 // use the 3D lightmap from q3bsp on this entity
597 qbool render_lightgrid;
599 // storage of decals on this entity
600 // (note: if allowdecals is set, be sure to call R_DecalSystem_Reset on removal!)
602 decalsystem_t decalsystem;
604 // FIELDS UPDATED BY RENDERER:
605 // last time visible during trace culling
606 double last_trace_visibility;
608 // user wavefunc parameters (from csqc)
609 vec_t userwavefunc_param[Q3WAVEFUNC_USER_COUNT];
613 typedef struct entity_persistent_s
615 vec3_t trail_origin; // previous position for particle trail spawning
616 vec3_t oldorigin; // lerp
617 vec3_t oldangles; // lerp
618 vec3_t neworigin; // lerp
619 vec3_t newangles; // lerp
620 vec_t lerpstarttime; // lerp
621 vec_t lerpdeltatime; // lerp
622 float muzzleflash; // muzzleflash intensity, fades over time
623 float trail_time; // residual error accumulation for particle trail spawning (to keep spacing across frames)
624 qbool trail_allowed; // set to false by teleports, true by update code, prevents bad lerps
628 typedef struct entity_s
630 // baseline state (default values)
631 entity_state_t state_baseline;
632 // previous state (interpolating from this)
633 entity_state_t state_previous;
634 // current state (interpolating to this)
635 entity_state_t state_current;
637 // used for regenerating parts of render
638 entity_persistent_t persistent;
640 // the only data the renderer should know about
641 entity_render_t render;
645 typedef struct usercmd_s
649 // intended velocities
654 vec3_t cursor_screen;
657 vec3_t cursor_impact;
658 vec3_t cursor_normal;
659 vec_t cursor_fraction;
660 int cursor_entitynumber;
662 double time; // time the move is executed for (cl_movement: clienttime, non-cl_movement: receivetime)
663 double receivetime; // time the move was received at
664 double clienttime; // time to which server state the move corresponds to
665 int msec; // for predicted moves
668 unsigned int sequence;
669 qbool applied; // if false we're still accumulating a move
670 qbool predicted; // if true the sequence should be sent as 0
672 // derived properties
679 typedef struct lightstyle_s
682 char map[MAX_STYLESTRING];
685 typedef struct scoreboard_s
687 char name[MAX_SCOREBOARDNAME];
689 int colors; // two 4 bit fields
692 char qw_userinfo[MAX_USERINFO_STRING];
699 char qw_skin[MAX_QPATH];
702 typedef struct cshift_s
705 float percent; // 0-255
706 float alphafade; // (any speed)
709 #define CSHIFT_CONTENTS 0
710 #define CSHIFT_DAMAGE 1
711 #define CSHIFT_BONUS 2
712 #define CSHIFT_POWERUP 3
713 #define CSHIFT_VCSHIFT 4
714 #define NUM_CSHIFTS 5
716 #define NAME_LENGTH 64
720 // client_state_t should hold all pieces of the client state
723 #define SIGNONS 4 // signon messages to receive before connected
725 typedef enum cactive_e
727 ca_uninitialized, // during early startup
728 ca_dedicated, // a dedicated server with no ability to start a client
729 ca_disconnected, // full screen console with no connection
730 ca_connected // valid netcon, talking to a server
734 typedef enum qw_downloadtype_e
744 #define CL_MAX_DOWNLOADACKS 4
746 typedef struct cl_downloadack_s
752 typedef struct cl_soundstats_s
756 int latency_milliseconds;
761 // the client_static_t structure is persistent through an arbitrary number
762 // of server connections
764 typedef struct client_static_s
768 // all client memory allocations go in these pools
769 mempool_t *levelmempool;
770 mempool_t *permanentmempool;
773 // -1 = don't play demos
775 // list of demos in loop
776 char demos[MAX_DEMOS][MAX_DEMONAME];
777 // the actively playing demo (set by CL_PlayDemo_f)
778 char demoname[MAX_QPATH];
780 // demo recording info must be here, because record is started before
781 // entering a map (and clearing client_state_t)
783 fs_offset_t demo_lastcsprogssize;
784 int demo_lastcsprogscrc;
786 qbool demostarting; // set if currently starting a demo, to stop -demo from quitting when switching to another demo
788 // -1 = use normal cd track
791 // realtime at second frame of timedemo (LadyHavoc: changed to double)
793 int td_frames; // total frames parsed
794 double td_onesecondnexttime;
795 double td_onesecondframes;
796 double td_onesecondrealtime;
797 double td_onesecondminfps;
798 double td_onesecondmaxfps;
799 double td_onesecondavgfps;
800 int td_onesecondavgcount;
801 // LadyHavoc: pausedemo
804 // sound mixer statistics for showsound display
805 cl_soundstats_t soundstats;
807 qbool connect_trying;
808 int connect_remainingtries;
809 double connect_nextsendtime;
810 lhnetsocket_t *connect_mysocket;
811 lhnetaddress_t connect_address;
812 lhnetaddress_t rcon_address;
813 // protocol version of the server we're connected to
814 // (kept outside client_state_t because it's used between levels)
815 protocolversion_t protocol;
819 lhnetaddress_t rcon_addresses[MAX_RCONS];
820 char rcon_commands[MAX_RCONS][MAX_INPUTLINE];
821 double rcon_timeout[MAX_RCONS];
824 // connection information
827 // network connection
830 // download information
831 // (note: qw_download variables are also used)
832 cl_downloadack_t dp_downloadack[CL_MAX_DOWNLOADACKS];
834 // input sequence numbers are not reset on level change, only connect
835 unsigned int servermovesequence;
837 // quakeworld stuff below
839 // value of "qport" cvar at time of connection
841 // copied from cls.netcon->qw. variables every time they change, or set by demos (which have no cls.netcon)
842 unsigned int qw_incoming_sequence;
843 unsigned int qw_outgoing_sequence;
845 // current file download buffer (only saved when file is completed)
846 char qw_downloadname[MAX_QPATH];
847 unsigned char *qw_downloadmemory;
848 int qw_downloadmemorycursize;
849 int qw_downloadmemorymaxsize;
850 int qw_downloadnumber;
851 int qw_downloadpercent;
852 qw_downloadtype_t qw_downloadtype;
853 // transfer rate display
854 double qw_downloadspeedtime;
855 int qw_downloadspeedcount;
856 int qw_downloadspeedrate;
857 qbool qw_download_deflate;
859 // current file upload buffer (for uploading screenshots to server)
860 unsigned char *qw_uploaddata;
865 // this normally contains the following keys in quakeworld:
866 // password spectator name team skin topcolor bottomcolor rate noaim msg *ver *ip
867 char userinfo[MAX_USERINFO_STRING];
869 // extra user info for the "connect" command
870 char connect_userinfo[MAX_USERINFO_STRING];
872 #ifdef CONFIG_VIDEO_CAPTURE
873 // video capture stuff
874 capturevideostate_t capturevideo;
880 // ProQuake compatibility stuff
881 int proquake_servermod; // 0 = not proquake, 1 = proquake
882 int proquake_serverversion; // actual proquake server version * 10 (3.40 = 34, etc)
883 int proquake_serverflags; // 0 (PQF_CHEATFREE not supported)
885 // don't write-then-read csprogs.dat (useful for demo playback)
886 unsigned char *caughtcsprogsdata;
887 fs_offset_t caughtcsprogsdatasize;
889 int r_speeds_graph_length;
890 int r_speeds_graph_current;
891 int *r_speeds_graph_data;
894 int r_speeds_graph_datamin[r_stat_count];
895 int r_speeds_graph_datamax[r_stat_count];
899 extern client_static_t cls;
905 qbool drawenginesbar;
911 PARTICLE_BILLBOARD = 0,
913 PARTICLE_ORIENTED_DOUBLESIDED = 2,
916 PARTICLE_INVALID = -1
929 typedef struct particletype_s
932 porientation_t orientation;
939 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
943 typedef struct particle_s
945 // for faster batch rendering, particles are rendered in groups by effect (resulting in less perfect sorting but far less state changes)
947 // fields used by rendering: (48 bytes)
948 vec3_t sortorigin; // sort by this group origin, not particle org
950 vec3_t vel; // velocity of particle, or orientation of decal, or end point of beam
952 float alpha; // 0-255
953 float stretch; // only for sparks
955 // fields not used by rendering: (44 bytes)
958 float sizeincrease; // rate of size change per second
959 float alphafade; // how much alpha reduces per second
960 float time2; // used for snow fluttering and decal fade
961 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)
962 float gravity; // how much gravity affects this particle (1.0 = normal gravity, 0.0 = none)
963 float airfriction; // how much air friction affects this object (objects with a low mass/size ratio tend to get more air friction)
964 float liquidfriction; // how much liquid friction affects this object (objects with a low mass/size ratio tend to get more liquid friction)
965 // float delayedcollisions; // time that p->bounce becomes active
966 float delayedspawn; // time that particle appears and begins moving
967 float die; // time when this particle should be removed, regardless of alpha
969 // short variables grouped to save memory (4 bytes)
970 short angle; // base rotation of particle
971 short spin; // geometry rotation speed around the particle center normal
973 // byte variables grouped to save memory (12 bytes)
974 unsigned char color[3];
975 unsigned char qualityreduction; // enables skipping of this particle according to r_refdef.view.qualityreduction
976 unsigned char typeindex;
977 unsigned char blendmode;
978 unsigned char orientation;
979 unsigned char texnum;
980 unsigned char staincolor[3];
981 signed char staintexnum;
985 typedef enum cl_parsingtextmode_e
987 CL_PARSETEXTMODE_NONE,
988 CL_PARSETEXTMODE_PING,
989 CL_PARSETEXTMODE_STATUS,
990 CL_PARSETEXTMODE_STATUS_PLAYERID,
991 CL_PARSETEXTMODE_STATUS_PLAYERIP
993 cl_parsingtextmode_t;
995 typedef struct cl_locnode_s
997 struct cl_locnode_s *next;
1003 typedef struct showlmp_s
1014 // the client_state_t structure is wiped completely at every
1017 typedef struct client_state_s
1019 // true if playing in a local game and no one else is connected
1022 // send a clc_nop periodically until connected
1025 // current input being accumulated by mouse/joystick/etc input
1027 // latest moves sent to the server that have not been confirmed yet
1028 usercmd_t movecmd[CL_MAX_USERCMDS];
1030 // information for local display
1032 int stats[MAX_CL_STATS];
1033 float *statsf; // points to stats[] array
1034 // last known inventory bit flags, for blinking
1036 // cl.time of acquiring item, for blinking
1037 float item_gettime[32];
1038 // last known STAT_ACTIVEWEAPON
1040 // cl.time of changing STAT_ACTIVEWEAPON
1042 // use pain anim frame if cl.time < this
1044 // for stair smoothing
1046 double stairsmoothtime;
1048 // color shifts for damage, powerups
1049 cshift_t cshifts[NUM_CSHIFTS];
1050 // and content types
1051 cshift_t prev_cshifts[NUM_CSHIFTS];
1053 // the client maintains its own idea of view angles, which are
1054 // sent to the server each frame. The server sets punchangle when
1055 // the view is temporarily offset, and an angle reset commands at the start
1056 // of each level and after teleporting.
1058 // mviewangles is read from demo
1059 // viewangles is either client controlled or lerped from mviewangles
1060 vec3_t mviewangles[2], viewangles;
1061 // update by server, used by qc to do weapon recoil
1062 vec3_t mpunchangle[2], punchangle;
1063 // update by server, can be used by mods to kick view around
1064 vec3_t mpunchvector[2], punchvector;
1065 // update by server, used for lean+bob (0 is newest)
1066 vec3_t mvelocity[2], velocity;
1067 // update by server, can be used by mods for zooming
1068 vec_t mviewzoom[2], viewzoom;
1069 // if true interpolation the mviewangles and other interpolation of the
1070 // player is disabled until the next network packet
1071 // this is used primarily by teleporters, and when spectating players
1072 // special checking of the old fixangle[1] is used to differentiate
1073 // between teleporting and spectating
1076 // client movement simulation
1077 // these fields are only updated by CL_ClientMovement (called by CL_SendMove after parsing each network packet)
1078 // set by CL_ClientMovement_Replay functions
1079 qbool movement_predicted;
1080 // if true the CL_ClientMovement_Replay function will update origin, etc
1081 qbool movement_replay;
1082 // simulated data (this is valid even if cl.movement is false)
1083 vec3_t movement_origin;
1084 vec3_t movement_velocity;
1085 // whether the replay should allow a jump at the first sequence
1086 qbool movement_replay_canjump;
1088 // previous gun angles (for leaning effects)
1089 vec3_t gunangles_prev;
1090 vec3_t gunangles_highpass;
1091 vec3_t gunangles_adjustment_lowpass;
1092 vec3_t gunangles_adjustment_highpass;
1093 // previous gun angles (for leaning effects)
1095 vec3_t gunorg_highpass;
1096 vec3_t gunorg_adjustment_lowpass;
1097 vec3_t gunorg_adjustment_highpass;
1099 // pitch drifting vars
1106 //[515]: added for csqc purposes
1107 float sensitivityscale;
1108 csqc_vidvars_t csqc_vidvars; //[515]: these parms must be set to true by default
1109 qbool csqc_wantsmousemove;
1110 struct model_s *csqc_model_precache[MAX_MODELS];
1112 // local amount for smoothing stepups
1122 double lastongroundtime;
1123 double hitgroundtime;
1125 float bobfall_speed;
1126 float bobfall_swing;
1127 double calcrefdef_prevtime;
1129 // don't change view angle, full screen, etc
1131 // latched at intermission start
1132 double completed_time;
1134 // the timestamp of the last two messages
1137 // clients view of time, time should be between mtime[0] and mtime[1] to
1138 // generate a lerp point for other data, oldtime is the previous frame's
1139 // value of time, frametime is the difference between time and oldtime
1140 // note: cl.time may be beyond cl.mtime[0] if packet loss is occuring, it
1141 // is only forcefully limited when a packet is received
1142 double time, oldtime;
1143 // how long it has been since the previous client frame in real time
1144 // (not game time, for that use cl.time - cl.oldtime)
1145 double realframetime;
1147 // fade var for fading while dead
1150 // motionblur alpha level variable
1151 float motionbluralpha;
1153 // copy of realtime from last recieved message, for net trouble icon
1154 float last_received_message;
1156 // information that is static for the entire time connected to a server
1157 struct model_s *model_precache[MAX_MODELS];
1158 struct sfx_s *sound_precache[MAX_SOUNDS];
1160 // FIXME: this is a lot of memory to be keeping around, this really should be dynamically allocated and freed somehow
1161 char model_name[MAX_MODELS][MAX_QPATH];
1162 char sound_name[MAX_SOUNDS][MAX_QPATH];
1164 // for display on solo scoreboard
1165 char worldmessage[40]; // map title (not related to filename)
1166 // variants of map name
1167 char worldbasename[MAX_QPATH]; // %s
1168 char worldname[MAX_QPATH]; // maps/%s.bsp
1169 char worldnamenoextension[MAX_QPATH]; // maps/%s
1170 // cl_entitites[cl.viewentity] = player
1172 // the real player entity (normally same as viewentity,
1173 // different than viewentity if mod uses chasecam or other tricks)
1174 int realplayerentity;
1175 // this is updated to match cl.viewentity whenever it is in the clients
1176 // range, basically this is used in preference to cl.realplayerentity for
1177 // most purposes because when spectating another player it should show
1178 // their information rather than yours
1180 // max players that can be in this game
1182 // type of game (deathmatch, coop, singleplayer)
1185 // models and sounds used by engine code (particularly cl_parse.c)
1186 dp_model_t *model_bolt;
1187 dp_model_t *model_bolt2;
1188 dp_model_t *model_bolt3;
1189 dp_model_t *model_beam;
1191 sfx_t *sfx_knighthit;
1197 // indicates that the file "sound/misc/talk2.wav" was found (for use by team chat messages)
1198 qbool foundteamchatsound;
1200 // refresh related state
1202 // cl_entitites[0].model
1203 struct model_s *worldmodel;
1209 int cdtrack, looptrack;
1214 scoreboard_t *scores;
1216 // keep track of svc_print parsing state (analyzes ping reports and status reports)
1217 cl_parsingtextmode_t parsingtextmode;
1218 int parsingtextplayerindex;
1219 // set by scoreboard code when sending ping command, this causes the next ping results to be hidden
1220 // (which could eat the wrong ping report if the player issues one
1221 // manually, but they would still see a ping report, just a later one
1222 // caused by the scoreboard code rather than the one they intentionally
1224 int parsingtextexpectingpingforscores;
1226 // entity database stuff
1227 // latest received entity frame numbers
1228 #define LATESTFRAMENUMS 32
1229 int latestframenumsposition;
1230 int latestframenums[LATESTFRAMENUMS];
1231 unsigned int latestsendnums[LATESTFRAMENUMS];
1232 entityframe_database_t *entitydatabase;
1233 entityframe4_database_t *entitydatabase4;
1234 entityframeqw_database_t *entitydatabaseqw;
1236 // keep track of quake entities because they need to be killed if they get stale
1237 int lastquakeentity;
1238 unsigned char isquakeentity[MAX_EDICTS];
1240 // bounding boxes for clientside movement
1241 vec3_t playerstandmins;
1242 vec3_t playerstandmaxs;
1243 vec3_t playercrouchmins;
1244 vec3_t playercrouchmaxs;
1246 // old decals are killed based on this
1247 unsigned int decalsequence;
1250 int max_csqcrenderentities;
1251 int max_static_entities;
1256 int max_brushmodel_entities;
1261 entity_render_t *csqcrenderentities;
1262 unsigned char *entities_active;
1263 entity_t *static_entities;
1264 cl_effect_t *effects;
1267 lightstyle_t *lightstyle;
1268 int *brushmodel_entities;
1269 particle_t *particles;
1270 showlmp_t *showlmps;
1273 int num_static_entities;
1274 int num_brushmodel_entities;
1282 double particles_updatetime;
1283 double decals_updatetime;
1287 // cl_serverextension_download feature
1288 int loadmodel_current;
1289 int downloadmodel_current;
1290 int loadmodel_total;
1291 int loadsound_current;
1292 int downloadsound_current;
1293 int loadsound_total;
1301 // local copy of the server infostring
1302 char qw_serverinfo[MAX_SERVERINFO_STRING];
1304 // time of last qw "pings" command sent to server while showing scores
1305 double last_ping_request;
1307 // used during connect
1310 // updated from serverinfo
1313 // unused: indicates whether the player is spectating
1314 // use cl.scores[cl.playerentity-1].qw_spectator instead
1315 //qbool qw_spectator;
1317 // last time an input packet was sent
1318 double lastpackettime;
1320 // movement parameters for client prediction
1321 unsigned int moveflags;
1322 float movevars_wallfriction;
1323 float movevars_waterfriction;
1324 float movevars_friction;
1325 float movevars_timescale;
1326 float movevars_gravity;
1327 float movevars_stopspeed;
1328 float movevars_maxspeed;
1329 float movevars_spectatormaxspeed;
1330 float movevars_accelerate;
1331 float movevars_airaccelerate;
1332 float movevars_wateraccelerate;
1333 float movevars_entgravity;
1334 float movevars_jumpvelocity;
1335 float movevars_edgefriction;
1336 float movevars_maxairspeed;
1337 float movevars_stepheight;
1338 float movevars_airaccel_qw;
1339 float movevars_airaccel_qw_stretchfactor;
1340 float movevars_airaccel_sideways_friction;
1341 float movevars_airstopaccelerate;
1342 float movevars_airstrafeaccelerate;
1343 float movevars_maxairstrafespeed;
1344 float movevars_airstrafeaccel_qw;
1345 float movevars_aircontrol;
1346 float movevars_aircontrol_power;
1347 float movevars_aircontrol_penalty;
1348 float movevars_warsowbunny_airforwardaccel;
1349 float movevars_warsowbunny_accel;
1350 float movevars_warsowbunny_topspeed;
1351 float movevars_warsowbunny_turnaccel;
1352 float movevars_warsowbunny_backtosideratio;
1353 float movevars_ticrate;
1354 float movevars_airspeedlimit_nonqw;
1356 // models used by qw protocol
1357 int qw_modelindex_spike;
1358 int qw_modelindex_player;
1359 int qw_modelindex_flag;
1360 int qw_modelindex_s_explod;
1362 vec3_t qw_intermission_origin;
1363 vec3_t qw_intermission_angles;
1365 // 255 is the most nails the QW protocol could send
1367 vec_t qw_nails[255][6];
1369 float qw_weaponkick;
1371 unsigned int qw_validsequence;
1373 unsigned int qw_deltasequence[QW_UPDATE_BACKUP];
1376 // server entity number corresponding to a clientside entity
1377 unsigned short csqc_server2csqcentitynumber[MAX_EDICTS];
1379 vec3_t csqc_vieworigin;
1380 vec3_t csqc_viewangles;
1381 vec3_t csqc_vieworiginfromengine;
1382 vec3_t csqc_viewanglesfromengine;
1383 matrix4x4_t csqc_viewmodelmatrixfromengine;
1384 qbool csqc_usecsqclistener;
1385 matrix4x4_t csqc_listenermatrix;
1386 char csqc_printtextbuf[MAX_INPUTLINE];
1388 // collision culling data
1391 // loc file stuff (points and boxes describing locations in the level)
1392 cl_locnode_t *locnodes;
1393 // this is updated to cl.movement_origin whenever health is < 1
1394 // used by %d print in say/say_team messages if cl_locs_enable is on
1395 vec3_t lastdeathorigin;
1397 // processing buffer used by R_BuildLightMap, reallocated as needed,
1398 // freed on each level change
1399 size_t buildlightmapmemorysize;
1400 unsigned char *buildlightmapmemory;
1402 // used by EntityState5_ReadUpdate
1403 skeleton_t *engineskeletonobjects;
1410 extern cvar_t cl_name;
1411 extern cvar_t cl_color;
1412 extern cvar_t cl_rate;
1413 extern cvar_t cl_rate_burstsize;
1414 extern cvar_t cl_pmodel;
1415 extern cvar_t cl_playermodel;
1416 extern cvar_t cl_playerskin;
1418 extern cvar_t rcon_password;
1419 extern cvar_t rcon_address;
1421 extern cvar_t cl_upspeed;
1422 extern cvar_t cl_forwardspeed;
1423 extern cvar_t cl_backspeed;
1424 extern cvar_t cl_sidespeed;
1426 extern cvar_t cl_movespeedkey;
1428 extern cvar_t cl_yawspeed;
1429 extern cvar_t cl_pitchspeed;
1431 extern cvar_t cl_anglespeedkey;
1433 extern cvar_t cl_autofire;
1435 extern cvar_t cl_shownet;
1436 extern cvar_t cl_nolerp;
1437 extern cvar_t cl_nettimesyncfactor;
1438 extern cvar_t cl_nettimesyncboundmode;
1439 extern cvar_t cl_nettimesyncboundtolerance;
1441 extern cvar_t cl_pitchdriftspeed;
1442 extern cvar_t lookspring;
1443 extern cvar_t lookstrafe;
1444 extern cvar_t sensitivity;
1446 extern cvar_t freelook;
1448 extern cvar_t m_pitch;
1449 extern cvar_t m_yaw;
1450 extern cvar_t m_forward;
1451 extern cvar_t m_side;
1453 extern cvar_t cl_autodemo;
1454 extern cvar_t cl_autodemo_nameformat;
1455 extern cvar_t cl_autodemo_delete;
1457 extern cvar_t r_draweffects;
1459 extern cvar_t cl_explosions_alpha_start;
1460 extern cvar_t cl_explosions_alpha_end;
1461 extern cvar_t cl_explosions_size_start;
1462 extern cvar_t cl_explosions_size_end;
1463 extern cvar_t cl_explosions_lifetime;
1464 extern cvar_t cl_stainmaps;
1465 extern cvar_t cl_stainmaps_clearonload;
1467 extern cvar_t cl_prydoncursor;
1468 extern cvar_t cl_prydoncursor_notrace;
1470 extern cvar_t cl_locs_enable;
1472 extern client_state_t cl;
1474 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);
1476 cl_locnode_t *CL_Locs_FindNearest(const vec3_t point);
1477 void CL_Locs_FindLocationName(char *buffer, size_t buffersize, vec3_t point);
1479 //=============================================================================
1485 double CL_Frame(double time);
1487 void CL_Shutdown (void);
1488 void CL_Init (void);
1490 void CL_EstablishConnection(const char *host, int firstarg);
1492 void CL_Disconnect (void);
1493 void CL_Disconnect_f(cmd_state_t *cmd);
1495 void CL_UpdateRenderEntity(entity_render_t *ent);
1496 void CL_SetEntityColormapColors(entity_render_t *ent, int colormap);
1497 void CL_UpdateViewEntities(void);
1502 typedef struct kbutton_s
1504 int down[2]; // key nums holding it down
1505 int state; // low bit is down state
1509 extern kbutton_t in_mlook, in_klook;
1510 extern kbutton_t in_strafe;
1511 extern kbutton_t in_speed;
1513 void CL_InitInput (void);
1514 void CL_SendMove (void);
1516 void CL_ValidateState(entity_state_t *s);
1517 void CL_MoveLerpEntityStates(entity_t *ent);
1518 void CL_LerpUpdate(entity_t *e);
1519 void CL_ParseTEnt (void);
1520 void CL_NewBeam (int ent, vec3_t start, vec3_t end, dp_model_t *m, int lightning);
1521 void CL_RelinkBeams (void);
1522 void CL_Beam_CalculatePositions (const beam_t *b, vec3_t start, vec3_t end);
1523 void CL_ClientMovement_Replay(void);
1525 void CL_ClearTempEntities (void);
1526 entity_render_t *CL_NewTempEntity (double shadertime);
1528 void CL_Effect(vec3_t org, dp_model_t *model, int startframe, int framecount, float framerate);
1530 void CL_ClearState (void);
1531 void CL_ExpandEntities(int num);
1532 void CL_ExpandCSQCRenderEntities(int num);
1533 void CL_SetInfo(const char *key, const char *value, qbool send, qbool allowstarkey, qbool allowmodel, qbool quiet);
1536 void CL_UpdateWorld (void);
1537 void CL_WriteToServer (void);
1538 void CL_Input (void);
1539 extern int cl_ignoremousemoves;
1542 float CL_KeyState (kbutton_t *key);
1547 /// adds the string as a clc_stringcmd to the client message.
1548 /// (used when there is no reason to generate a local command to do it)
1549 void CL_ForwardToServer (const char *s);
1551 /// adds the current command line as a clc_stringcmd to the client message.
1552 /// things like godmode, noclip, etc, are commands directed to the server,
1553 /// so when they are typed in at the console, they will need to be forwarded.
1554 void CL_ForwardToServer_f (cmd_state_t *cmd);
1555 void CL_InitCommands(void);
1561 void CL_StopPlayback(void);
1562 void CL_ReadDemoMessage(void);
1563 void CL_WriteDemoMessage(sizebuf_t *mesage);
1565 void CL_CutDemo(unsigned char **buf, fs_offset_t *filesize);
1566 void CL_PasteDemo(unsigned char **buf, fs_offset_t *filesize);
1568 void CL_NextDemo(void);
1569 void CL_Stop_f(cmd_state_t *cmd);
1570 void CL_Record_f(cmd_state_t *cmd);
1571 void CL_PlayDemo_f(cmd_state_t *cmd);
1572 void CL_TimeDemo_f(cmd_state_t *cmd);
1574 void CL_Demo_Init(void);
1581 extern cvar_t cl_particles;
1582 extern cvar_t cl_particles_quality;
1583 extern cvar_t cl_particles_size;
1584 extern cvar_t cl_particles_quake;
1585 extern cvar_t cl_particles_blood;
1586 extern cvar_t cl_particles_blood_alpha;
1587 extern cvar_t cl_particles_blood_decal_alpha;
1588 extern cvar_t cl_particles_blood_decal_scalemin;
1589 extern cvar_t cl_particles_blood_decal_scalemax;
1590 extern cvar_t cl_particles_blood_bloodhack;
1591 extern cvar_t cl_particles_bulletimpacts;
1592 extern cvar_t cl_particles_explosions_sparks;
1593 extern cvar_t cl_particles_explosions_shell;
1594 extern cvar_t cl_particles_rain;
1595 extern cvar_t cl_particles_snow;
1596 extern cvar_t cl_particles_smoke;
1597 extern cvar_t cl_particles_smoke_alpha;
1598 extern cvar_t cl_particles_smoke_alphafade;
1599 extern cvar_t cl_particles_sparks;
1600 extern cvar_t cl_particles_bubbles;
1601 extern cvar_t cl_decals;
1602 extern cvar_t cl_decals_time;
1603 extern cvar_t cl_decals_fadetime;
1605 void CL_Particles_Clear(void);
1606 void CL_Particles_Init(void);
1607 void CL_Particles_Shutdown(void);
1608 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]);
1610 typedef enum effectnameindex_s
1614 EFFECT_TE_GUNSHOTQUAD,
1616 EFFECT_TE_SPIKEQUAD,
1617 EFFECT_TE_SUPERSPIKE,
1618 EFFECT_TE_SUPERSPIKEQUAD,
1620 EFFECT_TE_KNIGHTSPIKE,
1621 EFFECT_TE_EXPLOSION,
1622 EFFECT_TE_EXPLOSIONQUAD,
1623 EFFECT_TE_TAREXPLOSION,
1625 EFFECT_TE_LAVASPLASH,
1626 EFFECT_TE_SMALLFLASH,
1631 EFFECT_TE_PLASMABURN,
1633 EFFECT_TE_TEI_SMOKE,
1634 EFFECT_TE_TEI_BIGEXPLOSION,
1635 EFFECT_TE_TEI_PLASMAHIT,
1641 EFFECT_TR_SLIGHTBLOOD,
1642 EFFECT_TR_KNIGHTSPIKE,
1643 EFFECT_TR_VORESPIKE,
1644 EFFECT_TR_NEHAHRASMOKE,
1645 EFFECT_TR_NEXUIZPLASMA,
1646 EFFECT_TR_GLOWTRAIL,
1647 EFFECT_SVC_PARTICLE,
1652 int CL_ParticleEffectIndexForName(const char *name);
1653 const char *CL_ParticleEffectNameForIndex(int i);
1654 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);
1655 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);
1656 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);
1657 void CL_ParseParticleEffect (void);
1658 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);
1659 void CL_ParticleRain (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, int type);
1660 void CL_EntityParticles (const entity_t *ent);
1661 void CL_ParticleExplosion (const vec3_t org);
1662 void CL_ParticleExplosion2 (const vec3_t org, int colorStart, int colorLength);
1664 #include "cl_screen.h"
1666 extern qbool sb_showscores;
1668 typedef enum waterlevel_e
1672 WATERLEVEL_SWIMMING,
1673 WATERLEVEL_SUBMERGED
1677 typedef struct cl_clientmovement_state_s
1679 // entity to be ignored for movement
1680 struct prvm_edict_s *self;
1684 // current bounding box (different if crouched vs standing)
1687 // currently on the ground
1689 // currently crouching
1691 // what kind of water (SUPERCONTENTS_LAVA for instance)
1694 waterlevel_t waterlevel;
1695 // weird hacks when jumping out of water
1696 // (this is in seconds and counts down to 0)
1697 float waterjumptime;
1702 cl_clientmovement_state_t;
1703 void CL_ClientMovement_PlayerMove_Frame(cl_clientmovement_state_t *s);
1705 // warpzone prediction hack (CSQC builtin)
1706 void CL_RotateMoves(const matrix4x4_t *m);
1708 typedef enum meshname_e {
1709 MESH_SCENE, // CSQC R_PolygonBegin, potentially also engine particles and debug stuff
1713 extern entity_t cl_meshentities[NUM_MESHENTITIES];
1714 extern dp_model_t cl_meshentitymodels[NUM_MESHENTITIES];
1715 extern const char *cl_meshentitynames[NUM_MESHENTITIES];
1716 #define CL_Mesh_Scene() (&cl_meshentitymodels[MESH_SCENE])
1717 #define CL_Mesh_UI() (&cl_meshentitymodels[MESH_UI])
1718 void CL_MeshEntities_Scene_Clear(void);
1719 void CL_MeshEntities_Scene_AddRenderEntity(void);
1720 void CL_MeshEntities_Scene_FinalizeRenderEntity(void);
1721 void CL_UpdateEntityShading(void);
1723 void CL_NewFrameReceived(int num);
1724 void CL_ParseEntityLump(char *entitystring);
1725 void CL_FindNonSolidLocation(const vec3_t in, vec3_t out, vec_t radius);
1726 void CL_RelinkLightFlashes(void);
1727 void CL_Beam_AddPolygons(const beam_t *b);
1728 void CL_UpdateMoveVars(void);
1729 void CL_Locs_Reload_f(cmd_state_t *cmd);