mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 12:52:46 +00:00
make r_particles truely a flag and call R_MaxParticlesCheck when r_particles
changes
This commit is contained in:
parent
aa6472da2b
commit
d9fd8dc29f
2 changed files with 19 additions and 9 deletions
|
@ -141,8 +141,11 @@ r_particles_f (cvar_t *var)
|
|||
{
|
||||
if (!var->int_val)
|
||||
R_ClearParticles ();
|
||||
r_maxparticles = 0;
|
||||
if (var->int_val && cl_max_particles)
|
||||
r_maxparticles = cl_max_particles->int_val;
|
||||
if (cl_max_particles)
|
||||
r_maxparticles = var->int_val * cl_max_particles->int_val;
|
||||
R_MaxParticlesCheck (cl_max_particles);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -65,21 +65,28 @@ R_MaxParticlesCheck (cvar_t *var)
|
|||
Prevents a segfault since if we grabbed the int_val of cl_max_particles
|
||||
we'd sig11 right here at startup.
|
||||
*/
|
||||
if (r_particles)
|
||||
r_maxparticles = max(var->int_val * r_particles->int_val, 0);
|
||||
if (r_particles && r_particles->int_val)
|
||||
r_maxparticles = var->int_val;
|
||||
else
|
||||
r_maxparticles = max(var->int_val, 0);
|
||||
r_maxparticles = 0;
|
||||
|
||||
/*
|
||||
Be very careful the next time we do something like this. calloc/free are
|
||||
IMPORTANT and the compiler doesn't know when we do bad things with them.
|
||||
*/
|
||||
free (particles);
|
||||
free (freeparticles);
|
||||
if (particles)
|
||||
free (particles);
|
||||
if (freeparticles)
|
||||
free (freeparticles);
|
||||
|
||||
particles = (particle_t *) calloc (r_maxparticles, sizeof (particle_t));
|
||||
freeparticles = (particle_t **) calloc (r_maxparticles,
|
||||
sizeof (particle_t *));
|
||||
particles = 0;
|
||||
freeparticles = 0;
|
||||
|
||||
if (r_maxparticles) {
|
||||
particles = (particle_t *) calloc (r_maxparticles, sizeof (particle_t));
|
||||
freeparticles = (particle_t **) calloc (r_maxparticles,
|
||||
sizeof (particle_t *));
|
||||
}
|
||||
|
||||
R_ClearParticles();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue