Minor housecleaning. sw no longer spits out diagnostic output, comments

are now sane and match current code, I moved things around in GL so they
more closely match the sw code, as the sw code makes more sense now that
I *finally* understand what in gods name I was doing wrong. ;)

I also made minor changes to the help to indicate the minimum values of
the variables (sw can deal with 1, gl 0) as well as that you really
ought to use r_particles 0 instead of a setting of cl_max_particles 0 in
GL :P

Thanks for all the help taniwha, those last two bugs were kicking my
butt.

Misty-chan
This commit is contained in:
Timothy C. McGrath 2001-04-03 05:40:15 +00:00
parent afaf10a2c8
commit 1843bb5839
2 changed files with 11 additions and 13 deletions

View file

@ -131,9 +131,6 @@ particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz,
void void
R_MaxParticlesCheck (cvar_t *var) R_MaxParticlesCheck (cvar_t *var)
{ {
// Clear the particles ala sw so we're at least consistent somewhat. GL doesn't need to do it before the max however.
R_ClearParticles();
/* /*
Catchall. If the user changed the setting to a number less than zero *or* if we had a wacky cfg get past Catchall. If the user changed the setting to a number less than zero *or* if we had a wacky cfg get past
the init code check, this will make sure we don't have problems. Also note that grabbing the var->int_val is IMPORTANT: the init code check, this will make sure we don't have problems. Also note that grabbing the var->int_val is IMPORTANT:
@ -156,6 +153,8 @@ R_MaxParticlesCheck (cvar_t *var)
calloc (r_numparticles, sizeof (particle_t)); calloc (r_numparticles, sizeof (particle_t));
freeparticles = (particle_t **) freeparticles = (particle_t **)
calloc (r_numparticles, sizeof (particle_t*)); calloc (r_numparticles, sizeof (particle_t*));
R_ClearParticles();
} }
/* /*
@ -168,7 +167,7 @@ R_Particles_Init_Cvars (void)
// Misty-chan: This is a cvar that does callbacks. Whenever it changes, it calls the function // Misty-chan: This is a cvar that does callbacks. Whenever it changes, it calls the function
// R_MaxParticlesCheck and therefore is very nifty. // R_MaxParticlesCheck and therefore is very nifty.
Cvar_Get ("cl_max_particles", "2048", CVAR_ARCHIVE, R_MaxParticlesCheck, Cvar_Get ("cl_max_particles", "2048", CVAR_ARCHIVE, R_MaxParticlesCheck,
"Maximum amount of particles to display"); "Maximum amount of particles to display. No maximum, minimum is 0, although it's best to use r_particles 0 instead.");
} }
/* /*

View file

@ -54,6 +54,7 @@ cvar_t *r_particles;
/* /*
R_MaxParticlesCheck R_MaxParticlesCheck
Misty-chan: EXTREME heavy lifting and bugfixing thanks goes out to taniwha - I built this, and he got it working :)
*/ */
void void
R_MaxParticlesCheck (cvar_t *var) R_MaxParticlesCheck (cvar_t *var)
@ -61,9 +62,11 @@ R_MaxParticlesCheck (cvar_t *var)
// Do not use 0 in this! sw doesn't grok 0 and it's going to segfault if we do! // Do not use 0 in this! sw doesn't grok 0 and it's going to segfault if we do!
r_numparticles = max(var->int_val, 1); r_numparticles = max(var->int_val, 1);
// Debugging code. will print what the above was set to, and is also useful /*
// for checking if this is accidentally being run all the time. Safe to remove if you fixed this section (!) Debugging code. will print what the above was set to, and is also useful
for checking if this is accidentally being run all the time.
Con_Printf ("%d", r_numparticles); Con_Printf ("%d", r_numparticles);
*/
if (particles) if (particles)
free (particles); free (particles);
@ -77,16 +80,12 @@ R_MaxParticlesCheck (cvar_t *var)
R_Particles_Init_Cvars R_Particles_Init_Cvars
*/ */
// Misty-chan: Hackhackhack to get below code to run. Remove if you got R_MaxParticlesCheck working!
cvar_t *cl_max_particles;
void void
R_Particles_Init_Cvars (void) R_Particles_Init_Cvars (void)
{ {
// Does a callback... Currently which does absolutely NOTHING! Joy. // Does a callback to R_MaxParticleCheck when the cvar changes. Neat trick.
cl_max_particles = Cvar_Get ("cl_max_particles", "2048", CVAR_ARCHIVE, R_MaxParticlesCheck, Cvar_Get ("cl_max_particles", "2048", CVAR_ARCHIVE, R_MaxParticlesCheck,
"Maximum amount of particles to display"); "Maximum amount of particles to display. No maximum, minimum is 1.");
// This is a temporary hack until R_MaxParticlesCheck is fixed and does NOT belong here. Disable if you're trying to fix above code :)
} }
/* /*