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.
20 // cl_main.c -- client main loop
24 // we need to declare some mouse variables here, because the menu system
25 // references them even when on a unix system.
27 // these two are not intended to be set directly
28 cvar_t cl_name = {CVAR_SAVE, "_cl_name", "player"};
29 cvar_t cl_color = {CVAR_SAVE, "_cl_color", "0"};
30 cvar_t cl_pmodel = {CVAR_SAVE, "_cl_pmodel", "0"};
32 cvar_t cl_shownet = {0, "cl_shownet","0"};
33 cvar_t cl_nolerp = {0, "cl_nolerp", "0"};
35 cvar_t cl_itembobheight = {0, "cl_itembobheight", "8"};
36 cvar_t cl_itembobspeed = {0, "cl_itembobspeed", "0.5"};
38 cvar_t lookspring = {CVAR_SAVE, "lookspring","0"};
39 cvar_t lookstrafe = {CVAR_SAVE, "lookstrafe","0"};
40 cvar_t sensitivity = {CVAR_SAVE, "sensitivity","3", 1, 30};
42 cvar_t m_pitch = {CVAR_SAVE, "m_pitch","0.022"};
43 cvar_t m_yaw = {CVAR_SAVE, "m_yaw","0.022"};
44 cvar_t m_forward = {CVAR_SAVE, "m_forward","1"};
45 cvar_t m_side = {CVAR_SAVE, "m_side","0.8"};
47 cvar_t freelook = {CVAR_SAVE, "freelook", "1"};
49 cvar_t cl_draweffects = {0, "cl_draweffects", "1"};
51 mempool_t *cl_scores_mempool;
52 mempool_t *cl_refdef_mempool;
56 // FIXME: put these on hunk?
57 entity_t cl_entities[MAX_EDICTS];
58 entity_t cl_static_entities[MAX_STATIC_ENTITIES];
59 lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
61 typedef struct effect_s
70 // these are for interpolation
77 #define MAX_EFFECTS 256
79 static cl_effect_t cl_effect[MAX_EFFECTS];
88 void CL_ClearState (void)
95 Mem_EmptyPool(cl_scores_mempool);
97 // wipe the entire cl structure
98 memset (&cl, 0, sizeof(cl));
100 SZ_Clear (&cls.message);
102 // clear other arrays
103 memset(cl_entities, 0, sizeof(cl_entities));
104 memset(cl_lightstyle, 0, sizeof(cl_lightstyle));
105 memset(cl_temp_entities, 0, sizeof(cl_temp_entities));
106 memset(cl_beams, 0, sizeof(cl_beams));
107 memset(cl_dlights, 0, sizeof(cl_dlights));
108 memset(cl_effect, 0, sizeof(cl_effect));
110 CL_Particles_Clear();
112 // LordHavoc: have to set up the baseline info for alpha and other stuff
113 for (i = 0;i < MAX_EDICTS;i++)
115 ClearStateToDefault(&cl_entities[i].state_baseline);
116 ClearStateToDefault(&cl_entities[i].state_previous);
117 ClearStateToDefault(&cl_entities[i].state_current);
121 void CL_LerpUpdate(entity_t *e)
123 entity_persistent_t *p;
128 if (p->modelindex != e->state_current.modelindex)
130 // reset all interpolation information
131 p->modelindex = e->state_current.modelindex;
132 p->frame1 = p->frame2 = e->state_current.frame;
133 p->frame1time = p->frame2time = cl.time;
136 else if (p->frame2 != e->state_current.frame)
138 // transition to new frame
139 p->frame1 = p->frame2;
140 p->frame1time = p->frame2time;
141 p->frame2 = e->state_current.frame;
142 p->frame2time = cl.time;
148 p->framelerp = (cl.time - p->frame2time) * 10;
149 p->framelerp = bound(0, p->framelerp, 1);
152 r->model = cl.model_precache[e->state_current.modelindex];
153 Mod_CheckLoaded(r->model);
154 r->frame = e->state_current.frame;
155 r->frame1 = p->frame1;
156 r->frame2 = p->frame2;
157 r->framelerp = p->framelerp;
158 r->frame1time = p->frame1time;
159 r->frame2time = p->frame2time;
163 =====================
166 Sends a disconnect message to the server
167 This is also called on Host_Error, so it shouldn't cause any errors
168 =====================
170 void CL_Disconnect (void)
172 if (cls.state == ca_dedicated)
175 // stop sounds (especially looping!)
176 S_StopAllSounds (true);
178 // clear contents blends
179 cl.cshifts[0].percent = 0;
180 cl.cshifts[1].percent = 0;
181 cl.cshifts[2].percent = 0;
182 cl.cshifts[3].percent = 0;
184 cl.worldmodel = NULL;
186 if (cls.demoplayback)
188 else if (cls.state == ca_connected)
190 if (cls.demorecording)
193 Con_DPrintf ("Sending clc_disconnect\n");
194 SZ_Clear (&cls.message);
195 MSG_WriteByte (&cls.message, clc_disconnect);
196 NET_SendUnreliableMessage (cls.netcon, &cls.message);
197 SZ_Clear (&cls.message);
198 NET_Close (cls.netcon);
199 // if running a local server, shut it down
201 Host_ShutdownServer(false);
203 cls.state = ca_disconnected;
205 cls.demoplayback = cls.timedemo = false;
209 void CL_Disconnect_f (void)
213 Host_ShutdownServer (false);
220 =====================
221 CL_EstablishConnection
223 Host should be either "local" or a net address to be passed on
224 =====================
226 void CL_EstablishConnection (char *host)
228 if (cls.state == ca_dedicated)
231 if (cls.demoplayback)
236 cls.netcon = NET_Connect (host);
238 Host_Error ("CL_Connect: connect failed\n");
239 Con_DPrintf ("CL_EstablishConnection: connected to %s\n", host);
241 cls.demonum = -1; // not in the demo loop now
242 cls.state = ca_connected;
243 cls.signon = 0; // need all the signon messages before playing
251 static void CL_PrintEntities_f (void)
257 for (i = 0, ent = cl_entities;i < MAX_EDICTS /*cl.num_entities*/;i++, ent++)
259 if (!ent->state_current.active)
261 if (!ent->render.model)
264 Con_Printf ("%3i:", i);
265 if (!ent->render.model)
267 Con_Printf ("EMPTY\n");
270 strncpy(name, ent->render.model->name, 30);
272 for (j = strlen(name);j < 30;j++)
274 Con_Printf ("%s:%04i (%5i %5i %5i) [%3i %3i %3i]\n", name, ent->render.frame, (int) ent->render.origin[0], (int) ent->render.origin[1], (int) ent->render.origin[2], (int) ent->render.angles[0] % 360, (int) ent->render.angles[1] % 360, (int) ent->render.angles[2] % 360);
283 Determines the fraction between the last two messages that the objects
287 static float CL_LerpPoint (void)
291 f = cl.mtime[0] - cl.mtime[1];
293 // LordHavoc: lerp in listen games as the server is being capped below the client (usually)
294 if (!f || cl_nolerp.integer || cls.timedemo || (sv.active && svs.maxclients == 1))
296 cl.time = cl.mtime[0];
301 { // dropped packet, or start of demo
302 cl.mtime[1] = cl.mtime[0] - 0.1;
305 frac = (cl.time - cl.mtime[1]) / f;
306 // Con_Printf ("frac: %f\n",frac);
311 cl.time = cl.mtime[1];
312 // Con_Printf ("low frac\n");
320 cl.time = cl.mtime[0];
321 // Con_Printf ("high frac\n");
329 static void CL_RelinkStaticEntities(void)
332 for (i = 0;i < cl.num_statics && r_refdef.numentities < MAX_VISEDICTS;i++)
334 Mod_CheckLoaded(cl_static_entities[i].render.model);
335 r_refdef.entities[r_refdef.numentities++] = &cl_static_entities[i].render;
344 static void CL_RelinkNetworkEntities()
347 int i, glowcolor, effects;
348 float f, d, bobjrotate, bobjoffset, dlightradius, glowsize, lerp;
349 vec3_t oldorg, neworg, delta, dlightcolor;
351 bobjrotate = ANGLEMOD(100*cl.time);
352 if (cl_itembobheight.value)
353 bobjoffset = (cos(cl.time * cl_itembobspeed.value * (2.0 * M_PI)) + 1.0) * 0.5 * cl_itembobheight.value;
357 CL_RelinkStaticEntities();
359 // start on the entity after the world
360 for (i = 1, ent = cl_entities + 1;i < MAX_EDICTS /*cl.num_entities*/;i++, ent++)
362 // if the object wasn't included in the latest packet, remove it
363 if (!ent->state_current.active)
366 VectorCopy(ent->persistent.trail_origin, oldorg);
368 if (!ent->state_previous.active)
370 // only one state available
372 VectorCopy (ent->state_current.origin, oldorg); // skip trails
373 VectorCopy (ent->state_current.origin, neworg);
374 VectorCopy (ent->state_current.angles, ent->render.angles);
377 // monster interpolation
378 ent->persistent.steplerptime = 0;
379 VectorCopy(ent->state_current.origin, ent->persistent.stepoldorigin);
380 VectorCopy(ent->state_current.angles, ent->persistent.stepoldangles);
381 VectorCopy(ent->state_current.origin, ent->persistent.steporigin);
382 VectorCopy(ent->state_current.angles, ent->persistent.stepangles);
386 else if ((ent->state_current.flags & ent->state_previous.flags) & ENTFLAG_STEP)
388 if (ent->state_current.origin[0] != ent->persistent.steporigin[0]
389 || ent->state_current.origin[1] != ent->persistent.steporigin[1]
390 || ent->state_current.origin[2] != ent->persistent.steporigin[2]
391 || ent->state_current.angles[0] != ent->persistent.stepangles[0]
392 || ent->state_current.angles[1] != ent->persistent.stepangles[1]
393 || ent->state_current.angles[2] != ent->persistent.stepangles[2])
395 // update lerp positions
396 ent->clientpersistent.steplerptime = sv.time;
397 VectorCopy(ent->steporigin, ent->stepoldorigin);
398 VectorCopy(ent->stepangles, ent->stepoldangles);
399 VectorCopy(ent->v.origin, ent->steporigin);
400 VectorCopy(ent->v.angles, ent->stepangles);
402 lerp = (cl.time - ent->persistent.steplerptime) * 10.0;
406 VectorSubtract(ent->persistent.steporigin, ent->persistent.stepoldorigin, delta);
407 VectorMA(ent->persistent.stepoldorigin, lerp, delta, neworg);
410 VectorSubtract(ent->persistent.stepangles, ent->persistent.stepoldangles, delta);
411 // choose shortest rotate (to avoid 'spin around' situations)
412 if (delta[0] < -180) delta[0] += 360;else if (delta[0] >= 180) delta[0] -= 360;
413 if (delta[1] < -180) delta[1] += 360;else if (delta[1] >= 180) delta[1] -= 360;
414 if (delta[2] < -180) delta[2] += 360;else if (delta[2] >= 180) delta[2] -= 360;
415 VectorMA(ent->stepoldangles, lerp, delta, ent->render.angles);
419 VectorCopy(ent->persistent.steporigin, neworg);
420 VectorCopy(ent->persistent.stepangles, ent->render.angles);
427 // monster interpolation
428 ent->persistent.steplerptime = 0;
429 VectorCopy(ent->state_current.origin, ent->persistent.stepoldorigin);
430 VectorCopy(ent->state_current.angles, ent->persistent.stepoldangles);
431 VectorCopy(ent->state_current.origin, ent->persistent.steporigin);
432 VectorCopy(ent->state_current.angles, ent->persistent.stepangles);
435 // if the delta is large, assume a teleport and don't lerp
436 VectorSubtract(ent->state_current.origin, ent->state_previous.origin, delta);
437 // LordHavoc: increased tolerance from 100 to 200, and now to 1000
438 if ((sv.active && svs.maxclients == 1 && !(ent->state_current.flags & RENDER_STEP)) || cls.timedemo || DotProduct(delta, delta) > 1000*1000 || cl_nolerp.integer)
442 f = ent->state_current.time - ent->state_previous.time;
444 lerp = (cl.time - ent->state_previous.time) / f;
451 VectorCopy (ent->state_current.origin, neworg);
452 VectorCopy (ent->state_current.angles, ent->render.angles);
456 // interpolate the origin and angles
457 VectorMA(ent->state_previous.origin, lerp, delta, neworg);
458 VectorSubtract(ent->state_current.angles, ent->state_previous.angles, delta);
459 if (delta[0] < -180) delta[0] += 360;else if (delta[0] >= 180) delta[0] -= 360;
460 if (delta[1] < -180) delta[1] += 360;else if (delta[1] >= 180) delta[1] -= 360;
461 if (delta[2] < -180) delta[2] += 360;else if (delta[2] >= 180) delta[2] -= 360;
462 VectorMA(ent->state_previous.angles, lerp, delta, ent->render.angles);
466 VectorCopy (neworg, ent->persistent.trail_origin);
467 // persistent.modelindex will be updated by CL_LerpUpdate
468 if (ent->state_current.modelindex != ent->persistent.modelindex)
469 VectorCopy(neworg, oldorg);
471 VectorCopy (neworg, ent->render.origin);
472 ent->render.flags = ent->state_current.flags;
473 ent->render.effects = effects = ent->state_current.effects;
474 if (cl.scores == NULL || !ent->state_current.colormap)
475 ent->render.colormap = -1; // no special coloring
477 ent->render.colormap = cl.scores[ent->state_current.colormap - 1].colors; // color it
478 ent->render.skinnum = ent->state_current.skin;
479 ent->render.alpha = ent->state_current.alpha * (1.0f / 255.0f); // FIXME: interpolate?
480 ent->render.scale = ent->state_current.scale * (1.0f / 16.0f); // FIXME: interpolate?
482 // update interpolation info
485 // handle effects now...
491 // LordHavoc: if the entity has no effects, don't check each
494 if (effects & EF_BRIGHTFIELD)
495 CL_EntityParticles (ent);
496 if (effects & EF_MUZZLEFLASH)
500 AngleVectors (ent->render.angles, v, NULL, NULL);
502 v2[0] = v[0] * 18 + neworg[0];
503 v2[1] = v[1] * 18 + neworg[1];
504 v2[2] = v[2] * 18 + neworg[2] + 16;
505 TraceLine(neworg, v2, v, NULL, 0);
507 CL_AllocDlight (NULL, v, 100, 1, 1, 1, 0, 0.1);
509 if (effects & EF_DIMLIGHT)
511 dlightcolor[0] += 200.0f;
512 dlightcolor[1] += 200.0f;
513 dlightcolor[2] += 200.0f;
515 if (effects & EF_BRIGHTLIGHT)
517 dlightcolor[0] += 400.0f;
518 dlightcolor[1] += 400.0f;
519 dlightcolor[2] += 400.0f;
521 // LordHavoc: added EF_RED and EF_BLUE
522 if (effects & EF_RED) // red
524 dlightcolor[0] += 200.0f;
525 dlightcolor[1] += 20.0f;
526 dlightcolor[2] += 20.0f;
528 if (effects & EF_BLUE) // blue
530 dlightcolor[0] += 20.0f;
531 dlightcolor[1] += 20.0f;
532 dlightcolor[2] += 200.0f;
534 if (effects & EF_FLAME)
536 if (ent->render.model)
540 if (ent->render.angles[0] || ent->render.angles[2])
542 VectorAdd(neworg, ent->render.model->rotatedmins, mins);
543 VectorAdd(neworg, ent->render.model->rotatedmaxs, maxs);
545 else if (ent->render.angles[1])
547 VectorAdd(neworg, ent->render.model->yawmins, mins);
548 VectorAdd(neworg, ent->render.model->yawmaxs, maxs);
552 VectorAdd(neworg, ent->render.model->normalmins, mins);
553 VectorAdd(neworg, ent->render.model->normalmaxs, maxs);
555 // how many flames to make
556 temp = (int) (cl.time * 300) - (int) (cl.oldtime * 300);
557 CL_FlameCube(mins, maxs, temp);
559 d = lhrandom(200, 250);
560 dlightcolor[0] += d * 1.0f;
561 dlightcolor[1] += d * 0.7f;
562 dlightcolor[2] += d * 0.3f;
566 // LordHavoc: if the model has no flags, don't check each
567 if (ent->render.model && ent->render.model->flags)
569 if (ent->render.model->flags & EF_ROTATE)
571 ent->render.angles[1] = bobjrotate;
572 ent->render.origin[2] += bobjoffset;
574 // only do trails if present in the previous frame as well
575 if (ent->state_previous.active)
577 if (ent->render.model->flags & EF_GIB)
578 CL_RocketTrail (oldorg, neworg, 2, ent);
579 else if (ent->render.model->flags & EF_ZOMGIB)
580 CL_RocketTrail (oldorg, neworg, 4, ent);
581 else if (ent->render.model->flags & EF_TRACER)
582 CL_RocketTrail (oldorg, neworg, 3, ent);
583 else if (ent->render.model->flags & EF_TRACER2)
584 CL_RocketTrail (oldorg, neworg, 5, ent);
585 else if (ent->render.model->flags & EF_ROCKET)
587 CL_RocketTrail (oldorg, ent->render.origin, 0, ent);
588 dlightcolor[0] += 200.0f;
589 dlightcolor[1] += 160.0f;
590 dlightcolor[2] += 80.0f;
592 else if (ent->render.model->flags & EF_GRENADE)
594 if (ent->render.alpha == -1) // LordHavoc: Nehahra dem compatibility
595 CL_RocketTrail (oldorg, neworg, 7, ent);
597 CL_RocketTrail (oldorg, neworg, 1, ent);
599 else if (ent->render.model->flags & EF_TRACER3)
600 CL_RocketTrail (oldorg, neworg, 6, ent);
603 // LordHavoc: customizable glow
604 glowsize = ent->state_current.glowsize * 4.0f; // FIXME: interpolate?
605 glowcolor = ent->state_current.glowcolor;
608 byte *tempcolor = (byte *)&d_8to24table[glowcolor];
609 dlightcolor[0] += glowsize * tempcolor[0] * (1.0f / 255.0f);
610 dlightcolor[1] += glowsize * tempcolor[1] * (1.0f / 255.0f);
611 dlightcolor[2] += glowsize * tempcolor[2] * (1.0f / 255.0f);
613 // LordHavoc: customizable trail
614 if (ent->render.flags & RENDER_GLOWTRAIL)
615 CL_RocketTrail2 (oldorg, neworg, glowcolor, ent);
617 if (dlightcolor[0] || dlightcolor[1] || dlightcolor[2])
620 dlightradius = VectorLength(dlightcolor);
621 d = 1.0f / dlightradius;
622 VectorCopy(neworg, vec);
623 // hack to make glowing player light shine on their gun
624 if (i == cl.viewentity && !chase_active.integer)
626 CL_AllocDlight (&ent->render, vec, dlightradius, dlightcolor[0] * d, dlightcolor[1] * d, dlightcolor[2] * d, 0, 0);
629 if (chase_active.integer)
631 if (ent->render.flags & RENDER_VIEWMODEL)
636 if (i == cl.viewentity || (ent->render.flags & RENDER_EXTERIORMODEL))
640 if (ent->render.model == NULL)
642 if (effects & EF_NODRAW)
644 if (r_refdef.numentities < MAX_VISEDICTS)
645 r_refdef.entities[r_refdef.numentities++] = &ent->render;
649 static void CL_LerpPlayerVelocity (void)
654 // fraction from previous network update to current
655 frac = CL_LerpPoint ();
657 for (i = 0;i < 3;i++)
658 cl.velocity[i] = cl.mvelocity[1][i] + frac * (cl.mvelocity[0][i] - cl.mvelocity[1][i]);
660 if (cls.demoplayback)
662 // interpolate the angles
663 for (i = 0;i < 3;i++)
665 d = cl.mviewangles[0][i] - cl.mviewangles[1][i];
670 cl.viewangles[i] = cl.mviewangles[1][i] + frac*d;
675 void CL_Effect(vec3_t org, int modelindex, int startframe, int framecount, float framerate)
679 if (!modelindex) // sanity check
681 for (i = 0, e = cl_effect;i < MAX_EFFECTS;i++, e++)
686 VectorCopy(org, e->origin);
687 e->modelindex = modelindex;
688 e->starttime = cl.time;
689 e->startframe = startframe;
690 e->endframe = startframe + framecount;
691 e->framerate = framerate;
694 e->frame1time = cl.time;
695 e->frame2time = cl.time;
700 static void CL_RelinkEffects()
707 for (i = 0, e = cl_effect;i < MAX_EFFECTS;i++, e++)
711 frame = (cl.time - e->starttime) * e->framerate + e->startframe;
713 if (intframe < 0 || intframe >= e->endframe)
716 memset(e, 0, sizeof(*e));
720 if (intframe != e->frame)
723 e->frame1time = e->frame2time;
724 e->frame2time = cl.time;
727 if ((vis = CL_NewTempEntity()))
729 // interpolation stuff
730 vis->render.frame1 = intframe;
731 vis->render.frame2 = intframe + 1;
732 if (vis->render.frame2 >= e->endframe)
733 vis->render.frame2 = -1; // disappear
734 vis->render.framelerp = frame - intframe;
735 vis->render.frame1time = e->frame1time;
736 vis->render.frame2time = e->frame2time;
739 VectorCopy(e->origin, vis->render.origin);
740 vis->render.model = cl.model_precache[e->modelindex];
741 vis->render.frame = vis->render.frame2;
742 vis->render.colormap = -1; // no special coloring
743 vis->render.scale = 1;
744 vis->render.alpha = 1;
750 void CL_RelinkEntities (void)
752 r_refdef.numentities = 0;
754 CL_LerpPlayerVelocity();
755 CL_RelinkNetworkEntities();
767 Read all incoming data from the server
770 int CL_ReadFromServer (void)
774 cl.oldtime = cl.time;
775 cl.time += cl.frametime;
780 ret = CL_GetMessage ();
782 Host_Error ("CL_ReadFromServer: lost server connection");
786 cl.last_received_message = realtime;
788 if (cl_shownet.integer)
791 CL_ParseServerMessage ();
793 while (ret && cls.state == ca_connected);
798 CL_RelinkEntities ();
801 // bring the links up to date
811 void CL_SendCmd (void)
815 if (cls.state != ca_connected)
818 if (cls.signon == SIGNONS)
820 // get basic movement from keyboard
823 // allow mice or other external controllers to add to the move
826 // send the unreliable message
830 if (cls.demoplayback)
832 SZ_Clear (&cls.message);
836 // send the reliable message
837 if (!cls.message.cursize)
838 return; // no message at all
840 if (!NET_CanSendMessage (cls.netcon))
842 Con_DPrintf ("CL_WriteToServer: can't send\n");
846 if (NET_SendMessage (cls.netcon, &cls.message) == -1)
847 Host_Error ("CL_WriteToServer: lost server connection");
849 SZ_Clear (&cls.message);
852 // LordHavoc: pausedemo command
853 static void CL_PauseDemo_f (void)
855 cls.demopaused = !cls.demopaused;
857 Con_Printf("Demo paused\n");
859 Con_Printf("Demo unpaused\n");
863 ======================
865 LordHavoc: Intended for Nehahra, I personally think this is dumb, but Mindcrime won't listen.
866 ======================
868 static void CL_PModel_f (void)
873 if (Cmd_Argc () == 1)
875 Con_Printf ("\"pmodel\" is \"%s\"\n", cl_pmodel.string);
878 i = atoi(Cmd_Argv(1));
880 if (cmd_source == src_command)
882 if (cl_pmodel.integer == i)
884 Cvar_SetValue ("_cl_pmodel", i);
885 if (cls.state == ca_connected)
886 Cmd_ForwardToServer ();
890 host_client->pmodel = i;
891 if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_pmodel)))
896 ======================
898 ======================
900 static void CL_Fog_f (void)
902 if (Cmd_Argc () == 1)
904 Con_Printf ("\"fog\" is \"%f %f %f %f\"\n", fog_density, fog_red, fog_green, fog_blue);
907 fog_density = atof(Cmd_Argv(1));
908 fog_red = atof(Cmd_Argv(2));
909 fog_green = atof(Cmd_Argv(3));
910 fog_blue = atof(Cmd_Argv(4));
920 cl_scores_mempool = Mem_AllocPool("client player info");
922 cl_refdef_mempool = Mem_AllocPool("refdef");
923 memset(&r_refdef, 0, sizeof(r_refdef));
924 r_refdef.entities = Mem_Alloc(cl_refdef_mempool, sizeof(entity_render_t *) * MAX_VISEDICTS);
926 SZ_Alloc (&cls.message, 1024, "cls.message");
932 // register our commands
934 Cvar_RegisterVariable (&cl_name);
935 Cvar_RegisterVariable (&cl_color);
936 if (gamemode == GAME_NEHAHRA)
937 Cvar_RegisterVariable (&cl_pmodel);
938 Cvar_RegisterVariable (&cl_upspeed);
939 Cvar_RegisterVariable (&cl_forwardspeed);
940 Cvar_RegisterVariable (&cl_backspeed);
941 Cvar_RegisterVariable (&cl_sidespeed);
942 Cvar_RegisterVariable (&cl_movespeedkey);
943 Cvar_RegisterVariable (&cl_yawspeed);
944 Cvar_RegisterVariable (&cl_pitchspeed);
945 Cvar_RegisterVariable (&cl_anglespeedkey);
946 Cvar_RegisterVariable (&cl_shownet);
947 Cvar_RegisterVariable (&cl_nolerp);
948 Cvar_RegisterVariable (&lookspring);
949 Cvar_RegisterVariable (&lookstrafe);
950 Cvar_RegisterVariable (&sensitivity);
951 Cvar_RegisterVariable (&freelook);
953 Cvar_RegisterVariable (&m_pitch);
954 Cvar_RegisterVariable (&m_yaw);
955 Cvar_RegisterVariable (&m_forward);
956 Cvar_RegisterVariable (&m_side);
958 Cvar_RegisterVariable (&cl_itembobspeed);
959 Cvar_RegisterVariable (&cl_itembobheight);
961 Cmd_AddCommand ("entities", CL_PrintEntities_f);
962 Cmd_AddCommand ("bitprofile", CL_BitProfile_f);
963 Cmd_AddCommand ("disconnect", CL_Disconnect_f);
964 Cmd_AddCommand ("record", CL_Record_f);
965 Cmd_AddCommand ("stop", CL_Stop_f);
966 Cmd_AddCommand ("playdemo", CL_PlayDemo_f);
967 Cmd_AddCommand ("timedemo", CL_TimeDemo_f);
969 Cmd_AddCommand ("fog", CL_Fog_f);
971 // LordHavoc: added pausedemo
972 Cmd_AddCommand ("pausedemo", CL_PauseDemo_f);
973 if (gamemode == GAME_NEHAHRA)
974 Cmd_AddCommand ("pmodel", CL_PModel_f);
976 Cvar_RegisterVariable(&cl_draweffects);