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
387 // the real player entity (normally same as viewentity,
388 // different than viewentity if mod uses chasecam or other tricks)
390 // max players that can be in this game
392 // type of game (deathmatch, coop, singleplayer)
395 // refresh related state
397 // cl_entitites[0].model
398 struct model_s *worldmodel;
404 int cdtrack, looptrack;
409 scoreboard_t *scores;
411 // used by view code for setting up eye position
412 vec3_t viewentorigin;
413 // LordHavoc: sniping zoom, QC controlled
416 float viewzoomold, viewzoomnew;
418 // entity database stuff
419 vec3_t viewentoriginold, viewentoriginnew;
420 entity_database_t entitydatabase;
424 extern mempool_t *cl_scores_mempool;
429 extern cvar_t cl_name;
430 extern cvar_t cl_color;
431 extern cvar_t cl_pmodel;
433 extern cvar_t cl_upspeed;
434 extern cvar_t cl_forwardspeed;
435 extern cvar_t cl_backspeed;
436 extern cvar_t cl_sidespeed;
438 extern cvar_t cl_movespeedkey;
440 extern cvar_t cl_yawspeed;
441 extern cvar_t cl_pitchspeed;
443 extern cvar_t cl_anglespeedkey;
445 extern cvar_t cl_autofire;
447 extern cvar_t cl_shownet;
448 extern cvar_t cl_nolerp;
450 extern cvar_t cl_pitchdriftspeed;
451 extern cvar_t lookspring;
452 extern cvar_t lookstrafe;
453 extern cvar_t sensitivity;
455 extern cvar_t freelook;
457 extern cvar_t m_pitch;
459 extern cvar_t m_forward;
460 extern cvar_t m_side;
462 extern cvar_t r_draweffects;
464 extern cvar_t cl_explosions;
465 extern cvar_t cl_stainmaps;
467 // these are updated by
468 extern int cl_num_entities;
469 extern int cl_num_static_entities;
470 extern int cl_num_temp_entities;
471 extern int cl_num_brushmodel_entities;
473 extern entity_t *cl_entities;
474 extern entity_t *cl_static_entities;
475 extern entity_t *cl_temp_entities;
476 extern entity_render_t **cl_brushmodel_entities;
477 extern cl_effect_t *cl_effects;
478 extern beam_t *cl_beams;
479 extern dlight_t *cl_dlights;
480 extern lightstyle_t *cl_lightstyle;
483 extern client_state_t cl;
485 extern void CL_AllocDlight (entity_render_t *ent, vec3_t org, float radius, float red, float green, float blue, float decay, float lifetime);
486 extern void CL_DecayLights (void);
488 //=============================================================================
496 void CL_EstablishConnection (char *host);
498 void CL_Disconnect (void);
499 void CL_Disconnect_f (void);
506 int down[2]; // key nums holding it down
507 int state; // low bit is down state
511 extern kbutton_t in_mlook, in_klook;
512 extern kbutton_t in_strafe;
513 extern kbutton_t in_speed;
515 void CL_InitInput (void);
516 void CL_SendCmd (void);
517 void CL_SendMove (usercmd_t *cmd);
519 void CL_LerpUpdate(entity_t *e);
520 void CL_ParseTEnt (void);
521 void CL_RelinkBeams (void);
523 void CL_ClearTempEntities (void);
524 entity_t *CL_NewTempEntity (void);
526 void CL_Effect(vec3_t org, int modelindex, int startframe, int framecount, float framerate);
528 void CL_ClearState (void);
531 int CL_ReadFromServer (void);
532 void CL_WriteToServer (usercmd_t *cmd);
533 void CL_BaseMove (usercmd_t *cmd);
536 float CL_KeyState (kbutton_t *key);
537 char *Key_KeynumToString (int keynum);
542 void CL_StopPlayback (void);
543 int CL_GetMessage (void);
545 void CL_NextDemo (void);
546 void CL_Stop_f (void);
547 void CL_Record_f (void);
548 void CL_PlayDemo_f (void);
549 void CL_TimeDemo_f (void);
554 void CL_Parse_Init(void);
555 void CL_ParseServerMessage(void);
556 void CL_BitProfile_f(void);
561 void V_StartPitchDrift (void);
562 void V_StopPitchDrift (void);
565 float V_CalcRoll (vec3_t angles, vec3_t velocity);
566 void V_UpdateBlends (void);
567 void V_ParseDamage (void);
573 void CL_InitTEnts (void);
579 #define PARTICLE_INVALID 0
580 #define PARTICLE_BILLBOARD 1
581 #define PARTICLE_UPRIGHT_FACING 2
582 #define PARTICLE_ORIENTED_DOUBLESIDED 3
584 void CL_Particles_Clear(void);
585 void CL_Particles_Init(void);
587 void CL_ParseParticleEffect (void);
588 void CL_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
589 void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent);
590 void CL_RocketTrail2 (vec3_t start, vec3_t end, int color, entity_t *ent);
591 void CL_SparkShower (vec3_t org, vec3_t dir, int count);
592 void CL_PlasmaBurn (vec3_t org);
593 void CL_BloodPuff (vec3_t org, vec3_t vel, int count);
594 void CL_Stardust (vec3_t mins, vec3_t maxs, int count);
595 void CL_FlameCube (vec3_t mins, vec3_t maxs, int count);
596 void CL_Flames (vec3_t org, vec3_t vel, int count);
597 void CL_BloodShower (vec3_t mins, vec3_t maxs, float velspeed, int count);
598 void CL_ParticleCube (vec3_t mins, vec3_t maxs, vec3_t dir, int count, int colorbase, int gravity, int randomvel);
599 void CL_ParticleRain (vec3_t mins, vec3_t maxs, vec3_t dir, int count, int colorbase, int type);
600 void CL_EntityParticles (entity_t *ent);
601 void CL_BlobExplosion (vec3_t org);
602 void CL_ParticleExplosion (vec3_t org, int smoke);
603 void CL_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength);
604 void CL_LavaSplash (vec3_t org);
605 void CL_TeleportSplash (vec3_t org);
606 void CL_MoveParticles(void);
607 void R_MoveExplosions(void);
608 void R_NewExplosion(vec3_t org);
610 #include "cl_screen.h"
615 int x, y, width, height;
622 // fullscreen color blend
626 entity_render_t viewent;
628 entity_render_t **entities;
634 int maxdrawqueuesize;
640 extern mempool_t *cl_refdef_mempool;