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];
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;
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
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;
{
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);
if (normal)
VectorCopy(trace.plane.normal, normal);
- //cl_traceline_startsupercontents = trace.startsupercontents;
maxfrac = trace.fraction;
maxrealfrac = trace.realfraction;
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
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)
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);
}
}
// 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
// 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]);
// 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);
{
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++)
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)
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
/*
=====================
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 ();
// 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
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;
}
}
}
{
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;
}
}
}
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;
void CL_ClearTempEntities (void)
{
- cl_num_temp_entities = 0;
+ cl.num_temp_entities = 0;
}
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;
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;
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;
}
}
// 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;
}
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)
{
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;
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)
{
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;
}
}
{
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?
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;
// 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)
// 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);
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)
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;
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;
{
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
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;
}
}
}
//[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;
}
}
}
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)
{
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;
}
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;
// 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);
}
}
- 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)
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)
{
CL_Particles_Shutdown();
CL_Parse_Shutdown();
- Mem_FreePool (&cl_mempool);
+ Mem_FreePool (&cls.mempool);
}
/*
*/
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 ();
// 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();
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);
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;
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)
{
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 ();
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 ();
}
// 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();
}
{
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
// This is definitely cheating...
if (ent->render.model == NULL)
- cl_num_static_entities--;
+ cl.num_static_entities--;
}
/*
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;
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)
// 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;
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:
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);
// 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:
// 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
{
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)
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:
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);
#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()&litude);
-
- 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] =
{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
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"};
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
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);
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:
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);
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
}
}
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++)
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);
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]);
{
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);
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);
}
}
}
-#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;
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;
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
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)
}
}
break;
-#ifndef WORKINGLQUAKE
case 7: // Nehahra smoke tracer
dec = 7;
if (smoke)
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);
}
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)
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;
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;
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;
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);
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:
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:
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);
}
}
}
- cl_numparticles = maxparticle + 1;
- cl_freeparticle = 0;
+ cl.num_particles = maxparticle + 1;
+ cl.free_particle = 0;
}
#define MAX_PARTICLETEXTURES 64
}
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"};
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
particletexture[tex_beam].t1 = 0;
particletexture[tex_beam].s2 = 1;
particletexture[tex_beam].t2 = 1;
-#endif
Mem_Free(particletexturedata);
}
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;
ca = 1;
}
ca /= cl_particles_quality.value;
-#ifndef WORKINGLQUAKE
if (p->type->lighting)
{
float ambient[3], diffuse[3], diffusenormal[3];
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)
{
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)
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)
{
}
}
}
-#endif
}
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;
}
*/
/*
{
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)
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;
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)
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;
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();
}
}
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;
}
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();
}
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;
}
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 );
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;
}
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 )
{
{
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;
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 )
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
{
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)
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 );
void CL_Video_Init( void )
{
- cl_activevideos = 0;
+ cl_num_videos = 0;
cl_videobytesperpixel = 4;
cl_videormask = BigLong(0xFF000000);
cl_videogmask = BigLong(0x00FF0000);
}
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
{
cactive_t state;
+ // all client memory allocations go in this pool
+ mempool_t *mempool;
+
// demo loop control
// -1 = don't play demos
int demonum;
// 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;
}
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
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
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);
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
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);
}
// 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);
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);
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);
}
}
}
{
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);
}
// 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);
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;
}
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;
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);
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;
}
*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);
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)
{
e->state_current.active = true;
}
e->persistent.lerpdeltatime = 0;//prog->globals.client->frametime;
- cl_num_csqcentities++;
+ cl.num_csqcentities++;
}
}
}
//[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)
*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
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];
//#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;
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] == '*')
{
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;
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;
}
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
#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);
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)
{
char *desc;
} nehahrademonames_t;
-nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
+static nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
{
{"intro", "Prologue"},
{"genf", "The Beginning"},
{"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);
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;
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);
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;
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;
}
-int demo_cursor;
-void M_Demo_Draw (void)
+static int demo_cursor;
+static void M_Demo_Draw (void)
{
int i;
m_entersound = true;
}
-void M_Demo_Key (int k, char ascii)
+
+static void M_Demo_Key (int k, char ascii)
{
switch (k)
{
//=============================================================================
/* 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)
{
}
-void M_Main_Draw (void)
+static void M_Main_Draw (void)
{
int f;
cachepic_t *p;
}
-void M_Main_Key (int key, char ascii)
+static void M_Main_Key (int key, char ascii)
{
switch (key)
{
//=============================================================================
/* SINGLE PLAYER MENU */
-int m_singleplayer_cursor;
+static int m_singleplayer_cursor;
#define SINGLEPLAYER_ITEMS 3
}
-void M_SinglePlayer_Draw (void)
+static void M_SinglePlayer_Draw (void)
{
cachepic_t *p;
}
-void M_SinglePlayer_Key (int key, char ascii)
+static void M_SinglePlayer_Key (int key, char ascii)
{
if (gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH)
{
//=============================================================================
/* 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];
}
-void M_Load_Draw (void)
+static void M_Load_Draw (void)
{
int i;
cachepic_t *p;
}
-void M_Save_Draw (void)
+static void M_Save_Draw (void)
{
int i;
cachepic_t *p;
}
-void M_Load_Key (int k, char ascii)
+static void M_Load_Key (int k, char ascii)
{
switch (k)
{
}
-void M_Save_Key (int k, char ascii)
+static void M_Save_Key (int k, char ascii)
{
switch (k)
{
//=============================================================================
/* 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)
key_dest = key_menu;
}
-void M_Transfusion_Episode_Draw (void)
+static void M_Transfusion_Episode_Draw (void)
{
int y;
cachepic_t *p;
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)
{
//=============================================================================
/* 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)
key_dest = key_menu;
}
-void M_Transfusion_Skill_Draw (void)
+static void M_Transfusion_Skill_Draw (void)
{
int y;
cachepic_t *p;
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)
{
//=============================================================================
/* MULTIPLAYER MENU */
-int m_multiplayer_cursor;
+static int m_multiplayer_cursor;
#define MULTIPLAYER_ITEMS 3
}
-void M_MultiPlayer_Draw (void)
+static void M_MultiPlayer_Draw (void)
{
int f;
cachepic_t *p;
}
-void M_MultiPlayer_Key (int key, char ascii)
+static void M_MultiPlayer_Key (int key, char ascii)
{
switch (key)
{
//=============================================================================
/* 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
return bound(1, i, RATES) - 1;
}
-void M_Setup_Draw (void)
+static void M_Setup_Draw (void)
{
int i;
cachepic_t *p;
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);
}
}
-void M_Setup_Key (int k, char ascii)
+static void M_Setup_Key (int k, char ascii)
{
int l;
#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;
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");
#define OPTIONS_ITEMS 40
-int options_cursor;
+static int options_cursor;
void M_Menu_Options_f (void)
{
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");
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)
{
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)
{
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)
{
optnum++;
}
-void M_Options_Draw (void)
+static void M_Options_Draw (void)
{
int visible;
cachepic_t *p;
}
-void M_Options_Key (int k, char ascii)
+static void M_Options_Key (int k, char ascii)
{
switch (k)
{
#define OPTIONS_EFFECTS_ITEMS 35
-int options_effects_cursor;
+static int options_effects_cursor;
void M_Menu_Options_Effects_f (void)
{
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");
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;
}
-void M_Options_Effects_Key (int k, char ascii)
+static void M_Options_Effects_Key (int k, char ascii)
{
switch (k)
{
#define OPTIONS_GRAPHICS_ITEMS 14
-int options_graphics_cursor;
+static int options_graphics_cursor;
void M_Menu_Options_Graphics_f (void)
{
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");
}
-void M_Options_Graphics_Draw (void)
+static void M_Options_Graphics_Draw (void)
{
int visible;
cachepic_t *p;
}
-void M_Options_Graphics_Key (int k, char ascii)
+static void M_Options_Graphics_Key (int k, char ascii)
{
switch (k)
{
#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)
{
}
-void M_Menu_Options_ColorControl_AdjustSliders (int dir)
+static void M_Menu_Options_ColorControl_AdjustSliders (int dir)
{
int optnum;
float f;
}
}
-void M_Options_ColorControl_Draw (void)
+static void M_Options_ColorControl_Draw (void)
{
int visible;
float x, c, s, t, u, v;
}
-void M_Options_ColorControl_Key (int k, char ascii)
+static void M_Options_ColorControl_Key (int k, char ascii)
{
switch (k)
{
//=============================================================================
/* KEYS MENU */
-char *quakebindnames[][2] =
+static char *quakebindnames[][2] =
{
{"+attack", "attack"},
{"impulse 10", "next weapon"},
{"+movedown", "swim down"}
};
-char *transfusionbindnames[][2] =
+static char *transfusionbindnames[][2] =
{
{"", "Movement"}, // Movement commands
{"+forward", "walk forward"},
{"impulse 79", "taunt 9"}
};
-char *goodvsbad2bindnames[][2] =
+static char *goodvsbad2bindnames[][2] =
{
{"impulse 69", "Power 1"},
{"impulse 70", "Power 2"},
{"+movedown", "swim down"}
};
-int numcommands;
-char *(*bindnames)[2];
+static int numcommands;
+static char *(*bindnames)[2];
/*
typedef struct binditem_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)
{
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);
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)
{
M_AddBindToCategory(*c, command, description);
}
-void M_DefaultBinds (void)
+static void M_DefaultBinds (void)
{
M_ClearBinds();
M_AddBind("movement", "+jump", "jump / swim up");
*/
-int keys_cursor;
-int bind_grab;
+static int keys_cursor;
+static int bind_grab;
void M_Menu_Keys_f (void)
{
}
}
-void M_UnbindCommand (char *command)
+static void M_UnbindCommand (char *command)
{
int j;
char *b;
}
-void M_Keys_Draw (void)
+static void M_Keys_Draw (void)
{
int i, j;
int keys[NUMKEYS];
}
-void M_Keys_Key (int k, char ascii)
+static void M_Keys_Key (int k, char ascii)
{
char cmd[80];
int keys[NUMKEYS];
}
-void M_Reset_Key (int key, char ascii)
+static void M_Reset_Key (int key, char ascii)
{
switch (key)
{
}
}
-void M_Reset_Draw (void)
+static void M_Reset_Draw (void)
{
int lines = 2, linelength = 20;
M_Background(linelength * 8 + 16, lines * 8 + 16);
#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)
{
}
-void M_Video_Draw (void)
+static void M_Video_Draw (void)
{
cachepic_t *p;
}
-void M_Menu_Video_AdjustSliders (int dir)
+static void M_Menu_Video_AdjustSliders (int dir)
{
S_LocalSound ("sound/misc/menu3.wav");
}
-void M_Video_Key (int key, char ascii)
+static void M_Video_Key (int key, char ascii)
{
switch (key)
{
//=============================================================================
/* HELP MENU */
-int help_page;
+static int help_page;
#define NUM_HELP_PAGES 6
-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)
{
-void M_Credits_Draw (void)
+static void M_Credits_Draw (void)
{
M_Background(640, 480);
M_DrawPic (0, 0, "gfx/creditsmiddle");
}
-void M_Credits_Key (int key, char ascii)
+static void M_Credits_Key (int key, char ascii)
{
M_Menu_Main_f ();
}
//=============================================================================
/* 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;
return 1;
}
-int M_ChooseQuitMessage(int request)
+static int M_ChooseQuitMessage(int request)
{
switch (gamemode)
{
}
-void M_Quit_Key (int key, char ascii)
+static void M_Quit_Key (int key, char ascii)
{
switch (key)
{
}
}
-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++)
//=============================================================================
/* 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)
{
}
-void M_LanConfig_Draw (void)
+static void M_LanConfig_Draw (void)
{
cachepic_t *p;
int basex;
}
-void M_LanConfig_Key (int key, char ascii)
+static void M_LanConfig_Key (int key, char ascii)
{
int l;
}
gamelevels_t;
-level_t quakelevels[] =
+static level_t quakelevels[] =
{
{"start", "Entrance"}, // 0
{"dm6", "The Dark Zone"}
};
-episode_t quakeepisodes[] =
+static episode_t quakeepisodes[] =
{
{"Welcome to Quake", 0, 1},
{"Doomed Dimension", 1, 8},
};
//MED 01/06/97 added hipnotic levels
-level_t hipnoticlevels[] =
+static level_t hipnoticlevels[] =
{
{"start", "Command HQ"}, // 0
};
//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},
//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"},
//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},
{"Deathmatch Arena", 16, 1}
};
-level_t nehahralevels[] =
+static level_t nehahralevels[] =
{
{"nehstart", "Welcome to Nehahra"},
{"neh1m1", "Forge City1: Slipgates"},
{"nehend", "Quintessence"}
};
-episode_t nehahraepisodes[] =
+static episode_t nehahraepisodes[] =
{
{"Welcome to Nehahra", 0, 1},
{"The Fall of Forge", 1, 9},
};
// Map list for Transfusion
-level_t transfusionlevels[] =
+static level_t transfusionlevels[] =
{
{"e1m1", "Cradle to Grave"},
{"e1m2", "Wrong Side of the Tracks"},
{"simple", "Dead Simple"}
};
-episode_t transfusionepisodes[] =
+static episode_t transfusionepisodes[] =
{
{"The Way of All Flesh", 0, 8},
{"Even Death May Die", 8, 9},
{"Conversions", 85, 9}
};
-level_t goodvsbad2levels[] =
+static level_t goodvsbad2levels[] =
{
{"rts", "Many Paths"}, // 0
{"chess", "Chess, Scott Hess"}, // 1
{"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
{"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"},
{"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
{
}
gameinfo_t;
-gameinfo_t gamelist[] =
+static gameinfo_t gamelist[] =
{
{GAME_NORMAL, &sharewarequakegame, ®isteredquakegame},
{GAME_HIPNOTIC, &hipnoticgame, &hipnoticgame},
{(gamemode_t)-1, &sharewarequakegame, ®isteredquakegame} // 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++);
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)
{
}
-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)
{
}
-void M_NetStart_Change (int dir)
+static void M_NetStart_Change (int dir)
{
gamelevels_t *g;
int count;
}
}
-void M_GameOptions_Key (int key, char ascii)
+static void M_GameOptions_Key (int key, char ascii)
{
gamelevels_t *g;
int l;
//=============================================================================
/* SLIST MENU */
-int slist_cursor;
+static int slist_cursor;
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;
}
-void M_ServerList_Key(int k, char ascii)
+static void M_ServerList_Key(int k, char ascii)
{
switch (k)
{
//=============================================================================
/* 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)
{
};
#ifdef NG_MENU
-qboolean m_displayed;
+static qboolean m_displayed;
#endif
static int m_numrequiredfunc = sizeof(m_required_func) / sizeof(char*);
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));
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;
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;
extern cvar_t hostname;
extern cvar_t developer_networking;
-extern char playername[];
-extern int playercolor;
#define SERVERLIST_TOTALSIZE 2048
#define SERVERLIST_VIEWLISTSIZE SERVERLIST_TOTALSIZE
#include "quakedef.h"
+#define E5_PROTOCOL_PRIORITYLEVELS 32
+
// this is 88 bytes (must match entity_state_t in protocol.h)
entity_state_t defaultstate =
{
{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;
}
}
-// 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;
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
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;
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)
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)
}
// (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;
}
// (client) reads a frame from network stream
-static entity_frame_t framedata; // FIXME?
void EntityFrame_CL_ReadFrame(void)
{
int i, number, removed;
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);
*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;
}
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;
}
}
}
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();
// 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
// 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)
{
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)
{
}
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);
}
}
-#define E5_PROTOCOL_PRIORITYLEVELS 32
-
entityframe5_database_t *EntityFrame5_AllocDatabase(mempool_t *pool)
{
int i;
// 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
// 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);
}
}
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;
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;
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)
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;
{
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++;
}
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);
}
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++;
}
}
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)
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)
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)
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;
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)
{
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;
return -1;
}
- if (entnum && entnum >= cl_max_entities)
+ if (entnum && entnum >= cl.max_entities)
CL_ExpandEntities(entnum);
// Pick a channel to play on
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++)
}
// 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;
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
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))
{