1 /*
2  * Copyright (C) 1997-2001 Id Software, Inc.
3  *
4  * This program is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU General Public License as published by the Free
6  * Software Foundation; either version 2 of the License, or (at your option)
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * See the GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc., 59
17  * Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18  *
19  */
20 /* client.h -- primary header for client */
21 
22 
23 #ifdef __x86_64__
24 #define INT long int
25 #else
26 #define INT int
27 #endif
28 
29 #include <math.h>
30 #include <string.h>
31 #include <stdarg.h>
32 #include <stdio.h>
33 #include <stdlib.h>
34 
35 #include "ref.h"
36 
37 #include "vid.h"
38 #include "screen.h"
39 #include "sound.h"
40 #include "input.h"
41 #include "keys.h"
42 #include "console.h"
43 #include "cdaudio.h"
44 
45 /*
46  * ===========================================================================
47  */
48 
49 #ifdef QMAX
50 #define random()	((rand () & 0x7fff) / ((float)0x7fff))
51 #define crandom()	(2.0 * (random() - 0.5))
52 
53 #include "particles.h"
54 
55 int		color8red  (int color8);
56 int		color8green(int color8);
57 int		color8blue (int color8);
58 
59 #endif
60 
61 vec3_t		clientOrg;	/* lerped org of client for server->client side effects */
62 void		vectoangles2(vec3_t value1, vec3_t angles);
63 
64 typedef struct {
65 	qboolean	valid;		/* cleared if delta parsing was invalid */
66 	int		serverframe;
67 	int		servertime;	/* server time the message is valid for (in msec) */
68 	int		deltaframe;
69 	byte		areabits  [MAX_MAP_AREAS / 8];	/* portalarea visibility bits */
70 	player_state_t	playerstate;
71 	int		num_entities;
72 	int		parse_entities;	/* non-masked index into cl_parse_entities array */
73 } frame_t;
74 
75 typedef struct {
76 	entity_state_t	baseline;	/* delta from this if not from a previous frame */
77 	entity_state_t	current;
78 	entity_state_t	prev;	/* will always be valid, but might just be a copy of current */
79 
80 	int		serverframe;	/* if not current, this ent isn't in the frame */
81 
82 	int		trailcount;	/* for diminishing grenade trails */
83 	vec3_t		lerp_origin;	/* for trails (variable hz) */
84 
85 	int		fly_stoptime;
86 } centity_t;
87 
88 #define MAX_CLIENTWEAPONMODELS		20	/* PGM -- upped from 16 to
89 						 * fit the chainfist vwep */
90 
91 typedef struct {
92 	char		name[MAX_QPATH];
93 	char		cinfo[MAX_QPATH];
94 	struct image_s *skin;
95 	struct image_s *icon;
96 	char		iconname[MAX_QPATH];
97 	struct model_s *model;
98 	struct model_s *weaponmodel[MAX_CLIENTWEAPONMODELS];
99 } clientinfo_t;
100 
101 extern char	cl_weaponmodels[MAX_CLIENTWEAPONMODELS][MAX_QPATH];
102 extern int	num_cl_weaponmodels;
103 
104 #define	CMD_BACKUP	64	/* allow a lot of command backups for very fast systems */
105 
106 //
107 /* the client_state_t structure is wiped completely at every */
108 /* server map change */
109 //
110 typedef struct {
111 	int		timeoutcount;
112 
113 	int		timedemo_frames;
114 	int		timedemo_start;
115 
116 	qboolean	refresh_prepped;		  /* false if on new level or new ref dll */
117 	qboolean	sound_prepped;			  /* ambient sounds can start */
118 	qboolean	force_refdef;		          /* vid has changed, so we can't use a paused refdef */
119 
120 	int		parse_entities;			  /* index (not anded off) into cl_parse_entities[] */
121 
122 	usercmd_t	cmd;
123 	usercmd_t	cmds[CMD_BACKUP];		  /* each mesage will send several old cmds */
124 	int		cmd_time[CMD_BACKUP];	  	  /* time sent, for calculating pings */
125 	short		predicted_origins[CMD_BACKUP][3]; /* for debug comparing against server */
126 
127 	float		predicted_step;			  /* for stair up smoothing */
128 	unsigned	predicted_step_time;
129 
130 	vec3_t		predicted_origin;		  /* generated by CL_PredictMovement */
131 	vec3_t		predicted_angles;
132 	vec3_t		prediction_error;
133 
134 	frame_t		frame;				  /* received from server */
135 	int		surpressCount;		     	  /* number of messages rate supressed */
136 	frame_t		frames[UPDATE_BACKUP];
137 
138 	/* the client maintains its own idea of view angles, which are */
139 
140 	/*
141 	 * sent to the server each frame.  It is cleared to 0 upon entering each level.
142 	 */
143 	/* the server sends a delta each frame which is added to the locally */
144 	/* tracked view angles to account for standing on rotating objects, */
145 	/* and teleport direction changes */
146 	vec3_t		viewangles;
147 
148 	int		time;	/* this is the time value that the client */
149 
150 	/* is rendering at.  always <= cls.realtime */
151 	float		lerpfrac;	/* between oldframe and frame */
152 
153 	refdef_t	refdef;
154 
155 	vec3_t		v_forward, v_right, v_up;	/* set when refdef.angles is set */
156 
157 	/* transient data from server */
158 	char		layout[1024];			/* general 2D overlay */
159 	int		inventory[MAX_ITEMS];
160 
161 	/* non-gameserver infornamtion */
162 	/* FIXME: move this cinematic stuff into the cin_t structure */
163 	fileHandle_t	cinematic_file;
164 	int		cinematictime;			/* cls.realtime for first cinematic frame */
165 	int		cinematicframe;
166 	unsigned char	cinematicpalette[768];
167 	qboolean	cinematicpalette_active;
168 
169 
170 	/* server state information */
171 	qboolean	attractloop;		/* running the attract loop, any key will menu */
172 	int		servercount;		/* server identification for prespawns */
173 	char		gamedir[MAX_QPATH];
174 	int		playernum;
175 
176 	char		configstrings[MAX_CONFIGSTRINGS][MAX_QPATH];
177 
178 	/* locally derived information from server state */
179 	struct model_s *model_draw[MAX_MODELS];
180 	struct cmodel_s *model_clip[MAX_MODELS];
181 
182 	struct sfx_s   *sound_precache[MAX_SOUNDS];
183 	struct image_s *image_precache[MAX_IMAGES];
184 
185 	clientinfo_t	clientinfo[MAX_CLIENTS];
186 	clientinfo_t	baseclientinfo;
187 
188 	clientinfo_t   *playername;
189 	int		playernametime;
190 
191 } client_state_t;
192 
193 extern client_state_t cl;
194 
195 typedef struct {
196 
197 	char		chathud[4][256];
198 
199 	int		echoTime;
200 	int		echoDelayTime;
201 	int		spamDelay;
202 
203 } NiceAss_Chat_t;
204 
205 /*
206  * ==================================================================
207  *
208  * the client_static_t structure is persistant through an arbitrary number of
209  * server connections
210  *
211  * ==================================================================
212  */
213 
214 typedef enum {
215 	ca_uninitialized,
216 	ca_disconnected,	/* not talking to a server */
217 	ca_connecting,		/* sending request packets to the server */
218 	ca_connected,		/* netchan_t established, waiting for svc_serverdata */
219 	ca_active		/* game views should be displayed */
220 } connstate_t;
221 
222 typedef enum {
223 	dl_none,
224 	dl_model,
225 	dl_sound,
226 	dl_skin,
227 	dl_single
228 } dltype_t;	/* download type */
229 
230 typedef enum {
231 	key_game, key_console, key_message, key_menu
232 } keydest_t;
233 
234 typedef struct {
235 	connstate_t	state;
236 	keydest_t	key_dest;
237 
238 	int		framecount;
239 	int		realtime;	/* always increasing, no clamping, etc */
240 	float		frametime;	/* seconds since last frame */
241 
242 	/* screen rendering information showing loading plaque between levels or changing rendering dlls*/
243 	float		disable_screen;
244 
245 	/* if time gets > 30 seconds ahead, break it */
246 	/* when we receive a frame and cl.servercount */
247 	/* > cls.disable_servercount, clear disable_screen */
248 	int		disable_servercount;
249 
250 	/* connection information */
251 	char		servername[MAX_OSPATH];	/* name of server from original connect */
252 	float		connect_time;		/* for connection retransmits */
253 
254 	int		quakePort;		/* a 16 bit value that allows quake servers */
255 						/* to work around address translating routers */
256 	netchan_t	netchan;
257 	int		serverProtocol;		/* in case we are doing some kind of version hack */
258 
259 	int		challenge;		/* from the server to use for connecting */
260 
261 	FILE           *download;		/* file transfer from server */
262 	char		downloadtempname[MAX_OSPATH];
263 	char		downloadname[MAX_OSPATH];
264 	int		downloadnumber;
265 	dltype_t	downloadtype;
266 	int		downloadpercent;
267 
268 	/*
269 	 * demo recording info must be here, so it isn't cleared on level
270 	 * change
271 	 */
272 	qboolean	demorecording;
273 	qboolean	demowaiting;		/* don't record until a non-delta message is received */
274 	FILE           *demofile;
275 
276 } client_static_t;
277 
278 extern client_static_t cls;
279 
280 /*
281  * ===========================================================================
282  */
283 
284 //
285 /* cvars */
286 //
287 extern cvar_t  *cl_stereo_separation;
288 extern cvar_t  *cl_stereo;
289 
290 extern cvar_t  *cl_gun;
291 extern cvar_t  *cl_add_blend;
292 extern cvar_t  *cl_add_lights;
293 extern cvar_t  *cl_add_particles;
294 extern cvar_t  *cl_add_entities;
295 extern cvar_t  *cl_predict;
296 extern cvar_t  *cl_footsteps;
297 extern cvar_t  *cl_footsteps_override;
298 extern cvar_t  *cl_footsteps_volume;
299 extern cvar_t  *cl_noskins;
300 extern cvar_t  *cl_autoskins;
301 
302 /* 3dcam */
303 extern cvar_t  *cl_3dcam;
304 extern cvar_t  *cl_3dcam_angle;
305 extern cvar_t  *cl_3dcam_chase;
306 extern cvar_t  *cl_3dcam_dist;
307 extern cvar_t  *cl_3dcam_alpha;
308 extern cvar_t  *cl_3dcam_adjust;
309 
310 #ifdef QMAX
311 extern cvar_t  *cl_railred;
312 extern cvar_t  *cl_railgreen;
313 extern cvar_t  *cl_railblue;
314 extern cvar_t  *cl_railtype;
315 extern cvar_t  *cl_blood;
316 extern cvar_t  *cl_gunsmoke;
317 extern cvar_t  *cl_explosion;
318 extern cvar_t  *cl_explosion_scale;
319 extern cvar_t  *cl_blaster_color;
320 extern cvar_t  *cl_blaster_type;
321 extern cvar_t  *cl_hyperblaster_color;
322 extern cvar_t  *cl_hyperblaster_particles;
323 extern cvar_t  *cl_hyperblaster_particles_type;
324 extern cvar_t  *cl_particles_type;
325 extern cvar_t  *cl_teleport_particles;
326 extern cvar_t  *cl_nukeblast_enh;
327 #endif
328 
329 extern cvar_t  *cl_upspeed;
330 extern cvar_t  *cl_forwardspeed;
331 extern cvar_t  *cl_sidespeed;
332 
333 extern cvar_t  *cl_yawspeed;
334 extern cvar_t  *cl_pitchspeed;
335 
336 extern cvar_t  *cl_run;
337 
338 extern cvar_t  *cl_anglespeedkey;
339 
340 extern cvar_t  *cl_shownet;
341 extern cvar_t  *cl_showmiss;
342 extern cvar_t  *cl_showclamp;
343 
344 extern cvar_t  *lookspring;
345 extern cvar_t  *lookstrafe;
346 extern cvar_t  *sensitivity;
347 
348 extern cvar_t  *m_pitch;
349 extern cvar_t  *m_yaw;
350 extern cvar_t  *m_forward;
351 extern cvar_t  *m_side;
352 
353 extern cvar_t  *freelook;
354 
355 extern cvar_t  *cl_lightlevel;	/* FIXME HACK */
356 
357 extern cvar_t  *cl_paused;
358 extern cvar_t  *cl_timedemo;
359 
360 extern cvar_t  *cl_vwep;
361 
362 extern cvar_t  *cl_drawclock;
363 extern cvar_t  *cl_drawtimestamps;
364 extern cvar_t  *con_height;
365 extern cvar_t  *con_notify;
366 extern cvar_t  *cl_highlight;;
367 extern cvar_t  *con_transparency;
368 extern cvar_t  *cl_hudalpha;
369 extern cvar_t  *cl_drawmaptime;
370 extern cvar_t  *cl_bobbing;
371 extern cvar_t  *cl_models_overbright;
372 extern cvar_t  *cl_underwater_movement;
373 extern cvar_t  *cl_underwater_trans;
374 extern cvar_t  *crosshair_red;
375 extern cvar_t  *crosshair_green;
376 extern cvar_t  *crosshair_blue;
377 extern cvar_t  *cl_draw_playername;
378 extern cvar_t  *cl_draw_playername_x;
379 extern cvar_t  *cl_draw_playername_y;
380 
381 #ifndef QMAX
382 extern cvar_t  *cl_railstyle;
383 extern cvar_t  *cl_railtrail;
384 extern cvar_t  *cl_railtrail_color;
385 #endif
386 
387 extern cvar_t  *deathmatch;
388 extern cvar_t  *coop;
389 
390 extern cvar_t  *cl_flashlight;
391 extern cvar_t  *cl_flashlight_decscale;
392 extern cvar_t  *cl_flashlight_distance;
393 extern cvar_t  *cl_flashlight_sound;
394 extern cvar_t  *cl_flashlight_red;
395 extern cvar_t  *cl_flashlight_green;
396 extern cvar_t  *cl_flashlight_blue;
397 extern cvar_t  *cl_flashlight_intensity;
398 
399 #ifdef WITH_XMMS
400 extern cvar_t  *xmms_enable;
401 #endif
402 
403 extern cvar_t  *cl_hud_red;
404 extern cvar_t  *cl_hud_green;
405 extern cvar_t  *cl_hud_blue;
406 extern cvar_t  *cl_menu_alpha;
407 extern cvar_t  *cl_conback_image;
408 extern cvar_t  *weap_shell;
409 extern cvar_t  *cl_drawlocs;
410 
411 extern cvar_t  *cl_mouse_cursor;
412 extern cvar_t  *cl_mouse_scale;
413 extern cvar_t  *cl_mouse_alpha;
414 extern cvar_t  *cl_mouse_red;
415 extern cvar_t  *cl_mouse_green;
416 extern cvar_t  *cl_mouse_blue;
417 extern cvar_t  *cl_mouse_rotate;
418 extern cvar_t  *cl_mouse_sensitivity;
419 
420 extern cvar_t  *font_color;
421 
422 extern cvar_t  *gl_minimap_x;
423 extern cvar_t  *gl_minimap_y;
424 
425 typedef struct {
426 	int		key;		/* so entities can reuse same entry */
427 	vec3_t		color;
428 	vec3_t		origin;
429 	float		radius;
430 	float		die;		/* stop lighting after this time */
431 	float		decay;		/* drop this each second */
432 	float		minlight;	/* don't add when contributing less */
433 } cdlight_t;
434 
435 extern centity_t cl_entities[MAX_EDICTS];
436 extern cdlight_t cl_dlights[MAX_DLIGHTS];
437 
438 /* the cl_parse_entities must be large enough to hold UPDATE_BACKUP frames of */
439 /* entities, so that when a delta compressed message arives from the server */
440 /* it can be un-deltad from the original  */
441 #define	MAX_PARSE_ENTITIES	1024
442 extern entity_state_t cl_parse_entities[MAX_PARSE_ENTITIES];
443 
444 /*
445  * ===========================================================================
446  */
447 
448 void		DrawString(int x, int y, char *s);
449 void		DrawAltString(int x, int y, char *s);	/* toggle high bit */
450 qboolean	CL_CheckOrDownloadFile(char *filename);
451 
452 void		CL_AddNetgraph(void);
453 
454 /* ROGUE */
455 typedef struct cl_sustain {
456 	int		id;
457 	int		type;
458 	int		endtime;
459 	int		nextthink;
460 	int		thinkinterval;
461 	vec3_t		org;
462 	vec3_t		dir;
463 	int		color;
464 	int		count;
465 	int		magnitude;
466 	void            (*think) (struct cl_sustain *self);
467 } cl_sustain_t;
468 
469 #define MAX_SUSTAINS		32
470 void		CL_ParticleSteamEffect2(cl_sustain_t * self);
471 
472 void		CL_TeleporterParticles(entity_state_t * ent);
473 void		CL_ParticleEffect(vec3_t org, vec3_t dir, int color, int count);
474 void		CL_ParticleEffect2(vec3_t org, vec3_t dir, int color, int count);
475 
476 /* RAFAEL */
477 void		CL_ParticleEffect3(vec3_t org, vec3_t dir, int color, int count);
478 
479 
480 /* ================================================= */
481 
482 #ifdef QMAX
483 
484 typedef struct {
485 	qboolean	isactive;
486 
487 	vec3_t		lightcol;
488 	float		light;
489 	float		lightvel;
490 } cplight_t;
491 
492 #define P_LIGHTS_MAX 8
493 #endif
494 
495 /* ======== */
496 /* PGM */
497 typedef struct particle_s {
498 	struct particle_s *next;
499 
500 	float		time;
501 
502 	vec3_t		org;
503 	vec3_t		vel;
504 	vec3_t		accel;
505 #ifdef QMAX
506 	vec3_t		color;
507 	vec3_t		colorvel;
508 #else
509 	float		color;
510 	float		colorvel;
511 #endif
512 	float		alpha;
513 	float		alphavel;
514 
515 #ifdef QMAX
516 	cplight_t	lights[P_LIGHTS_MAX];
517 
518 	float		start;
519 	float		size;
520 	float		sizevel;
521 
522 	vec3_t		angle;
523 
524 	int		image;
525 	int		flags;
526 
527 	vec3_t		oldorg;
528 	float		temp;
529 	int		src_ent;
530 	int		dst_ent;
531 	int		blendfunc_src;
532 	int		blendfunc_dst;
533 
534 	struct particle_s *link;
535 
536 	void            (*think) (struct particle_s *p, vec3_t org, vec3_t angle, float *alpha, float *size,
537 	                          int *image, float *mytime);
538 	qboolean	thinknext;
539 #endif
540 } cparticle_t;
541 
542 
543 #define	PARTICLE_GRAVITY		40
544 #define BLASTER_PARTICLE_COLOR		0xe0
545 /* PMM */
546 #define INSTANT_PARTICLE		-10000.0
547 /* PGM */
548 /* ======== */
549 
550 void		CL_ClearEffects(void);
551 void		CL_ClearTEnts(void);
552 void		CL_BlasterTrail(vec3_t start, vec3_t end);
553 void		CL_QuadTrail(vec3_t start, vec3_t end);
554 void		CL_RailTrail(vec3_t start, vec3_t end);
555 void		CL_BubbleTrail(vec3_t start, vec3_t end);
556 
557 #ifdef QMAX
558 void		CL_ParticleSmokeEffect(vec3_t org, vec3_t dir, float size, float alpha);
559 void		CL_FlagTrail(vec3_t start, vec3_t end, qboolean isred, qboolean isgreen);
560 void		CL_TrackerTrail(vec3_t start, vec3_t end);
561 #else
562 void		CL_FlagTrail(vec3_t start, vec3_t end, float color);
563 void		CL_TrackerTrail(vec3_t start, vec3_t end, int particleColor);
564 void		CL_ParticleSmokeEffect(vec3_t org, vec3_t dir, int color, int count, int magnitude);
565 #endif
566 
567 /* RAFAEL */
568 void		CL_IonripperTrail(vec3_t start, vec3_t end);
569 
570 /* psychospaz -- client side clipping */
571 void		ClipCam   (vec3_t start, vec3_t end, vec3_t newpos);
572 
573 /* ======== */
574 /* PGM */
575 void		CL_BlasterParticles2(vec3_t org, vec3_t dir, unsigned int color);
576 void		CL_BlasterTrail2(vec3_t start, vec3_t end);
577 void		CL_DebugTrail(vec3_t start, vec3_t end);
578 
579 #ifdef QMAX
580 void		CL_SmokeTrail(vec3_t start, vec3_t end);
581 #else
582 void		CL_SmokeTrail(vec3_t start, vec3_t end, int colorStart, int colorRun, int spacing);
583 #endif
584 
585 void		CL_Flashlight(int ent, vec3_t pos);
586 void		CL_ForceWall(vec3_t start, vec3_t end, int color);
587 void		CL_FlameEffects(centity_t * ent, vec3_t origin);
588 void		CL_GenericParticleEffect(vec3_t org, vec3_t dir, int color, int count, int numcolors,
589                                          int dirspread, float alphavel);
590 void		CL_BubbleTrail2(vec3_t start, vec3_t end, int dist);
591 void		CL_Heatbeam(vec3_t start, vec3_t forward);
592 
593 #ifdef QMAX
594 void
595 CL_ParticleSteamEffect(vec3_t org, vec3_t dir, int red, int green, int blue,
596                        int reddelta, int greendelta, int bluedelta, int count, int magnitude);
597 #else
598 void		CL_ParticleSteamEffect(vec3_t org, vec3_t dir, int color, int count, int magnitude);
599 #endif
600 
601 void		CL_Tracker_Explode(vec3_t origin);
602 void		CL_TagTrail(vec3_t start, vec3_t end, float color);
603 void		CL_ColorFlash(vec3_t pos, int ent, int intensity, float r, float g, float b);
604 void		CL_Tracker_Shell(vec3_t origin);
605 void		CL_MonsterPlasma_Shell(vec3_t origin);
606 void		CL_ColorExplosionParticles(vec3_t org, int color, int run);
607 void		CL_Widowbeamout(cl_sustain_t * self);
608 void		CL_Nukeblast(cl_sustain_t * self);
609 #ifdef QMAX
610 void		CL_Nukeblast_Opt(cl_sustain_t * self);
611 #endif
612 void		CL_WidowSplash(vec3_t org);
613 
614 trace_t		CL_Trace(vec3_t start, vec3_t end, float size, int contentmask);
615 
616 #ifdef QMAX
617 /* Knightmare- Hyperblaster glows */
618 void
619 CL_BlasterTrailColor(vec3_t start, vec3_t end, int red, int green, int blue,
620     int reddelta, int greendelta, int bluedelta);
621 void
622 CL_HyperBlasterTrail(vec3_t start, vec3_t end, int red, int green, int blue,
623     int reddelta, int greendelta, int bluedelta);
624 void		CL_BlasterTracer(vec3_t origin, vec3_t angle, int red, int green, int blue, float len, float size);
625 void		CL_HyperBlasterEffect(vec3_t start, vec3_t end, vec3_t angle,
626                                       int red, int green, int blue, int reddelta, int greendelta, int bluedelta,
627 				      float len, float size);
628 void		CL_ParticleWaterEffectSplash(vec3_t org, vec3_t dir, int color, int count, int r);
629 void		CL_Flame(vec3_t start, qboolean light);
630 void		CL_GloomFlame(vec3_t start, qboolean light);
631 void		CL_FlameTrail(vec3_t start, vec3_t end, float size, float grow, qboolean light);
632 void		CL_GloomFlameTrail(vec3_t start, vec3_t end, float size, float grow, qboolean light);
633 void		CL_BlueFlameTrail(vec3_t start, vec3_t end);
634 void		CL_Tracer(vec3_t origin, vec3_t angle, int r, int g, int b, float len, float size);
635 #endif
636 
637 /* PGM */
638 /* ======== */
639 
640 int		CL_ParseEntityBits(unsigned *bits);
641 void		CL_ParseDelta(entity_state_t * from, entity_state_t * to, int number, int bits);
642 void		CL_ParseFrame(void);
643 
644 void		CL_ParseTEnt(void);
645 void		CL_ParseConfigString(void);
646 void		CL_ParseMuzzleFlash(void);
647 void		CL_ParseMuzzleFlash2(void);
648 void		SmokeAndFlash(vec3_t origin);
649 
650 void		CL_SetLightstyle(int i);
651 
652 void		CL_RunParticles(void);
653 void		CL_RunDLights(void);
654 void		CL_RunLightStyles(void);
655 
656 void		CL_AddEntities(void);
657 void		CL_AddDLights(void);
658 
659 #ifdef QMAX
660 void		CL_AddHeatDLights(void);
661 void		CL_ClearDlights(void);
662 #endif
663 
664 void		CL_AddTEnts(void);
665 void		CL_AddLightStyles(void);
666 void		V_AddStain(vec3_t org, vec3_t color, float size);
667 
668 /* ================================================= */
669 
670 void		CL_PrepRefresh(void);
671 void		CL_RegisterSounds(void);
672 
673 void		CL_Quit_f (void);
674 
675 void		IN_Accumulate(void);
676 
677 void		CL_ParseLayout(void);
678 
679 //
680 /* cl_loc.c */
681 //
682 void		CL_LoadLoc(void);
683 void		CL_LocPlace(void);
684 void		CL_AddViewLocs(void);
685 void		CL_LocDelete(void);
686 void		CL_LocAdd (char *name);
687 void		CL_LocWrite(char *filename);
688 void		CL_LocHelp_f(void);
689 
690 //
691 /* cl_main */
692 //
693 extern refexport_t re;		/* interface to refresh .dll */
694 
695 void		CL_Init(void);
696 
697 void		CL_FixUpGender(void);
698 void		CL_Disconnect(void);
699 void		CL_Disconnect_f(void);
700 void		CL_GetChallengePacket(void);
701 void		CL_PingServers_f(void);
702 void		CL_Snd_Restart_f(void);
703 void		CL_RequestNextDownload(void);
704 
705 //
706 /* cl_input */
707 //
708 typedef struct {
709 	int		down[2];	/* key nums holding it down */
710 	unsigned	downtime;	/* msec timestamp */
711 	unsigned	msec;		/* msec down this frame */
712 	int		state;
713 } kbutton_t;
714 
715 extern kbutton_t in_mlook, in_klook;
716 extern kbutton_t in_strafe;
717 extern kbutton_t in_speed;
718 
719 void		CL_InitInput(void);
720 void		CL_SendCmd(void);
721 void		CL_SendMove(usercmd_t * cmd);
722 
723 void		CL_ClearState(void);
724 
725 void		CL_ReadPackets(void);
726 
727 int		CL_ReadFromServer(void);
728 void		CL_WriteToServer(usercmd_t * cmd);
729 void		CL_BaseMove(usercmd_t * cmd);
730 
731 void		IN_CenterView(void);
732 
733 float		CL_KeyState(kbutton_t * key);
734 char           *Key_KeynumToString(int keynum);
735 
736 //
737 /* cl_demo.c */
738 //
739 void		CL_WriteDemoMessage(void);
740 void		CL_Stop_f (void);
741 void		CL_Record_f(void);
742 
743 //
744 /* cl_parse.c */
745 //
746 extern char    *svc_strings[256];
747 
748 void		CL_ParseServerMessage(void);
749 void		CL_LoadClientinfo(clientinfo_t * ci, char *s);
750 void		SHOWNET   (char *s);
751 void		CL_ParseClientinfo(int player);
752 void		CL_Download_f(void);
753 
754 //
755 /* cl_view.c */
756 //
757 extern int	gun_frame;
758 extern struct model_s *gun_model;
759 
760 void		V_Init    (void);
761 void		V_RenderView(float stereo_separation);
762 void		V_AddEntity(entity_t * ent);
763 
764 #ifdef QMAX
765 void		V_AddParticle(vec3_t org, vec3_t angle, vec3_t color, float alpha, int alpha_src,
766                               int alpha_dst, float size, int image, int flags);
767 #else
768 void		V_AddParticle(vec3_t org, int color, float alpha);
769 #endif
770 
771 void		V_AddLight(vec3_t org, float intensity, float r, float g, float b);
772 void		V_AddLightStyle(int style, float r, float g, float b);
773 qboolean	CL_IsVisible(vec3_t org1, vec3_t org2);
774 
775 //
776 /* cl_tent.c */
777 //
778 void		CL_RegisterTEntSounds(void);
779 void		CL_RegisterTEntModels(void);
780 void		CL_SmokeAndFlash(vec3_t origin);
781 
782 
783 //
784 /* cl_pred.c */
785 //
786 void		CL_InitPrediction(void);
787 void		CL_PredictMove(void);
788 void		CL_CheckPredictionError(void);
789 trace_t 	CL_PMSurfaceTrace (int playernum, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int contentmask);
790 
791 //
792 /* cl_fx.c */
793 //
794 cdlight_t * CL_AllocDlight(int key);
795 void		CL_BigTeleportParticles(vec3_t org);
796 void		CL_RocketTrail(vec3_t start, vec3_t end, centity_t * old);
797 void		CL_DiminishingTrail(vec3_t start, vec3_t end, centity_t * old, int flags);
798 void		CL_FlyEffect(centity_t * ent, vec3_t origin);
799 void		CL_BfgParticles(entity_t * ent);
800 void		CL_AddParticles(void);
801 void		CL_EntityEvent(entity_state_t * ent);
802 
803 /* RAFAEL */
804 void		CL_TrapParticles(entity_t * ent);
805 
806 #ifdef QMAX
807 void		CL_ParticleEffectSplash(vec3_t org, vec3_t dir, int color, int count);
808 void		CL_ElectricParticles(vec3_t org, vec3_t dir, int count);
809 #endif
810 
811 
812 
813 //
814 /* menus */
815 //
816 void		M_Init    (void);
817 void		M_Keydown (int key);
818 void		M_Draw    (void);
819 void		M_Menu_Main_f(void);
820 void		M_ForceMenuOff(void);
821 void		M_AddToServerList(netadr_t adr, char *info);
822 
823 //
824 /* cl_inv.c */
825 //
826 void		CL_ParseInventory(void);
827 void		CL_KeyInventory(int key);
828 void		CL_DrawInventory(void);
829 
830 //
831 /* cl_pred.c */
832 //
833 void		CL_PredictMovement(void);
834 
835 
836 #ifdef QMAX
837 void		SetParticleImages(void);
838 #endif
839