From b25a4374604ea557d6a727cb55094f95edbdcf6d Mon Sep 17 00:00:00 2001 From: "Timothy C. McGrath" Date: Thu, 22 Mar 2001 01:52:33 +0000 Subject: [PATCH] Very minor changes. cl_max_particles still cannot be used dynamically, however I've removed the stupid limits that I'd accidentally left behind in my panic to comment out the messed up code in r_part.c so software clients now can use a setting of zero. Particles in sw clients will not default to 2048 if you use a number less than 1 - it will now use 0. Otherwise, I made comments to myself for when I actually fix this and cleared up some silliness in comments I'd made. Nothing special. Special note: To use cl_max_particles *right now* you can either set it while playing and then restart the client (I think this should work, it's archived. May not however) Or do this which I absolutely am *positive* works: clientname othercommands +set cl_max_particles number othercommands So, again, while changing in game does not work, it at least is still useful somewhat. Misty-chan --- qw/source/gl_dyn_part.c | 9 ++++++--- qw/source/r_part.c | 13 ++++--------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/qw/source/gl_dyn_part.c b/qw/source/gl_dyn_part.c index 5487e22c4..cd1035400 100644 --- a/qw/source/gl_dyn_part.c +++ b/qw/source/gl_dyn_part.c @@ -127,12 +127,13 @@ particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz, void R_InitParticles (void) { - // Chooses cvar if bigger than zero, otherwise ignore and set variable to zero + // Misty-chan: Chooses cvar if bigger than zero, otherwise ignore and set variable to zero. Deek showed this to me. r_numparticles = max(cl_max_particles->int_val, 0); particles = (particle_t *) Hunk_AllocName (r_numparticles * sizeof (particle_t), "particles"); + // Misty-chan: Note to self, *THIS* is bugged, use our line when we remerge freeparticles = (void *) Hunk_AllocName (r_numparticles * sizeof (particle_t), "particles"); @@ -143,7 +144,7 @@ R_InitParticles (void) R_MaxParticlesCheck */ /* -This entire section is disabled because I don't understand Hunk_Allocname, or how to fix it yet. +Misty-chan: This entire section is disabled until it can be fixed void R_MaxParticlesCheck (void) { @@ -154,7 +155,9 @@ R_MaxParticlesCheck (void) R_ClearParticles(); r_numparticles = cl_max_particles->int_val; - + // Misty-chan: Note to self: PLEASE remember to do this section in this order: + // R_ClearParticles to disable the particles, then free the memory, then calloc. + // then set the variable. Otherwise you'll likely be shot on sight. particles = (particle_t *) Hunk_AllocName (r_numparticles * sizeof (particle_t), "particles"); diff --git a/qw/source/r_part.c b/qw/source/r_part.c index c399918bd..3795b8b67 100644 --- a/qw/source/r_part.c +++ b/qw/source/r_part.c @@ -59,14 +59,9 @@ cvar_t *r_particles; void R_InitParticles (void) { - if (cl_max_particles->int_val < 1) - { - /* Abuse check */ - r_numparticles = 2048; - } else { - r_numparticles = cl_max_particles->int_val; - } - + // Misty-chan: Chooses cvar if bigger than zero, otherwise ignore and set variable to zero. Deek showed this to me. + r_numparticles = max(cl_max_particles->int_val, 0); + particles = (particle_t *) Hunk_AllocName (r_numparticles * sizeof (particle_t), "particles"); } @@ -75,7 +70,7 @@ R_InitParticles (void) R_MaxParticlesCheck */ /* -Disabled until it is fixed +Misty-chan: Disabled until it is fixed void R_MaxParticlesCheck (void) {