Okay, this patch REMOVES the -particles command line option, and adds a

new cvar: cl_max_particles. This cvar is archived, has no lower or
upper limits (well, less than 1 is not allowed) and can be changed in
game at any time.

BUGS:

Only one so far. I can't figure out why it's doing this, but in software
clients, (well, at least X11) if you set it to 1 particle, it acts like
you set it far higher. 2 acts like you set it to zero... Or maybe
it's showing 2 and I just can't see it on my 320x200 window. In any
case, the vagary must be something in the software particles code,
because I basically used the same code from the GL particles code for
this as I used for the software renderer.

If nobody can find fault with my code, I'll just make a special note in
the console help.

In any case, let me know of any problems.

Misty-chan
This commit is contained in:
Timothy C. McGrath 2001-03-18 07:04:47 +00:00
parent ed2f2ce2ca
commit 264547d470
3 changed files with 61 additions and 28 deletions

View file

@ -140,6 +140,8 @@ cvar_t *cl_predict_players;
cvar_t *cl_predict_players2;
cvar_t *cl_solid_players;
cvar_t *cl_max_particles;
cvar_t *localid;
static qboolean allowremotecmd = true;
@ -1294,6 +1296,8 @@ CL_Init_Cvars (void)
msg = Cvar_Get ("msg", "1", CVAR_ARCHIVE | CVAR_USERINFO, "Determines the type of messages reported 0 is maximum, 4 is none");
noaim = Cvar_Get ("noaim", "0", CVAR_ARCHIVE | CVAR_USERINFO,
"Auto aim off switch. Set to 1 to turn off.");
cl_max_particles = Cvar_Get ("cl_max_particles", "2048", CVAR_ARCHIVE,
"Maximum amount of particles to display");
}
/*

View file

@ -46,11 +46,6 @@
#include "qargs.h"
#include "sys.h"
#define MAX_PARTICLES 2048 // 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 {
pt_static, pt_grav, pt_blob, pt_blob2,
pt_smoke, pt_smokecloud, pt_bloodcloud,
@ -76,6 +71,8 @@ static short r_numparticles, numparticles;
extern qboolean lighthalf;
extern cvar_t *cl_max_particles;
extern void GDT_Init (void);
extern int part_tex_smoke[8];
extern int part_tex_dot;
@ -130,14 +127,12 @@ particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz,
void
R_InitParticles (void)
{
int i;
i = COM_CheckParm ("-particles");
if (i) {
r_numparticles = max (ABSOLUTE_MIN_PARTICLES, atoi (com_argv[i + 1]));
if (cl_max_particles->int_val < 1)
{
/* Protect against stupidity */
r_numparticles = 2048;
} else {
r_numparticles = MAX_PARTICLES;
r_numparticles = cl_max_particles->int_val;
}
particles = (particle_t *)
@ -150,6 +145,27 @@ R_InitParticles (void)
GDT_Init ();
}
/*
R_MaxParticlesCheck
*/
void
R_MaxParticlesCheck (void)
{
if (cl_max_particles->int_val == r_numparticles || cl_max_particles->int_val < 1)
{
return;
} else {
R_ClearParticles();
r_numparticles = cl_max_particles->int_val;
particles = (particle_t *)
Hunk_AllocName (r_numparticles * sizeof (particle_t), "particles");
freeparticles = (void *)
Hunk_AllocName (r_numparticles * sizeof (particle_t), "particles");
}
}
/*
R_ClearParticles
@ -541,6 +557,8 @@ R_DrawParticles (void)
particle_t *part;
int activeparticles, maxparticle, j, k;
R_MaxParticlesCheck ();
// LordHavoc: particles should not affect zbuffer
glDepthMask (GL_FALSE);

View file

@ -39,11 +39,7 @@
#include "r_dynamic.h"
#include "r_local.h"
#define MAX_PARTICLES 2048 // default max # of particles at one
// time
#define ABSOLUTE_MIN_PARTICLES 512 // no fewer than this no matter
// what's
// on the command line
extern cvar_t *cl_max_particles;
int ramp1[8] = { 0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61 };
int ramp2[8] = { 0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66 };
@ -63,22 +59,35 @@ cvar_t *r_particles;
void
R_InitParticles (void)
{
int i;
i = COM_CheckParm ("-particles");
if (i) {
r_numparticles = (int) (atoi (com_argv[i + 1]));
if (r_numparticles < ABSOLUTE_MIN_PARTICLES)
r_numparticles = ABSOLUTE_MIN_PARTICLES;
if (cl_max_particles->int_val < 1)
{
/* Abuse check */
r_numparticles = 2048;
} else {
r_numparticles = MAX_PARTICLES;
r_numparticles = cl_max_particles->int_val;
}
particles = (particle_t *)
Hunk_AllocName (r_numparticles * sizeof (particle_t), "particles");
}
/*
R_MaxParticlesCheck
*/
void
R_MaxParticlesCheck (void)
{
if (cl_max_particles->int_val == r_numparticles || cl_max_particles->int_val < 1)
{
return;
} else {
R_ClearParticles();
r_numparticles = cl_max_particles->int_val;
particles = (particle_t *)
Hunk_AllocName (r_numparticles * sizeof (particle_t), "particles");
}
}
/*
R_ClearParticles
@ -482,7 +491,9 @@ R_DrawParticles (void)
float time1;
float dvel;
float frametime;
R_MaxParticlesCheck ();
D_StartParticles ();
VectorScale (vright, xscaleshrink, r_pright);