]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
moved many cl_ prefixed variables into cl. or cls.
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 15 Mar 2006 07:02:56 +0000 (07:02 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 15 Mar 2006 07:02:56 +0000 (07:02 +0000)
made most menu functions static
removed WORKINGLQUAKE support from cl_particles.c and moved particle allocation to cl_main.c (where all the other arrays are allocated)
renamed cl_activevideos to cl_num_videos and videoarray to cl_videos (did not move these into cls. however)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6117 d7cf8633-e32d-0410-b094-e92efae38249

24 files changed:
cl_collision.c
cl_input.c
cl_main.c
cl_parse.c
cl_particles.c
cl_screen.c
cl_video.c
client.h
clvm_cmds.c
csprogs.c
csprogs.h
gl_rsurf.c
host.c
menu.c
meshqueue.c
netconn.c
netconn.h
protocol.c
r_crosshairs.c
r_lightning.c
snd_main.c
snd_mix.c
view.c
wad.c

index 72d2f78b5d7b61625479f650b3478f5ca180ba27..28f908e89096ecb02e810f86c9c2b600c8c6967d 100644 (file)
@@ -50,7 +50,7 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co
        if (hitent)
                *hitent = 0;
 
-       if (hitbmodels && cl_num_brushmodel_entities)
+       if (hitbmodels && cl.num_brushmodel_entities)
        {
                tracemins[0] = min(start[0], end[0]) + mins[0];
                tracemaxs[0] = max(start[0], end[0]) + maxs[0];
@@ -60,9 +60,9 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co
                tracemaxs[2] = max(start[2], end[2]) + maxs[2];
 
                // look for embedded bmodels
-               for (n = 0;n < cl_num_brushmodel_entities;n++)
+               for (n = 0;n < cl.num_brushmodel_entities;n++)
                {
-                       ent = &cl_entities[cl_brushmodel_entities[n]].render;
+                       ent = &cl.entities[cl.brushmodel_entities[n]].render;
                        if (!BoxesOverlap(tracemins, tracemaxs, ent->mins, ent->maxs))
                                continue;
 
@@ -84,7 +84,7 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co
                                cliptrace.startsolid = true;
                                if (cliptrace.realfraction == 1)
                                        if (hitent)
-                                               *hitent = cl_brushmodel_entities[n];
+                                               *hitent = cl.brushmodel_entities[n];
                        }
                        // don't set this except on the world, because it can easily confuse
                        // monsters underwater if there's a bmodel involved in the trace
@@ -99,7 +99,7 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co
                                cliptrace.realfraction = trace.realfraction;
                                cliptrace.plane = trace.plane;
                                if (hitent)
-                                       *hitent = cl_brushmodel_entities[n];
+                                       *hitent = cl.brushmodel_entities[n];
                                Matrix4x4_Transform3x3(&ent->matrix, trace.plane.normal, cliptrace.plane.normal);
                        }
                        cliptrace.startsupercontents |= trace.startsupercontents;
@@ -118,10 +118,10 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co
                {
                        if (n != cl.playerentity)
                        {
-                               ent = &cl_entities[n].render;
+                               ent = &cl.entities[n].render;
                                // FIXME: crouch
-                               playermins = cl_playerstandmins;
-                               playermaxs = cl_playerstandmaxs;
+                               playermins = cl.playerstandmins;
+                               playermaxs = cl.playerstandmaxs;
                                Matrix4x4_OriginFromMatrix(&ent->matrix, origin);
                                VectorAdd(origin, playermins, entmins);
                                VectorAdd(origin, playermaxs, entmaxs);
@@ -195,7 +195,6 @@ float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, ve
 
        if (normal)
                VectorCopy(trace.plane.normal, normal);
-       //cl_traceline_startsupercontents = trace.startsupercontents;
        maxfrac = trace.fraction;
        maxrealfrac = trace.realfraction;
 
@@ -208,15 +207,15 @@ float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, ve
 
        if(csqcents)
        {
-               entlist = cl_csqcentities;
-               entactivelist = cl_csqcentities_active;
-               entsnum = cl_num_csqcentities;
+               entlist = cl.csqcentities;
+               entactivelist = cl.csqcentities_active;
+               entsnum = cl.num_csqcentities;
        }
        else
        {
-               entlist = cl_entities;
-               entactivelist = cl_entities_active;
-               entsnum = cl_num_entities;
+               entlist = cl.entities;
+               entactivelist = cl.entities_active;
+               entsnum = cl.num_entities;
        }
 
        // look for embedded bmodels
@@ -242,7 +241,6 @@ float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, ve
                if (ent->model && ent->model->TraceBox)
                        ent->model->TraceBox(ent->model, ent->frameblend[0].frame, &trace, starttransformed, starttransformed, endtransformed, endtransformed, SUPERCONTENTS_SOLID);
 
-               //cl_traceline_startsupercontents |= trace.startsupercontents;
                if (maxrealfrac > trace.realfraction)
                {
                        if (hitent)
index 557f04b30ae3f9413981956e14d330edf189bff8..8d3b33774e74ac526aa5ff61ee7b4b61cf589b92 100644 (file)
@@ -510,7 +510,7 @@ void CL_UpdatePrydonCursor(void)
        VectorSet(temp, cl.cmd.cursor_screen[2] * scale[2], cl.cmd.cursor_screen[0] * scale[0], cl.cmd.cursor_screen[1] * scale[1]);
        Matrix4x4_Transform(&r_refdef.viewentitymatrix, temp, cl.cmd.cursor_end);
        // trace from view origin to the cursor
-       cl.cmd.cursor_fraction = CL_SelectTraceLine(cl.cmd.cursor_start, cl.cmd.cursor_end, cl.cmd.cursor_impact, cl.cmd.cursor_normal, &cl.cmd.cursor_entitynumber, (chase_active.integer || cl.intermission) ? &cl_entities[cl.playerentity].render : NULL, false);
+       cl.cmd.cursor_fraction = CL_SelectTraceLine(cl.cmd.cursor_start, cl.cmd.cursor_end, cl.cmd.cursor_impact, cl.cmd.cursor_normal, &cl.cmd.cursor_entitynumber, (chase_active.integer || cl.intermission) ? &cl.entities[cl.playerentity].render : NULL, false);
        // makes sparks where cursor is
        //CL_SparkShower(cl.cmd.cursor_impact, cl.cmd.cursor_normal, 5, 0);
 }
@@ -667,7 +667,7 @@ void CL_ClientMovement_Replay(void)
        }
 
        // fetch current starting values
-       VectorCopy(cl_entities[cl.playerentity].state_current.origin, currentorigin);
+       VectorCopy(cl.entities[cl.playerentity].state_current.origin, currentorigin);
        VectorCopy(cl.mvelocity[0], currentvelocity);
        // FIXME: try minor nudges in various directions if startsolid to find a
        // safe place to start the walk (due to network compression in some
@@ -678,7 +678,7 @@ void CL_ClientMovement_Replay(void)
        // check if onground
        VectorSet(currentorigin2, currentorigin[0], currentorigin[1], currentorigin[2] + 1);
        VectorSet(neworigin2, currentorigin[0], currentorigin[1], currentorigin[2] - 1);
-       trace = CL_TraceBox(currentorigin2, cl_playercrouchmins, cl_playercrouchmaxs, neworigin2, true, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_PLAYERCLIP, true);
+       trace = CL_TraceBox(currentorigin2, cl.playercrouchmins, cl.playercrouchmaxs, neworigin2, true, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_PLAYERCLIP, true);
        onground = trace.fraction < 1 && trace.plane.normal[2] > 0.7;
        //Con_Printf("%f: ", cl.mtime[0]);
 
@@ -704,20 +704,20 @@ void CL_ClientMovement_Replay(void)
                                // low ceiling first
                                if (crouch)
                                {
-                                       trace = CL_TraceBox(currentorigin, cl_playerstandmins, cl_playerstandmaxs, currentorigin, true, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_PLAYERCLIP, true);
+                                       trace = CL_TraceBox(currentorigin, cl.playerstandmins, cl.playerstandmaxs, currentorigin, true, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_PLAYERCLIP, true);
                                        if (!trace.startsolid)
                                                crouch = false;
                                }
                        }
                        if (crouch)
                        {
-                               playermins = cl_playercrouchmins;
-                               playermaxs = cl_playercrouchmaxs;
+                               playermins = cl.playercrouchmins;
+                               playermaxs = cl.playercrouchmaxs;
                        }
                        else
                        {
-                               playermins = cl_playerstandmins;
-                               playermaxs = cl_playerstandmaxs;
+                               playermins = cl.playerstandmins;
+                               playermaxs = cl.playerstandmaxs;
                        }
                        // change velocity according to q->viewangles and q->move
                        contents = CL_PointSuperContents(currentorigin);
@@ -816,13 +816,13 @@ void CL_ClientMovement_Replay(void)
                {
                        if (crouch)
                        {
-                               playermins = cl_playercrouchmins;
-                               playermaxs = cl_playercrouchmaxs;
+                               playermins = cl.playercrouchmins;
+                               playermaxs = cl.playercrouchmaxs;
                        }
                        else
                        {
-                               playermins = cl_playerstandmins;
-                               playermaxs = cl_playerstandmaxs;
+                               playermins = cl.playerstandmins;
+                               playermaxs = cl.playerstandmaxs;
                        }
                        onground = false;
                        for (bump = 0, t = frametime;bump < 8 && VectorLength2(currentvelocity) > 0;bump++)
@@ -867,8 +867,8 @@ void CL_ClientMovement_Replay(void)
        VectorCopy(cl.movement_origin, cl.movement_oldorigin);
        VectorCopy(currentorigin, cl.movement_origin);
        VectorCopy(currentvelocity, cl.movement_velocity);
-       //VectorCopy(currentorigin, cl_entities[cl.playerentity].state_current.origin);
-       //VectorSet(cl_entities[cl.playerentity].state_current.angles, 0, cl.viewangles[1], 0);
+       //VectorCopy(currentorigin, cl.entities[cl.playerentity].state_current.origin);
+       //VectorSet(cl.entities[cl.playerentity].state_current.angles, 0, cl.viewangles[1], 0);
 }
 
 void QW_MSG_WriteDeltaUsercmd(sizebuf_t *buf, qw_usercmd_t *from, qw_usercmd_t *to)
index cb78f39bd421aca3b651e3cf57da7ead4ae9f59a..8a1211076c70454e976e7e5402ed3eca312f137a 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -72,50 +72,11 @@ cvar_t cl_prydoncursor = {0, "cl_prydoncursor", "0", "enables a mouse pointer wh
 
 cvar_t cl_deathnoviewmodel = {0, "cl_deathnoviewmodel", "1", "hides gun model when dead"};
 
-vec3_t cl_playerstandmins;
-vec3_t cl_playerstandmaxs;
-vec3_t cl_playercrouchmins;
-vec3_t cl_playercrouchmaxs;
-
-mempool_t *cl_mempool;
-
 client_static_t        cls;
 client_state_t cl;
 
-int cl_max_entities;
-int cl_max_csqcentities;
-int cl_max_static_entities;
-int cl_max_temp_entities;
-int cl_max_effects;
-int cl_max_beams;
-int cl_max_dlights;
-int cl_max_lightstyle;
-int cl_max_brushmodel_entities;
-int cl_activedlights;
-int cl_activeeffects;
-int cl_activebeams;
-
-entity_t *cl_entities;
-entity_t *cl_csqcentities;     //[515]: csqc
-unsigned char *cl_entities_active;
-unsigned char *cl_csqcentities_active; //[515]: csqc
-entity_t *cl_static_entities;
-entity_t *cl_temp_entities;
-cl_effect_t *cl_effects;
-beam_t *cl_beams;
-dlight_t *cl_dlights;
-lightstyle_t *cl_lightstyle;
-int *cl_brushmodel_entities;
-
-int cl_num_entities;
-int cl_num_csqcentities;       //[515]: csqc
-int cl_num_static_entities;
-int cl_num_temp_entities;
-int cl_num_brushmodel_entities;
-
-// keep track of quake entities because they need to be killed if they get stale
-extern int cl_lastquakeentity;
-extern unsigned char cl_isquakeentity[MAX_EDICTS];
+#define MAX_PARTICLES                  32768   // default max # of particles at one time
+#define ABSOLUTE_MIN_PARTICLES 512             // no fewer than this no matter what's on the command line
 
 /*
 =====================
@@ -128,21 +89,22 @@ void CL_ClearState(void)
        int i;
        entity_t *ent;
 
-       if (cl_entities) Mem_Free(cl_entities);cl_entities = NULL;
-       if (cl_csqcentities) Mem_Free(cl_csqcentities);cl_csqcentities = NULL;  //[515]: csqc
-       if (cl_entities_active) Mem_Free(cl_entities_active);cl_entities_active = NULL;
-       if (cl_csqcentities_active) Mem_Free(cl_csqcentities_active);cl_csqcentities_active = NULL;     //[515]: csqc
-       if (cl_static_entities) Mem_Free(cl_static_entities);cl_static_entities = NULL;
-       if (cl_temp_entities) Mem_Free(cl_temp_entities);cl_temp_entities = NULL;
-       if (cl_effects) Mem_Free(cl_effects);cl_effects = NULL;
-       if (cl_beams) Mem_Free(cl_beams);cl_beams = NULL;
-       if (cl_dlights) Mem_Free(cl_dlights);cl_dlights = NULL;
-       if (cl_lightstyle) Mem_Free(cl_lightstyle);cl_lightstyle = NULL;
-       if (cl_brushmodel_entities) Mem_Free(cl_brushmodel_entities);cl_brushmodel_entities = NULL;
+       if (cl.entities) Mem_Free(cl.entities);cl.entities = NULL;
+       if (cl.csqcentities) Mem_Free(cl.csqcentities);cl.csqcentities = NULL;  //[515]: csqc
+       if (cl.entities_active) Mem_Free(cl.entities_active);cl.entities_active = NULL;
+       if (cl.csqcentities_active) Mem_Free(cl.csqcentities_active);cl.csqcentities_active = NULL;     //[515]: csqc
+       if (cl.static_entities) Mem_Free(cl.static_entities);cl.static_entities = NULL;
+       if (cl.temp_entities) Mem_Free(cl.temp_entities);cl.temp_entities = NULL;
+       if (cl.effects) Mem_Free(cl.effects);cl.effects = NULL;
+       if (cl.beams) Mem_Free(cl.beams);cl.beams = NULL;
+       if (cl.dlights) Mem_Free(cl.dlights);cl.dlights = NULL;
+       if (cl.lightstyle) Mem_Free(cl.lightstyle);cl.lightstyle = NULL;
+       if (cl.brushmodel_entities) Mem_Free(cl.brushmodel_entities);cl.brushmodel_entities = NULL;
        if (cl.entitydatabase) EntityFrame_FreeDatabase(cl.entitydatabase);cl.entitydatabase = NULL;
        if (cl.entitydatabase4) EntityFrame4_FreeDatabase(cl.entitydatabase4);cl.entitydatabase4 = NULL;
        if (cl.entitydatabaseqw) EntityFrameQW_FreeDatabase(cl.entitydatabaseqw);cl.entitydatabaseqw = NULL;
        if (cl.scores) Mem_Free(cl.scores);cl.scores = NULL;
+       if (cl.particles) Mem_Free(cl.particles);cl.particles = NULL;
 
        if (!sv.active)
                Host_ClearMemory ();
@@ -155,77 +117,86 @@ void CL_ClearState(void)
        // reset the view zoom interpolation
        cl.mviewzoom[0] = cl.mviewzoom[1] = 1;
 
-       cl_num_entities = 0;
-       cl_num_csqcentities = 0;        //[515]: csqc
-       cl_num_static_entities = 0;
-       cl_num_temp_entities = 0;
-       cl_num_brushmodel_entities = 0;
+       cl.num_entities = 0;
+       cl.num_csqcentities = 0;        //[515]: csqc
+       cl.num_static_entities = 0;
+       cl.num_temp_entities = 0;
+       cl.num_brushmodel_entities = 0;
 
        // tweak these if the game runs out
-       cl_max_entities = 256;
-       cl_max_csqcentities = 256;      //[515]: csqc
-       cl_max_static_entities = 256;
-       cl_max_temp_entities = 512;
-       cl_max_effects = 256;
-       cl_max_beams = 256;
-       cl_max_dlights = MAX_DLIGHTS;
-       cl_max_lightstyle = MAX_LIGHTSTYLES;
-       cl_max_brushmodel_entities = MAX_EDICTS;
-       cl_activedlights = 0;
-       cl_activeeffects = 0;
-       cl_activebeams = 0;
-
-       cl_entities = (entity_t *)Mem_Alloc(cl_mempool, cl_max_entities * sizeof(entity_t));
-       cl_csqcentities = (entity_t *)Mem_Alloc(cl_mempool, cl_max_csqcentities * sizeof(entity_t));    //[515]: csqc
-       cl_entities_active = (unsigned char *)Mem_Alloc(cl_mempool, cl_max_brushmodel_entities * sizeof(unsigned char));
-       cl_csqcentities_active = (unsigned char *)Mem_Alloc(cl_mempool, cl_max_brushmodel_entities * sizeof(unsigned char));    //[515]: csqc
-       cl_static_entities = (entity_t *)Mem_Alloc(cl_mempool, cl_max_static_entities * sizeof(entity_t));
-       cl_temp_entities = (entity_t *)Mem_Alloc(cl_mempool, cl_max_temp_entities * sizeof(entity_t));
-       cl_effects = (cl_effect_t *)Mem_Alloc(cl_mempool, cl_max_effects * sizeof(cl_effect_t));
-       cl_beams = (beam_t *)Mem_Alloc(cl_mempool, cl_max_beams * sizeof(beam_t));
-       cl_dlights = (dlight_t *)Mem_Alloc(cl_mempool, cl_max_dlights * sizeof(dlight_t));
-       cl_lightstyle = (lightstyle_t *)Mem_Alloc(cl_mempool, cl_max_lightstyle * sizeof(lightstyle_t));
-       cl_brushmodel_entities = (int *)Mem_Alloc(cl_mempool, cl_max_brushmodel_entities * sizeof(int));
-
-       cl_lastquakeentity = 0;
-       memset(cl_isquakeentity, 0, sizeof(cl_isquakeentity));
+       cl.max_entities = 256;
+       cl.max_csqcentities = 256;      //[515]: csqc
+       cl.max_static_entities = 256;
+       cl.max_temp_entities = 512;
+       cl.max_effects = 256;
+       cl.max_beams = 256;
+       cl.max_dlights = MAX_DLIGHTS;
+       cl.max_lightstyle = MAX_LIGHTSTYLES;
+       cl.max_brushmodel_entities = MAX_EDICTS;
+       cl.max_particles = MAX_PARTICLES;
+
+// COMMANDLINEOPTION: Client: -particles <number> changes maximum number of particles at once, default 32768
+       i = COM_CheckParm ("-particles");
+       if (i && i < com_argc - 1)
+       {
+               cl.max_particles = (int)(atoi(com_argv[i+1]));
+               if (cl.max_particles < ABSOLUTE_MIN_PARTICLES)
+                       cl.max_particles = ABSOLUTE_MIN_PARTICLES;
+       }
+
+       cl.num_dlights = 0;
+       cl.num_effects = 0;
+       cl.num_beams = 0;
+
+       cl.entities = (entity_t *)Mem_Alloc(cls.mempool, cl.max_entities * sizeof(entity_t));
+       cl.csqcentities = (entity_t *)Mem_Alloc(cls.mempool, cl.max_csqcentities * sizeof(entity_t));   //[515]: csqc
+       cl.entities_active = (unsigned char *)Mem_Alloc(cls.mempool, cl.max_brushmodel_entities * sizeof(unsigned char));
+       cl.csqcentities_active = (unsigned char *)Mem_Alloc(cls.mempool, cl.max_brushmodel_entities * sizeof(unsigned char));   //[515]: csqc
+       cl.static_entities = (entity_t *)Mem_Alloc(cls.mempool, cl.max_static_entities * sizeof(entity_t));
+       cl.temp_entities = (entity_t *)Mem_Alloc(cls.mempool, cl.max_temp_entities * sizeof(entity_t));
+       cl.effects = (cl_effect_t *)Mem_Alloc(cls.mempool, cl.max_effects * sizeof(cl_effect_t));
+       cl.beams = (beam_t *)Mem_Alloc(cls.mempool, cl.max_beams * sizeof(beam_t));
+       cl.dlights = (dlight_t *)Mem_Alloc(cls.mempool, cl.max_dlights * sizeof(dlight_t));
+       cl.lightstyle = (lightstyle_t *)Mem_Alloc(cls.mempool, cl.max_lightstyle * sizeof(lightstyle_t));
+       cl.brushmodel_entities = (int *)Mem_Alloc(cls.mempool, cl.max_brushmodel_entities * sizeof(int));
+       cl.particles = (particle_t *) Mem_Alloc(cls.mempool, cl.max_particles * sizeof(particle_t));
 
        // LordHavoc: have to set up the baseline info for alpha and other stuff
-       for (i = 0;i < cl_max_entities;i++)
+       for (i = 0;i < cl.max_entities;i++)
        {
-               cl_entities[i].state_baseline = defaultstate;
-               cl_entities[i].state_previous = defaultstate;
-               cl_entities[i].state_current = defaultstate;
+               cl.entities[i].state_baseline = defaultstate;
+               cl.entities[i].state_previous = defaultstate;
+               cl.entities[i].state_current = defaultstate;
        }
 
-       for (i = 0;i < cl_max_csqcentities;i++)
+       for (i = 0;i < cl.max_csqcentities;i++)
        {
-               cl_csqcentities[i].state_baseline = defaultstate;       //[515]: csqc
-               cl_csqcentities[i].state_previous = defaultstate;       //[515]: csqc
-               cl_csqcentities[i].state_current = defaultstate;        //[515]: csqc
-               cl_csqcentities[i].csqc = true;
-               cl_csqcentities[i].state_current.number = -i;
+               cl.csqcentities[i].state_baseline = defaultstate;       //[515]: csqc
+               cl.csqcentities[i].state_previous = defaultstate;       //[515]: csqc
+               cl.csqcentities[i].state_current = defaultstate;        //[515]: csqc
+               cl.csqcentities[i].csqc = true;
+               cl.csqcentities[i].state_current.number = -i;
        }
 
        if (gamemode == GAME_NEXUIZ)
        {
-               VectorSet(cl_playerstandmins, -16, -16, -24);
-               VectorSet(cl_playerstandmaxs, 16, 16, 45);
-               VectorSet(cl_playercrouchmins, -16, -16, -24);
-               VectorSet(cl_playercrouchmaxs, 16, 16, 25);
+               VectorSet(cl.playerstandmins, -16, -16, -24);
+               VectorSet(cl.playerstandmaxs, 16, 16, 45);
+               VectorSet(cl.playercrouchmins, -16, -16, -24);
+               VectorSet(cl.playercrouchmaxs, 16, 16, 25);
        }
        else
        {
-               VectorSet(cl_playerstandmins, -16, -16, -24);
-               VectorSet(cl_playerstandmaxs, 16, 16, 24);
-               VectorSet(cl_playercrouchmins, -16, -16, -24);
-               VectorSet(cl_playercrouchmaxs, 16, 16, 24);
+               VectorSet(cl.playerstandmins, -16, -16, -24);
+               VectorSet(cl.playerstandmaxs, 16, 16, 24);
+               VectorSet(cl.playercrouchmins, -16, -16, -24);
+               VectorSet(cl.playercrouchmaxs, 16, 16, 24);
        }
 
        // disable until we get textures for it
        R_ResetSkyBox();
 
-       ent = &cl_entities[0];
+       ent = &cl.entities[0];
        // entire entity array was cleared, so just fill in a few fields
        ent->state_current.active = true;
        ent->render.model = cl.worldmodel = NULL; // no world model yet
@@ -244,30 +215,29 @@ void CL_ClearState(void)
        memset(cl.qw_deltasequence, -1, sizeof(cl.qw_deltasequence));
 
        CL_Screen_NewMap();
-       CL_Particles_Clear();
 }
 
 void CL_ExpandEntities(int num)
 {
        int i, oldmaxentities;
        entity_t *oldentities;
-       if (num >= cl_max_entities)
+       if (num >= cl.max_entities)
        {
-               if (!cl_entities)
-                       Sys_Error("CL_ExpandEntities: cl_entities not initialized");
+               if (!cl.entities)
+                       Sys_Error("CL_ExpandEntities: cl.entities not initialized");
                if (num >= MAX_EDICTS)
                        Host_Error("CL_ExpandEntities: num %i >= %i", num, MAX_EDICTS);
-               oldmaxentities = cl_max_entities;
-               oldentities = cl_entities;
-               cl_max_entities = (num & ~255) + 256;
-               cl_entities = (entity_t *)Mem_Alloc(cl_mempool, cl_max_entities * sizeof(entity_t));
-               memcpy(cl_entities, oldentities, oldmaxentities * sizeof(entity_t));
+               oldmaxentities = cl.max_entities;
+               oldentities = cl.entities;
+               cl.max_entities = (num & ~255) + 256;
+               cl.entities = (entity_t *)Mem_Alloc(cls.mempool, cl.max_entities * sizeof(entity_t));
+               memcpy(cl.entities, oldentities, oldmaxentities * sizeof(entity_t));
                Mem_Free(oldentities);
-               for (i = oldmaxentities;i < cl_max_entities;i++)
+               for (i = oldmaxentities;i < cl.max_entities;i++)
                {
-                       cl_entities[i].state_baseline = defaultstate;
-                       cl_entities[i].state_previous = defaultstate;
-                       cl_entities[i].state_current = defaultstate;
+                       cl.entities[i].state_baseline = defaultstate;
+                       cl.entities[i].state_previous = defaultstate;
+                       cl.entities[i].state_current = defaultstate;
                }
        }
 }
@@ -276,25 +246,25 @@ void CL_ExpandCSQCEntities(int num)
 {
        int i, oldmaxentities;
        entity_t *oldentities;
-       if (num >= cl_max_csqcentities)
+       if (num >= cl.max_csqcentities)
        {
-               if (!cl_csqcentities)
-                       Sys_Error("CL_ExpandCSQCEntities: cl_csqcentities not initialized\n");
+               if (!cl.csqcentities)
+                       Sys_Error("CL_ExpandCSQCEntities: cl.csqcentities not initialized\n");
                if (num >= MAX_EDICTS)
                        Host_Error("CL_ExpandCSQCEntities: num %i >= %i\n", num, MAX_EDICTS);
-               oldmaxentities = cl_max_csqcentities;
-               oldentities = cl_csqcentities;
-               cl_max_csqcentities = (num & ~255) + 256;
-               cl_csqcentities = Mem_Alloc(cl_mempool, cl_max_csqcentities * sizeof(entity_t));
-               memcpy(cl_csqcentities, oldentities, oldmaxentities * sizeof(entity_t));
+               oldmaxentities = cl.max_csqcentities;
+               oldentities = cl.csqcentities;
+               cl.max_csqcentities = (num & ~255) + 256;
+               cl.csqcentities = Mem_Alloc(cls.mempool, cl.max_csqcentities * sizeof(entity_t));
+               memcpy(cl.csqcentities, oldentities, oldmaxentities * sizeof(entity_t));
                Mem_Free(oldentities);
-               for (i = oldmaxentities;i < cl_max_csqcentities;i++)
+               for (i = oldmaxentities;i < cl.max_csqcentities;i++)
                {
-                       cl_csqcentities[i].state_baseline = defaultstate;
-                       cl_csqcentities[i].state_previous = defaultstate;
-                       cl_csqcentities[i].state_current = defaultstate;
-                       cl_csqcentities[i].csqc = true;
-                       cl_csqcentities[i].state_current.number = -i;
+                       cl.csqcentities[i].state_baseline = defaultstate;
+                       cl.csqcentities[i].state_previous = defaultstate;
+                       cl.csqcentities[i].state_current = defaultstate;
+                       cl.csqcentities[i].csqc = true;
+                       cl.csqcentities[i].state_current.number = -i;
                }
        }
 }
@@ -432,7 +402,7 @@ static void CL_PrintEntities_f(void)
        int i, j;
        char name[32];
 
-       for (i = 0, ent = cl_entities;i < cl_num_entities;i++, ent++)
+       for (i = 0, ent = cl.entities;i < cl.num_entities;i++, ent++)
        {
                if (!ent->state_current.active)
                        continue;
@@ -536,7 +506,7 @@ static float CL_LerpPoint(void)
 
 void CL_ClearTempEntities (void)
 {
-       cl_num_temp_entities = 0;
+       cl.num_temp_entities = 0;
 }
 
 entity_t *CL_NewTempEntity(void)
@@ -545,9 +515,9 @@ entity_t *CL_NewTempEntity(void)
 
        if (r_refdef.numentities >= r_refdef.maxentities)
                return NULL;
-       if (cl_num_temp_entities >= cl_max_temp_entities)
+       if (cl.num_temp_entities >= cl.max_temp_entities)
                return NULL;
-       ent = &cl_temp_entities[cl_num_temp_entities++];
+       ent = &cl.temp_entities[cl.num_temp_entities++];
        memset (ent, 0, sizeof(*ent));
        r_refdef.entities[r_refdef.numentities++] = &ent->render;
 
@@ -564,7 +534,7 @@ void CL_Effect(vec3_t org, int modelindex, int startframe, int framecount, float
        cl_effect_t *e;
        if (!modelindex) // sanity check
                return;
-       for (i = 0, e = cl_effects;i < cl_max_effects;i++, e++)
+       for (i = 0, e = cl.effects;i < cl.max_effects;i++, e++)
        {
                if (e->active)
                        continue;
@@ -579,7 +549,7 @@ void CL_Effect(vec3_t org, int modelindex, int startframe, int framecount, float
                e->frame = 0;
                e->frame1time = cl.time;
                e->frame2time = cl.time;
-               cl_activeeffects = max(cl_activeeffects, i + 1);
+               cl.num_effects = max(cl.num_effects, i + 1);
                break;
        }
 }
@@ -593,22 +563,22 @@ void CL_AllocDlight(entity_render_t *ent, matrix4x4_t *matrix, float radius, flo
 // first look for an exact key match
        if (ent)
        {
-               dl = cl_dlights;
-               for (i = 0;i < cl_activedlights;i++, dl++)
+               dl = cl.dlights;
+               for (i = 0;i < cl.num_dlights;i++, dl++)
                        if (dl->ent == ent)
                                goto dlightsetup;
        }
        */
 
 // then look for anything else
-       dl = cl_dlights;
-       for (i = 0;i < cl_activedlights;i++, dl++)
+       dl = cl.dlights;
+       for (i = 0;i < cl.num_dlights;i++, dl++)
                if (!dl->radius)
                        goto dlightsetup;
        // if we hit the end of the active dlights and found no gaps, add a new one
        if (i < MAX_DLIGHTS)
        {
-               cl_activedlights = i + 1;
+               cl.num_dlights = i + 1;
                goto dlightsetup;
        }
 
@@ -655,9 +625,9 @@ void CL_DecayLights(void)
        float time, f;
 
        time = cl.time - cl.oldtime;
-       oldmax = cl_activedlights;
-       cl_activedlights = 0;
-       for (i = 0, dl = cl_dlights;i < oldmax;i++, dl++)
+       oldmax = cl.num_dlights;
+       cl.num_dlights = 0;
+       for (i = 0, dl = cl.dlights;i < oldmax;i++, dl++)
        {
                if (dl->radius)
                {
@@ -665,7 +635,7 @@ void CL_DecayLights(void)
                        if (cl.time < dl->die && f > 0)
                        {
                                dl->radius = dl->radius - time * dl->decay;
-                               cl_activedlights = i + 1;
+                               cl.num_dlights = i + 1;
                        }
                        else
                                dl->radius = 0;
@@ -683,7 +653,7 @@ void CL_UpdateLights(void)
        r_refdef.numlights = 0;
        if (r_dynamic.integer)
        {
-               for (i = 0, dl = cl_dlights;i < cl_activedlights;i++, dl++)
+               for (i = 0, dl = cl.dlights;i < cl.num_dlights;i++, dl++)
                {
                        if (dl->radius)
                        {
@@ -698,17 +668,17 @@ void CL_UpdateLights(void)
        f = cl.time * 10;
        i = (int)floor(f);
        frac = f - i;
-       for (j = 0;j < cl_max_lightstyle;j++)
+       for (j = 0;j < cl.max_lightstyle;j++)
        {
-               if (!cl_lightstyle || !cl_lightstyle[j].length)
+               if (!cl.lightstyle || !cl.lightstyle[j].length)
                {
                        r_refdef.lightstylevalue[j] = 256;
                        continue;
                }
-               k = i % cl_lightstyle[j].length;
-               l = (i-1) % cl_lightstyle[j].length;
-               k = cl_lightstyle[j].map[k] - 'a';
-               l = cl_lightstyle[j].map[l] - 'a';
+               k = i % cl.lightstyle[j].length;
+               l = (i-1) % cl.lightstyle[j].length;
+               k = cl.lightstyle[j].map[k] - 'a';
+               l = cl.lightstyle[j].map[l] - 'a';
                r_refdef.lightstylevalue[j] = ((k*frac)+(l*(1-frac)))*22;
        }
 }
@@ -799,7 +769,7 @@ void CL_LinkNetworkEntity(entity_t *e)
        {
                e->persistent.linkframe = entitylinkframenumber;
                // skip inactive entities and world
-               if (!e->state_current.active || e == cl_entities || e == cl_csqcentities)
+               if (!e->state_current.active || e == cl.entities || e == cl.csqcentities)
                        return;
                e->render.alpha = e->state_current.alpha * (1.0f / 255.0f); // FIXME: interpolate?
                e->render.scale = e->state_current.scale * (1.0f / 16.0f); // FIXME: interpolate?
@@ -852,11 +822,11 @@ void CL_LinkNetworkEntity(entity_t *e)
                        if (!e->csqc)
                        {
                                if (cl.viewentity)
-                                       CL_LinkNetworkEntity(cl_entities + cl.viewentity);
-                               if (e == &cl.viewent && cl_entities[cl.viewentity].state_current.active)
+                                       CL_LinkNetworkEntity(cl.entities + cl.viewentity);
+                               if (e == &cl.viewent && cl.entities[cl.viewentity].state_current.active)
                                {
-                                       e->state_current.alpha = cl_entities[cl.viewentity].state_current.alpha;
-                                       e->state_current.effects = EF_NOSHADOW | (cl_entities[cl.viewentity].state_current.effects & (EF_ADDITIVE | EF_REFLECTIVE | EF_FULLBRIGHT | EF_NODEPTHTEST));
+                                       e->state_current.alpha = cl.entities[cl.viewentity].state_current.alpha;
+                                       e->state_current.effects = EF_NOSHADOW | (cl.entities[cl.viewentity].state_current.effects & (EF_ADDITIVE | EF_REFLECTIVE | EF_FULLBRIGHT | EF_NODEPTHTEST));
                                }
                        }
                        matrix = &viewmodelmatrix;
@@ -866,15 +836,15 @@ void CL_LinkNetworkEntity(entity_t *e)
                        // if the tag entity is currently impossible, skip it
                        if (!e->csqc)
                        {
-                               if (e->state_current.tagentity >= cl_num_entities)
+                               if (e->state_current.tagentity >= cl.num_entities)
                                        return;
-                               t = cl_entities + e->state_current.tagentity;
+                               t = cl.entities + e->state_current.tagentity;
                        }
                        else
                        {
-                               if (e->state_current.tagentity >= cl_num_csqcentities)
+                               if (e->state_current.tagentity >= cl.num_csqcentities)
                                        return;
-                               t = cl_csqcentities + e->state_current.tagentity;
+                               t = cl.csqcentities + e->state_current.tagentity;
                        }
                        // if the tag entity is inactive, skip it
                        if (!t->state_current.active)
@@ -909,7 +879,7 @@ void CL_LinkNetworkEntity(entity_t *e)
 
                // movement lerp
                // if it's the player entity, update according to client movement
-               if (e == cl_entities + cl.playerentity && cl.movement)// && !e->csqc)
+               if (e == cl.entities + cl.playerentity && cl.movement)// && !e->csqc)
                {
                        lerp = (cl.time - cl.mtime[1]) / (cl.mtime[0] - cl.mtime[1]);
                        lerp = bound(0, lerp, 1);
@@ -1224,7 +1194,7 @@ void CL_LinkNetworkEntity(entity_t *e)
                if (e->state_current.number == cl.viewentity)
                        V_CalcRefdef();
                if (e->render.model && e->render.model->name[0] == '*' && e->render.model->TraceBox)
-                       cl_brushmodel_entities[cl_num_brushmodel_entities++] = e->state_current.number;
+                       cl.brushmodel_entities[cl.num_brushmodel_entities++] = e->state_current.number;
                // don't show entities with no modelindex (note: this still shows
                // entities which have a modelindex that resolved to a NULL model)
                if (e->render.model && !(e->render.effects & EF_NODRAW) && r_refdef.numentities < r_refdef.maxentities)
@@ -1236,8 +1206,8 @@ void CL_LinkNetworkEntity(entity_t *e)
 
 void CL_RelinkWorld(void)
 {
-       entity_t *ent = &cl_entities[0];
-       cl_brushmodel_entities[cl_num_brushmodel_entities++] = 0;
+       entity_t *ent = &cl.entities[0];
+       cl.brushmodel_entities[cl.num_brushmodel_entities++] = 0;
        // FIXME: this should be done at load
        ent->render.matrix = identitymatrix;
        ent->render.inversematrix = identitymatrix;
@@ -1253,10 +1223,10 @@ void CL_RelinkWorld(void)
 
 void CL_RelinkCSQCWorld(void)  //[515]: csqc
 {
-       entity_t *ent = &cl_csqcentities[0];
+       entity_t *ent = &cl.csqcentities[0];
        if(!csqc_loaded)
                return;
-//     cl_brushmodel_entities[cl_num_brushmodel_entities++] = 0;
+//     cl.brushmodel_entities[cl.num_brushmodel_entities++] = 0;
        // FIXME: this should be done at load
        ent->render.matrix = identitymatrix;
        ent->render.inversematrix = identitymatrix;
@@ -1274,7 +1244,7 @@ static void CL_RelinkStaticEntities(void)
 {
        int i;
        entity_t *e;
-       for (i = 0, e = cl_static_entities;i < cl_num_static_entities && r_refdef.numentities < r_refdef.maxentities;i++, e++)
+       for (i = 0, e = cl.static_entities;i < cl.num_static_entities && r_refdef.numentities < r_refdef.maxentities;i++, e++)
        {
                e->render.flags = 0;
                // transparent stuff can't be lit during the opaque stage
@@ -1336,21 +1306,21 @@ static void CL_RelinkNetworkEntities(int drawmask)
        entitylinkframenumber++;
        if(drawmask & ENTMASK_ENGINE || !csqc_loaded)
        {
-               for (i = 1;i < cl_num_entities;i++)
+               for (i = 1;i < cl.num_entities;i++)
                {
-                       if (cl_entities_active[i])
+                       if (cl.entities_active[i])
                        {
-                               ent = cl_entities + i;
+                               ent = cl.entities + i;
                                if (!(drawmask & ENTMASK_ENGINEVIEWMODELS))
                                if (ent->state_current.flags & RENDER_VIEWMODEL)        //[515]: csqc drawmask
                                {
-                                       cl_entities_active[i] = false;
+                                       cl.entities_active[i] = false;
                                        continue;
                                }
                                if (ent->state_current.active)
                                        CL_LinkNetworkEntity(ent);
                                else
-                                       cl_entities_active[i] = false;
+                                       cl.entities_active[i] = false;
                        }
                }
        }
@@ -1358,16 +1328,16 @@ static void CL_RelinkNetworkEntities(int drawmask)
        //[515]: csqc
        if(csqc_loaded)
        {
-               for (i=1,k=cl_num_csqcentities;k;i++)
+               for (i=1,k=cl.num_csqcentities;k;i++)
                {
-                       if (cl_csqcentities_active[i])
+                       if (cl.csqcentities_active[i])
                        {
                                --k;
-                               ent = cl_csqcentities + i;
+                               ent = cl.csqcentities + i;
                                if (ent->state_current.active)
                                        CL_LinkNetworkEntity(ent);
                                else
-                                       cl_csqcentities_active[i] = false;
+                                       cl.csqcentities_active[i] = false;
                        }
                }
        }
@@ -1382,7 +1352,7 @@ static void CL_RelinkEffects(void)
        entity_t *ent;
        float frame;
 
-       for (i = 0, e = cl_effects;i < cl_activeeffects;i++, e++)
+       for (i = 0, e = cl.effects;i < cl.num_effects;i++, e++)
        {
                if (e->active)
                {
@@ -1391,8 +1361,8 @@ static void CL_RelinkEffects(void)
                        if (intframe < 0 || intframe >= e->endframe)
                        {
                                memset(e, 0, sizeof(*e));
-                               while (cl_activeeffects > 0 && !cl_effects[cl_activeeffects - 1].active)
-                                       cl_activeeffects--;
+                               while (cl.num_effects > 0 && !cl.effects[cl.num_effects - 1].active)
+                                       cl.num_effects--;
                                continue;
                        }
 
@@ -1446,7 +1416,7 @@ void CL_RelinkBeams(void)
        float forward;
        matrix4x4_t tempmatrix;
 
-       for (i = 0, b = cl_beams;i < cl_activebeams;i++, b++)
+       for (i = 0, b = cl.beams;i < cl.num_beams;i++, b++)
        {
                if (!b->model)
                        continue;
@@ -1458,10 +1428,10 @@ void CL_RelinkBeams(void)
 
                // if coming from the player, update the start position
                //if (b->entity == cl.viewentity)
-               //      Matrix4x4_OriginFromMatrix(&cl_entities[cl.viewentity].render.matrix, b->start);
-               if (cl_beams_relative.integer && b->entity && cl_entities[b->entity].state_current.active && b->relativestartvalid)
+               //      Matrix4x4_OriginFromMatrix(&cl.entities[cl.viewentity].render.matrix, b->start);
+               if (cl_beams_relative.integer && b->entity && cl.entities[b->entity].state_current.active && b->relativestartvalid)
                {
-                       entity_render_t *r = &cl_entities[b->entity].render;
+                       entity_render_t *r = &cl.entities[b->entity].render;
                        //Matrix4x4_OriginFromMatrix(&r->matrix, origin);
                        //Matrix4x4_CreateFromQuakeEntity(&matrix, r->origin[0], r->origin[1], r->origin[2] + 16, r->angles[0], r->angles[1], r->angles[2], 1);
                        Matrix4x4_Transform(&r->matrix, b->relativestart, b->start);
@@ -1526,8 +1496,8 @@ void CL_RelinkBeams(void)
                }
        }
 
-       while (cl_activebeams > 0 && !cl_beams[cl_activebeams - 1].model)
-               cl_activebeams--;
+       while (cl.num_beams > 0 && !cl.beams[cl.num_beams - 1].model)
+               cl.num_beams--;
 }
 
 static void CL_RelinkQWNails(void)
@@ -1626,7 +1596,7 @@ int CL_ReadFromServer(void)
        r_refdef.extraupdate = !r_speeds.integer;
        r_refdef.numentities = 0;
        r_refdef.viewentitymatrix = identitymatrix;
-       cl_num_brushmodel_entities = 0;
+       cl.num_brushmodel_entities = 0;
 
        if (cls.state == ca_connected && cls.signon == SIGNONS)
        {
@@ -1733,7 +1703,7 @@ void CL_Shutdown (void)
        CL_Particles_Shutdown();
        CL_Parse_Shutdown();
 
-       Mem_FreePool (&cl_mempool);
+       Mem_FreePool (&cls.mempool);
 }
 
 /*
@@ -1743,16 +1713,16 @@ CL_Init
 */
 void CL_Init (void)
 {
-       cl_mempool = Mem_AllocPool("client", 0, NULL);
+       cls.mempool = Mem_AllocPool("client", 0, NULL);
 
        memset(&r_refdef, 0, sizeof(r_refdef));
        // max entities sent to renderer per frame
        r_refdef.maxentities = MAX_EDICTS + 256 + 512;
-       r_refdef.entities = (entity_render_t **)Mem_Alloc(cl_mempool, sizeof(entity_render_t *) * r_refdef.maxentities);
+       r_refdef.entities = (entity_render_t **)Mem_Alloc(cls.mempool, sizeof(entity_render_t *) * r_refdef.maxentities);
        // 256k drawqueue buffer
        // TODO: make dynamic
        r_refdef.maxdrawqueuesize = 256 * 1024;
-       r_refdef.drawqueue = (unsigned char *)Mem_Alloc(cl_mempool, r_refdef.maxdrawqueuesize);
+       r_refdef.drawqueue = (unsigned char *)Mem_Alloc(cls.mempool, r_refdef.maxdrawqueuesize);
 
        CL_InitInput ();
 
index 60474a742f6f7419bbe6b55b661109ffdde5a8f4..dfd07743659c8e4a0fb3bfc4943065e027e234ac 100644 (file)
@@ -490,8 +490,8 @@ static void QW_CL_RequestNextDownload(void)
 
                // now that we have a world model, set up the world entity, renderer
                // modules and csqc
-               cl_entities[0].render.model = cl.worldmodel = cl.model_precache[1];
-               CL_BoundingBoxForEntity(&cl_entities[0].render);
+               cl.entities[0].render.model = cl.worldmodel = cl.model_precache[1];
+               CL_BoundingBoxForEntity(&cl.entities[0].render);
 
                R_Modules_NewMap();
 
@@ -586,7 +586,7 @@ static void QW_CL_ParseDownload(void)
                while (cls.qw_downloadmemorymaxsize < cls.qw_downloadmemorycursize + size)
                        cls.qw_downloadmemorymaxsize *= 2;
                old = cls.qw_downloadmemory;
-               cls.qw_downloadmemory = Mem_Alloc(cl_mempool, cls.qw_downloadmemorymaxsize);
+               cls.qw_downloadmemory = Mem_Alloc(cls.mempool, cls.qw_downloadmemorymaxsize);
                if (old)
                {
                        memcpy(cls.qw_downloadmemory, old, cls.qw_downloadmemorycursize);
@@ -748,7 +748,7 @@ void QW_CL_StartUpload(unsigned char *data, int size)
 
        Con_DPrintf("Starting upload of %d bytes...\n", size);
 
-       cls.qw_uploaddata = Mem_Alloc(cl_mempool, size);
+       cls.qw_uploaddata = Mem_Alloc(cls.mempool, size);
        memcpy(cls.qw_uploaddata, data, size);
        cls.qw_uploadsize = size;
        cls.qw_uploadpos = 0;
@@ -985,7 +985,7 @@ void CL_ParseServerInfo (void)
        cls.protocol = protocol;
        Con_DPrintf("Server protocol is %s\n", Protocol_NameForEnum(cls.protocol));
 
-       cl_num_entities = 1;
+       cl.num_entities = 1;
 
        if (protocol == PROTOCOL_QUAKEWORLD)
        {
@@ -1016,7 +1016,7 @@ void CL_ParseServerInfo (void)
                i = MSG_ReadByte();
                cl.qw_spectator = (i & 128) != 0;
                cl.playerentity = cl.viewentity = (i & 127) + 1;
-               cl.scores = (scoreboard_t *)Mem_Alloc(cl_mempool, cl.maxclients*sizeof(*cl.scores));
+               cl.scores = (scoreboard_t *)Mem_Alloc(cls.mempool, cl.maxclients*sizeof(*cl.scores));
 
                // get the full level name
                str = MSG_ReadString ();
@@ -1059,7 +1059,7 @@ void CL_ParseServerInfo (void)
                        Host_Error("Bad maxclients (%u) from server", cl.maxclients);
                        return;
                }
-               cl.scores = (scoreboard_t *)Mem_Alloc(cl_mempool, cl.maxclients*sizeof(*cl.scores));
+               cl.scores = (scoreboard_t *)Mem_Alloc(cls.mempool, cl.maxclients*sizeof(*cl.scores));
 
        // parse gametype
                cl.gametype = MSG_ReadByte ();
@@ -1150,8 +1150,8 @@ void CL_ParseServerInfo (void)
                }
 
                // we now have the worldmodel so we can set up the game world
-               cl_entities[0].render.model = cl.worldmodel = cl.model_precache[1];
-               CL_BoundingBoxForEntity(&cl_entities[0].render);
+               cl.entities[0].render.model = cl.worldmodel = cl.model_precache[1];
+               CL_BoundingBoxForEntity(&cl.entities[0].render);
                R_Modules_NewMap();
        }
 
@@ -1415,9 +1415,9 @@ void CL_ParseStatic (int large)
 {
        entity_t *ent;
 
-       if (cl_num_static_entities >= cl_max_static_entities)
+       if (cl.num_static_entities >= cl.max_static_entities)
                Host_Error ("Too many static entities");
-       ent = &cl_static_entities[cl_num_static_entities++];
+       ent = &cl.static_entities[cl.num_static_entities++];
        CL_ParseBaseline (ent, large);
 
 // copy it to the current state
@@ -1441,7 +1441,7 @@ void CL_ParseStatic (int large)
 
        // This is definitely cheating...
        if (ent->render.model == NULL)
-               cl_num_static_entities--;
+               cl.num_static_entities--;
 }
 
 /*
@@ -1509,23 +1509,23 @@ void CL_ParseBeam (model_t *m, int lightning)
                ent = 0;
        }
 
-       if (ent >= cl_max_entities)
+       if (ent >= cl.max_entities)
                CL_ExpandEntities(ent);
 
        // override any beam with the same entity
-       i = cl_max_beams;
+       i = cl.max_beams;
        if (ent)
-               for (i = 0, b = cl_beams;i < cl_max_beams;i++, b++)
+               for (i = 0, b = cl.beams;i < cl.max_beams;i++, b++)
                        if (b->entity == ent)
                                break;
        // if the entity was not found then just replace an unused beam
-       if (i == cl_max_beams)
-               for (i = 0, b = cl_beams;i < cl_max_beams;i++, b++)
+       if (i == cl.max_beams)
+               for (i = 0, b = cl.beams;i < cl.max_beams;i++, b++)
                        if (!b->model || b->endtime < cl.time)
                                break;
-       if (i < cl_max_beams)
+       if (i < cl.max_beams)
        {
-               cl_activebeams = max(cl_activebeams, i + 1);
+               cl.num_beams = max(cl.num_beams, i + 1);
                b->entity = ent;
                b->lightning = lightning;
                b->model = m;
@@ -1533,14 +1533,14 @@ void CL_ParseBeam (model_t *m, int lightning)
                VectorCopy (start, b->start);
                VectorCopy (end, b->end);
                b->relativestartvalid = 0;
-               if (ent && cl_entities[ent].state_current.active)
+               if (ent && cl.entities[ent].state_current.active)
                {
                        entity_state_t *p;
                        matrix4x4_t matrix, imatrix;
                        if (ent == cl.viewentity && cl.movement)
-                               p = &cl_entities[b->entity].state_previous;
+                               p = &cl.entities[b->entity].state_previous;
                        else
-                               p = &cl_entities[b->entity].state_current;
+                               p = &cl.entities[b->entity].state_current;
                        // not really valid yet, we need to get the orientation now
                        // (ParseBeam flagged this because it is received before
                        //  entities are received, by now they have been received)
@@ -2192,7 +2192,7 @@ void CL_ParseServerMessage(void)
 
                // slightly kill qw player entities each frame
                for (i = 1;i < cl.maxclients;i++)
-                       cl_entities_active[i] = false;
+                       cl.entities_active[i] = false;
 
                // kill all qw nails
                cl.qw_num_nails = 0;
@@ -2299,14 +2299,14 @@ void CL_ParseServerMessage(void)
 
                        case qw_svc_lightstyle:
                                i = MSG_ReadByte ();
-                               if (i >= cl_max_lightstyle)
+                               if (i >= cl.max_lightstyle)
                                {
                                        Con_Printf ("svc_lightstyle >= MAX_LIGHTSTYLES");
                                        break;
                                }
-                               strlcpy (cl_lightstyle[i].map,  MSG_ReadString(), sizeof (cl_lightstyle[i].map));
-                               cl_lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
-                               cl_lightstyle[i].length = (int)strlen(cl_lightstyle[i].map);
+                               strlcpy (cl.lightstyle[i].map,  MSG_ReadString(), sizeof (cl.lightstyle[i].map));
+                               cl.lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
+                               cl.lightstyle[i].length = (int)strlen(cl.lightstyle[i].map);
                                break;
 
                        case qw_svc_sound:
@@ -2351,9 +2351,9 @@ void CL_ParseServerMessage(void)
                                i = (unsigned short) MSG_ReadShort();
                                if (i < 0 || i >= MAX_EDICTS)
                                        Host_Error ("CL_ParseServerMessage: svc_spawnbaseline: invalid entity number %i", i);
-                               if (i >= cl_max_entities)
+                               if (i >= cl.max_entities)
                                        CL_ExpandEntities(i);
-                               CL_ParseBaseline(cl_entities + i, false);
+                               CL_ParseBaseline(cl.entities + i, false);
                                break;
                        case qw_svc_spawnstatic:
                                CL_ParseStatic(false);
@@ -2427,9 +2427,9 @@ void CL_ParseServerMessage(void)
                                // NOTE: in QW this only worked on clients
                                if (i < 0 || i >= MAX_EDICTS)
                                        Host_Error("CL_ParseServerMessage: svc_spawnbaseline: invalid entity number %i", i);
-                               if (i >= cl_max_entities)
+                               if (i >= cl.max_entities)
                                        CL_ExpandEntities(i);
-                               cl_entities[i].persistent.muzzleflash = 1.0f;
+                               cl.entities[i].persistent.muzzleflash = 1.0f;
                                break;
 
                        case qw_svc_updateuserinfo:
@@ -2506,8 +2506,8 @@ void CL_ParseServerMessage(void)
 
                // fully kill the still slightly dead qw player entities each frame
                for (i = 1;i < cl.maxclients;i++)
-                       if (!cl_entities_active[i])
-                               cl_entities[i].state_current.active = false;
+                       if (!cl.entities_active[i])
+                               cl.entities[i].state_current.active = false;
        }
        else
        {
@@ -2645,7 +2645,7 @@ void CL_ParseServerMessage(void)
                                cl.viewentity = (unsigned short)MSG_ReadShort ();
                                if (cl.viewentity >= MAX_EDICTS)
                                        Host_Error("svc_setview >= MAX_EDICTS");
-                               if (cl.viewentity >= cl_max_entities)
+                               if (cl.viewentity >= cl.max_entities)
                                        CL_ExpandEntities(cl.viewentity);
                                // LordHavoc: assume first setview recieved is the real player entity
                                if (!cl.playerentity)
@@ -2654,14 +2654,14 @@ void CL_ParseServerMessage(void)
 
                        case svc_lightstyle:
                                i = MSG_ReadByte ();
-                               if (i >= cl_max_lightstyle)
+                               if (i >= cl.max_lightstyle)
                                {
                                        Con_Printf ("svc_lightstyle >= MAX_LIGHTSTYLES");
                                        break;
                                }
-                               strlcpy (cl_lightstyle[i].map,  MSG_ReadString(), sizeof (cl_lightstyle[i].map));
-                               cl_lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
-                               cl_lightstyle[i].length = (int)strlen(cl_lightstyle[i].map);
+                               strlcpy (cl.lightstyle[i].map,  MSG_ReadString(), sizeof (cl.lightstyle[i].map));
+                               cl.lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
+                               cl.lightstyle[i].length = (int)strlen(cl.lightstyle[i].map);
                                break;
 
                        case svc_sound:
@@ -2748,17 +2748,17 @@ void CL_ParseServerMessage(void)
                                i = (unsigned short) MSG_ReadShort ();
                                if (i < 0 || i >= MAX_EDICTS)
                                        Host_Error ("CL_ParseServerMessage: svc_spawnbaseline: invalid entity number %i", i);
-                               if (i >= cl_max_entities)
+                               if (i >= cl.max_entities)
                                        CL_ExpandEntities(i);
-                               CL_ParseBaseline (cl_entities + i, false);
+                               CL_ParseBaseline (cl.entities + i, false);
                                break;
                        case svc_spawnbaseline2:
                                i = (unsigned short) MSG_ReadShort ();
                                if (i < 0 || i >= MAX_EDICTS)
                                        Host_Error ("CL_ParseServerMessage: svc_spawnbaseline2: invalid entity number %i", i);
-                               if (i >= cl_max_entities)
+                               if (i >= cl.max_entities)
                                        CL_ExpandEntities(i);
-                               CL_ParseBaseline (cl_entities + i, true);
+                               CL_ParseBaseline (cl.entities + i, true);
                                break;
                        case svc_spawnstatic:
                                CL_ParseStatic (false);
index 1f47610a3ee10d4ab71a78d31006fa0bc6c0cda7..8222aa2f25aa978dd35f67cb47843ee399d2c861 100644 (file)
@@ -20,198 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "quakedef.h"
 
-#ifdef WORKINGLQUAKE
-#define lhrandom(MIN,MAX) ((rand() & 32767) * (((MAX)-(MIN)) * (1.0f / 32767.0f)) + (MIN))
-#define NUMVERTEXNORMALS       162
-siextern float r_avertexnormals[NUMVERTEXNORMALS][3];
-#define m_bytenormals r_avertexnormals
-#define CL_PointQ1Contents(v) (Mod_PointInLeaf(v,cl.worldmodel)->contents)
-typedef unsigned char unsigned char;
-#define cl_stainmaps.integer 0
-void R_Stain (vec3_t origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2)
-{
-}
-#define CL_EntityParticles R_EntityParticles
-#define CL_ReadPointFile_f R_ReadPointFile_f
-#define CL_ParseParticleEffect R_ParseParticleEffect
-#define CL_ParticleExplosion R_ParticleExplosion
-#define CL_ParticleExplosion2 R_ParticleExplosion2
-#define CL_TeleportSplash R_TeleportSplash
-#define CL_BlobExplosion R_BlobExplosion
-#define CL_RunParticleEffect R_RunParticleEffect
-#define CL_LavaSplash R_LavaSplash
-void R_CalcBeam_Vertex3f (float *vert, vec3_t org1, vec3_t org2, float width)
-{
-       vec3_t right1, right2, diff, normal;
-
-       VectorSubtract (org2, org1, normal);
-       VectorNormalize (normal);
-
-       // calculate 'right' vector for start
-       VectorSubtract (r_vieworigin, org1, diff);
-       VectorNormalize (diff);
-       CrossProduct (normal, diff, right1);
-
-       // calculate 'right' vector for end
-       VectorSubtract (r_vieworigin, org2, diff);
-       VectorNormalize (diff);
-       CrossProduct (normal, diff, right2);
-
-       vert[ 0] = org1[0] + width * right1[0];
-       vert[ 1] = org1[1] + width * right1[1];
-       vert[ 2] = org1[2] + width * right1[2];
-       vert[ 3] = org1[0] - width * right1[0];
-       vert[ 4] = org1[1] - width * right1[1];
-       vert[ 5] = org1[2] - width * right1[2];
-       vert[ 6] = org2[0] - width * right2[0];
-       vert[ 7] = org2[1] - width * right2[1];
-       vert[ 8] = org2[2] - width * right2[2];
-       vert[ 9] = org2[0] + width * right2[0];
-       vert[10] = org2[1] + width * right2[1];
-       vert[11] = org2[2] + width * right2[2];
-}
-void fractalnoise(unsigned char *noise, int size, int startgrid)
-{
-       int x, y, g, g2, amplitude, min, max, size1 = size - 1, sizepower, gridpower;
-       int *noisebuf;
-#define n(x,y) noisebuf[((y)&size1)*size+((x)&size1)]
-
-       for (sizepower = 0;(1 << sizepower) < size;sizepower++);
-       if (size != (1 << sizepower))
-       {
-               Con_Printf("fractalnoise: size must be power of 2\n");
-               return;
-       }
-
-       for (gridpower = 0;(1 << gridpower) < startgrid;gridpower++);
-       if (startgrid != (1 << gridpower))
-       {
-               Con_Printf("fractalnoise: grid must be power of 2\n");
-               return;
-       }
-
-       startgrid = bound(0, startgrid, size);
-
-       amplitude = 0xFFFF; // this gets halved before use
-       noisebuf = malloc(size*size*sizeof(int));
-       memset(noisebuf, 0, size*size*sizeof(int));
-
-       for (g2 = startgrid;g2;g2 >>= 1)
-       {
-               // brownian motion (at every smaller level there is random behavior)
-               amplitude >>= 1;
-               for (y = 0;y < size;y += g2)
-                       for (x = 0;x < size;x += g2)
-                               n(x,y) += (rand()&amplitude);
-
-               g = g2 >> 1;
-               if (g)
-               {
-                       // subdivide, diamond-square algorithm (really this has little to do with squares)
-                       // diamond
-                       for (y = 0;y < size;y += g2)
-                               for (x = 0;x < size;x += g2)
-                                       n(x+g,y+g) = (n(x,y) + n(x+g2,y) + n(x,y+g2) + n(x+g2,y+g2)) >> 2;
-                       // square
-                       for (y = 0;y < size;y += g2)
-                               for (x = 0;x < size;x += g2)
-                               {
-                                       n(x+g,y) = (n(x,y) + n(x+g2,y) + n(x+g,y-g) + n(x+g,y+g)) >> 2;
-                                       n(x,y+g) = (n(x,y) + n(x,y+g2) + n(x-g,y+g) + n(x+g,y+g)) >> 2;
-                               }
-               }
-       }
-       // find range of noise values
-       min = max = 0;
-       for (y = 0;y < size;y++)
-               for (x = 0;x < size;x++)
-               {
-                       if (n(x,y) < min) min = n(x,y);
-                       if (n(x,y) > max) max = n(x,y);
-               }
-       max -= min;
-       max++;
-       // normalize noise and copy to output
-       for (y = 0;y < size;y++)
-               for (x = 0;x < size;x++)
-                       *noise++ = (unsigned char) (((n(x,y) - min) * 256) / max);
-       free(noisebuf);
-#undef n
-}
-void VectorVectors(const vec3_t forward, vec3_t right, vec3_t up)
-{
-       float d;
-
-       right[0] = forward[2];
-       right[1] = -forward[0];
-       right[2] = forward[1];
-
-       d = DotProduct(forward, right);
-       right[0] -= d * forward[0];
-       right[1] -= d * forward[1];
-       right[2] -= d * forward[2];
-       VectorNormalize(right);
-       CrossProduct(right, forward, up);
-}
-#if QW
-#include "pmove.h"
-extern qboolean PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, pmtrace_t *trace);
-#endif
-trace_t CL_TraceBox (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int hitbmodels, int *hitent, int hitsupercontentsmask, qboolean hitplayers)
-{
-#if QW
-       pmtrace_t trace;
-#else
-       trace_t trace;
-#endif
-       memset (&trace, 0, sizeof(trace));
-       trace.fraction = 1;
-       VectorCopy (end, trace.endpos);
-#if QW
-       PM_RecursiveHullCheck (cl.model_precache[1]->hulls, 0, 0, 1, start, end, &trace);
-#else
-       RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, start, end, &trace);
-#endif
-       return trace;
-}
-#else
 #include "cl_collision.h"
 #include "image.h"
-#endif
-
-#define MAX_PARTICLES                  32768   // default max # of particles at one time
-#define ABSOLUTE_MIN_PARTICLES 512             // no fewer than this no matter what's on the command line
-
-typedef enum
-{
-       PARTICLE_BILLBOARD = 0,
-       PARTICLE_SPARK = 1,
-       PARTICLE_ORIENTED_DOUBLESIDED = 2,
-       PARTICLE_BEAM = 3
-}
-porientation_t;
-
-typedef enum
-{
-       PBLEND_ALPHA = 0,
-       PBLEND_ADD = 1,
-       PBLEND_MOD = 2
-}
-pblend_t;
-
-typedef struct particletype_s
-{
-       pblend_t blendmode;
-       porientation_t orientation;
-       qboolean lighting;
-}
-particletype_t;
-
-typedef enum
-{
-       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
-}
-ptype_t;
 
 // must match ptype_t values
 particletype_t particletype[pt_total] =
@@ -230,27 +40,6 @@ particletype_t particletype[pt_total] =
        {PBLEND_ALPHA, PARTICLE_BILLBOARD, false}, //pt_entityparticle
 };
 
-typedef struct particle_s
-{
-       particletype_t *type;
-       int                     texnum;
-       vec3_t          org;
-       vec3_t          vel; // velocity of particle, or orientation of decal, or end point of beam
-       float           size;
-       float           alpha; // 0-255
-       float           alphafade; // how much alpha reduces per second
-       float           time2; // used for snow fluttering and decal fade
-       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)
-       float           gravity; // how much gravity affects this particle (1.0 = normal gravity, 0.0 = none)
-       float           friction; // how much air friction affects this object (objects with a low mass/size ratio tend to get more air friction)
-       unsigned char           color[4];
-       unsigned short owner; // decal stuck to this entity
-       model_t         *ownermodel; // model the decal is stuck to (used to make sure the entity is still alive)
-       vec3_t          relativeorigin; // decal at this location in entity's coordinate space
-       vec3_t          relativedirection; // decal oriented this way relative to entity's coordinate space
-}
-particle_t;
-
 static int particlepalette[256] =
 {
        0x000000,0x0f0f0f,0x1f1f1f,0x2f2f2f,0x3f3f3f,0x4b4b4b,0x5b5b5b,0x6b6b6b, // 0-7
@@ -304,11 +93,6 @@ static const int tex_bubble = 62;
 static const int tex_raindrop = 61;
 static const int tex_beam = 60;
 
-static int                     cl_maxparticles;
-static int                     cl_numparticles;
-static int                     cl_freeparticle;
-static particle_t      *particles;
-
 cvar_t cl_particles = {CVAR_SAVE, "cl_particles", "1", "enables particle effects"};
 cvar_t cl_particles_quality = {CVAR_SAVE, "cl_particles_quality", "1", "multiplies number of particles and reduces their alpha"};
 cvar_t cl_particles_size = {CVAR_SAVE, "cl_particles_size", "1", "multiplies particle size"};
@@ -331,13 +115,6 @@ cvar_t cl_decals = {CVAR_SAVE, "cl_decals", "0", "enables decals (bullet holes,
 cvar_t cl_decals_time = {CVAR_SAVE, "cl_decals_time", "0", "how long before decals start to fade away"};
 cvar_t cl_decals_fadetime = {CVAR_SAVE, "cl_decals_fadetime", "20", "how long decals take to fade away"};
 
-void CL_Particles_Clear(void)
-{
-       cl_numparticles = 0;
-       cl_freeparticle = 0;
-       memset(particles, 0, sizeof(particle_t) * cl_maxparticles);
-}
-
 /*
 ===============
 CL_InitParticles
@@ -346,20 +123,6 @@ CL_InitParticles
 void CL_ReadPointFile_f (void);
 void CL_Particles_Init (void)
 {
-       int             i;
-
-// COMMANDLINEOPTION: Client: -particles <number> changes maximum number of particles at once, default 32768
-       i = COM_CheckParm ("-particles");
-
-       if (i && i < com_argc - 1)
-       {
-               cl_maxparticles = (int)(atoi(com_argv[i+1]));
-               if (cl_maxparticles < ABSOLUTE_MIN_PARTICLES)
-                       cl_maxparticles = ABSOLUTE_MIN_PARTICLES;
-       }
-       else
-               cl_maxparticles = MAX_PARTICLES;
-
        Cmd_AddCommand ("pointfile", CL_ReadPointFile_f, "display point file produced by qbsp when a leak was detected in the map (a line leading through the leak hole, to an entity inside the level)");
 
        Cvar_RegisterVariable (&cl_particles);
@@ -383,20 +146,10 @@ void CL_Particles_Init (void)
        Cvar_RegisterVariable (&cl_decals);
        Cvar_RegisterVariable (&cl_decals_time);
        Cvar_RegisterVariable (&cl_decals_fadetime);
-
-#ifdef WORKINGLQUAKE
-       particles = (particle_t *) Hunk_AllocName(cl_maxparticles * sizeof(particle_t), "particles");
-#else
-       particles = (particle_t *) Mem_Alloc(cl_mempool, cl_maxparticles * sizeof(particle_t));
-#endif
-       CL_Particles_Clear();
 }
 
 void CL_Particles_Shutdown (void)
 {
-#ifdef WORKINGLQUAKE
-       // No clue what to do here...
-#endif
 }
 
 // list of all 26 parameters:
@@ -417,12 +170,12 @@ particle_t *particle(particletype_t *ptype, int pcolor1, int pcolor2, int ptex,
        int l1, l2;
        particle_t *part;
        vec3_t v;
-       for (;cl_freeparticle < cl_maxparticles && particles[cl_freeparticle].type;cl_freeparticle++);
-       if (cl_freeparticle >= cl_maxparticles)
+       for (;cl.free_particle < cl.max_particles && cl.particles[cl.free_particle].type;cl.free_particle++);
+       if (cl.free_particle >= cl.max_particles)
                return NULL;
-       part = &particles[cl_freeparticle++];
-       if (cl_numparticles < cl_freeparticle)
-               cl_numparticles = cl_freeparticle;
+       part = &cl.particles[cl.free_particle++];
+       if (cl.num_particles < cl.free_particle)
+               cl.num_particles = cl.free_particle;
        memset(part, 0, sizeof(*part));
        part->type = ptype;
        l2 = (int)lhrandom(0.5, 256.5);
@@ -458,13 +211,11 @@ void CL_SpawnDecalParticleForSurface(int hitent, const vec3_t org, const vec3_t
        if (p)
        {
                p->time2 = cl.time;
-#ifndef WORKINGLQUAKE
                p->owner = hitent;
-               p->ownermodel = cl_entities[p->owner].render.model;
-               Matrix4x4_Transform(&cl_entities[p->owner].render.inversematrix, org, p->relativeorigin);
-               Matrix4x4_Transform3x3(&cl_entities[p->owner].render.inversematrix, normal, p->relativedirection);
+               p->ownermodel = cl.entities[p->owner].render.model;
+               Matrix4x4_Transform(&cl.entities[p->owner].render.inversematrix, org, p->relativeorigin);
+               Matrix4x4_Transform3x3(&cl.entities[p->owner].render.inversematrix, normal, p->relativedirection);
                VectorAdd(p->relativeorigin, p->relativedirection, p->relativeorigin);
-#endif
        }
 }
 
@@ -505,11 +256,7 @@ void CL_EntityParticles (entity_t *ent)
        static vec3_t avelocities[NUMVERTEXNORMALS];
        if (!cl_particles.integer) return;
 
-#ifdef WORKINGLQUAKE
-       VectorCopy(ent->origin, org);
-#else
        Matrix4x4_OriginFromMatrix(&ent->render.matrix, org);
-#endif
 
        if (!avelocities[0][0])
                for (i = 0;i < NUMVERTEXNORMALS * 3;i++)
@@ -539,11 +286,7 @@ void CL_ReadPointFile_f (void)
 
        FS_StripExtension (cl.worldmodel->name, name, sizeof (name));
        strlcat (name, ".pts", sizeof (name));
-#if WORKINGLQUAKE
-       pointfile = COM_LoadTempFile (name);
-#else
        pointfile = (char *)FS_LoadFile(name, tempmempool, true, NULL);
-#endif
        if (!pointfile)
        {
                Con_Printf("Could not open %s\n", name);
@@ -575,15 +318,13 @@ void CL_ReadPointFile_f (void)
                        VectorCopy(org, leakorg);
                c++;
 
-               if (cl_numparticles < cl_maxparticles - 3)
+               if (cl.num_particles < cl.max_particles - 3)
                {
                        s++;
                        particle(particletype + pt_static, particlepalette[(-c)&15], particlepalette[(-c)&15], tex_particle, 2, 255, 0, 0, 0, org[0], org[1], org[2], 0, 0, 0, 0, 0, 0);
                }
        }
-#ifndef WORKINGLQUAKE
        Mem_Free(pointfile);
-#endif
        VectorCopy(leakorg, org);
        Con_Printf("%i points read (%i particles spawned)\nLeak at %f %f %f\n", c, s, org[0], org[1], org[2]);
 
@@ -686,11 +427,6 @@ void CL_ParticleExplosion (vec3_t org)
                                {
                                        int k;
                                        vec3_t v, v2;
-#ifdef WORKINGLQUAKE
-                                       v2[0] = lhrandom(-48, 48);
-                                       v2[1] = lhrandom(-48, 48);
-                                       v2[2] = lhrandom(-48, 48);
-#else
                                        for (k = 0;k < 16;k++)
                                        {
                                                v[0] = org[0] + lhrandom(-48, 48);
@@ -701,7 +437,6 @@ void CL_ParticleExplosion (vec3_t org)
                                                        break;
                                        }
                                        VectorSubtract(trace.endpos, org, v2);
-#endif
                                        VectorScale(v2, 2.0f, v2);
                                        particle(particletype + pt_smoke, 0x202020, 0x404040, tex_smoke[rand()&7], 12, 32, 64, 0, 0, org[0], org[1], org[2], v2[0], v2[1], v2[2], 0, 0, 0);
                                }
@@ -1165,18 +900,11 @@ void CL_TeleportSplash (vec3_t org)
        }
 }
 
-#ifdef WORKINGLQUAKE
-void R_RocketTrail (vec3_t start, vec3_t end, int type)
-#else
 void CL_RocketTrail (vec3_t start, vec3_t end, int type, int color, entity_t *ent)
-#endif
 {
        vec3_t vec, dir, vel, pos;
        float len, dec, speed, qd;
        int smoke, blood, bubbles, r;
-#ifdef WORKINGLQUAKE
-       int contents;
-#endif
 
        if (end[0] == start[0] && end[1] == start[1] && end[2] == start[2])
                return;
@@ -1185,12 +913,6 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, int color, entity_t *en
        VectorNormalize(dir);
 
        VectorSubtract (end, start, vec);
-#ifdef WORKINGLQUAKE
-       len = VectorNormalize (vec);
-       dec = 0;
-       speed = 1.0f / cl.frametime;
-       VectorSubtract(end, start, vel);
-#else
        len = VectorNormalizeLength (vec);
        dec = -ent->persistent.trail_time;
        ent->persistent.trail_time += len;
@@ -1205,7 +927,6 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, int color, entity_t *en
                speed = 1.0f / speed;
        VectorSubtract(ent->state_current.origin, ent->state_previous.origin, vel);
        color = particlepalette[color];
-#endif
        VectorScale(vel, speed, vel);
 
        // advance into this frame to reach the first puff location
@@ -1214,12 +935,7 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, int color, entity_t *en
 
        smoke = cl_particles.integer && cl_particles_smoke.integer;
        blood = cl_particles.integer && cl_particles_blood.integer;
-#ifdef WORKINGLQUAKE
-       contents = CL_PointQ1Contents(pos);
-       bubbles = cl_particles.integer && cl_particles_bubbles.integer && (contents == CONTENTS_WATER || contents == CONTENTS_SLIME);
-#else
        bubbles = cl_particles.integer && cl_particles_bubbles.integer && (CL_PointSuperContents(pos) & (SUPERCONTENTS_WATER | SUPERCONTENTS_SLIME));
-#endif
        qd = 1.0f / cl_particles_quality.value;
 
        while (len >= 0)
@@ -1366,7 +1082,6 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, int color, entity_t *en
                                        }
                                }
                                break;
-#ifndef WORKINGLQUAKE
                        case 7: // Nehahra smoke tracer
                                dec = 7;
                                if (smoke)
@@ -1382,7 +1097,6 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, int color, entity_t *en
                                if (smoke)
                                        particle(particletype + pt_alphastatic, color, color, tex_particle, 5, 128, 320, 0, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 0);
                                break;
-#endif
                        default:
                                Sys_Error("CL_RocketTrail: unknown trail type %i", type);
                }
@@ -1392,9 +1106,7 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, int color, entity_t *en
                len -= dec;
                VectorMA (pos, dec, vec, pos);
        }
-#ifndef WORKINGLQUAKE
        ent->persistent.trail_time = len;
-#endif
 }
 
 void CL_BeamParticle (const vec3_t start, const vec3_t end, vec_t radius, float red, float green, float blue, float alpha, float lifetime)
@@ -1452,24 +1164,20 @@ void CL_MoveParticles (void)
        trace_t trace;
 
        // LordHavoc: early out condition
-       if (!cl_numparticles)
+       if (!cl.num_particles)
        {
-               cl_freeparticle = 0;
+               cl.free_particle = 0;
                return;
        }
 
-#ifdef WORKINGLQUAKE
-       frametime = cl.frametime;
-#else
        frametime = cl.time - cl.oldtime;
-#endif
        gravity = frametime * sv_gravity.value;
        dvel = 1+4*frametime;
        bloodwaterfade = max(cl_particles_blood_alpha.value, 0.01f) * frametime * 128.0f;
 
        maxparticle = -1;
        j = 0;
-       for (i = 0, p = particles;i < cl_numparticles;i++, p++)
+       for (i = 0, p = cl.particles;i < cl.num_particles;i++, p++)
        {
                if (!p->type)
                        continue;
@@ -1525,10 +1233,8 @@ void CL_MoveParticles (void)
                                                VectorCopy(trace.endpos, p->org);
                                                VectorCopy(trace.plane.normal, p->vel);
                                                VectorAdd(p->org, p->vel, p->org);
-#ifndef WORKINGLQUAKE
                                                if (cl_stainmaps.integer)
                                                        R_Stain(p->org, 32, 32, 16, 16, p->alpha * p->size * (1.0f / 40.0f), 192, 48, 48, p->alpha * p->size * (1.0f / 40.0f));
-#endif
                                                if (!cl_decals.integer)
                                                {
                                                        p->type = NULL;
@@ -1537,12 +1243,10 @@ void CL_MoveParticles (void)
 
                                                p->type = particletype + pt_decal;
                                                p->texnum = tex_blooddecal[rand()&7];
-#ifndef WORKINGLQUAKE
                                                p->owner = hitent;
-                                               p->ownermodel = cl_entities[hitent].render.model;
-                                               Matrix4x4_Transform(&cl_entities[hitent].render.inversematrix, p->org, p->relativeorigin);
-                                               Matrix4x4_Transform3x3(&cl_entities[hitent].render.inversematrix, p->vel, p->relativedirection);
-#endif
+                                               p->ownermodel = cl.entities[hitent].render.model;
+                                               Matrix4x4_Transform(&cl.entities[hitent].render.inversematrix, p->org, p->relativeorigin);
+                                               Matrix4x4_Transform3x3(&cl.entities[hitent].render.inversematrix, p->vel, p->relativedirection);
                                                p->time2 = cl.time;
                                                p->alphafade = 0;
                                                p->bounce = 0;
@@ -1577,11 +1281,7 @@ void CL_MoveParticles (void)
                        if (p->friction)
                        {
                                f = p->friction * frametime;
-#ifdef WORKINGLQUAKE
-                               if (CL_PointQ1Contents(p->org) != CONTENTS_EMPTY)
-#else
                                if (CL_PointSuperContents(p->org) & SUPERCONTENTS_LIQUIDSMASK)
-#endif
                                        f *= 4;
                                f = 1.0f - f;
                                VectorScale(p->vel, f, p->vel);
@@ -1600,47 +1300,28 @@ void CL_MoveParticles (void)
                                        p->time2 = 1;
                                break;
                        case pt_blood:
-#ifdef WORKINGLQUAKE
-                               a = CL_PointQ1Contents(p->org);
-                               if (a <= CONTENTS_WATER)
-#else
                                a = CL_PointSuperContents(p->org);
                                if (a & (SUPERCONTENTS_WATER | SUPERCONTENTS_SLIME))
-#endif
                                {
                                        p->size += frametime * 8;
                                        //p->alpha -= bloodwaterfade;
                                }
                                else
                                        p->vel[2] -= gravity;
-#ifdef WORKINGLQUAKE
-                               if (a == CONTENTS_SOLID || a == CONTENTS_LAVA)
-#else
                                if (a & (SUPERCONTENTS_SOLID | SUPERCONTENTS_LAVA | SUPERCONTENTS_NODROP))
-#endif
                                        p->type = NULL;
                                break;
                        case pt_bubble:
-#ifdef WORKINGLQUAKE
-                               a = CL_PointQ1Contents(p->org);
-                               if (a != CONTENTS_WATER && a != CONTENTS_SLIME)
-#else
                                a = CL_PointSuperContents(p->org);
                                if (!(a & (SUPERCONTENTS_WATER | SUPERCONTENTS_SLIME)))
-#endif
                                {
                                        p->type = NULL;
                                        break;
                                }
                                break;
                        case pt_rain:
-#ifdef WORKINGLQUAKE
-                               a = CL_PointQ1Contents(p->org);
-                               if (a != CONTENTS_EMPTY && a != CONTENTS_SKY)
-#else
                                a = CL_PointSuperContents(p->org);
                                if (a & (SUPERCONTENTS_SOLID | SUPERCONTENTS_LIQUIDSMASK))
-#endif
                                        p->type = NULL;
                                break;
                        case pt_snow:
@@ -1652,13 +1333,8 @@ void CL_MoveParticles (void)
                                        p->vel[1] = p->relativedirection[1] + lhrandom(-32, 32);
                                        //p->vel[2] = p->relativedirection[2] + lhrandom(-32, 32);
                                }
-#ifdef WORKINGLQUAKE
-                               a = CL_PointQ1Contents(p->org);
-                               if (a != CONTENTS_EMPTY && a != CONTENTS_SKY)
-#else
                                a = CL_PointSuperContents(p->org);
                                if (a & (SUPERCONTENTS_SOLID | SUPERCONTENTS_LIQUIDSMASK))
-#endif
                                        p->type = NULL;
                                break;
                        case pt_smoke:
@@ -1667,15 +1343,13 @@ void CL_MoveParticles (void)
                        case pt_decal:
                                // FIXME: this has fairly wacky handling of alpha
                                p->alphafade = cl.time > (p->time2 + cl_decals_time.value) ? (255 / cl_decals_fadetime.value) : 0;
-#ifndef WORKINGLQUAKE
-                               if (cl_entities[p->owner].render.model == p->ownermodel)
+                               if (cl.entities[p->owner].render.model == p->ownermodel)
                                {
-                                       Matrix4x4_Transform(&cl_entities[p->owner].render.matrix, p->relativeorigin, p->org);
-                                       Matrix4x4_Transform3x3(&cl_entities[p->owner].render.matrix, p->relativedirection, p->vel);
+                                       Matrix4x4_Transform(&cl.entities[p->owner].render.matrix, p->relativeorigin, p->org);
+                                       Matrix4x4_Transform3x3(&cl.entities[p->owner].render.matrix, p->relativedirection, p->vel);
                                }
                                else
                                        p->type = NULL;
-#endif
                                break;
                        case pt_raindecal:
                                a = max(0, (cl.time - p->time2) * 40);
@@ -1689,8 +1363,8 @@ void CL_MoveParticles (void)
                        }
                }
        }
-       cl_numparticles = maxparticle + 1;
-       cl_freeparticle = 0;
+       cl.num_particles = maxparticle + 1;
+       cl.free_particle = 0;
 }
 
 #define MAX_PARTICLETEXTURES 64
@@ -1702,12 +1376,8 @@ typedef struct particletexture_s
 }
 particletexture_t;
 
-#if WORKINGLQUAKE
-static int particlefonttexture;
-#else
 static rtexturepool_t *particletexturepool;
 static rtexture_t *particlefonttexture;
-#endif
 static particletexture_t particletexture[MAX_PARTICLETEXTURES];
 
 static cvar_t r_drawparticles = {0, "r_drawparticles", "1", "enables drawing of particles"};
@@ -1982,12 +1652,6 @@ static void R_InitParticleTexture (void)
                setuptex(tex_bulletdecal[i], &data[0][0][0], particletexturedata);
        }
 
-#if WORKINGLQUAKE
-       glBindTexture(GL_TEXTURE_2D, (particlefonttexture = gl_extension_number++));
-       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-#else
-
 #if 0
        Image_WriteTGARGBA ("particles/particlefont.tga", PARTICLEFONTSIZE, PARTICLEFONTSIZE, particletexturedata);
 #endif
@@ -2024,7 +1688,6 @@ static void R_InitParticleTexture (void)
        particletexture[tex_beam].t1 = 0;
        particletexture[tex_beam].s2 = 1;
        particletexture[tex_beam].t2 = 1;
-#endif
        Mem_Free(particletexturedata);
 }
 
@@ -2041,39 +1704,20 @@ static void r_part_shutdown(void)
 
 static void r_part_newmap(void)
 {
-       cl_numparticles = 0;
-       cl_freeparticle = 0;
 }
 
 void R_Particles_Init (void)
 {
        Cvar_RegisterVariable(&r_drawparticles);
-#ifdef WORKINGLQUAKE
-       r_part_start();
-#else
        R_RegisterModule("R_Particles", r_part_start, r_part_shutdown, r_part_newmap);
-#endif
-}
-
-#ifdef WORKINGLQUAKE
-void R_InitParticles(void)
-{
-       CL_Particles_Init();
-       R_Particles_Init();
 }
-#endif
 
 float particle_vertex3f[12], particle_texcoord2f[8];
 
-#ifdef WORKINGLQUAKE
-void R_DrawParticle(particle_t *p)
-{
-#else
 void R_DrawParticle_TransparentCallback(const entity_render_t *ent, int surfacenumber, const rtlight_t *rtlight)
 {
-       const particle_t *p = particles + surfacenumber;
+       const particle_t *p = cl.particles + surfacenumber;
        rmeshstate_t m;
-#endif
        pblend_t blendmode;
        float org[3], up2[3], v[3], right[3], up[3], fog, ifog, cr, cg, cb, ca, size;
        particletexture_t *tex;
@@ -2097,7 +1741,6 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, int surfacen
                ca = 1;
        }
        ca /= cl_particles_quality.value;
-#ifndef WORKINGLQUAKE
        if (p->type->lighting)
        {
                float ambient[3], diffuse[3], diffusenormal[3];
@@ -2139,7 +1782,6 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, int surfacen
                GL_BlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
        GL_DepthMask(false);
        GL_DepthTest(true);
-#endif
        size = p->size * cl_particles_size.value;
        if (p->type->orientation == PARTICLE_BILLBOARD || p->type->orientation == PARTICLE_ORIENTED_DOUBLESIDED)
        {
@@ -2206,23 +1848,7 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, int surfacen
                return;
        }
 
-#if WORKINGLQUAKE
-       if (blendmode == PBLEND_ALPHA)
-               glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-       else if (blendmode == PBLEND_ADD)
-               glBlendFunc(GL_SRC_ALPHA, GL_ONE);
-       else //if (blendmode == PBLEND_MOD)
-               glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
-       glColor4f(cr, cg, cb, ca);
-       glBegin(GL_QUADS);
-       glTexCoord2f(particle_texcoord2f[0], particle_texcoord2f[1]);glVertex3f(particle_vertex3f[ 0], particle_vertex3f[ 1], particle_vertex3f[ 2]);
-       glTexCoord2f(particle_texcoord2f[2], particle_texcoord2f[3]);glVertex3f(particle_vertex3f[ 3], particle_vertex3f[ 4], particle_vertex3f[ 5]);
-       glTexCoord2f(particle_texcoord2f[4], particle_texcoord2f[5]);glVertex3f(particle_vertex3f[ 6], particle_vertex3f[ 7], particle_vertex3f[ 8]);
-       glTexCoord2f(particle_texcoord2f[6], particle_texcoord2f[7]);glVertex3f(particle_vertex3f[ 9], particle_vertex3f[10], particle_vertex3f[11]);
-       glEnd();
-#else
        R_Mesh_Draw(0, 4, 2, polygonelements);
-#endif
 }
 
 void R_DrawParticles (void)
@@ -2231,31 +1857,14 @@ void R_DrawParticles (void)
        float minparticledist;
        particle_t *p;
 
-#ifdef WORKINGLQUAKE
-       CL_MoveParticles();
-#endif
-
        // LordHavoc: early out conditions
-       if ((!cl_numparticles) || (!r_drawparticles.integer))
+       if ((!cl.num_particles) || (!r_drawparticles.integer))
                return;
 
        minparticledist = DotProduct(r_vieworigin, r_viewforward) + 4.0f;
 
-#ifdef WORKINGLQUAKE
-       glBindTexture(GL_TEXTURE_2D, particlefonttexture);
-       glEnable(GL_BLEND);
-       glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-       glDepthMask(0);
-       // LordHavoc: only render if not too close
-       for (i = 0, p = particles;i < cl_numparticles;i++, p++)
-               if (p->type && DotProduct(p->org, r_viewforward) >= minparticledist)
-                       R_DrawParticle(p);
-       glDepthMask(1);
-       glDisable(GL_BLEND);
-       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-#else
        // LordHavoc: only render if not too close
-       for (i = 0, p = particles;i < cl_numparticles;i++, p++)
+       for (i = 0, p = cl.particles;i < cl.num_particles;i++, p++)
        {
                if (p->type)
                {
@@ -2269,6 +1878,5 @@ void R_DrawParticles (void)
                        }
                }
        }
-#endif
 }
 
index 01ac7fa23bc6b57c47331759b877d5594d367981..7b1852c7adc393f3aa038f574c2fe62d794188b5 100644 (file)
@@ -951,51 +951,29 @@ void SCR_ScreenShot_f (void)
        shotnumber++;
 }
 
-typedef enum capturevideoformat_e
-{
-       CAPTUREVIDEOFORMAT_TARGA,
-       CAPTUREVIDEOFORMAT_JPEG,
-       CAPTUREVIDEOFORMAT_RAWRGB,
-       CAPTUREVIDEOFORMAT_RAWYV12
-}
-capturevideoformat_t;
-
-qboolean cl_capturevideo_active = false;
-capturevideoformat_t cl_capturevideo_format;
-static double cl_capturevideo_starttime = 0;
-double cl_capturevideo_framerate = 0;
-static int cl_capturevideo_soundrate = 0;
-static int cl_capturevideo_frame = 0;
-static unsigned char *cl_capturevideo_buffer = NULL;
-static qfile_t *cl_capturevideo_videofile = NULL;
-qfile_t *cl_capturevideo_soundfile = NULL;
-static short cl_capturevideo_rgbtoyuvscaletable[3][3][256];
-static unsigned char cl_capturevideo_yuvnormalizetable[3][256];
-//static unsigned char cl_capturevideo_rgbgammatable[3][256];
-
 void SCR_CaptureVideo_BeginVideo(void)
 {
        double gamma, g;
        unsigned int i;
        unsigned char out[44];
-       if (cl_capturevideo_active)
+       if (cls.capturevideo_active)
                return;
        // soundrate is figured out on the first SoundFrame
-       cl_capturevideo_active = true;
-       cl_capturevideo_starttime = Sys_DoubleTime();
-       cl_capturevideo_framerate = bound(1, cl_capturevideo_fps.value, 1000);
-       cl_capturevideo_soundrate = 0;
-       cl_capturevideo_frame = 0;
-       cl_capturevideo_buffer = (unsigned char *)Mem_Alloc(tempmempool, vid.width * vid.height * (3+3+3) + 18);
+       cls.capturevideo_active = true;
+       cls.capturevideo_starttime = Sys_DoubleTime();
+       cls.capturevideo_framerate = bound(1, cl_capturevideo_fps.value, 1000);
+       cls.capturevideo_soundrate = 0;
+       cls.capturevideo_frame = 0;
+       cls.capturevideo_buffer = (unsigned char *)Mem_Alloc(tempmempool, vid.width * vid.height * (3+3+3) + 18);
        gamma = 1.0/scr_screenshot_gamma.value;
 
        /*
        for (i = 0;i < 256;i++)
        {
                unsigned char j = (unsigned char)bound(0, 255*pow(i/255.0, gamma), 255);
-               cl_capturevideo_rgbgammatable[0][i] = j;
-               cl_capturevideo_rgbgammatable[1][i] = j;
-               cl_capturevideo_rgbgammatable[2][i] = j;
+               cls.capturevideo_rgbgammatable[0][i] = j;
+               cls.capturevideo_rgbgammatable[1][i] = j;
+               cls.capturevideo_rgbgammatable[2][i] = j;
        }
        */
 /*
@@ -1010,73 +988,73 @@ Cr = R *  .500 + G * -.419 + B * -.0813 + 128.;
        {
                g = 255*pow(i/255.0, gamma);
                // Y weights from RGB
-               cl_capturevideo_rgbtoyuvscaletable[0][0][i] = (short)(g *  0.299);
-               cl_capturevideo_rgbtoyuvscaletable[0][1][i] = (short)(g *  0.587);
-               cl_capturevideo_rgbtoyuvscaletable[0][2][i] = (short)(g *  0.114);
+               cls.capturevideo_rgbtoyuvscaletable[0][0][i] = (short)(g *  0.299);
+               cls.capturevideo_rgbtoyuvscaletable[0][1][i] = (short)(g *  0.587);
+               cls.capturevideo_rgbtoyuvscaletable[0][2][i] = (short)(g *  0.114);
                // Cb weights from RGB
-               cl_capturevideo_rgbtoyuvscaletable[1][0][i] = (short)(g * -0.169);
-               cl_capturevideo_rgbtoyuvscaletable[1][1][i] = (short)(g * -0.332);
-               cl_capturevideo_rgbtoyuvscaletable[1][2][i] = (short)(g *  0.500);
+               cls.capturevideo_rgbtoyuvscaletable[1][0][i] = (short)(g * -0.169);
+               cls.capturevideo_rgbtoyuvscaletable[1][1][i] = (short)(g * -0.332);
+               cls.capturevideo_rgbtoyuvscaletable[1][2][i] = (short)(g *  0.500);
                // Cr weights from RGB
-               cl_capturevideo_rgbtoyuvscaletable[2][0][i] = (short)(g *  0.500);
-               cl_capturevideo_rgbtoyuvscaletable[2][1][i] = (short)(g * -0.419);
-               cl_capturevideo_rgbtoyuvscaletable[2][2][i] = (short)(g * -0.0813);
+               cls.capturevideo_rgbtoyuvscaletable[2][0][i] = (short)(g *  0.500);
+               cls.capturevideo_rgbtoyuvscaletable[2][1][i] = (short)(g * -0.419);
+               cls.capturevideo_rgbtoyuvscaletable[2][2][i] = (short)(g * -0.0813);
                // range reduction of YCbCr to valid signal range
-               cl_capturevideo_yuvnormalizetable[0][i] = 16 + i * (236-16) / 256;
-               cl_capturevideo_yuvnormalizetable[1][i] = 16 + i * (240-16) / 256;
-               cl_capturevideo_yuvnormalizetable[2][i] = 16 + i * (240-16) / 256;
+               cls.capturevideo_yuvnormalizetable[0][i] = 16 + i * (236-16) / 256;
+               cls.capturevideo_yuvnormalizetable[1][i] = 16 + i * (240-16) / 256;
+               cls.capturevideo_yuvnormalizetable[2][i] = 16 + i * (240-16) / 256;
        }
 
        if (cl_capturevideo_rawrgb.integer)
        {
-               cl_capturevideo_format = CAPTUREVIDEOFORMAT_RAWRGB;
-               cl_capturevideo_videofile = FS_Open ("video/dpvideo.rgb", "wb", false, true);
+               cls.capturevideo_format = CAPTUREVIDEOFORMAT_RAWRGB;
+               cls.capturevideo_videofile = FS_Open ("video/dpvideo.rgb", "wb", false, true);
        }
        else if (cl_capturevideo_rawyv12.integer)
        {
-               cl_capturevideo_format = CAPTUREVIDEOFORMAT_RAWYV12;
-               cl_capturevideo_videofile = FS_Open ("video/dpvideo.yv12", "wb", false, true);
+               cls.capturevideo_format = CAPTUREVIDEOFORMAT_RAWYV12;
+               cls.capturevideo_videofile = FS_Open ("video/dpvideo.yv12", "wb", false, true);
        }
        else if (scr_screenshot_jpeg.integer)
        {
-               cl_capturevideo_format = CAPTUREVIDEOFORMAT_JPEG;
-               cl_capturevideo_videofile = NULL;
+               cls.capturevideo_format = CAPTUREVIDEOFORMAT_JPEG;
+               cls.capturevideo_videofile = NULL;
        }
        else
        {
-               cl_capturevideo_format = CAPTUREVIDEOFORMAT_TARGA;
-               cl_capturevideo_videofile = NULL;
+               cls.capturevideo_format = CAPTUREVIDEOFORMAT_TARGA;
+               cls.capturevideo_videofile = NULL;
        }
 
        if (cl_capturevideo_sound.integer)
        {
-               cl_capturevideo_soundfile = FS_Open ("video/dpvideo.wav", "wb", false, true);
+               cls.capturevideo_soundfile = FS_Open ("video/dpvideo.wav", "wb", false, true);
                // wave header will be filled out when video ends
                memset(out, 0, 44);
-               FS_Write (cl_capturevideo_soundfile, out, 44);
+               FS_Write (cls.capturevideo_soundfile, out, 44);
        }
        else
-               cl_capturevideo_soundfile = NULL;
+               cls.capturevideo_soundfile = NULL;
 }
 
 void SCR_CaptureVideo_EndVideo(void)
 {
        int i, n;
        unsigned char out[44];
-       if (!cl_capturevideo_active)
+       if (!cls.capturevideo_active)
                return;
-       cl_capturevideo_active = false;
+       cls.capturevideo_active = false;
 
-       if (cl_capturevideo_videofile)
+       if (cls.capturevideo_videofile)
        {
-               FS_Close(cl_capturevideo_videofile);
-               cl_capturevideo_videofile = NULL;
+               FS_Close(cls.capturevideo_videofile);
+               cls.capturevideo_videofile = NULL;
        }
 
        // finish the wave file
-       if (cl_capturevideo_soundfile)
+       if (cls.capturevideo_soundfile)
        {
-               i = (int)FS_Tell (cl_capturevideo_soundfile);
+               i = (int)FS_Tell (cls.capturevideo_soundfile);
                //"RIFF", (int) unknown (chunk size), "WAVE",
                //"fmt ", (int) 16 (chunk size), (short) format 1 (uncompressed PCM), (short) 2 channels, (int) unknown rate, (int) unknown bytes per second, (short) 4 bytes per sample (channels * bytes per channel), (short) 16 bits per channel
                //"data", (int) unknown (chunk size)
@@ -1088,13 +1066,13 @@ void SCR_CaptureVideo_EndVideo(void)
                out[6] = (n >> 16) & 0xFF;
                out[7] = (n >> 24) & 0xFF;
                // rate
-               n = cl_capturevideo_soundrate;
+               n = cls.capturevideo_soundrate;
                out[24] = (n) & 0xFF;
                out[25] = (n >> 8) & 0xFF;
                out[26] = (n >> 16) & 0xFF;
                out[27] = (n >> 24) & 0xFF;
                // bytes per second (rate * channels * bytes per channel)
-               n = cl_capturevideo_soundrate * 2 * 2;
+               n = cls.capturevideo_soundrate * 2 * 2;
                out[28] = (n) & 0xFF;
                out[29] = (n >> 8) & 0xFF;
                out[30] = (n >> 16) & 0xFF;
@@ -1105,21 +1083,21 @@ void SCR_CaptureVideo_EndVideo(void)
                out[41] = (n >> 8) & 0xFF;
                out[42] = (n >> 16) & 0xFF;
                out[43] = (n >> 24) & 0xFF;
-               FS_Seek (cl_capturevideo_soundfile, 0, SEEK_SET);
-               FS_Write (cl_capturevideo_soundfile, out, 44);
-               FS_Close (cl_capturevideo_soundfile);
-               cl_capturevideo_soundfile = NULL;
+               FS_Seek (cls.capturevideo_soundfile, 0, SEEK_SET);
+               FS_Write (cls.capturevideo_soundfile, out, 44);
+               FS_Close (cls.capturevideo_soundfile);
+               cls.capturevideo_soundfile = NULL;
        }
 
-       if (cl_capturevideo_buffer)
+       if (cls.capturevideo_buffer)
        {
-               Mem_Free (cl_capturevideo_buffer);
-               cl_capturevideo_buffer = NULL;
+               Mem_Free (cls.capturevideo_buffer);
+               cls.capturevideo_buffer = NULL;
        }
 
-       cl_capturevideo_starttime = 0;
-       cl_capturevideo_framerate = 0;
-       cl_capturevideo_frame = 0;
+       cls.capturevideo_starttime = 0;
+       cls.capturevideo_framerate = 0;
+       cls.capturevideo_frame = 0;
 }
 
 qboolean SCR_CaptureVideo_VideoFrame(int newframenum)
@@ -1128,85 +1106,85 @@ qboolean SCR_CaptureVideo_VideoFrame(int newframenum)
        unsigned char *b, *out;
        char filename[32];
        int outoffset = (width/2)*(height/2);
-       //return SCR_ScreenShot(filename, cl_capturevideo_buffer, cl_capturevideo_buffer + vid.width * vid.height * 3, cl_capturevideo_buffer + vid.width * vid.height * 6, 0, 0, vid.width, vid.height, false, false, false, jpeg, true);
+       //return SCR_ScreenShot(filename, cls.capturevideo_buffer, cls.capturevideo_buffer + vid.width * vid.height * 3, cls.capturevideo_buffer + vid.width * vid.height * 6, 0, 0, vid.width, vid.height, false, false, false, jpeg, true);
        // speed is critical here, so do saving as directly as possible
-       switch (cl_capturevideo_format)
+       switch (cls.capturevideo_format)
        {
        case CAPTUREVIDEOFORMAT_RAWYV12:
                // FIXME: width/height must be multiple of 2, enforce this?
-               qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, cl_capturevideo_buffer);
+               qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, cls.capturevideo_buffer);
                CHECKGLERROR
                // process one line at a time, and CbCr every other line at 2 pixel intervals
                for (y = 0;y < height;y++)
                {
                        // 1x1 Y
-                       for (b = cl_capturevideo_buffer + (height-1-y)*width*3, out = cl_capturevideo_buffer + width*height*3 + y*width, x = 0;x < width;x++, b += 3, out++)
-                               *out = cl_capturevideo_yuvnormalizetable[0][cl_capturevideo_rgbtoyuvscaletable[0][0][b[0]] + cl_capturevideo_rgbtoyuvscaletable[0][1][b[1]] + cl_capturevideo_rgbtoyuvscaletable[0][2][b[2]]];
+                       for (b = cls.capturevideo_buffer + (height-1-y)*width*3, out = cls.capturevideo_buffer + width*height*3 + y*width, x = 0;x < width;x++, b += 3, out++)
+                               *out = cls.capturevideo_yuvnormalizetable[0][cls.capturevideo_rgbtoyuvscaletable[0][0][b[0]] + cls.capturevideo_rgbtoyuvscaletable[0][1][b[1]] + cls.capturevideo_rgbtoyuvscaletable[0][2][b[2]]];
                        if ((y & 1) == 0)
                        {
                                // 2x2 Cb and Cr planes
 #if 1
                                // low quality, no averaging
-                               for (b = cl_capturevideo_buffer + (height-2-y)*width*3, out = cl_capturevideo_buffer + width*height*3 + width*height + (y/2)*(width/2), x = 0;x < width/2;x++, b += 6, out++)
+                               for (b = cls.capturevideo_buffer + (height-2-y)*width*3, out = cls.capturevideo_buffer + width*height*3 + width*height + (y/2)*(width/2), x = 0;x < width/2;x++, b += 6, out++)
                                {
                                        // Cr
-                                       out[0        ] = cl_capturevideo_yuvnormalizetable[2][cl_capturevideo_rgbtoyuvscaletable[2][0][b[0]] + cl_capturevideo_rgbtoyuvscaletable[2][1][b[1]] + cl_capturevideo_rgbtoyuvscaletable[2][2][b[2]] + 128];
+                                       out[0        ] = cls.capturevideo_yuvnormalizetable[2][cls.capturevideo_rgbtoyuvscaletable[2][0][b[0]] + cls.capturevideo_rgbtoyuvscaletable[2][1][b[1]] + cls.capturevideo_rgbtoyuvscaletable[2][2][b[2]] + 128];
                                        // Cb
-                                       out[outoffset] = cl_capturevideo_yuvnormalizetable[1][cl_capturevideo_rgbtoyuvscaletable[1][0][b[0]] + cl_capturevideo_rgbtoyuvscaletable[1][1][b[1]] + cl_capturevideo_rgbtoyuvscaletable[1][2][b[2]] + 128];
+                                       out[outoffset] = cls.capturevideo_yuvnormalizetable[1][cls.capturevideo_rgbtoyuvscaletable[1][0][b[0]] + cls.capturevideo_rgbtoyuvscaletable[1][1][b[1]] + cls.capturevideo_rgbtoyuvscaletable[1][2][b[2]] + 128];
                                }
 #else
                                // high quality, averaging
                                int inpitch = width*3;
-                               for (b = cl_capturevideo_buffer + (height-2-y)*width*3, out = cl_capturevideo_buffer + width*height*3 + width*height + (y/2)*(width/2), x = 0;x < width/2;x++, b += 6, out++)
+                               for (b = cls.capturevideo_buffer + (height-2-y)*width*3, out = cls.capturevideo_buffer + width*height*3 + width*height + (y/2)*(width/2), x = 0;x < width/2;x++, b += 6, out++)
                                {
                                        int blockr, blockg, blockb;
                                        blockr = (b[0] + b[3] + b[inpitch+0] + b[inpitch+3]) >> 2;
                                        blockg = (b[1] + b[4] + b[inpitch+1] + b[inpitch+4]) >> 2;
                                        blockb = (b[2] + b[5] + b[inpitch+2] + b[inpitch+5]) >> 2;
                                        // Cr
-                                       out[0        ] = cl_capturevideo_yuvnormalizetable[2][cl_capturevideo_rgbtoyuvscaletable[2][0][blockr] + cl_capturevideo_rgbtoyuvscaletable[2][1][blockg] + cl_capturevideo_rgbtoyuvscaletable[2][2][blockb] + 128];
+                                       out[0        ] = cls.capturevideo_yuvnormalizetable[2][cls.capturevideo_rgbtoyuvscaletable[2][0][blockr] + cls.capturevideo_rgbtoyuvscaletable[2][1][blockg] + cls.capturevideo_rgbtoyuvscaletable[2][2][blockb] + 128];
                                        // Cb
-                                       out[outoffset] = cl_capturevideo_yuvnormalizetable[1][cl_capturevideo_rgbtoyuvscaletable[1][0][blockr] + cl_capturevideo_rgbtoyuvscaletable[1][1][blockg] + cl_capturevideo_rgbtoyuvscaletable[1][2][blockb] + 128];
+                                       out[outoffset] = cls.capturevideo_yuvnormalizetable[1][cls.capturevideo_rgbtoyuvscaletable[1][0][blockr] + cls.capturevideo_rgbtoyuvscaletable[1][1][blockg] + cls.capturevideo_rgbtoyuvscaletable[1][2][blockb] + 128];
                                }
 #endif
                        }
                }
-               for (;cl_capturevideo_frame < newframenum;cl_capturevideo_frame++)
-                       if (!FS_Write (cl_capturevideo_videofile, cl_capturevideo_buffer + width*height*3, width*height+(width/2)*(height/2)*2))
+               for (;cls.capturevideo_frame < newframenum;cls.capturevideo_frame++)
+                       if (!FS_Write (cls.capturevideo_videofile, cls.capturevideo_buffer + width*height*3, width*height+(width/2)*(height/2)*2))
                                return false;
                return true;
        case CAPTUREVIDEOFORMAT_RAWRGB:
-               qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, cl_capturevideo_buffer);
+               qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, cls.capturevideo_buffer);
                CHECKGLERROR
-               for (;cl_capturevideo_frame < newframenum;cl_capturevideo_frame++)
-                       if (!FS_Write (cl_capturevideo_videofile, cl_capturevideo_buffer, width*height*3))
+               for (;cls.capturevideo_frame < newframenum;cls.capturevideo_frame++)
+                       if (!FS_Write (cls.capturevideo_videofile, cls.capturevideo_buffer, width*height*3))
                                return false;
                return true;
        case CAPTUREVIDEOFORMAT_JPEG:
-               qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, cl_capturevideo_buffer);
+               qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, cls.capturevideo_buffer);
                CHECKGLERROR
-               for (;cl_capturevideo_frame < newframenum;cl_capturevideo_frame++)
+               for (;cls.capturevideo_frame < newframenum;cls.capturevideo_frame++)
                {
-                       sprintf(filename, "video/dp%06d.jpg", cl_capturevideo_frame);
-                       if (!JPEG_SaveImage_preflipped (filename, width, height, cl_capturevideo_buffer))
+                       sprintf(filename, "video/dp%06d.jpg", cls.capturevideo_frame);
+                       if (!JPEG_SaveImage_preflipped (filename, width, height, cls.capturevideo_buffer))
                                return false;
                }
                return true;
        case CAPTUREVIDEOFORMAT_TARGA:
-               //return Image_WriteTGARGB_preflipped (filename, width, height, cl_capturevideo_buffer, cl_capturevideo_buffer + vid.width * vid.height * 3, );
-               memset (cl_capturevideo_buffer, 0, 18);
-               cl_capturevideo_buffer[2] = 2;          // uncompressed type
-               cl_capturevideo_buffer[12] = (width >> 0) & 0xFF;
-               cl_capturevideo_buffer[13] = (width >> 8) & 0xFF;
-               cl_capturevideo_buffer[14] = (height >> 0) & 0xFF;
-               cl_capturevideo_buffer[15] = (height >> 8) & 0xFF;
-               cl_capturevideo_buffer[16] = 24;        // pixel size
-               qglReadPixels (x, y, width, height, GL_BGR, GL_UNSIGNED_BYTE, cl_capturevideo_buffer + 18);
+               //return Image_WriteTGARGB_preflipped (filename, width, height, cls.capturevideo_buffer, cls.capturevideo_buffer + vid.width * vid.height * 3, );
+               memset (cls.capturevideo_buffer, 0, 18);
+               cls.capturevideo_buffer[2] = 2;         // uncompressed type
+               cls.capturevideo_buffer[12] = (width >> 0) & 0xFF;
+               cls.capturevideo_buffer[13] = (width >> 8) & 0xFF;
+               cls.capturevideo_buffer[14] = (height >> 0) & 0xFF;
+               cls.capturevideo_buffer[15] = (height >> 8) & 0xFF;
+               cls.capturevideo_buffer[16] = 24;       // pixel size
+               qglReadPixels (x, y, width, height, GL_BGR, GL_UNSIGNED_BYTE, cls.capturevideo_buffer + 18);
                CHECKGLERROR
-               for (;cl_capturevideo_frame < newframenum;cl_capturevideo_frame++)
+               for (;cls.capturevideo_frame < newframenum;cls.capturevideo_frame++)
                {
-                       sprintf(filename, "video/dp%06d.tga", cl_capturevideo_frame);
-                       if (!FS_WriteFile (filename, cl_capturevideo_buffer, width*height*3 + 18))
+                       sprintf(filename, "video/dp%06d.tga", cls.capturevideo_frame);
+                       if (!FS_WriteFile (filename, cls.capturevideo_buffer, width*height*3 + 18))
                                return false;
                }
                return true;
@@ -1217,13 +1195,13 @@ qboolean SCR_CaptureVideo_VideoFrame(int newframenum)
 
 void SCR_CaptureVideo_SoundFrame(unsigned char *bufstereo16le, size_t length, int rate)
 {
-       if (!cl_capturevideo_soundfile)
+       if (!cls.capturevideo_soundfile)
                return;
-       cl_capturevideo_soundrate = rate;
-       if (FS_Write (cl_capturevideo_soundfile, bufstereo16le, 4 * length) < (fs_offset_t)(4 * length))
+       cls.capturevideo_soundrate = rate;
+       if (FS_Write (cls.capturevideo_soundfile, bufstereo16le, 4 * length) < (fs_offset_t)(4 * length))
        {
                Cvar_SetValueQuick(&cl_capturevideo, 0);
-               Con_Printf("video sound saving failed on frame %i, out of disk space? stopping video capture.\n", cl_capturevideo_frame);
+               Con_Printf("video sound saving failed on frame %i, out of disk space? stopping video capture.\n", cls.capturevideo_frame);
                SCR_CaptureVideo_EndVideo();
        }
 }
@@ -1233,25 +1211,25 @@ void SCR_CaptureVideo(void)
        int newframenum;
        if (cl_capturevideo.integer && r_render.integer)
        {
-               if (!cl_capturevideo_active)
+               if (!cls.capturevideo_active)
                        SCR_CaptureVideo_BeginVideo();
-               if (cl_capturevideo_framerate != cl_capturevideo_fps.value)
+               if (cls.capturevideo_framerate != cl_capturevideo_fps.value)
                {
                        Con_Printf("You can not change the video framerate while recording a video.\n");
-                       Cvar_SetValueQuick(&cl_capturevideo_fps, cl_capturevideo_framerate);
+                       Cvar_SetValueQuick(&cl_capturevideo_fps, cls.capturevideo_framerate);
                }
-               if (cl_capturevideo_soundfile)
+               if (cls.capturevideo_soundfile)
                {
                        // preserve sound sync by duplicating frames when running slow
-                       newframenum = (Sys_DoubleTime() - cl_capturevideo_starttime) * cl_capturevideo_framerate;
+                       newframenum = (Sys_DoubleTime() - cls.capturevideo_starttime) * cls.capturevideo_framerate;
                }
                else
-                       newframenum = cl_capturevideo_frame + 1;
+                       newframenum = cls.capturevideo_frame + 1;
                // if falling behind more than one second, stop
-               if (newframenum - cl_capturevideo_frame > (int)ceil(cl_capturevideo_framerate))
+               if (newframenum - cls.capturevideo_frame > (int)ceil(cls.capturevideo_framerate))
                {
                        Cvar_SetValueQuick(&cl_capturevideo, 0);
-                       Con_Printf("video saving failed on frame %i, your machine is too slow for this capture speed.\n", cl_capturevideo_frame);
+                       Con_Printf("video saving failed on frame %i, your machine is too slow for this capture speed.\n", cls.capturevideo_frame);
                        SCR_CaptureVideo_EndVideo();
                        return;
                }
@@ -1259,11 +1237,11 @@ void SCR_CaptureVideo(void)
                if (!SCR_CaptureVideo_VideoFrame(newframenum))
                {
                        Cvar_SetValueQuick(&cl_capturevideo, 0);
-                       Con_Printf("video saving failed on frame %i, out of disk space? stopping video capture.\n", cl_capturevideo_frame);
+                       Con_Printf("video saving failed on frame %i, out of disk space? stopping video capture.\n", cls.capturevideo_frame);
                        SCR_CaptureVideo_EndVideo();
                }
        }
-       else if (cl_capturevideo_active)
+       else if (cls.capturevideo_active)
                SCR_CaptureVideo_EndVideo();
 }
 
index 64e023070ee1adf3cbc4506de68a8107a6d9de75..8d44d9ae32fae036baa4e32b7c01d26622909b00 100644 (file)
@@ -9,16 +9,16 @@ static int  cl_videobmask;
 static int  cl_videogmask;
 static int     cl_videobytesperpixel;
 
-static int cl_activevideos;
-static clvideo_t videoarray[ MAXCLVIDEOS ];
+static int cl_num_videos;
+static clvideo_t cl_videos[ MAXCLVIDEOS ];
 static rtexturepool_t *cl_videotexturepool;
 
 static clvideo_t *FindUnusedVid( void )
 {
        int i;
        for( i = 1 ; i < MAXCLVIDEOS ; i++ )
-               if( videoarray[ i ].state == CLVIDEO_UNUSED )
-                       return &videoarray[ i ];
+               if( cl_videos[ i ].state == CLVIDEO_UNUSED )
+                       return &cl_videos[ i ];
        return NULL;
 }
 
@@ -60,7 +60,7 @@ static qboolean WakeVideo( clvideo_t * video )
                        return false;
                }
 
-       video->imagedata = Mem_Alloc( cl_mempool, video->cpif.width * video->cpif.height * cl_videobytesperpixel );
+       video->imagedata = Mem_Alloc( cls.mempool, video->cpif.width * video->cpif.height * cl_videobytesperpixel );
        video->cpif.tex = R_LoadTexture2D( cl_videotexturepool, video->cpif.name,
                video->cpif.width, video->cpif.height, NULL, TEXTYPE_RGBA, 0, NULL );
 
@@ -91,7 +91,7 @@ static clvideo_t* OpenVideo( clvideo_t *video, const char *filename, const char
        video->cpif.tex = R_LoadTexture2D( cl_videotexturepool, video->cpif.name,
                video->cpif.width, video->cpif.height, NULL, TEXTYPE_RGBA, 0, NULL );
 
-    video->imagedata = Mem_Alloc( cl_mempool, video->cpif.width * video->cpif.height * cl_videobytesperpixel );
+    video->imagedata = Mem_Alloc( cls.mempool, video->cpif.width * video->cpif.height * cl_videobytesperpixel );
 
        return video;
 }
@@ -108,13 +108,13 @@ clvideo_t* CL_OpenVideo( const char *filename, const char *name, int owner )
        video = OpenVideo( video, filename, name, owner );
        // expand the active range to include the new entry
        if (video)
-               cl_activevideos = max(cl_activevideos, (int)(video - videoarray) + 1);
+               cl_num_videos = max(cl_num_videos, (int)(video - cl_videos) + 1);
        return video;
 }
 
 static clvideo_t* CL_GetVideoBySlot( int slot )
 {
-       clvideo_t *video = &videoarray[ slot ];
+       clvideo_t *video = &cl_videos[ slot ];
 
        if( video->suspended )
        {
@@ -133,11 +133,11 @@ clvideo_t *CL_GetVideoByName( const char *name )
 {
        int i;
 
-       for( i = 0 ; i < cl_activevideos ; i++ )
-               if( videoarray[ i ].state != CLVIDEO_UNUSED
-                       &&      !strcmp( videoarray[ i ].cpif.name , name ) )
+       for( i = 0 ; i < cl_num_videos ; i++ )
+               if( cl_videos[ i ].state != CLVIDEO_UNUSED
+                       &&      !strcmp( cl_videos[ i ].cpif.name , name ) )
                        break;
-       if( i != cl_activevideos )
+       if( i != cl_num_videos )
                return CL_GetVideoBySlot( i );
        else
                return NULL;
@@ -214,10 +214,10 @@ void CL_VideoFrame( void ) // update all videos
        int i;
        clvideo_t *video;
 
-       if (!cl_activevideos)
+       if (!cl_num_videos)
                return;
 
-       for( video = videoarray, i = 0 ; i < cl_activevideos ; video++, i++ )
+       for( video = cl_videos, i = 0 ; i < cl_num_videos ; video++, i++ )
                if( video->state != CLVIDEO_UNUSED && !video->suspended )
                {
                        if( realtime - video->lasttime > CLTHRESHOLD )
@@ -228,27 +228,27 @@ void CL_VideoFrame( void ) // update all videos
                                VideoFrame( video );
                }
 
-       if( videoarray->state == CLVIDEO_FIRSTFRAME )
+       if( cl_videos->state == CLVIDEO_FIRSTFRAME )
                CL_VideoStop();
 
        // reduce range to exclude unnecessary entries
-       while (cl_activevideos > 0 && videoarray[cl_activevideos-1].state == CLVIDEO_UNUSED)
-               cl_activevideos--;
+       while (cl_num_videos > 0 && cl_videos[cl_num_videos-1].state == CLVIDEO_UNUSED)
+               cl_num_videos--;
 }
 
 void CL_Video_Shutdown( void )
 {
        int i;
-       for( i = 0 ; i < cl_activevideos ; i++ )
-               CL_CloseVideo( &videoarray[ i ] );
+       for( i = 0 ; i < cl_num_videos ; i++ )
+               CL_CloseVideo( &cl_videos[ i ] );
 }
 
 void CL_PurgeOwner( int owner )
 {
        int i;
-       for( i = 0 ; i < cl_activevideos ; i++ )
-               if( videoarray[ i ].ownertag == owner )
-                       CL_CloseVideo( &videoarray[ i ] );
+       for( i = 0 ; i < cl_num_videos ; i++ )
+               if( cl_videos[ i ].ownertag == owner )
+                       CL_CloseVideo( &cl_videos[ i ] );
 }
 
 int cl_videoplaying = false; // old, but still supported
@@ -263,24 +263,24 @@ void CL_VideoStart(char *filename)
 {
        Host_StartVideo();
 
-       if( videoarray->state != CLVIDEO_UNUSED )
-               CL_CloseVideo( videoarray );
-       if( !OpenVideo( videoarray, filename, va( CLVIDEOPREFIX "%s", filename ), 0 ) )
+       if( cl_videos->state != CLVIDEO_UNUSED )
+               CL_CloseVideo( cl_videos );
+       if( !OpenVideo( cl_videos, filename, va( CLVIDEOPREFIX "%s", filename ), 0 ) )
                return;
        // expand the active range to include the new entry
-       cl_activevideos = max(cl_activevideos, 1);
+       cl_num_videos = max(cl_num_videos, 1);
 
        cl_videoplaying = true;
 
-       CL_SetVideoState( videoarray, CLVIDEO_PLAY );
-       CL_RestartVideo( videoarray );
+       CL_SetVideoState( cl_videos, CLVIDEO_PLAY );
+       CL_RestartVideo( cl_videos );
 }
 
 void CL_VideoStop(void)
 {
        cl_videoplaying = false;
 
-       CL_CloseVideo( videoarray );
+       CL_CloseVideo( cl_videos );
 }
 
 static void CL_PlayVideo_f(void)
@@ -311,7 +311,7 @@ static void cl_video_start( void )
 
        cl_videotexturepool = R_AllocTexturePool();
 
-       for( video = videoarray, i = 0 ; i < cl_activevideos ; i++, video++ )
+       for( video = cl_videos, i = 0 ; i < cl_num_videos ; i++, video++ )
                if( video->state != CLVIDEO_UNUSED && !video->suspended )
                        video->cpif.tex = R_LoadTexture2D( cl_videotexturepool, video->cpif.name,
                                video->cpif.width, video->cpif.height, NULL, TEXTYPE_RGBA, 0, NULL );
@@ -328,7 +328,7 @@ static void cl_video_newmap( void )
 
 void CL_Video_Init( void )
 {
-       cl_activevideos = 0;
+       cl_num_videos = 0;
        cl_videobytesperpixel = 4;
        cl_videormask = BigLong(0xFF000000);
        cl_videogmask = BigLong(0x00FF0000);
index 540ed0d0aa0ec1270f72a481e6e2fe5b778b6d0e..cbe86f44819a71a6a842c97f188d826e31187adf 100644 (file)
--- a/client.h
+++ b/client.h
@@ -423,6 +423,15 @@ typedef enum qw_downloadtype_e
 }
 qw_downloadtype_t;
 
+typedef enum capturevideoformat_e
+{
+       CAPTUREVIDEOFORMAT_TARGA,
+       CAPTUREVIDEOFORMAT_JPEG,
+       CAPTUREVIDEOFORMAT_RAWRGB,
+       CAPTUREVIDEOFORMAT_RAWYV12
+}
+capturevideoformat_t;
+
 //
 // the client_static_t structure is persistent through an arbitrary number
 // of server connections
@@ -431,6 +440,9 @@ typedef struct client_static_s
 {
        cactive_t state;
 
+       // all client memory allocations go in this pool
+       mempool_t *mempool;
+
 // demo loop control
        // -1 = don't play demos
        int demonum;
@@ -498,6 +510,19 @@ typedef struct client_static_s
        // this normally contains the following keys in quakeworld:
        // password spectator name team skin topcolor bottomcolor rate noaim msg *ver *ip
        char userinfo[MAX_USERINFO_STRING];
+
+       // video capture stuff
+       qboolean capturevideo_active;
+       capturevideoformat_t capturevideo_format;
+       double capturevideo_starttime;
+       double capturevideo_framerate;
+       int capturevideo_soundrate;
+       int capturevideo_frame;
+       unsigned char *capturevideo_buffer;
+       qfile_t *capturevideo_videofile;
+       qfile_t *capturevideo_soundfile;
+       short capturevideo_rgbtoyuvscaletable[3][3][256];
+       unsigned char capturevideo_yuvnormalizetable[3][256];
 }
 client_static_t;
 
@@ -535,6 +560,58 @@ typedef struct qw_usercmd_s
 }
 qw_usercmd_t;
 
+typedef enum
+{
+       PARTICLE_BILLBOARD = 0,
+       PARTICLE_SPARK = 1,
+       PARTICLE_ORIENTED_DOUBLESIDED = 2,
+       PARTICLE_BEAM = 3
+}
+porientation_t;
+
+typedef enum
+{
+       PBLEND_ALPHA = 0,
+       PBLEND_ADD = 1,
+       PBLEND_MOD = 2
+}
+pblend_t;
+
+typedef struct particletype_s
+{
+       pblend_t blendmode;
+       porientation_t orientation;
+       qboolean lighting;
+}
+particletype_t;
+
+typedef enum
+{
+       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
+}
+ptype_t;
+
+typedef struct particle_s
+{
+       particletype_t *type;
+       int                     texnum;
+       vec3_t          org;
+       vec3_t          vel; // velocity of particle, or orientation of decal, or end point of beam
+       float           size;
+       float           alpha; // 0-255
+       float           alphafade; // how much alpha reduces per second
+       float           time2; // used for snow fluttering and decal fade
+       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)
+       float           gravity; // how much gravity affects this particle (1.0 = normal gravity, 0.0 = none)
+       float           friction; // how much air friction affects this object (objects with a low mass/size ratio tend to get more air friction)
+       unsigned char           color[4];
+       unsigned short owner; // decal stuck to this entity
+       model_t         *ownermodel; // model the decal is stuck to (used to make sure the entity is still alive)
+       vec3_t          relativeorigin; // decal at this location in entity's coordinate space
+       vec3_t          relativedirection; // decal oriented this way relative to entity's coordinate space
+}
+particle_t;
+
 //
 // the client_state_t structure is wiped completely at every
 // server signon
@@ -707,6 +784,52 @@ typedef struct client_state_s
        entityframe4_database_t *entitydatabase4;
        entityframeqw_database_t *entitydatabaseqw;
 
+       // keep track of quake entities because they need to be killed if they get stale
+       int lastquakeentity;
+       unsigned char isquakeentity[MAX_EDICTS];
+
+       // bounding boxes for clientside movement
+       vec3_t playerstandmins;
+       vec3_t playerstandmaxs;
+       vec3_t playercrouchmins;
+       vec3_t playercrouchmaxs;
+
+       int max_entities;
+       int max_csqcentities;
+       int max_static_entities;
+       int max_temp_entities;
+       int max_effects;
+       int max_beams;
+       int max_dlights;
+       int max_lightstyle;
+       int max_brushmodel_entities;
+       int max_particles;
+
+       entity_t *entities;
+       entity_t *csqcentities; //[515]: csqc
+       unsigned char *entities_active;
+       unsigned char *csqcentities_active;     //[515]: csqc
+       entity_t *static_entities;
+       entity_t *temp_entities;
+       cl_effect_t *effects;
+       beam_t *beams;
+       dlight_t *dlights;
+       lightstyle_t *lightstyle;
+       int *brushmodel_entities;
+       particle_t *particles;
+
+       int num_entities;
+       int num_csqcentities;   //[515]: csqc
+       int num_static_entities;
+       int num_temp_entities;
+       int num_brushmodel_entities;
+       int num_effects;
+       int num_beams;
+       int num_dlights;
+       int num_particles;
+
+       int free_particle;
+
        // quakeworld stuff
 
        // local copy of the server infostring
@@ -816,45 +939,6 @@ extern cvar_t cl_stainmaps_clearonload;
 
 extern cvar_t cl_prydoncursor;
 
-extern vec3_t cl_playerstandmins;
-extern vec3_t cl_playerstandmaxs;
-extern vec3_t cl_playercrouchmins;
-extern vec3_t cl_playercrouchmaxs;
-
-extern mempool_t *cl_mempool;
-
-extern int cl_max_entities;
-extern int cl_max_csqcentities;
-extern int cl_max_static_entities;
-extern int cl_max_temp_entities;
-extern int cl_max_effects;
-extern int cl_max_beams;
-extern int cl_max_dlights;
-extern int cl_max_lightstyle;
-extern int cl_max_brushmodel_entities;
-extern int cl_activedlights;
-extern int cl_activeeffects;
-extern int cl_activebeams;
-
-extern entity_t *cl_entities;
-extern entity_t *cl_csqcentities;      //[515]: csqc
-extern unsigned char *cl_entities_active;
-extern unsigned char *cl_csqcentities_active;  //[515]: csqc
-extern entity_t *cl_static_entities;
-extern entity_t *cl_temp_entities;
-extern cl_effect_t *cl_effects;
-extern beam_t *cl_beams;
-extern dlight_t *cl_dlights;
-extern lightstyle_t *cl_lightstyle;
-extern int *cl_brushmodel_entities;
-
-// these are updated by CL_ClearState
-extern int cl_num_entities;
-extern int cl_num_csqcentities;        //[515]: csqc
-extern int cl_num_static_entities;
-extern int cl_num_temp_entities;
-extern int cl_num_brushmodel_entities;
-
 extern client_state_t cl;
 
 extern void CL_AllocDlight (entity_render_t *ent, matrix4x4_t *matrix, float radius, float red, float green, float blue, float decay, float lifetime, int cubemapnum, int style, int shadowenable, vec_t corona, vec_t coronasizescale, vec_t ambientscale, vec_t diffusescale, vec_t specularscale, int flags);
index 7b3900a6c2b1023a3e653aa017e71f5fb4d70ebf..28df1b6ccafddd09babb61c9e4a0e2469393cd9d 100644 (file)
@@ -441,11 +441,11 @@ void VM_CL_lightstyle (void)
 
        i = PRVM_G_FLOAT(OFS_PARM0);
        c = PRVM_G_STRING(OFS_PARM1);
-       if (i >= cl_max_lightstyle)
+       if (i >= cl.max_lightstyle)
                PF_WARNING("VM_CL_lightstyle >= MAX_LIGHTSTYLES\n");
-       strlcpy (cl_lightstyle[i].map,  MSG_ReadString(), sizeof (cl_lightstyle[i].map));
-       cl_lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
-       cl_lightstyle[i].length = (int)strlen(cl_lightstyle[i].map);
+       strlcpy (cl.lightstyle[i].map,  MSG_ReadString(), sizeof (cl.lightstyle[i].map));
+       cl.lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
+       cl.lightstyle[i].length = (int)strlen(cl.lightstyle[i].map);
 }
 
 // #40 float(entity e) checkbottom
@@ -1110,13 +1110,13 @@ void CSQC_ParseBeam (int ent, vec3_t start, vec3_t end, model_t *m, int lightnin
        beam_t  *b;
 
        // override any beam with the same entity
-       for (i = 0, b = cl_beams;i < cl_max_beams;i++, b++)
+       for (i = 0, b = cl.beams;i < cl.max_beams;i++, b++)
        {
                if (b->entity == ent && ent)
                {
                        //b->entity = ent;
                        b->lightning = lightning;
-                       b->relativestartvalid = (ent && cl_csqcentities[ent].state_current.active) ? 2 : 0;
+                       b->relativestartvalid = (ent && cl.csqcentities[ent].state_current.active) ? 2 : 0;
                        b->model = m;
                        b->endtime = cl.time + 0.2;
                        VectorCopy (start, b->start);
@@ -1126,13 +1126,13 @@ void CSQC_ParseBeam (int ent, vec3_t start, vec3_t end, model_t *m, int lightnin
        }
 
        // find a free beam
-       for (i = 0, b = cl_beams;i < cl_max_beams;i++, b++)
+       for (i = 0, b = cl.beams;i < cl.max_beams;i++, b++)
        {
                if (!b->model || b->endtime < cl.time)
                {
                        b->entity = ent;
                        b->lightning = lightning;
-                       b->relativestartvalid = (ent && cl_csqcentities[ent].state_current.active) ? 2 : 0;
+                       b->relativestartvalid = (ent && cl.csqcentities[ent].state_current.active) ? 2 : 0;
                        b->model = m;
                        b->endtime = cl.time + 0.2;
                        VectorCopy (start, b->start);
@@ -1163,10 +1163,10 @@ void VM_CL_trailparticles (void)
                Con_Printf("CSQC_ParseBeam: invalid entity number %i\n", entnum);
                return;
        }
-       if (entnum >= cl_max_csqcentities)
+       if (entnum >= cl.max_csqcentities)
                CL_ExpandCSQCEntities(entnum);
 
-       ent = &cl_csqcentities[entnum];
+       ent = &cl.csqcentities[entnum];
 
        if(prog->argc > 4)
                col = PRVM_G_FLOAT(OFS_PARM4);
@@ -1327,13 +1327,13 @@ void VM_CL_getinputstate (void)
                        prog->globals.client->input_timelength = cl.movement_queue[i].frametime;
                        if(cl.movement_queue[i].crouch)
                        {
-                               VectorCopy(cl_playercrouchmins, prog->globals.client->pmove_mins);
-                               VectorCopy(cl_playercrouchmaxs, prog->globals.client->pmove_maxs);
+                               VectorCopy(cl.playercrouchmins, prog->globals.client->pmove_mins);
+                               VectorCopy(cl.playercrouchmaxs, prog->globals.client->pmove_maxs);
                        }
                        else
                        {
-                               VectorCopy(cl_playerstandmins, prog->globals.client->pmove_mins);
-                               VectorCopy(cl_playerstandmaxs, prog->globals.client->pmove_maxs);
+                               VectorCopy(cl.playerstandmins, prog->globals.client->pmove_mins);
+                               VectorCopy(cl.playerstandmaxs, prog->globals.client->pmove_maxs);
                        }
                }
 }
@@ -1890,20 +1890,18 @@ static void VM_CL_NewBeam (int ent, float *start, float *end, model_t *m, qboole
 {
        beam_t  *b;
        int             i;
-       extern entity_t *cl_csqcentities;
-       extern int cl_max_csqcentities;
 
-       if (ent >= cl_max_csqcentities)
+       if (ent >= cl.max_csqcentities)
                CL_ExpandCSQCEntities(ent);
 
        // override any beam with the same entity
-       for (i = 0, b = cl_beams;i < cl_max_beams;i++, b++)
+       for (i = 0, b = cl.beams;i < cl.max_beams;i++, b++)
        {
                if (b->entity == ent && ent)
                {
                        //b->entity = ent;
                        b->lightning = lightning;
-                       b->relativestartvalid = (ent && cl_csqcentities[ent].state_current.active) ? 2 : 0;
+                       b->relativestartvalid = (ent && cl.csqcentities[ent].state_current.active) ? 2 : 0;
                        b->model = m;
                        b->endtime = cl.time + 0.2;
                        VectorCopy (start, b->start);
@@ -1913,13 +1911,13 @@ static void VM_CL_NewBeam (int ent, float *start, float *end, model_t *m, qboole
        }
 
        // find a free beam
-       for (i = 0, b = cl_beams;i < cl_max_beams;i++, b++)
+       for (i = 0, b = cl.beams;i < cl.max_beams;i++, b++)
        {
                if (!b->model || b->endtime < cl.time)
                {
                        b->entity = ent;
                        b->lightning = lightning;
-                       b->relativestartvalid = (ent && cl_csqcentities[ent].state_current.active) ? 2 : 0;
+                       b->relativestartvalid = (ent && cl.csqcentities[ent].state_current.active) ? 2 : 0;
                        b->model = m;
                        b->endtime = cl.time + 0.2;
                        VectorCopy (start, b->start);
@@ -2601,16 +2599,16 @@ void VM_CL_selecttraceline (void)
        csqcents = PRVM_G_FLOAT(OFS_PARM3);
        ent = 0;
 
-       if((csqcents && ignore > cl_num_csqcentities) || (!csqcents && ignore > cl_num_entities))
+       if((csqcents && ignore > cl.num_csqcentities) || (!csqcents && ignore > cl.num_entities))
        {
                Con_Printf("VM_CL_selecttraceline: out of entities\n");
                return;
        }
        else
                if(csqcents)
-                       prog->globals.client->trace_fraction = CL_SelectTraceLine(v1, v2, prog->globals.client->trace_endpos, prog->globals.client->trace_plane_normal, &prog->globals.client->trace_ent, &cl_csqcentities[ignore].render, csqcents);
+                       prog->globals.client->trace_fraction = CL_SelectTraceLine(v1, v2, prog->globals.client->trace_endpos, prog->globals.client->trace_plane_normal, &prog->globals.client->trace_ent, &cl.csqcentities[ignore].render, csqcents);
                else
-                       prog->globals.client->trace_fraction = CL_SelectTraceLine(v1, v2, prog->globals.client->trace_endpos, prog->globals.client->trace_plane_normal, &ent, &cl_entities[ignore].render, csqcents);
+                       prog->globals.client->trace_fraction = CL_SelectTraceLine(v1, v2, prog->globals.client->trace_endpos, prog->globals.client->trace_plane_normal, &ent, &cl.entities[ignore].render, csqcents);
        PRVM_G_FLOAT(OFS_RETURN) = ent;
 }
 
index b0f811ab638b1aaad25b3bb0ac5cb2e058bd1bc8..80a270744f0a493419ff256e590082dc82779bfd 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -65,10 +65,6 @@ int csqc_fieldoff_tag_index;
 
 qboolean csqc_loaded = false;
 
-extern entity_t        *cl_csqcentities;
-extern unsigned char   *cl_csqcentities_active;
-extern int             cl_num_csqcentities;
-
 vec3_t csqc_origin, csqc_angles;
 static double csqc_frametime = 0;
 int csqc_buttons;
@@ -136,7 +132,7 @@ static void CSQC_SetGlobals (void)
                prog->globals.client->input_buttons = csqc_buttons;
                VectorSet(prog->globals.client->input_movevalues, cl.cmd.forwardmove, cl.cmd.sidemove, cl.cmd.upmove);
                //VectorCopy(cl.movement_origin, csqc_origin);
-               VectorCopy(cl_entities[cl.viewentity].render.origin, csqc_origin);
+               VectorCopy(cl.entities[cl.viewentity].render.origin, csqc_origin);
                VectorCopy(csqc_origin, prog->globals.client->pmove_org);
                prog->globals.client->maxclients = cl.maxclients;
                //VectorCopy(cl.movement_velocity, prog->globals.client->pmove_vel);
@@ -227,8 +223,8 @@ static qboolean CSQC_EdictToEntity (prvm_edict_t *ed, entity_t *e)
 
 void CSQC_ClearCSQCEntities (void)
 {
-       memset(cl_csqcentities_active, 0, sizeof(cl_csqcentities_active));
-       cl_num_csqcentities = 0;
+       memset(cl.csqcentities_active, 0, sizeof(cl.csqcentities_active));
+       cl.num_csqcentities = 0;
        csqc_drawmask = 0;
 }
 
@@ -243,15 +239,15 @@ void CSQC_RelinkCSQCEntities (void)
        *prog->time = cl.time;
        for(i=1;i<prog->num_edicts;i++)
        {
-               if(i >= cl_max_csqcentities)
+               if(i >= cl.max_csqcentities)
                        CL_ExpandCSQCEntities(i);
 
-               e = &cl_csqcentities[i];
+               e = &cl.csqcentities[i];
                ed = &prog->edicts[i];
                if(ed->priv.required->free)
                {
                        e->state_current.active = false;
-                       cl_csqcentities_active[i] = false;
+                       cl.csqcentities_active[i] = false;
                        continue;
                }
                VectorAdd(ed->fields.client->origin, ed->fields.client->mins, ed->fields.client->absmin);
@@ -260,23 +256,23 @@ void CSQC_RelinkCSQCEntities (void)
                if(ed->priv.required->free)
                {
                        e->state_current.active = false;
-                       cl_csqcentities_active[i] = false;
+                       cl.csqcentities_active[i] = false;
                        continue;
                }
                CSQC_Predraw(ed);
                if(ed->priv.required->free)
                {
                        e->state_current.active = false;
-                       cl_csqcentities_active[i] = false;
+                       cl.csqcentities_active[i] = false;
                        continue;
                }
-               if(!cl_csqcentities_active[i])
+               if(!cl.csqcentities_active[i])
                if(!((int)ed->fields.client->drawmask & csqc_drawmask))
                        continue;
 
                e->state_previous       = e->state_current;
                e->state_current        = defaultstate;
-               if((cl_csqcentities_active[i] = CSQC_EdictToEntity(ed, e)))
+               if((cl.csqcentities_active[i] = CSQC_EdictToEntity(ed, e)))
                {
                        if(!e->state_current.active)
                        {
@@ -286,7 +282,7 @@ void CSQC_RelinkCSQCEntities (void)
                                e->state_current.active = true;
                        }
                        e->persistent.lerpdeltatime = 0;//prog->globals.client->frametime;
-                       cl_num_csqcentities++;
+                       cl.num_csqcentities++;
                }
        }
 }
@@ -294,7 +290,7 @@ void CSQC_RelinkCSQCEntities (void)
 //[515]: omfg... it's all weird =/
 void CSQC_AddEntity (int n)
 {
-       cl_csqcentities_active[n] = true;
+       cl.csqcentities_active[n] = true;
 }
 
 qboolean CL_VM_InputEvent (qboolean pressed, int key)
@@ -322,7 +318,7 @@ qboolean CL_VM_UpdateView (void)
                *prog->time = cl.time;
                CSQC_SetGlobals();
                csqc_drawmask = 0;
-               cl_num_csqcentities = 0;
+               cl.num_csqcentities = 0;
                PRVM_ExecuteProgram (prog->globals.client->CSQC_UpdateView, CL_F_UPDATEVIEW);
                //VectorCopy(oldangles, cl.viewangles);
        CSQC_END
@@ -585,7 +581,7 @@ void CL_VM_Init (void)
        cl.csqc_vidvars.drawenginesbar = false;
 
        // local state
-       ent = &cl_csqcentities[0];
+       ent = &cl.csqcentities[0];
        // entire entity array was cleared, so just fill in a few fields
        ent->state_current.active = true;
        ent->render.model = cl.worldmodel = cl.model_precache[1];
index 8d6f2ccb0d5776965cdadbc3ba449b80e754524a..f37f4e79e4d939a306d76a191c27ed5b519054e6 100644 (file)
--- a/csprogs.h
+++ b/csprogs.h
@@ -46,7 +46,6 @@
 //#define RF_DOUBLESIDED               32
 
 extern unsigned int csqc_drawmask;
-extern int cl_max_csqcentities;
 extern qboolean csqc_frame;
 extern int csqc_buttons;
 extern qboolean csqc_loaded;
index a31b6df9ca82b6dcc43adb4ff7b9f4570f9f9a31..6ba68f2ad33e419d6f40330a1c06cd5f0f4560be 100644 (file)
@@ -268,9 +268,9 @@ void R_Stain (const vec3_t origin, float radius, int cr1, int cg1, int cb1, int
        R_StainNode(r_refdef.worldmodel->brush.data_nodes + r_refdef.worldmodel->brushq1.hulls[0].firstclipnode, r_refdef.worldmodel, origin, radius, fcolor);
 
        // look for embedded bmodels
-       for (n = 0;n < cl_num_brushmodel_entities;n++)
+       for (n = 0;n < cl.num_brushmodel_entities;n++)
        {
-               ent = &cl_entities[cl_brushmodel_entities[n]].render;
+               ent = &cl.entities[cl.brushmodel_entities[n]].render;
                model = ent->model;
                if (model && model->name[0] == '*')
                {
diff --git a/host.c b/host.c
index fb15b44a55ba454c2bf090e1154b84533c9ee1da..dfc42fa0c983720c2226d661c89b6359e206fb2a 100644 (file)
--- a/host.c
+++ b/host.c
@@ -547,9 +547,6 @@ Host_FilterTime
 Returns false if the time is too short to run a frame
 ===================
 */
-extern qboolean cl_capturevideo_active;
-extern double cl_capturevideo_framerate;
-extern qfile_t *cl_capturevideo_soundfile;
 qboolean Host_FilterTime (double time)
 {
        double timecap, timeleft;
@@ -580,8 +577,8 @@ qboolean Host_FilterTime (double time)
                timecap = sys_ticrate.value;
        if (cls.state != ca_dedicated)
        {
-               if (cl_capturevideo_active)
-                       timecap = 1.0 / cl_capturevideo_framerate;
+               if (cls.capturevideo_active)
+                       timecap = 1.0 / cls.capturevideo_framerate;
                else if (vid_activewindow)
                        timecap = 1.0 / cl_maxfps.value;
        }
@@ -607,7 +604,7 @@ qboolean Host_FilterTime (double time)
        host_realframetime = host_frametime = realtime - oldrealtime;
        oldrealtime = realtime;
 
-       if (cl_capturevideo_active && !cl_capturevideo_soundfile)
+       if (cls.capturevideo_active && !cls.capturevideo_soundfile)
                host_frametime = timecap;
 
        // apply slowmo scaling
diff --git a/menu.c b/menu.c
index d121bbfc813046f42947098173451a81fd0074de..2ae3f6374df02a97a9bfb3175ec94c5e5ae04856 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -28,9 +28,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #define TYPE_GAME 2
 #define TYPE_BOTH 3
 
-int NehGameType;
+static int NehGameType;
 
 enum m_state_e m_state;
+char m_return_reason[32];
 
 void M_Menu_Main_f (void);
        void M_Menu_SinglePlayer_f (void);
@@ -54,54 +55,51 @@ void M_Menu_LanConfig_f (void);
 void M_Menu_GameOptions_f (void);
 void M_Menu_ServerList_f (void);
 
-void M_Main_Draw (void);
-       void M_SinglePlayer_Draw (void);
-               void M_Transfusion_Episode_Draw (void);
-                       void M_Transfusion_Skill_Draw (void);
-               void M_Load_Draw (void);
-               void M_Save_Draw (void);
-       void M_MultiPlayer_Draw (void);
-               void M_Setup_Draw (void);
-       void M_Options_Draw (void);
-       void M_Options_Effects_Draw (void);
-       void M_Options_Graphics_Draw (void);
-       void M_Options_ColorControl_Draw (void);
-               void M_Keys_Draw (void);
-               void M_Reset_Draw (void);
-               void M_Video_Draw (void);
-       void M_Help_Draw (void);
-       void M_Credits_Draw (void);
-       void M_Quit_Draw (void);
-void M_LanConfig_Draw (void);
-void M_GameOptions_Draw (void);
-void M_ServerList_Draw (void);
-
-void M_Main_Key (int key, char ascii);
-       void M_SinglePlayer_Key (int key, char ascii);
-               void M_Transfusion_Episode_Key (int key, char ascii);
-                       void M_Transfusion_Skill_Key (int key, char ascii);
-               void M_Load_Key (int key, char ascii);
-               void M_Save_Key (int key, char ascii);
-       void M_MultiPlayer_Key (int key, char ascii);
-               void M_Setup_Key (int key, char ascii);
-       void M_Options_Key (int key, char ascii);
-       void M_Options_Effects_Key (int key, char ascii);
-       void M_Options_Graphics_Key (int key, char ascii);
-       void M_Options_ColorControl_Key (int key, char ascii);
-               void M_Keys_Key (int key, char ascii);
-               void M_Reset_Key (int key, char ascii);
-               void M_Video_Key (int key, char ascii);
-       void M_Help_Key (int key, char ascii);
-       void M_Credits_Key (int key, char ascii);
-       void M_Quit_Key (int key, char ascii);
-void M_LanConfig_Key (int key, char ascii);
-void M_GameOptions_Key (int key, char ascii);
-void M_ServerList_Key (int key, char ascii);
-
-qboolean       m_entersound;           // play after drawing a frame, so caching
-                                                               // won't disrupt the sound
-
-char           m_return_reason [32];
+static void M_Main_Draw (void);
+       static void M_SinglePlayer_Draw (void);
+               static void M_Transfusion_Episode_Draw (void);
+                       static void M_Transfusion_Skill_Draw (void);
+               static void M_Load_Draw (void);
+               static void M_Save_Draw (void);
+       static void M_MultiPlayer_Draw (void);
+               static void M_Setup_Draw (void);
+       static void M_Options_Draw (void);
+       static void M_Options_Effects_Draw (void);
+       static void M_Options_Graphics_Draw (void);
+       static void M_Options_ColorControl_Draw (void);
+               static void M_Keys_Draw (void);
+               static void M_Reset_Draw (void);
+               static void M_Video_Draw (void);
+       static void M_Help_Draw (void);
+       static void M_Credits_Draw (void);
+       static void M_Quit_Draw (void);
+static void M_LanConfig_Draw (void);
+static void M_GameOptions_Draw (void);
+static void M_ServerList_Draw (void);
+
+static void M_Main_Key (int key, char ascii);
+       static void M_SinglePlayer_Key (int key, char ascii);
+               static void M_Transfusion_Episode_Key (int key, char ascii);
+                       static void M_Transfusion_Skill_Key (int key, char ascii);
+               static void M_Load_Key (int key, char ascii);
+               static void M_Save_Key (int key, char ascii);
+       static void M_MultiPlayer_Key (int key, char ascii);
+               static void M_Setup_Key (int key, char ascii);
+       static void M_Options_Key (int key, char ascii);
+       static void M_Options_Effects_Key (int key, char ascii);
+       static void M_Options_Graphics_Key (int key, char ascii);
+       static void M_Options_ColorControl_Key (int key, char ascii);
+               static void M_Keys_Key (int key, char ascii);
+               static void M_Reset_Key (int key, char ascii);
+               static void M_Video_Key (int key, char ascii);
+       static void M_Help_Key (int key, char ascii);
+       static void M_Credits_Key (int key, char ascii);
+       static void M_Quit_Key (int key, char ascii);
+static void M_LanConfig_Key (int key, char ascii);
+static void M_GameOptions_Key (int key, char ascii);
+static void M_ServerList_Key (int key, char ascii);
+
+static qboolean        m_entersound;           // play after drawing a frame, so caching won't disrupt the sound
 
 void M_Update_Return_Reason(char *s)
 {
@@ -121,7 +119,7 @@ typedef struct nehahrademonames_s
        char *desc;
 } nehahrademonames_t;
 
-nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
+static nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
 {
        {"intro", "Prologue"},
        {"genf", "The Beginning"},
@@ -159,9 +157,9 @@ nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
        {"seal", "The Seal is Broken"}
 };
 
-float menu_x, menu_y, menu_width, menu_height;
+static float menu_x, menu_y, menu_width, menu_height;
 
-void M_Background(int width, int height)
+static void M_Background(int width, int height)
 {
        menu_width = bound(1, width, vid_conwidth.integer);
        menu_height = bound(1, height, vid_conheight.integer);
@@ -178,7 +176,7 @@ M_DrawCharacter
 Draws one solid graphics character
 ================
 */
-void M_DrawCharacter (float cx, float cy, int num)
+static void M_DrawCharacter (float cx, float cy, int num)
 {
        char temp[2];
        temp[0] = num;
@@ -186,22 +184,22 @@ void M_DrawCharacter (float cx, float cy, int num)
        DrawQ_String(menu_x + cx, menu_y + cy, temp, 1, 8, 8, 1, 1, 1, 1, 0);
 }
 
-void M_PrintColored(float cx, float cy, const char *str)
+static void M_PrintColored(float cx, float cy, const char *str)
 {
        DrawQ_ColoredString(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0, NULL);
 }
 
-void M_Print(float cx, float cy, const char *str)
+static void M_Print(float cx, float cy, const char *str)
 {
        DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
 }
 
-void M_PrintRed (float cx, float cy, const char *str)
+static void M_PrintRed(float cx, float cy, const char *str)
 {
        DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 0, 0, 1, 0);
 }
 
-void M_ItemPrint(float cx, float cy, const char *str, int unghosted)
+static void M_ItemPrint(float cx, float cy, const char *str, int unghosted)
 {
        if (unghosted)
                DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
@@ -209,15 +207,15 @@ void M_ItemPrint(float cx, float cy, const char *str, int unghosted)
                DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 0.4, 0.4, 0.4, 1, 0);
 }
 
-void M_DrawPic (float cx, float cy, const char *picname)
+static void M_DrawPic(float cx, float cy, const char *picname)
 {
-       DrawQ_Pic (menu_x + cx, menu_y + cy, Draw_CachePic(picname, false), 0, 0, 1, 1, 1, 1, 0);
+       DrawQ_Pic(menu_x + cx, menu_y + cy, Draw_CachePic(picname, false), 0, 0, 1, 1, 1, 1, 0);
 }
 
-unsigned char identityTable[256];
-unsigned char translationTable[256];
+static unsigned char identityTable[256];
+static unsigned char translationTable[256];
 
-void M_BuildTranslationTable(int top, int bottom)
+static void M_BuildTranslationTable(int top, int bottom)
 {
        int j;
        unsigned char *dest, *source;
@@ -243,8 +241,7 @@ void M_BuildTranslationTable(int top, int bottom)
                        dest[BOTTOM_RANGE+j] = source[bottom+15-j];
 }
 
-
-void M_DrawTextBox (float x, float y, float width, float height)
+static void M_DrawTextBox(float x, float y, float width, float height)
 {
        int n;
        float cx, cy;
@@ -313,8 +310,8 @@ void M_ToggleMenu_f (void)
 }
 
 
-int demo_cursor;
-void M_Demo_Draw (void)
+static int demo_cursor;
+static void M_Demo_Draw (void)
 {
        int i;
 
@@ -335,7 +332,8 @@ void M_Menu_Demos_f (void)
        m_entersound = true;
 }
 
-void M_Demo_Key (int k, char ascii)
+
+static void M_Demo_Key (int k, char ascii)
 {
        switch (k)
        {
@@ -371,9 +369,10 @@ void M_Demo_Key (int k, char ascii)
 //=============================================================================
 /* MAIN MENU */
 
-int    m_main_cursor;
+static int     m_main_cursor;
+
+static int MAIN_ITEMS = 4; // Nehahra: Menu Disable
 
-int MAIN_ITEMS = 4; // Nehahra: Menu Disable
 
 void M_Menu_Main_f (void)
 {
@@ -413,7 +412,7 @@ void M_Menu_Main_f (void)
 }
 
 
-void M_Main_Draw (void)
+static void M_Main_Draw (void)
 {
        int             f;
        cachepic_t      *p;
@@ -474,7 +473,7 @@ void M_Main_Draw (void)
 }
 
 
-void M_Main_Key (int key, char ascii)
+static void M_Main_Key (int key, char ascii)
 {
        switch (key)
        {
@@ -735,7 +734,7 @@ void M_Main_Key (int key, char ascii)
 //=============================================================================
 /* SINGLE PLAYER MENU */
 
-int    m_singleplayer_cursor;
+static int     m_singleplayer_cursor;
 #define        SINGLEPLAYER_ITEMS      3
 
 
@@ -747,7 +746,7 @@ void M_Menu_SinglePlayer_f (void)
 }
 
 
-void M_SinglePlayer_Draw (void)
+static void M_SinglePlayer_Draw (void)
 {
        cachepic_t      *p;
 
@@ -782,7 +781,7 @@ void M_SinglePlayer_Draw (void)
 }
 
 
-void M_SinglePlayer_Key (int key, char ascii)
+static void M_SinglePlayer_Key (int key, char ascii)
 {
        if (gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH)
        {
@@ -844,13 +843,13 @@ void M_SinglePlayer_Key (int key, char ascii)
 //=============================================================================
 /* LOAD/SAVE MENU */
 
-int            load_cursor;            // 0 < load_cursor < MAX_SAVEGAMES
+static int             load_cursor;            // 0 < load_cursor < MAX_SAVEGAMES
 
 #define        MAX_SAVEGAMES           12
-char   m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
-int            loadable[MAX_SAVEGAMES];
+static char    m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
+static int             loadable[MAX_SAVEGAMES];
 
-void M_ScanSaves (void)
+static void M_ScanSaves (void)
 {
        int             i, j, len;
        char    name[MAX_OSPATH];
@@ -911,7 +910,7 @@ void M_Menu_Save_f (void)
 }
 
 
-void M_Load_Draw (void)
+static void M_Load_Draw (void)
 {
        int             i;
        cachepic_t      *p;
@@ -929,7 +928,7 @@ void M_Load_Draw (void)
 }
 
 
-void M_Save_Draw (void)
+static void M_Save_Draw (void)
 {
        int             i;
        cachepic_t      *p;
@@ -947,7 +946,7 @@ void M_Save_Draw (void)
 }
 
 
-void M_Load_Key (int k, char ascii)
+static void M_Load_Key (int k, char ascii)
 {
        switch (k)
        {
@@ -988,7 +987,7 @@ void M_Load_Key (int k, char ascii)
 }
 
 
-void M_Save_Key (int k, char ascii)
+static void M_Save_Key (int k, char ascii)
 {
        switch (k)
        {
@@ -1026,7 +1025,7 @@ void M_Save_Key (int k, char ascii)
 //=============================================================================
 /* Transfusion Single Player Episode Menu */
 
-int    m_episode_cursor;
+static int     m_episode_cursor;
 #define        EPISODE_ITEMS   6
 
 void M_Menu_Transfusion_Episode_f (void)
@@ -1036,7 +1035,7 @@ void M_Menu_Transfusion_Episode_f (void)
        key_dest = key_menu;
 }
 
-void M_Transfusion_Episode_Draw (void)
+static void M_Transfusion_Episode_Draw (void)
 {
        int y;
        cachepic_t *p;
@@ -1051,7 +1050,7 @@ void M_Transfusion_Episode_Draw (void)
        M_DrawPic (0, 120 + (m_episode_cursor + 1) * 40, va("gfx/menu/episode%iselected", m_episode_cursor + 1));
 }
 
-void M_Transfusion_Episode_Key (int key, char ascii)
+static void M_Transfusion_Episode_Key (int key, char ascii)
 {
        switch (key)
        {
@@ -1083,7 +1082,7 @@ void M_Transfusion_Episode_Key (int key, char ascii)
 //=============================================================================
 /* Transfusion Single Player Skill Menu */
 
-int    m_skill_cursor = 2;
+static int     m_skill_cursor = 2;
 #define        SKILL_ITEMS     5
 
 void M_Menu_Transfusion_Skill_f (void)
@@ -1093,7 +1092,7 @@ void M_Menu_Transfusion_Skill_f (void)
        key_dest = key_menu;
 }
 
-void M_Transfusion_Skill_Draw (void)
+static void M_Transfusion_Skill_Draw (void)
 {
        int y;
        cachepic_t      *p;
@@ -1109,7 +1108,7 @@ void M_Transfusion_Skill_Draw (void)
        M_DrawPic (0, 140 + (m_skill_cursor + 1) *40, va("gfx/menu/difficulty%iselected", m_skill_cursor + 1));
 }
 
-void M_Transfusion_Skill_Key (int key, char ascii)
+static void M_Transfusion_Skill_Key (int key, char ascii)
 {
        switch (key)
        {
@@ -1183,7 +1182,7 @@ void M_Transfusion_Skill_Key (int key, char ascii)
 //=============================================================================
 /* MULTIPLAYER MENU */
 
-int    m_multiplayer_cursor;
+static int     m_multiplayer_cursor;
 #define        MULTIPLAYER_ITEMS       3
 
 
@@ -1195,7 +1194,7 @@ void M_Menu_MultiPlayer_f (void)
 }
 
 
-void M_MultiPlayer_Draw (void)
+static void M_MultiPlayer_Draw (void)
 {
        int             f;
        cachepic_t      *p;
@@ -1223,7 +1222,7 @@ void M_MultiPlayer_Draw (void)
 }
 
 
-void M_MultiPlayer_Key (int key, char ascii)
+static void M_MultiPlayer_Key (int key, char ascii)
 {
        switch (key)
        {
@@ -1262,16 +1261,16 @@ void M_MultiPlayer_Key (int key, char ascii)
 //=============================================================================
 /* SETUP MENU */
 
-int            setup_cursor = 4;
-int            setup_cursor_table[] = {40, 64, 88, 124, 140};
+static int             setup_cursor = 4;
+static int             setup_cursor_table[] = {40, 64, 88, 124, 140};
 
-char   setup_myname[32];
-int            setup_oldtop;
-int            setup_oldbottom;
-int            setup_top;
-int            setup_bottom;
-int            setup_rate;
-int            setup_oldrate;
+static char    setup_myname[32];
+static int             setup_oldtop;
+static int             setup_oldbottom;
+static int             setup_top;
+static int             setup_bottom;
+static int             setup_rate;
+static int             setup_oldrate;
 
 #define        NUM_SETUP_CMDS  5
 
@@ -1323,7 +1322,7 @@ static int setup_rateindex(int rate)
        return bound(1, i, RATES) - 1;
 }
 
-void M_Setup_Draw (void)
+static void M_Setup_Draw (void)
 {
        int i;
        cachepic_t      *p;
@@ -1364,8 +1363,8 @@ void M_Setup_Draw (void)
                        menuplyr_width = image_width;
                        menuplyr_height = image_height;
                        Mem_Free(f);
-                       menuplyr_pixels = (unsigned char *)Mem_Alloc(cl_mempool, menuplyr_width * menuplyr_height);
-                       menuplyr_translated = (unsigned int *)Mem_Alloc(cl_mempool, menuplyr_width * menuplyr_height * 4);
+                       menuplyr_pixels = (unsigned char *)Mem_Alloc(cls.mempool, menuplyr_width * menuplyr_height);
+                       menuplyr_translated = (unsigned int *)Mem_Alloc(cls.mempool, menuplyr_width * menuplyr_height * 4);
                        memcpy(menuplyr_pixels, data, menuplyr_width * menuplyr_height);
                        Mem_Free(data);
                }
@@ -1393,7 +1392,7 @@ void M_Setup_Draw (void)
 }
 
 
-void M_Setup_Key (int k, char ascii)
+static void M_Setup_Key (int k, char ascii)
 {
        int                     l;
 
@@ -1507,7 +1506,7 @@ forward:
 
 #define        SLIDER_RANGE    10
 
-void M_DrawSlider (int x, int y, float num, float rangemin, float rangemax)
+static void M_DrawSlider (int x, int y, float num, float rangemin, float rangemax)
 {
        char text[16];
        int i;
@@ -1525,7 +1524,7 @@ void M_DrawSlider (int x, int y, float num, float rangemin, float rangemax)
        M_Print(x + (SLIDER_RANGE+2) * 8, y, text);
 }
 
-void M_DrawCheckbox (int x, int y, int on)
+static void M_DrawCheckbox (int x, int y, int on)
 {
        if (on)
                M_Print(x, y, "on");
@@ -1536,7 +1535,7 @@ void M_DrawCheckbox (int x, int y, int on)
 
 #define OPTIONS_ITEMS 40
 
-int options_cursor;
+static int options_cursor;
 
 void M_Menu_Options_f (void)
 {
@@ -1550,7 +1549,7 @@ extern dllhandle_t jpeg_dll;
 extern cvar_t gl_texture_anisotropy;
 extern cvar_t r_textshadow;
 
-void M_Menu_Options_AdjustSliders (int dir)
+static void M_Menu_Options_AdjustSliders (int dir)
 {
        int optnum;
        S_LocalSound ("sound/misc/menu3.wav");
@@ -1635,11 +1634,11 @@ void M_Menu_Options_AdjustSliders (int dir)
                Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
 }
 
-int optnum;
-int opty;
-int optcursor;
+static int optnum;
+static int opty;
+static int optcursor;
 
-void M_Options_PrintCommand(const char *s, int enabled)
+static void M_Options_PrintCommand(const char *s, int enabled)
 {
        if (opty >= 32)
        {
@@ -1650,7 +1649,7 @@ void M_Options_PrintCommand(const char *s, int enabled)
        optnum++;
 }
 
-void M_Options_PrintCheckbox(const char *s, int enabled, int yes)
+static void M_Options_PrintCheckbox(const char *s, int enabled, int yes)
 {
        if (opty >= 32)
        {
@@ -1662,7 +1661,7 @@ void M_Options_PrintCheckbox(const char *s, int enabled, int yes)
        optnum++;
 }
 
-void M_Options_PrintSlider(const char *s, int enabled, float value, float minvalue, float maxvalue)
+static void M_Options_PrintSlider(const char *s, int enabled, float value, float minvalue, float maxvalue)
 {
        if (opty >= 32)
        {
@@ -1674,7 +1673,7 @@ void M_Options_PrintSlider(const char *s, int enabled, float value, float minval
        optnum++;
 }
 
-void M_Options_Draw (void)
+static void M_Options_Draw (void)
 {
        int visible;
        cachepic_t      *p;
@@ -1733,7 +1732,7 @@ void M_Options_Draw (void)
 }
 
 
-void M_Options_Key (int k, char ascii)
+static void M_Options_Key (int k, char ascii)
 {
        switch (k)
        {
@@ -1800,7 +1799,7 @@ void M_Options_Key (int k, char ascii)
 
 #define        OPTIONS_EFFECTS_ITEMS   35
 
-int options_effects_cursor;
+static int options_effects_cursor;
 
 void M_Menu_Options_Effects_f (void)
 {
@@ -1826,7 +1825,7 @@ extern cvar_t r_lightningbeam_color_green;
 extern cvar_t r_lightningbeam_color_blue;
 extern cvar_t r_lightningbeam_qmbtexture;
 
-void M_Menu_Options_Effects_AdjustSliders (int dir)
+static void M_Menu_Options_Effects_AdjustSliders (int dir)
 {
        int optnum;
        S_LocalSound ("sound/misc/menu3.wav");
@@ -1869,7 +1868,7 @@ void M_Menu_Options_Effects_AdjustSliders (int dir)
        else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_waterscroll, bound(0, r_waterscroll.value + dir * 0.5, 10));
 }
 
-void M_Options_Effects_Draw (void)
+static void M_Options_Effects_Draw (void)
 {
        int visible;
        cachepic_t      *p;
@@ -1923,7 +1922,7 @@ void M_Options_Effects_Draw (void)
 }
 
 
-void M_Options_Effects_Key (int k, char ascii)
+static void M_Options_Effects_Key (int k, char ascii)
 {
        switch (k)
        {
@@ -1962,7 +1961,7 @@ void M_Options_Effects_Key (int k, char ascii)
 
 #define        OPTIONS_GRAPHICS_ITEMS  14
 
-int options_graphics_cursor;
+static int options_graphics_cursor;
 
 void M_Menu_Options_Graphics_f (void)
 {
@@ -1985,7 +1984,7 @@ extern cvar_t r_bloom_blur;
 extern cvar_t r_bloom_resolution;
 extern cvar_t gl_picmip;
 
-void M_Menu_Options_Graphics_AdjustSliders (int dir)
+static void M_Menu_Options_Graphics_AdjustSliders (int dir)
 {
        int optnum;
        S_LocalSound ("sound/misc/menu3.wav");
@@ -2009,7 +2008,7 @@ void M_Menu_Options_Graphics_AdjustSliders (int dir)
 }
 
 
-void M_Options_Graphics_Draw (void)
+static void M_Options_Graphics_Draw (void)
 {
        int visible;
        cachepic_t      *p;
@@ -2042,7 +2041,7 @@ void M_Options_Graphics_Draw (void)
 }
 
 
-void M_Options_Graphics_Key (int k, char ascii)
+static void M_Options_Graphics_Key (int k, char ascii)
 {
        switch (k)
        {
@@ -2081,10 +2080,10 @@ void M_Options_Graphics_Key (int k, char ascii)
 
 #define        OPTIONS_COLORCONTROL_ITEMS      18
 
-int            options_colorcontrol_cursor;
+static int             options_colorcontrol_cursor;
 
 // intensity value to match up to 50% dither to 'correct' quake
-cvar_t menu_options_colorcontrol_correctionvalue = {0, "menu_options_colorcontrol_correctionvalue", "0.25", "intensity value that matches up to white/black dither pattern, due to Quake's grey level being quite dark this is 0.25, other games may use other values"};
+static cvar_t menu_options_colorcontrol_correctionvalue = {0, "menu_options_colorcontrol_correctionvalue", "0.25", "intensity value that matches up to white/black dither pattern, due to Quake's grey level being quite dark this is 0.25, other games may use other values"};
 
 void M_Menu_Options_ColorControl_f (void)
 {
@@ -2094,7 +2093,7 @@ void M_Menu_Options_ColorControl_f (void)
 }
 
 
-void M_Menu_Options_ColorControl_AdjustSliders (int dir)
+static void M_Menu_Options_ColorControl_AdjustSliders (int dir)
 {
        int optnum;
        float f;
@@ -2193,7 +2192,7 @@ void M_Menu_Options_ColorControl_AdjustSliders (int dir)
        }
 }
 
-void M_Options_ColorControl_Draw (void)
+static void M_Options_ColorControl_Draw (void)
 {
        int visible;
        float x, c, s, t, u, v;
@@ -2269,7 +2268,7 @@ void M_Options_ColorControl_Draw (void)
 }
 
 
-void M_Options_ColorControl_Key (int k, char ascii)
+static void M_Options_ColorControl_Key (int k, char ascii)
 {
        switch (k)
        {
@@ -2331,7 +2330,7 @@ void M_Options_ColorControl_Key (int k, char ascii)
 //=============================================================================
 /* KEYS MENU */
 
-char *quakebindnames[][2] =
+static char *quakebindnames[][2] =
 {
 {"+attack",            "attack"},
 {"impulse 10",                 "next weapon"},
@@ -2354,7 +2353,7 @@ char *quakebindnames[][2] =
 {"+movedown",          "swim down"}
 };
 
-char *transfusionbindnames[][2] =
+static char *transfusionbindnames[][2] =
 {
 {"",                           "Movement"},            // Movement commands
 {"+forward",           "walk forward"},
@@ -2412,7 +2411,7 @@ char *transfusionbindnames[][2] =
 {"impulse 79",         "taunt 9"}
 };
 
-char *goodvsbad2bindnames[][2] =
+static char *goodvsbad2bindnames[][2] =
 {
 {"impulse 69",         "Power 1"},
 {"impulse 70",         "Power 2"},
@@ -2435,8 +2434,8 @@ char *goodvsbad2bindnames[][2] =
 {"+movedown",          "swim down"}
 };
 
-int numcommands;
-char *(*bindnames)[2];
+static int numcommands;
+static char *(*bindnames)[2];
 
 /*
 typedef struct binditem_s
@@ -2454,9 +2453,9 @@ typedef struct bindcategory_s
 }
 bindcategory_t;
 
-bindcategory_t *bindcategories = NULL;
+static bindcategory_t *bindcategories = NULL;
 
-void M_ClearBinds (void)
+static void M_ClearBinds (void)
 {
        for (c = bindcategories;c;c = cnext)
        {
@@ -2471,7 +2470,7 @@ void M_ClearBinds (void)
        bindcategories = NULL;
 }
 
-void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
+static void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
 {
        for (b = &c->binds;*b;*b = &(*b)->next);
        *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1);
@@ -2481,7 +2480,7 @@ void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
        strcpy(*b->description, description);
 }
 
-void M_AddBind (char *category, char *command, char *description)
+static void M_AddBind (char *category, char *command, char *description)
 {
        for (c = &bindcategories;*c;c = &(*c)->next)
        {
@@ -2495,7 +2494,7 @@ void M_AddBind (char *category, char *command, char *description)
        M_AddBindToCategory(*c, command, description);
 }
 
-void M_DefaultBinds (void)
+static void M_DefaultBinds (void)
 {
        M_ClearBinds();
        M_AddBind("movement", "+jump", "jump / swim up");
@@ -2529,8 +2528,8 @@ void M_DefaultBinds (void)
 */
 
 
-int            keys_cursor;
-int            bind_grab;
+static int             keys_cursor;
+static int             bind_grab;
 
 void M_Menu_Keys_f (void)
 {
@@ -2566,7 +2565,7 @@ void M_FindKeysForCommand (const char *command, int *keys)
        }
 }
 
-void M_UnbindCommand (char *command)
+static void M_UnbindCommand (char *command)
 {
        int             j;
        char    *b;
@@ -2582,7 +2581,7 @@ void M_UnbindCommand (char *command)
 }
 
 
-void M_Keys_Draw (void)
+static void M_Keys_Draw (void)
 {
        int             i, j;
        int             keys[NUMKEYS];
@@ -2643,7 +2642,7 @@ void M_Keys_Draw (void)
 }
 
 
-void M_Keys_Key (int k, char ascii)
+static void M_Keys_Key (int k, char ascii)
 {
        char    cmd[80];
        int             keys[NUMKEYS];
@@ -2719,7 +2718,7 @@ void M_Menu_Reset_f (void)
 }
 
 
-void M_Reset_Key (int key, char ascii)
+static void M_Reset_Key (int key, char ascii)
 {
        switch (key)
        {
@@ -2740,7 +2739,7 @@ void M_Reset_Key (int key, char ascii)
        }
 }
 
-void M_Reset_Draw (void)
+static void M_Reset_Draw (void)
 {
        int lines = 2, linelength = 20;
        M_Background(linelength * 8 + 16, lines * 8 + 16);
@@ -2825,9 +2824,9 @@ video_resolution_t video_resolutions[] =
 #define VID_RES_COUNT ((int)(sizeof(video_resolutions) / sizeof(video_resolutions[0])) - 1)
 
 #define VIDEO_ITEMS 7
-int video_cursor = 0;
-int video_cursor_table[] = {56, 68, 88, 100, 112, 132, 162};
-int video_resolution;
+static int video_cursor = 0;
+static int video_cursor_table[] = {56, 68, 88, 100, 112, 132, 162};
+static int video_resolution;
 
 void M_Menu_Video_f (void)
 {
@@ -2871,7 +2870,7 @@ void M_Menu_Video_f (void)
 }
 
 
-void M_Video_Draw (void)
+static void M_Video_Draw (void)
 {
        cachepic_t      *p;
 
@@ -2917,7 +2916,7 @@ void M_Video_Draw (void)
 }
 
 
-void M_Menu_Video_AdjustSliders (int dir)
+static void M_Menu_Video_AdjustSliders (int dir)
 {
        S_LocalSound ("sound/misc/menu3.wav");
 
@@ -2959,7 +2958,7 @@ void M_Menu_Video_AdjustSliders (int dir)
 }
 
 
-void M_Video_Key (int key, char ascii)
+static void M_Video_Key (int key, char ascii)
 {
        switch (key)
        {
@@ -3019,7 +3018,7 @@ void M_Video_Key (int key, char ascii)
 //=============================================================================
 /* HELP MENU */
 
-int            help_page;
+static int             help_page;
 #define        NUM_HELP_PAGES  6
 
 
@@ -3033,14 +3032,14 @@ void M_Menu_Help_f (void)
 
 
 
-void M_Help_Draw (void)
+static void M_Help_Draw (void)
 {
        M_Background(320, 200);
        M_DrawPic (0, 0, va("gfx/help%i", help_page));
 }
 
 
-void M_Help_Key (int key, char ascii)
+static void M_Help_Key (int key, char ascii)
 {
        switch (key)
        {
@@ -3077,7 +3076,7 @@ void M_Menu_Credits_f (void)
 
 
 
-void M_Credits_Draw (void)
+static void M_Credits_Draw (void)
 {
        M_Background(640, 480);
        M_DrawPic (0, 0, "gfx/creditsmiddle");
@@ -3087,7 +3086,7 @@ void M_Credits_Draw (void)
 }
 
 
-void M_Credits_Key (int key, char ascii)
+static void M_Credits_Key (int key, char ascii)
 {
                M_Menu_Main_f ();
 }
@@ -3095,12 +3094,12 @@ void M_Credits_Key (int key, char ascii)
 //=============================================================================
 /* QUIT MENU */
 
-char *m_quit_message[9];
-int            m_quit_prevstate;
-qboolean       wasInMenus;
+static char *m_quit_message[9];
+static int             m_quit_prevstate;
+static qboolean        wasInMenus;
 
 
-int M_QuitMessage(char *line1, char *line2, char *line3, char *line4, char *line5, char *line6, char *line7, char *line8)
+static int M_QuitMessage(char *line1, char *line2, char *line3, char *line4, char *line5, char *line6, char *line7, char *line8)
 {
        m_quit_message[0] = line1;
        m_quit_message[1] = line2;
@@ -3114,7 +3113,7 @@ int M_QuitMessage(char *line1, char *line2, char *line3, char *line4, char *line
        return 1;
 }
 
-int M_ChooseQuitMessage(int request)
+static int M_ChooseQuitMessage(int request)
 {
        switch (gamemode)
        {
@@ -3191,7 +3190,7 @@ void M_Menu_Quit_f (void)
 }
 
 
-void M_Quit_Key (int key, char ascii)
+static void M_Quit_Key (int key, char ascii)
 {
        switch (key)
        {
@@ -3220,7 +3219,7 @@ void M_Quit_Key (int key, char ascii)
        }
 }
 
-void M_Quit_Draw (void)
+static void M_Quit_Draw (void)
 {
        int i, l, linelength, firstline, lastline, lines;
        for (i = 0, linelength = 0, firstline = 9999, lastline = -1;m_quit_message[i];i++)
@@ -3246,13 +3245,13 @@ void M_Quit_Draw (void)
 //=============================================================================
 /* LAN CONFIG MENU */
 
-int            lanConfig_cursor = -1;
-int            lanConfig_cursor_table [] = {56, 76, 84, 120};
+static int             lanConfig_cursor = -1;
+static int             lanConfig_cursor_table [] = {56, 76, 84, 120};
 #define NUM_LANCONFIG_CMDS     4
 
-int    lanConfig_port;
-char   lanConfig_portname[6];
-char   lanConfig_joinname[22];
+static int     lanConfig_port;
+static char    lanConfig_portname[6];
+static char    lanConfig_joinname[22];
 
 void M_Menu_LanConfig_f (void)
 {
@@ -3273,7 +3272,7 @@ void M_Menu_LanConfig_f (void)
 }
 
 
-void M_LanConfig_Draw (void)
+static void M_LanConfig_Draw (void)
 {
        cachepic_t      *p;
        int             basex;
@@ -3326,7 +3325,7 @@ void M_LanConfig_Draw (void)
 }
 
 
-void M_LanConfig_Key (int key, char ascii)
+static void M_LanConfig_Key (int key, char ascii)
 {
        int             l;
 
@@ -3461,7 +3460,7 @@ typedef struct gamelevels_s
 }
 gamelevels_t;
 
-level_t quakelevels[] =
+static level_t quakelevels[] =
 {
        {"start", "Entrance"},  // 0
 
@@ -3509,7 +3508,7 @@ level_t quakelevels[] =
        {"dm6", "The Dark Zone"}
 };
 
-episode_t quakeepisodes[] =
+static episode_t quakeepisodes[] =
 {
        {"Welcome to Quake", 0, 1},
        {"Doomed Dimension", 1, 8},
@@ -3521,7 +3520,7 @@ episode_t quakeepisodes[] =
 };
 
  //MED 01/06/97 added hipnotic levels
-level_t     hipnoticlevels[] =
+static level_t     hipnoticlevels[] =
 {
    {"start", "Command HQ"},  // 0
 
@@ -3549,7 +3548,7 @@ level_t     hipnoticlevels[] =
 };
 
 //MED 01/06/97  added hipnotic episodes
-episode_t   hipnoticepisodes[] =
+static episode_t   hipnoticepisodes[] =
 {
    {"Scourge of Armagon", 0, 1},
    {"Fortress of the Dead", 1, 5},
@@ -3561,7 +3560,7 @@ episode_t   hipnoticepisodes[] =
 
 //PGM 01/07/97 added rogue levels
 //PGM 03/02/97 added dmatch level
-level_t                roguelevels[] =
+static level_t         roguelevels[] =
 {
        {"start",       "Split Decision"},
        {"r1m1",        "Deviant's Domain"},
@@ -3584,7 +3583,7 @@ level_t           roguelevels[] =
 
 //PGM 01/07/97 added rogue episodes
 //PGM 03/02/97 added dmatch episode
-episode_t      rogueepisodes[] =
+static episode_t       rogueepisodes[] =
 {
        {"Introduction", 0, 1},
        {"Hell's Fortress", 1, 7},
@@ -3592,7 +3591,7 @@ episode_t rogueepisodes[] =
        {"Deathmatch Arena", 16, 1}
 };
 
-level_t                nehahralevels[] =
+static level_t         nehahralevels[] =
 {
        {"nehstart",    "Welcome to Nehahra"},
        {"neh1m1",      "Forge City1: Slipgates"},
@@ -3615,7 +3614,7 @@ level_t           nehahralevels[] =
        {"nehend",      "Quintessence"}
 };
 
-episode_t      nehahraepisodes[] =
+static episode_t       nehahraepisodes[] =
 {
        {"Welcome to Nehahra", 0, 1},
        {"The Fall of Forge", 1, 9},
@@ -3624,7 +3623,7 @@ episode_t nehahraepisodes[] =
 };
 
 // Map list for Transfusion
-level_t                transfusionlevels[] =
+static level_t         transfusionlevels[] =
 {
        {"e1m1",                "Cradle to Grave"},
        {"e1m2",                "Wrong Side of the Tracks"},
@@ -3732,7 +3731,7 @@ level_t           transfusionlevels[] =
        {"simple",              "Dead Simple"}
 };
 
-episode_t      transfusionepisodes[] =
+static episode_t       transfusionepisodes[] =
 {
        {"The Way of All Flesh", 0, 8},
        {"Even Death May Die", 8, 9},
@@ -3747,7 +3746,7 @@ episode_t transfusionepisodes[] =
        {"Conversions", 85, 9}
 };
 
-level_t goodvsbad2levels[] =
+static level_t goodvsbad2levels[] =
 {
        {"rts", "Many Paths"},  // 0
        {"chess", "Chess, Scott Hess"},                         // 1
@@ -3760,12 +3759,12 @@ level_t goodvsbad2levels[] =
        {"island", "Adventure Islands"},
 };
 
-episode_t goodvsbad2episodes[] =
+static episode_t goodvsbad2episodes[] =
 {
        {"Levels? Bevels!", 0, 8},
 };
 
-level_t battlemechlevels[] =
+static level_t battlemechlevels[] =
 {
        {"start", "Parking Level"},
        {"dm1", "Hot Dump"},                        // 1
@@ -3776,12 +3775,12 @@ level_t battlemechlevels[] =
        {"dm6", "Army go Underground"},
 };
 
-episode_t battlemechepisodes[] =
+static episode_t battlemechepisodes[] =
 {
        {"Time for Battle", 0, 7},
 };
 
-level_t openquartzlevels[] =
+static level_t openquartzlevels[] =
 {
        {"start", "Welcome to Openquartz"},
 
@@ -3800,35 +3799,35 @@ level_t openquartzlevels[] =
        {"am1", "The nameless chambers"},
 };
 
-episode_t openquartzepisodes[] =
+static episode_t openquartzepisodes[] =
 {
        {"Single Player", 0, 1},
        {"Void Deathmatch", 1, 6},
        {"Contrib", 7, 6},
 };
 
-level_t defeatindetail2levels[] =
+static level_t defeatindetail2levels[] =
 {
        {"atac3",       "River Crossing"},
        {"atac4",       "Canyon Chaos"},
        {"atac7",       "Desert Stormer"},
 };
 
-episode_t defeatindetail2episodes[] =
+static episode_t defeatindetail2episodes[] =
 {
        {"ATAC Campaign", 0, 3},
 };
 
-gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2};
-gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7};
-gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6};
-gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4};
-gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4};
-gamelevels_t transfusiongame = {"Transfusion", transfusionlevels, transfusionepisodes, 11};
-gamelevels_t goodvsbad2game = {"Good Vs. Bad 2", goodvsbad2levels, goodvsbad2episodes, 1};
-gamelevels_t battlemechgame = {"Battlemech", battlemechlevels, battlemechepisodes, 1};
-gamelevels_t openquartzgame = {"OpenQuartz", openquartzlevels, openquartzepisodes, 3};
-gamelevels_t defeatindetail2game = {"Defeat In Detail 2", defeatindetail2levels, defeatindetail2episodes, 1};
+static gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2};
+static gamelevels_t registeredquakegame = {"Quake", quakelevels, quakeepisodes, 7};
+static gamelevels_t hipnoticgame = {"Scourge of Armagon", hipnoticlevels, hipnoticepisodes, 6};
+static gamelevels_t roguegame = {"Dissolution of Eternity", roguelevels, rogueepisodes, 4};
+static gamelevels_t nehahragame = {"Nehahra", nehahralevels, nehahraepisodes, 4};
+static gamelevels_t transfusiongame = {"Transfusion", transfusionlevels, transfusionepisodes, 11};
+static gamelevels_t goodvsbad2game = {"Good Vs. Bad 2", goodvsbad2levels, goodvsbad2episodes, 1};
+static gamelevels_t battlemechgame = {"Battlemech", battlemechlevels, battlemechepisodes, 1};
+static gamelevels_t openquartzgame = {"OpenQuartz", openquartzlevels, openquartzepisodes, 3};
+static gamelevels_t defeatindetail2game = {"Defeat In Detail 2", defeatindetail2levels, defeatindetail2episodes, 1};
 
 typedef struct gameinfo_s
 {
@@ -3838,7 +3837,7 @@ typedef struct gameinfo_s
 }
 gameinfo_t;
 
-gameinfo_t gamelist[] =
+static gameinfo_t gamelist[] =
 {
        {GAME_NORMAL, &sharewarequakegame, &registeredquakegame},
        {GAME_HIPNOTIC, &hipnoticgame, &hipnoticgame},
@@ -3852,7 +3851,7 @@ gameinfo_t gamelist[] =
        {(gamemode_t)-1, &sharewarequakegame, &registeredquakegame} // final fallback
 };
 
-gamelevels_t *lookupgameinfo(void)
+static gamelevels_t *lookupgameinfo(void)
 {
        int i;
        for (i = 0;gamelist[i].gameid >= 0 && gamelist[i].gameid != gamemode;i++);
@@ -3862,11 +3861,11 @@ gamelevels_t *lookupgameinfo(void)
                return gamelist[i].notregistered;
 }
 
-int    startepisode;
-int    startlevel;
-int maxplayers;
-qboolean m_serverInfoMessage = false;
-double m_serverInfoMessageTime;
+static int     startepisode;
+static int     startlevel;
+static int maxplayers;
+static qboolean m_serverInfoMessage = false;
+static double m_serverInfoMessageTime;
 
 void M_Menu_GameOptions_f (void)
 {
@@ -3880,9 +3879,9 @@ void M_Menu_GameOptions_f (void)
 }
 
 
-int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 104, 112, 140, 160, 168};
+static int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 104, 112, 140, 160, 168};
 #define        NUM_GAMEOPTIONS 12
-int            gameoptions_cursor;
+static int             gameoptions_cursor;
 
 void M_GameOptions_Draw (void)
 {
@@ -4048,7 +4047,7 @@ void M_GameOptions_Draw (void)
 }
 
 
-void M_NetStart_Change (int dir)
+static void M_NetStart_Change (int dir)
 {
        gamelevels_t *g;
        int count;
@@ -4213,7 +4212,7 @@ void M_NetStart_Change (int dir)
        }
 }
 
-void M_GameOptions_Key (int key, char ascii)
+static void M_GameOptions_Key (int key, char ascii)
 {
        gamelevels_t *g;
        int l;
@@ -4303,7 +4302,7 @@ void M_GameOptions_Key (int key, char ascii)
 //=============================================================================
 /* SLIST MENU */
 
-int slist_cursor;
+static int slist_cursor;
 
 void M_Menu_ServerList_f (void)
 {
@@ -4319,7 +4318,7 @@ void M_Menu_ServerList_f (void)
 }
 
 
-void M_ServerList_Draw (void)
+static void M_ServerList_Draw (void)
 {
        int n, y, visible, start, end;
        cachepic_t *p;
@@ -4368,7 +4367,7 @@ void M_ServerList_Draw (void)
 }
 
 
-void M_ServerList_Key(int k, char ascii)
+static void M_ServerList_Key(int k, char ascii)
 {
        switch (k)
        {
@@ -4414,10 +4413,10 @@ void M_ServerList_Key(int k, char ascii)
 //=============================================================================
 /* Menu Subsystem */
 
-void M_Keydown(int key, char ascii);
-void M_Draw(void);
+static void M_Keydown(int key, char ascii);
+static void M_Draw(void);
 void M_ToggleMenu_f(void);
-void M_Shutdown(void);
+static void M_Shutdown(void);
 
 void M_Init (void)
 {
@@ -4774,7 +4773,7 @@ M_F_SHUTDOWN,
 };
 
 #ifdef NG_MENU
-qboolean m_displayed;
+static qboolean m_displayed;
 #endif
 
 static int m_numrequiredfunc = sizeof(m_required_func) / sizeof(char*);
index 6228d6d9c9cd419b696c139e26675133b746fb01..69593bd809a3196a63c2734b91f2750362142645 100644 (file)
@@ -49,7 +49,7 @@ void R_MeshQueue_Render(void)
 static void R_MeshQueue_EnlargeTransparentArray(int newtotal)
 {
        meshqueue_t *newarray;
-       newarray = (meshqueue_t *)Mem_Alloc(cl_mempool, newtotal * sizeof(meshqueue_t));
+       newarray = (meshqueue_t *)Mem_Alloc(cls.mempool, newtotal * sizeof(meshqueue_t));
        if (mqt_array)
        {
                memcpy(newarray, mqt_array, mqt_total * sizeof(meshqueue_t));
@@ -167,11 +167,11 @@ void R_MeshQueue_BeginScene(void)
                mq_total = r_meshqueue_entries.integer;
                if (mq_array)
                        Mem_Free(mq_array);
-               mq_array = (meshqueue_t *)Mem_Alloc(cl_mempool, mq_total * sizeof(meshqueue_t));
+               mq_array = (meshqueue_t *)Mem_Alloc(cls.mempool, mq_total * sizeof(meshqueue_t));
        }
 
        if (mqt_array == NULL)
-               mqt_array = (meshqueue_t *)Mem_Alloc(cl_mempool, mqt_total * sizeof(meshqueue_t));
+               mqt_array = (meshqueue_t *)Mem_Alloc(cls.mempool, mqt_total * sizeof(meshqueue_t));
 
        mq_count = 0;
        mqt_count = 0;
index 039f7e1f552f3b51b5e6a6d29e3fbbe314e41fc3..00d5dd075ec2cd17935e0510fff3a06dc88ba82c 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -116,10 +116,10 @@ static double serverlist_querywaittime = 0;
 static unsigned char sendbuffer[NET_HEADERSIZE+NET_MAXMESSAGE];
 static unsigned char readbuffer[NET_HEADERSIZE+NET_MAXMESSAGE];
 
-int cl_numsockets;
-lhnetsocket_t *cl_sockets[16];
-int sv_numsockets;
-lhnetsocket_t *sv_sockets[16];
+static int cl_numsockets;
+static lhnetsocket_t *cl_sockets[16];
+static int sv_numsockets;
+static lhnetsocket_t *sv_sockets[16];
 
 netconn_t *netconn_list = NULL;
 mempool_t *netconn_mempool = NULL;
index 883f887bf188388ea8e4534cd5eeed87e66c14a2..e798cfda32dac900bc8fea330c3023593df935a8 100755 (executable)
--- a/netconn.h
+++ b/netconn.h
@@ -193,8 +193,6 @@ extern mempool_t *netconn_mempool;
 
 extern cvar_t hostname;
 extern cvar_t developer_networking;
-extern char playername[];
-extern int playercolor;
 
 #define SERVERLIST_TOTALSIZE           2048
 #define SERVERLIST_VIEWLISTSIZE                SERVERLIST_TOTALSIZE
index 508b8802910b67c5997a7b0f41bd48c3746ef440..3899b23e7277fe498448cffd79026d4a12f1671b 100644 (file)
@@ -1,6 +1,8 @@
 
 #include "quakedef.h"
 
+#define E5_PROTOCOL_PRIORITYLEVELS 32
+
 // this is 88 bytes (must match entity_state_t in protocol.h)
 entity_state_t defaultstate =
 {
@@ -60,6 +62,17 @@ protocolversioninfo[] =
        {0, NULL}
 };
 
+static mempool_t *sv2csqc = NULL;
+int csqc_clent = 0;
+sizebuf_t *sv2csqcbuf = NULL;
+static unsigned char *sv2csqcents_version[MAX_SCOREBOARD];
+
+static entity_frame_t deltaframe; // FIXME?
+static entity_frame_t framedata; // FIXME?
+
+int entityframe5_prioritychaincounts[E5_PROTOCOL_PRIORITYLEVELS];
+unsigned short entityframe5_prioritychains[E5_PROTOCOL_PRIORITYLEVELS][ENTITYFRAME5_MAXSTATES];
+
 protocolversion_t Protocol_EnumForName(const char *s)
 {
        int i;
@@ -102,10 +115,6 @@ void Protocol_Names(char *buffer, size_t buffersize)
        }
 }
 
-// keep track of quake entities because they need to be killed if they get stale
-int cl_lastquakeentity = 0;
-unsigned char cl_isquakeentity[MAX_EDICTS];
-
 void EntityFrameQuake_ReadEntity(int bits)
 {
        int num;
@@ -131,14 +140,14 @@ void EntityFrameQuake_ReadEntity(int bits)
        if (num < 1)
                Host_Error("EntityFrameQuake_ReadEntity: invalid entity number (%i)", num);
 
-       if (cl_num_entities <= num)
+       if (cl.num_entities <= num)
        {
-               cl_num_entities = num + 1;
-               if (num >= cl_max_entities)
+               cl.num_entities = num + 1;
+               if (num >= cl.max_entities)
                        CL_ExpandEntities(num);
        }
 
-       ent = cl_entities + num;
+       ent = cl.entities + num;
 
        // note: this inherits the 'active' state of the baseline chosen
        // (state_baseline is always active, state_current may not be active if
@@ -151,9 +160,9 @@ void EntityFrameQuake_ReadEntity(int bits)
                s.active = true;
        }
 
-       cl_isquakeentity[num] = true;
-       if (cl_lastquakeentity < num)
-               cl_lastquakeentity = num;
+       cl.isquakeentity[num] = true;
+       if (cl.lastquakeentity < num)
+               cl.lastquakeentity = num;
        s.number = num;
        s.time = cl.mtime[0];
        s.flags = 0;
@@ -206,7 +215,7 @@ void EntityFrameQuake_ReadEntity(int bits)
        if (ent->state_current.active)
        {
                CL_MoveLerpEntityStates(ent);
-               cl_entities_active[ent->state_current.number] = true;
+               cl.entities_active[ent->state_current.number] = true;
        }
 
        if (msg_badread)
@@ -216,35 +225,30 @@ void EntityFrameQuake_ReadEntity(int bits)
 void EntityFrameQuake_ISeeDeadEntities(void)
 {
        int num, lastentity;
-       if (cl_lastquakeentity == 0)
+       if (cl.lastquakeentity == 0)
                return;
-       lastentity = cl_lastquakeentity;
-       cl_lastquakeentity = 0;
+       lastentity = cl.lastquakeentity;
+       cl.lastquakeentity = 0;
        for (num = 0;num <= lastentity;num++)
        {
-               if (cl_isquakeentity[num])
+               if (cl.isquakeentity[num])
                {
-                       if (cl_entities_active[num] && cl_entities[num].state_current.time == cl.mtime[0])
+                       if (cl.entities_active[num] && cl.entities[num].state_current.time == cl.mtime[0])
                        {
-                               cl_isquakeentity[num] = true;
-                               cl_lastquakeentity = num;
+                               cl.isquakeentity[num] = true;
+                               cl.lastquakeentity = num;
                        }
                        else
                        {
-                               cl_isquakeentity[num] = false;
-                               cl_entities_active[num] = false;
-                               cl_entities[num].state_current = defaultstate;
-                               cl_entities[num].state_current.number = num;
+                               cl.isquakeentity[num] = false;
+                               cl.entities_active[num] = false;
+                               cl.entities[num].state_current = defaultstate;
+                               cl.entities[num].state_current.number = num;
                        }
                }
        }
 }
 
-static mempool_t *sv2csqc = NULL;
-int csqc_clent = 0;
-sizebuf_t *sv2csqcbuf = NULL;
-static unsigned char *sv2csqcents_version[MAX_SCOREBOARD];
-
 void EntityFrameCSQC_ClearVersions (void)
 {
        if(sv2csqc)
@@ -1007,7 +1011,6 @@ void EntityFrame_AddFrame(entityframe_database_t *d, vec3_t eye, int framenum, i
 }
 
 // (server) writes a frame to network stream
-static entity_frame_t deltaframe; // FIXME?
 void EntityFrame_WriteFrame(sizebuf_t *msg, entityframe_database_t *d, int numstates, const entity_state_t *states, int viewentnum)
 {
        int i, onum, number;
@@ -1076,7 +1079,6 @@ void EntityFrame_WriteFrame(sizebuf_t *msg, entityframe_database_t *d, int numst
 }
 
 // (client) reads a frame from network stream
-static entity_frame_t framedata; // FIXME?
 void EntityFrame_CL_ReadFrame(void)
 {
        int i, number, removed;
@@ -1085,7 +1087,7 @@ void EntityFrame_CL_ReadFrame(void)
        entity_t *ent;
        entityframe_database_t *d;
        if (!cl.entitydatabase)
-               cl.entitydatabase = EntityFrame_AllocDatabase(cl_mempool);
+               cl.entitydatabase = EntityFrame_AllocDatabase(cls.mempool);
        d = cl.entitydatabase;
 
        EntityFrame_Clear(f, NULL, -1);
@@ -1147,13 +1149,13 @@ void EntityFrame_CL_ReadFrame(void)
                                *e = defaultstate;
                        }
 
-                       if (cl_num_entities <= number)
+                       if (cl.num_entities <= number)
                        {
-                               cl_num_entities = number + 1;
-                               if (number >= cl_max_entities)
+                               cl.num_entities = number + 1;
+                               if (number >= cl.max_entities)
                                        CL_ExpandEntities(number);
                        }
-                       cl_entities_active[number] = true;
+                       cl.entities_active[number] = true;
                        e->active = true;
                        e->time = cl.mtime[0];
                        e->number = number;
@@ -1169,35 +1171,35 @@ void EntityFrame_CL_ReadFrame(void)
        }
        EntityFrame_AddFrame(d, f->eye, f->framenum, f->numentities, f->entitydata);
 
-       memset(cl_entities_active, 0, cl_num_entities * sizeof(unsigned char));
+       memset(cl.entities_active, 0, cl.num_entities * sizeof(unsigned char));
        number = 1;
        for (i = 0;i < f->numentities;i++)
        {
-               for (;number < f->entitydata[i].number && number < cl_num_entities;number++)
+               for (;number < f->entitydata[i].number && number < cl.num_entities;number++)
                {
-                       if (cl_entities_active[number])
+                       if (cl.entities_active[number])
                        {
-                               cl_entities_active[number] = false;
-                               cl_entities[number].state_current.active = false;
+                               cl.entities_active[number] = false;
+                               cl.entities[number].state_current.active = false;
                        }
                }
-               if (number >= cl_num_entities)
+               if (number >= cl.num_entities)
                        break;
                // update the entity
-               ent = &cl_entities[number];
+               ent = &cl.entities[number];
                ent->state_previous = ent->state_current;
                ent->state_current = f->entitydata[i];
                CL_MoveLerpEntityStates(ent);
                // the entity lives again...
-               cl_entities_active[number] = true;
+               cl.entities_active[number] = true;
                number++;
        }
-       for (;number < cl_num_entities;number++)
+       for (;number < cl.num_entities;number++)
        {
-               if (cl_entities_active[number])
+               if (cl.entities_active[number])
                {
-                       cl_entities_active[number] = false;
-                       cl_entities[number].state_current.active = false;
+                       cl.entities_active[number] = false;
+                       cl.entities[number].state_current.active = false;
                }
        }
 }
@@ -1355,7 +1357,7 @@ void EntityFrame4_CL_ReadFrame(void)
        entity_state_t *s;
        entityframe4_database_t *d;
        if (!cl.entitydatabase4)
-               cl.entitydatabase4 = EntityFrame4_AllocDatabase(cl_mempool);
+               cl.entitydatabase4 = EntityFrame4_AllocDatabase(cls.mempool);
        d = cl.entitydatabase4;
        // read the number of the frame this refers to
        referenceframenum = MSG_ReadLong();
@@ -1410,10 +1412,10 @@ void EntityFrame4_CL_ReadFrame(void)
                // high bit means it's a remove message
                cnumber = n & 0x7FFF;
                // if this is a live entity we may need to expand the array
-               if (cl_num_entities <= cnumber && !(n & 0x8000))
+               if (cl.num_entities <= cnumber && !(n & 0x8000))
                {
-                       cl_num_entities = cnumber + 1;
-                       if (cnumber >= cl_max_entities)
+                       cl.num_entities = cnumber + 1;
+                       if (cnumber >= cl.max_entities)
                                CL_ExpandEntities(cnumber);
                }
                // add one (the changed one) if not done
@@ -1421,7 +1423,7 @@ void EntityFrame4_CL_ReadFrame(void)
                // process entities in range from the last one to the changed one
                for (;enumber < stopnumber;enumber++)
                {
-                       if (skip || enumber >= cl_num_entities)
+                       if (skip || enumber >= cl.num_entities)
                        {
                                if (enumber == cnumber && (n & 0x8000) == 0)
                                {
@@ -1431,10 +1433,10 @@ void EntityFrame4_CL_ReadFrame(void)
                                continue;
                        }
                        // slide the current into the previous slot
-                       cl_entities[enumber].state_previous = cl_entities[enumber].state_current;
+                       cl.entities[enumber].state_previous = cl.entities[enumber].state_current;
                        // copy a new current from reference database
-                       cl_entities[enumber].state_current = *EntityFrame4_GetReferenceEntity(d, enumber);
-                       s = &cl_entities[enumber].state_current;
+                       cl.entities[enumber].state_current = *EntityFrame4_GetReferenceEntity(d, enumber);
+                       s = &cl.entities[enumber].state_current;
                        // if this is the one to modify, read more data...
                        if (enumber == cnumber)
                        {
@@ -1456,24 +1458,24 @@ void EntityFrame4_CL_ReadFrame(void)
                        }
                        else if (developer_networkentities.integer >= 4)
                                Con_Printf("entity %i: copy\n", enumber);
-                       // set the cl_entities_active flag
-                       cl_entities_active[enumber] = s->active;
+                       // set the cl.entities_active flag
+                       cl.entities_active[enumber] = s->active;
                        // set the update time
                        s->time = cl.mtime[0];
                        // fix the number (it gets wiped occasionally by copying from defaultstate)
                        s->number = enumber;
                        // check if we need to update the lerp stuff
                        if (s->active)
-                               CL_MoveLerpEntityStates(&cl_entities[enumber]);
+                               CL_MoveLerpEntityStates(&cl.entities[enumber]);
                        // add this to the commit entry whether it is modified or not
                        if (d->currentcommit)
-                               EntityFrame4_AddCommitEntity(d, &cl_entities[enumber].state_current);
+                               EntityFrame4_AddCommitEntity(d, &cl.entities[enumber].state_current);
                        // print extra messages if desired
-                       if (developer_networkentities.integer >= 2 && cl_entities[enumber].state_current.active != cl_entities[enumber].state_previous.active)
+                       if (developer_networkentities.integer >= 2 && cl.entities[enumber].state_current.active != cl.entities[enumber].state_previous.active)
                        {
-                               if (cl_entities[enumber].state_current.active)
+                               if (cl.entities[enumber].state_current.active)
                                        Con_Printf("entity #%i has become active\n", enumber);
-                               else if (cl_entities[enumber].state_previous.active)
+                               else if (cl.entities[enumber].state_previous.active)
                                        Con_Printf("entity #%i has become inactive\n", enumber);
                        }
                }
@@ -1590,8 +1592,6 @@ void EntityFrame4_WriteFrame(sizebuf_t *msg, entityframe4_database_t *d, int num
 
 
 
-#define E5_PROTOCOL_PRIORITYLEVELS 32
-
 entityframe5_database_t *EntityFrame5_AllocDatabase(mempool_t *pool)
 {
        int i;
@@ -2055,14 +2055,14 @@ void EntityFrame5_CL_ReadFrame(void)
                // get the entity number
                enumber = n & 0x7FFF;
                // we may need to expand the array
-               if (cl_num_entities <= enumber)
+               if (cl.num_entities <= enumber)
                {
-                       cl_num_entities = enumber + 1;
-                       if (enumber >= cl_max_entities)
+                       cl.num_entities = enumber + 1;
+                       if (enumber >= cl.max_entities)
                                CL_ExpandEntities(enumber);
                }
                // look up the entity
-               ent = cl_entities + enumber;
+               ent = cl.entities + enumber;
                // slide the current into the previous slot
                ent->state_previous = ent->state_current;
                // read the update
@@ -2077,21 +2077,21 @@ void EntityFrame5_CL_ReadFrame(void)
                        // update entity
                        EntityState5_ReadUpdate(s);
                }
-               // set the cl_entities_active flag
-               cl_entities_active[enumber] = s->active;
+               // set the cl.entities_active flag
+               cl.entities_active[enumber] = s->active;
                // set the update time
                s->time = cl.mtime[0];
                // fix the number (it gets wiped occasionally by copying from defaultstate)
                s->number = enumber;
                // check if we need to update the lerp stuff
                if (s->active)
-                       CL_MoveLerpEntityStates(&cl_entities[enumber]);
+                       CL_MoveLerpEntityStates(&cl.entities[enumber]);
                // print extra messages if desired
-               if (developer_networkentities.integer >= 2 && cl_entities[enumber].state_current.active != cl_entities[enumber].state_previous.active)
+               if (developer_networkentities.integer >= 2 && cl.entities[enumber].state_current.active != cl.entities[enumber].state_previous.active)
                {
-                       if (cl_entities[enumber].state_current.active)
+                       if (cl.entities[enumber].state_current.active)
                                Con_Printf("entity #%i has become active\n", enumber);
-                       else if (cl_entities[enumber].state_previous.active)
+                       else if (cl.entities[enumber].state_previous.active)
                                Con_Printf("entity #%i has become inactive\n", enumber);
                }
        }
@@ -2166,9 +2166,6 @@ void EntityFrame5_AckFrame(entityframe5_database_t *d, int framenum)
                        d->packetlog[i].packetnumber = 0;
 }
 
-int entityframe5_prioritychaincounts[E5_PROTOCOL_PRIORITYLEVELS];
-unsigned short entityframe5_prioritychains[E5_PROTOCOL_PRIORITYLEVELS][ENTITYFRAME5_MAXSTATES];
-
 void EntityFrame5_WriteFrame(sizebuf_t *msg, entityframe5_database_t *d, int numstates, const entity_state_t *states, int viewentnum, int *stats, int movesequence)
 {
        const entity_state_t *n;
@@ -2389,7 +2386,7 @@ void EntityStateQW_ReadPlayerUpdate(void)
        int bits;
        entity_state_t *s;
        // look up the entity
-       entity_t *ent = cl_entities + enumber;
+       entity_t *ent = cl.entities + enumber;
        vec3_t viewangles;
        vec3_t velocity;
 
@@ -2500,15 +2497,15 @@ void EntityStateQW_ReadPlayerUpdate(void)
                        cl.stats[STAT_VIEWHEIGHT] = 22;
        }
 
-       // set the cl_entities_active flag
-       cl_entities_active[enumber] = s->active;
+       // set the cl.entities_active flag
+       cl.entities_active[enumber] = s->active;
        // set the update time
        s->time = cl.mtime[0] - msec * 0.001; // qw has no clock
        // fix the number (it gets wiped occasionally by copying from defaultstate)
        s->number = enumber;
        // check if we need to update the lerp stuff
        if (s->active)
-               CL_MoveLerpEntityStates(&cl_entities[enumber]);
+               CL_MoveLerpEntityStates(&cl.entities[enumber]);
 }
 
 static void EntityStateQW_ReadEntityUpdate(entity_state_t *s, int bits)
@@ -2597,7 +2594,7 @@ void EntityFrameQW_CL_ReadFrame(qboolean delta)
        entityframeqw_snapshot_t *oldsnap, *newsnap;
 
        if (!cl.entitydatabaseqw)
-               cl.entitydatabaseqw = EntityFrameQW_AllocDatabase(cl_mempool);
+               cl.entitydatabaseqw = EntityFrameQW_AllocDatabase(cls.mempool);
        d = cl.entitydatabaseqw;
 
        newsnapindex = cls.netcon->qw.incoming_sequence & QW_UPDATE_MASK;
@@ -2680,7 +2677,7 @@ void EntityFrameQW_CL_ReadFrame(qboolean delta)
                {
                        if (newsnap->num_entities >= QW_MAX_PACKET_ENTITIES)
                                Host_Error("EntityFrameQW_CL_ReadFrame: newsnap->num_entities == MAX_PACKETENTITIES");
-                       newsnap->entities[newsnap->num_entities] = (newnum == oldnum) ? oldsnap->entities[oldindex] : cl_entities[newnum].state_baseline;
+                       newsnap->entities[newsnap->num_entities] = (newnum == oldnum) ? oldsnap->entities[oldindex] : cl.entities[newnum].state_baseline;
                        EntityStateQW_ReadEntityUpdate(newsnap->entities + newsnap->num_entities, word);
                        newsnap->num_entities++;
                }
@@ -2689,12 +2686,12 @@ void EntityFrameQW_CL_ReadFrame(qboolean delta)
                        oldindex++;
        }
 
-       // expand cl_num_entities to include every entity we've seen this game
+       // expand cl.num_entities to include every entity we've seen this game
        newnum = newsnap->num_entities ? newsnap->entities[newsnap->num_entities - 1].number : 1;
-       if (cl_num_entities <= newnum)
+       if (cl.num_entities <= newnum)
        {
-               cl_num_entities = newnum + 1;
-               if (cl_max_entities < newnum + 1)
+               cl.num_entities = newnum + 1;
+               if (cl.max_entities < newnum + 1)
                        CL_ExpandEntities(newnum);
        }
 
@@ -2702,26 +2699,26 @@ void EntityFrameQW_CL_ReadFrame(qboolean delta)
        number = cl.maxclients + 1;
        for (newindex = 0;;newindex++)
        {
-               newnum = newindex >= newsnap->num_entities ? cl_num_entities : newsnap->entities[newindex].number;
+               newnum = newindex >= newsnap->num_entities ? cl.num_entities : newsnap->entities[newindex].number;
                // kill any missing entities
                for (;number < newnum;number++)
                {
-                       if (cl_entities_active[number])
+                       if (cl.entities_active[number])
                        {
-                               cl_entities_active[number] = false;
-                               cl_entities[number].state_current.active = false;
+                               cl.entities_active[number] = false;
+                               cl.entities[number].state_current.active = false;
                        }
                }
-               if (number >= cl_num_entities)
+               if (number >= cl.num_entities)
                        break;
                // update the entity
-               ent = &cl_entities[number];
+               ent = &cl.entities[number];
                ent->state_previous = ent->state_current;
                ent->state_current = newsnap->entities[newindex];
                ent->state_current.time = cl.mtime[0];
                CL_MoveLerpEntityStates(ent);
                // the entity lives again...
-               cl_entities_active[number] = true;
+               cl.entities_active[number] = true;
                number++;
        }
 }
index dcef703ff43a8212a29afc565f8a32282f4509ff..38e1b4c5321494b447118605c4d816b282cfe134 100644 (file)
@@ -67,7 +67,7 @@ void R_DrawWorldCrosshair(void)
        num = crosshair.integer;
        if (num < 1 || num > NUMCROSSHAIRS || cl.intermission)
                return;
-       if (!cl.viewentity || !cl_entities[cl.viewentity].state_current.active)
+       if (!cl.viewentity || !cl.entities[cl.viewentity].state_current.active)
                return;
        pic = r_crosshairs[num];
        if (!pic)
@@ -75,7 +75,7 @@ void R_DrawWorldCrosshair(void)
        R_GetCrosshairColor(color);
 
        // trace the shot path up to a certain distance
-       Matrix4x4_OriginFromMatrix(&cl_entities[cl.viewentity].render.matrix, v1);
+       Matrix4x4_OriginFromMatrix(&cl.entities[cl.viewentity].render.matrix, v1);
        v1[2] += 16; // HACK: this depends on the QC
 
        // get the forward vector for the gun (not the view)
@@ -102,7 +102,7 @@ void R_Draw2DCrosshair(void)
        num = crosshair.integer;
        if (num < 1 || num > NUMCROSSHAIRS || cl.intermission)
                return;
-       if (!cl.viewentity || !cl_entities[cl.viewentity].state_current.active)
+       if (!cl.viewentity || !cl.entities[cl.viewentity].state_current.active)
                return;
        pic = r_crosshairs[num];
        if (pic)
index f6b5bd3ae0c5c741fadb01bbe50dc9fec7a8dd6e..54caa07c63f46557d04131ac3fac4358a1950d54 100644 (file)
@@ -231,7 +231,7 @@ float beamrepeatscale;
 
 void R_DrawLightningBeam_TransparentCallback(const entity_render_t *ent, int surfacenumber, const rtlight_t *rtlight)
 {
-       const beam_t *b = cl_beams + surfacenumber;
+       const beam_t *b = cl.beams + surfacenumber;
        rmeshstate_t m;
        vec3_t beamdir, right, up, offset;
        float length, t1, t2;
@@ -337,7 +337,7 @@ void R_DrawLightningBeams(void)
                return;
 
        beamrepeatscale = 1.0f / r_lightningbeam_repeatdistance.value;
-       for (i = 0, b = cl_beams;i < cl_activebeams;i++, b++)
+       for (i = 0, b = cl.beams;i < cl.num_beams;i++, b++)
        {
                if (b->model && b->endtime >= r_refdef.time && b->lightning)
                {
index 186fc0e56836f9d46d1682258fe02ea2d5af7770..a6db955deaec6e733070436d5b93af411d8257c2 100644 (file)
@@ -549,12 +549,12 @@ void SND_Spatialize(channel_t *ch, qboolean isstatic)
        vec3_t source_vec;
 
        // update sound origin if we know about the entity
-       if (ch->entnum > 0 && cls.state == ca_connected && cl_entities[ch->entnum].state_current.active)
+       if (ch->entnum > 0 && cls.state == ca_connected && cl.entities[ch->entnum].state_current.active)
        {
-               //Con_Printf("-- entnum %i origin %f %f %f neworigin %f %f %f\n", ch->entnum, ch->origin[0], ch->origin[1], ch->origin[2], cl_entities[ch->entnum].state_current.origin[0], cl_entities[ch->entnum].state_current.origin[1], cl_entities[ch->entnum].state_current.origin[2]);
-               VectorCopy(cl_entities[ch->entnum].state_current.origin, ch->origin);
-               if (cl_entities[ch->entnum].state_current.modelindex && cl.model_precache[cl_entities[ch->entnum].state_current.modelindex] && cl.model_precache[cl_entities[ch->entnum].state_current.modelindex]->soundfromcenter)
-                       VectorMAMAM(1.0f, ch->origin, 0.5f, cl.model_precache[cl_entities[ch->entnum].state_current.modelindex]->normalmins, 0.5f, cl.model_precache[cl_entities[ch->entnum].state_current.modelindex]->normalmaxs, ch->origin);
+               //Con_Printf("-- entnum %i origin %f %f %f neworigin %f %f %f\n", ch->entnum, ch->origin[0], ch->origin[1], ch->origin[2], cl.entities[ch->entnum].state_current.origin[0], cl.entities[ch->entnum].state_current.origin[1], cl.entities[ch->entnum].state_current.origin[2]);
+               VectorCopy(cl.entities[ch->entnum].state_current.origin, ch->origin);
+               if (cl.entities[ch->entnum].state_current.modelindex && cl.model_precache[cl.entities[ch->entnum].state_current.modelindex] && cl.model_precache[cl.entities[ch->entnum].state_current.modelindex]->soundfromcenter)
+                       VectorMAMAM(1.0f, ch->origin, 0.5f, cl.model_precache[cl.entities[ch->entnum].state_current.modelindex]->normalmins, 0.5f, cl.model_precache[cl.entities[ch->entnum].state_current.modelindex]->normalmaxs, ch->origin);
        }
 
        mastervol = ch->master_vol;
@@ -639,7 +639,7 @@ int S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float f
                return -1;
        }
 
-       if (entnum && entnum >= cl_max_entities)
+       if (entnum && entnum >= cl.max_entities)
                CL_ExpandEntities(entnum);
 
        // Pick a channel to play on
index 8ba7a5e0b29e7beb42fb7299b6a98a2a2203f333..8133314c388712c3f524789ce1e8cfddc50beb76 100644 (file)
--- a/snd_mix.c
+++ b/snd_mix.c
@@ -32,14 +32,13 @@ typedef struct portable_samplepair_s
 portable_sampleframe_t paintbuffer[PAINTBUFFER_SIZE];
 
 // FIXME: this desyncs with the video too easily
-extern qboolean cl_capturevideo_active;
 extern void SCR_CaptureVideo_SoundFrame(unsigned char *bufstereo16le, size_t length, int rate);
 void S_CaptureAVISound(portable_sampleframe_t *buf, size_t length)
 {
        int n;
        size_t i;
        unsigned char out[PAINTBUFFER_SIZE * 4];
-       if (!cl_capturevideo_active)
+       if (!cls.capturevideo_active)
                return;
        // write the sound buffer as little endian 16bit interleaved stereo
        for(i = 0;i < length;i++)
diff --git a/view.c b/view.c
index 28fe76408f0e0918211441987c58751f38e7c3a5..94a830de5e91a86a7f247fe6876a2c4db7809fca 100644 (file)
--- a/view.c
+++ b/view.c
@@ -255,9 +255,9 @@ void V_ParseDamage (void)
        }
 
        // calculate view angle kicks
-       if (cl_entities[cl.viewentity].state_current.active)
+       if (cl.entities[cl.viewentity].state_current.active)
        {
-               ent = &cl_entities[cl.viewentity];
+               ent = &cl.entities[cl.viewentity];
                Matrix4x4_Transform(&ent->render.inversematrix, from, localfrom);
                VectorNormalize(localfrom);
                v_dmg_pitch = count * localfrom[0] * v_kickpitch.value;
@@ -330,7 +330,7 @@ void V_CalcRefdef (void)
        if (cls.state == ca_connected && cls.signon == SIGNONS)
        {
                // ent is the view entity (visible when out of body)
-               ent = &cl_entities[cl.viewentity];
+               ent = &cl.entities[cl.viewentity];
                if (cl.intermission)
                {
                        // entity is a fixed camera, just copy the matrix
diff --git a/wad.c b/wad.c
index 7d488dbd961359f8b10733fa7ba20c7680c88c4e..3418f3c694637115f91d19d4610334ef7c7a9aef 100644 (file)
--- a/wad.c
+++ b/wad.c
@@ -76,7 +76,7 @@ void *W_GetLumpName(const char *name)
        if (!wad_loaded)
        {
                wad_loaded = true;
-               if ((wad_base = FS_LoadFile ("gfx.wad", cl_mempool, false, &filesize)))
+               if ((wad_base = FS_LoadFile ("gfx.wad", cls.mempool, false, &filesize)))
                {
                        if (memcmp(wad_base, "WAD2", 4))
                        {