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 // LordHavoc: 256 dynamic lights
26 #define MAX_DLIGHTS 256
27 // LordHavoc: this affects the lighting scale of the whole game
28 #define LIGHTOFFSET 1024.0f
29 // max lights shining on one entity
30 #define MAXENTLIGHTS 128
32 extern int cl_max_entities;
33 extern int cl_max_static_entities;
34 extern int cl_max_temp_entities;
35 extern int cl_max_effects;
36 extern int cl_max_beams;
38 typedef struct effect_s
47 // these are for interpolation
57 struct model_s *model;
67 // stop lighting after this time
71 // brightness (not really radius anymore)
73 // drop this each second
75 // the entity that spawned this light (can be NULL if it will never be replaced)
76 //entity_render_t *ent;
80 typedef struct frameblend_s
87 // LordHavoc: disregard the following warning, entlights stuff is semi-persistent...
88 // LordHavoc: nothing in this structure is persistent, it may be overwritten by the client every frame, for persistent data use entity_lerp_t.
89 typedef struct entity_render_s
95 // opacity (alpha) of the model
97 // size the model is shown
102 // current uninterpolated animation frame (for things which do not use interpolation)
104 // entity shirt and pants colors
106 // light, particles, etc
113 // these are copied from the persistent data
115 // frame that the model is interpolating from
117 // frame that the model is interpolating to
119 // interpolation factor, usually computed from frame2time
121 // time frame1 began playing (for framegroup animations)
123 // time frame2 began playing (for framegroup animations)
126 // calculated by the renderer (but not persistent)
128 // if visframe == r_framecount, it is visible
130 // calculated during R_AddModelEntities
132 // 4 frame numbers (-1 if not used) and their blending scalers (0-1), if interpolation is not desired, use frame instead
133 frameblend_t frameblend[4];
135 // caching results of static light traces (this is semi-persistent)
136 double entlightstime;
137 vec3_t entlightsorigin;
139 unsigned short entlights[MAXENTLIGHTS];
143 typedef struct entity_persistent_s
153 // muzzleflash fading
156 // interpolated animation
158 // lerp resets when model changes
160 // frame that the model is interpolating from
162 // frame that the model is interpolating to
164 // interpolation factor, usually computed from frame2time
166 // time frame1 began playing (for framegroup animations)
168 // time frame2 began playing (for framegroup animations)
173 typedef struct entity_s
175 // baseline state (default values)
176 entity_state_t state_baseline;
177 // previous state (interpolating from this)
178 entity_state_t state_previous;
179 // current state (interpolating to this)
180 entity_state_t state_current;
182 // used for regenerating parts of render
183 entity_persistent_t persistent;
185 // the only data the renderer should know about
186 entity_render_t render;
194 // intended velocities
203 char map[MAX_STYLESTRING];
208 char name[MAX_SCOREBOARDNAME];
211 int colors; // two 4 bit fields
217 int percent; // 0-256
220 #define CSHIFT_CONTENTS 0
221 #define CSHIFT_DAMAGE 1
222 #define CSHIFT_BONUS 2
223 #define CSHIFT_POWERUP 3
224 #define NUM_CSHIFTS 4
226 #define NAME_LENGTH 64
230 // client_state_t should hold all pieces of the client state
233 #define SIGNONS 4 // signon messages to receive before connected
235 #define MAX_MAPSTRING 2048
237 #define MAX_DEMONAME 16
241 ca_dedicated, // a dedicated server with no ability to start a client
242 ca_disconnected, // full screen console with no connection
243 ca_connected // valid netcon, talking to a server
248 // the client_static_t structure is persistent through an arbitrary number
249 // of server connections
255 // personalization data sent to server
256 char mapstring[MAX_QPATH];
257 // to restart a level
258 //char spawnparms[MAX_MAPSTRING];
261 // -1 = don't play demos
263 // list of demos in loop
264 char demos[MAX_DEMOS][MAX_DEMONAME];
266 // demo recording info must be here, because record is started before
267 // entering a map (and clearing client_state_t)
268 qboolean demorecording;
269 qboolean demoplayback;
271 // -1 = use normal cd track
274 // to meter out one message a frame
276 // host_framecount at start
278 // realtime at second frame of timedemo (LordHavoc: changed to double)
280 // LordHavoc: pausedemo
284 // connection information
288 struct qsocket_s *netcon;
289 // writing buffer to send to server
294 extern client_static_t cls;
297 // the client_state_t structure is wiped completely at every
302 // when connecting to the server throw out the first couple move messages
303 // so the player doesn't accidentally do something the first frame
306 // send a clc_nop periodically until connected
309 // last command sent to the server
312 // information for local display
314 int stats[MAX_CL_STATS];
315 // inventory bit flags
317 // cl.time of acquiring item, for blinking
318 float item_gettime[32];
319 // use pain anim frame if cl.time < this
322 // color shifts for damage, powerups
323 cshift_t cshifts[NUM_CSHIFTS];
325 cshift_t prev_cshifts[NUM_CSHIFTS];
327 // the client maintains its own idea of view angles, which are
328 // sent to the server each frame. The server sets punchangle when
329 // the view is temporarily offset, and an angle reset commands at the start
330 // of each level and after teleporting.
332 // during demo playback viewangles is lerped between these
333 vec3_t mviewangles[2];
334 // either client controlled, or lerped from demo mviewangles
337 // update by server, used for lean+bob (0 is newest)
339 // lerped between mvelocity[0] and [1]
344 // LordHavoc: origin view kick
347 // pitch drifting vars
355 // local amount for smoothing stepups
363 // don't change view angle, full screen, etc
365 // latched at intermission start
368 // the timestamp of the last two messages
371 // clients view of time, time should be between mtime[0] and mtime[1] to
372 // generate a lerp point for other data, oldtime is the previous frame's
373 // value of time, frametime is the difference between time and oldtime
374 double time, oldtime, frametime;
376 // copy of realtime from last recieved message, for net trouble icon
377 float last_received_message;
379 // information that is static for the entire time connected to a server
380 struct model_s *model_precache[MAX_MODELS];
381 struct sfx_s *sound_precache[MAX_SOUNDS];
383 // for display on solo scoreboard
385 // cl_entitites[cl.viewentity] = player
390 // refresh related state
392 // cl_entitites[0].model
393 struct model_s *worldmodel;
399 int cdtrack, looptrack;
404 scoreboard_t *scores;
406 // used by view code for setting up eye position
407 vec3_t viewentorigin;
408 // LordHavoc: sniping zoom, QC controlled
411 float viewzoomold, viewzoomnew;
413 // entity database stuff
414 vec3_t viewentoriginold, viewentoriginnew;
415 entity_database_t entitydatabase;
419 extern mempool_t *cl_scores_mempool;
424 extern cvar_t cl_name;
425 extern cvar_t cl_color;
426 extern cvar_t cl_pmodel;
428 extern cvar_t cl_upspeed;
429 extern cvar_t cl_forwardspeed;
430 extern cvar_t cl_backspeed;
431 extern cvar_t cl_sidespeed;
433 extern cvar_t cl_movespeedkey;
435 extern cvar_t cl_yawspeed;
436 extern cvar_t cl_pitchspeed;
438 extern cvar_t cl_anglespeedkey;
440 extern cvar_t cl_autofire;
442 extern cvar_t cl_shownet;
443 extern cvar_t cl_nolerp;
445 extern cvar_t cl_pitchdriftspeed;
446 extern cvar_t lookspring;
447 extern cvar_t lookstrafe;
448 extern cvar_t sensitivity;
450 extern cvar_t freelook;
452 extern cvar_t m_pitch;
454 extern cvar_t m_forward;
455 extern cvar_t m_side;
457 extern cvar_t r_draweffects;
459 extern cvar_t cl_explosions;
460 extern cvar_t cl_stainmaps;
462 // these are updated by
463 extern int cl_num_entities;
464 extern int cl_num_static_entities;
465 extern int cl_num_temp_entities;
466 extern int cl_num_brushmodel_entities;
468 extern entity_t *cl_entities;
469 extern entity_t *cl_static_entities;
470 extern entity_t *cl_temp_entities;
471 extern entity_render_t **cl_brushmodel_entities;
472 extern cl_effect_t *cl_effects;
473 extern beam_t *cl_beams;
474 extern dlight_t *cl_dlights;
475 extern lightstyle_t *cl_lightstyle;
478 extern client_state_t cl;
480 extern void CL_AllocDlight (entity_render_t *ent, vec3_t org, float radius, float red, float green, float blue, float decay, float lifetime);
481 extern void CL_DecayLights (void);
483 //=============================================================================
491 void CL_EstablishConnection (char *host);
493 void CL_Disconnect (void);
494 void CL_Disconnect_f (void);
501 int down[2]; // key nums holding it down
502 int state; // low bit is down state
506 extern kbutton_t in_mlook, in_klook;
507 extern kbutton_t in_strafe;
508 extern kbutton_t in_speed;
510 void CL_InitInput (void);
511 void CL_SendCmd (void);
512 void CL_SendMove (usercmd_t *cmd);
514 void CL_LerpUpdate(entity_t *e);
515 void CL_ParseTEnt (void);
516 void CL_RelinkBeams (void);
518 void CL_ClearTempEntities (void);
519 entity_t *CL_NewTempEntity (void);
521 void CL_Effect(vec3_t org, int modelindex, int startframe, int framecount, float framerate);
523 void CL_ClearState (void);
526 int CL_ReadFromServer (void);
527 void CL_WriteToServer (usercmd_t *cmd);
528 void CL_BaseMove (usercmd_t *cmd);
531 float CL_KeyState (kbutton_t *key);
532 char *Key_KeynumToString (int keynum);
537 void CL_StopPlayback (void);
538 int CL_GetMessage (void);
540 void CL_NextDemo (void);
541 void CL_Stop_f (void);
542 void CL_Record_f (void);
543 void CL_PlayDemo_f (void);
544 void CL_TimeDemo_f (void);
549 void CL_Parse_Init(void);
550 void CL_ParseServerMessage(void);
551 void CL_BitProfile_f(void);
556 void V_StartPitchDrift (void);
557 void V_StopPitchDrift (void);
560 float V_CalcRoll (vec3_t angles, vec3_t velocity);
561 void V_UpdateBlends (void);
562 void V_ParseDamage (void);
568 void CL_InitTEnts (void);
574 #define PARTICLE_INVALID 0
575 #define PARTICLE_BILLBOARD 1
576 #define PARTICLE_UPRIGHT_FACING 2
577 #define PARTICLE_ORIENTED_DOUBLESIDED 3
579 void CL_Particles_Clear(void);
580 void CL_Particles_Init(void);
582 void CL_ParseParticleEffect (void);
583 void CL_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
584 void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent);
585 void CL_RocketTrail2 (vec3_t start, vec3_t end, int color, entity_t *ent);
586 void CL_SparkShower (vec3_t org, vec3_t dir, int count);
587 void CL_PlasmaBurn (vec3_t org);
588 void CL_BloodPuff (vec3_t org, vec3_t vel, int count);
589 void CL_Stardust (vec3_t mins, vec3_t maxs, int count);
590 void CL_FlameCube (vec3_t mins, vec3_t maxs, int count);
591 void CL_Flames (vec3_t org, vec3_t vel, int count);
592 void CL_BloodShower (vec3_t mins, vec3_t maxs, float velspeed, int count);
593 void CL_ParticleCube (vec3_t mins, vec3_t maxs, vec3_t dir, int count, int colorbase, int gravity, int randomvel);
594 void CL_ParticleRain (vec3_t mins, vec3_t maxs, vec3_t dir, int count, int colorbase, int type);
595 void CL_EntityParticles (entity_t *ent);
596 void CL_BlobExplosion (vec3_t org);
597 void CL_ParticleExplosion (vec3_t org, int smoke);
598 void CL_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength);
599 void CL_LavaSplash (vec3_t org);
600 void CL_TeleportSplash (vec3_t org);
601 void CL_MoveParticles(void);
602 void R_MoveExplosions(void);
603 void R_NewExplosion(vec3_t org);
605 #include "cl_screen.h"
610 int x, y, width, height;
617 // fullscreen color blend
621 entity_render_t viewent;
623 entity_render_t **entities;
629 int maxdrawqueuesize;
635 extern mempool_t *cl_refdef_mempool;