client_static_t cls;
client_state_t cl;
-#define MAX_PARTICLES 32768 // default max # of particles at one time
-#define MAX_DECALS 32768 // default max # of decals at one time
-#define ABSOLUTE_MIN_PARTICLES 512 // no fewer than this no matter what's on the command line
-
/*
=====================
CL_ClearState
=====================
*/
+void CL_VM_ShutDown (void);
void CL_ClearState(void)
{
int i;
entity_t *ent;
+ CL_VM_ShutDown();
+
// wipe the entire cl structure
Mem_EmptyPool(cls.levelmempool);
memset (&cl, 0, sizeof(cl));
cl.max_dlights = MAX_DLIGHTS;
cl.max_lightstyle = MAX_LIGHTSTYLES;
cl.max_brushmodel_entities = MAX_EDICTS;
- cl.max_particles = MAX_PARTICLES;
- cl.max_decals = MAX_DECALS;
+ cl.max_particles = 8192; // grows dynamically
+ cl.max_decals = 2048; // grows dynamically
cl.max_showlmps = 0;
-// 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;
if (!allowmodel && (!strcasecmp(key, "pmodel") || !strcasecmp(key, "emodel")))
fail = true;
for (i = 0;key[i];i++)
- if (key[i] <= ' ' || key[i] == '\"')
+ if (ISWHITESPACE(key[i]) || key[i] == '\"')
fail = true;
for (i = 0;value[i];i++)
if (value[i] == '\r' || value[i] == '\n' || value[i] == '\"')
}
}
-void CL_VM_ShutDown (void);
/*
=====================
CL_Disconnect
Con_DPrintf("CL_Disconnect\n");
+ Cvar_SetValueQuick(&csqc_progcrc, -1);
+ Cvar_SetValueQuick(&csqc_progsize, -1);
CL_VM_ShutDown();
// stop sounds (especially looping!)
S_StopAllSounds ();
vec3_t tempdiffusenormal;
// fetch the lighting from the worldmodel data
- VectorSet(ent->modellight_ambient, r_ambient.value * (2.0f / 128.0f), r_ambient.value * (2.0f / 128.0f), r_ambient.value * (2.0f / 128.0f));
+ VectorSet(ent->modellight_ambient, r_refdef.scene.ambient * (2.0f / 128.0f), r_refdef.scene.ambient * (2.0f / 128.0f), r_refdef.scene.ambient * (2.0f / 128.0f));
VectorClear(ent->modellight_diffuse);
VectorClear(tempdiffusenormal);
if ((ent->flags & RENDER_LIGHT) && cl.worldmodel && cl.worldmodel->brush.LightPoint)
{
vec3_t org;
vec_t scale;
- model_t *model = ent->model;
+ dp_model_t *model = ent->model;
// update the inverse matrix for the renderer
Matrix4x4_Invert_Simple(&ent->inversematrix, &ent->matrix);
// update the animation blend state
int j, k, l, frame;
float origin[3], angles[3], delta[3], lerp, d;
entity_t *t;
- model_t *model;
+ dp_model_t *model;
//entity_persistent_t *p = &e->persistent;
//entity_render_t *r = &e->render;
// skip inactive entities and world
e->render.flags = e->state_current.flags;
e->render.effects = e->state_current.effects;
VectorScale(e->state_current.colormod, (1.0f / 32.0f), e->render.colormod);
- e->render.entitynumber = e - cl.entities;
+ if(e >= cl.entities && e < cl.entities + cl.num_entities)
+ e->render.entitynumber = e - cl.entities;
+ else
+ e->render.entitynumber = 0;
if (e->state_current.flags & RENDER_COLORMAPPED)
CL_SetEntityColormapColors(&e->render, e->state_current.colormap);
else if (e->state_current.colormap > 0 && e->state_current.colormap <= cl.maxclients && cl.scores != NULL)
interpolate = false;
if (e == cl.entities + cl.playerentity && cl.movement_predicted && (!cl.fixangle[1] || !cl.fixangle[0]))
{
- lerp = (cl.time - cl.movement_time[2]) / (cl.movement_time[0] - cl.movement_time[1]);
- lerp = bound(0, lerp, 1);
- if (!interpolate)
- lerp = 1;
- VectorLerp(cl.movement_oldorigin, lerp, cl.movement_origin, origin);
+ VectorCopy(cl.movement_origin, origin);
VectorSet(angles, 0, cl.viewangles[1], 0);
}
else if (interpolate && e->persistent.lerpdeltatime > 0 && (lerp = (cl.time - e->persistent.lerpstarttime) / e->persistent.lerpdeltatime) < 1)
e->render.flags |= RENDER_SHADOW;
if (e->render.flags & RENDER_VIEWMODEL)
e->render.flags |= RENDER_NOSELFSHADOW;
+ if (e->render.effects & EF_NOSELFSHADOW)
+ e->render.flags |= RENDER_NOSELFSHADOW;
// make the other useful stuff
CL_UpdateRenderEntity(&e->render);
r_refdef.scene.numentities = 0;
r_refdef.scene.numlights = 0;
r_refdef.view.matrix = identitymatrix;
+ r_refdef.view.quality = 1;
cl.num_brushmodel_entities = 0;
CL_RelinkLightFlashes();
CSQC_RelinkAllEntities(ENTMASK_ENGINE | ENTMASK_ENGINEVIEWMODELS);
- // move decals, particles, and any other effects
- CL_MoveDecals();
- CL_MoveParticles();
- R_MoveExplosions();
+ // decals, particles, and explosions will be updated during rneder
}
r_refdef.scene.time = cl.time;
for (i = 0;i < 128;i++)
{
Matrix4x4_CreateFromQuakeEntity(&r_refdef.view.matrix, r_refdef.view.origin[0], r_refdef.view.origin[1], r_refdef.view.origin[2], 0, i / 128.0 * 360.0, 0, 1);
+ r_refdef.view.quality = 1;
CL_UpdateScreen();
}
timedelta = Sys_DoubleTime() - timestart;
FS_StripExtension(cl.worldmodel->name, locfilename, sizeof(locfilename));
strlcat(locfilename, ".loc", sizeof(locfilename));
- outfile = FS_Open(locfilename, "w", false, false);
+ outfile = FS_OpenRealFile(locfilename, "w", false);
if (!outfile)
return;
// if any boxes are used then this is a proquake-format loc file, which
if (text < textend)
text++;
// trim trailing whitespace
- while (lineend > linestart && lineend[-1] <= ' ')
+ while (lineend > linestart && ISWHITESPACE(lineend[-1]))
lineend--;
// trim leading whitespace
- while (linestart < lineend && *linestart <= ' ')
+ while (linestart < lineend && ISWHITESPACE(*linestart))
linestart++;
// check if this is a comment
if (linestart + 2 <= lineend && !strncmp(linestart, "//", 2))
else
maxs[i - 3] = atof(linetext);
// now advance past the number
- while (linetext < lineend && *linetext > ' ' && *linetext != ',')
+ while (linetext < lineend && !ISWHITESPACE(*linetext) && *linetext != ',')
linetext++;
// advance through whitespace
if (linetext < lineend)
limit = 6;
// note: comma can be followed by whitespace
}
- if (*linetext <= ' ')
+ if (ISWHITESPACE(*linetext))
{
// skip whitespace
- while (linetext < lineend && *linetext <= ' ')
+ while (linetext < lineend && ISWHITESPACE(*linetext))
linetext++;
}
}
r_refdef.scene.maxentities = MAX_EDICTS + 256 + 512;
r_refdef.scene.entities = (entity_render_t **)Mem_Alloc(cls.permanentmempool, sizeof(entity_render_t *) * r_refdef.scene.maxentities);
- r_refdef.scene.maxtempentities = 512;
+ r_refdef.scene.maxtempentities = 4096; // FIXME: make this grow
r_refdef.scene.tempentities = (entity_render_t *)Mem_Alloc(cls.permanentmempool, sizeof(entity_render_t) * r_refdef.scene.maxtempentities);
CL_InitInput ();
CL_Screen_Init();
CL_Video_Init();
-#ifdef SUPPORT_GECKO
CL_Gecko_Init();
-#endif
}