mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
This took half the hair on my head. Just kidding:
cl_max_particles now lives in *part.c - in GL it dynamically changes the amount of particles on the fly! Needless to say this is fun, and this is proboably the third cvar that uses the callbacks function at all - which IMHO is really a cool trick Taniwha. However I'm losing my SANITY in r_part.c - if someone could take a look, I'd be greatly appreciative. It should be obvious to any developer that I'm having a few problems. :P Basically the dynamic code is completely and totally disabled, and I hacked in code which *works* but shouldn't EVER EVER EVER be left there after we fix this as it is downright EVIL the way I implimented it. SW client does work, and does still work with +set cl_max_particles - however the hacks I made to get it to do that... *shakes head* Tread softly in there, it's a mess. Other notes of interest: I changed show_time so it archives its setting. Got annoyed with it. If someone finds this change to be bad, change it back. :) glspeed.cfg got updated with a setting of 60 for cl_max_particles. 60 works nicely, and doesn't use too much speed on my aging hardware, so I'm sure newer systems will just plain FLY with this on. I also changed the cl_maxfps setting as 72 is great if you aren't using a modem !.! due to the way cl_maxfps works, the higher it goes, the more data is sent to you by the server. This causes a heck of a lot of lost packets if you don't have the bandwidth OR if your card can't keep up with the framerate. Either of which is bad. I set it to 30, the default of the cvar is 0/32 so go figure out what works best for you I say. Let me know if this blows up in your face and ESPECIALLY let me know if you can fix the r_part.c problems! Misty-chan
This commit is contained in:
parent
f5c168b8a5
commit
d649508b5d
6 changed files with 92 additions and 81 deletions
|
@ -71,7 +71,10 @@ cl_cshift_damage "0"
|
|||
// megatf/2k. Older quakeworld servers couldn't disable gl_polyblend anyway.
|
||||
cl_cshift_content "1"
|
||||
// client's maximum fps allowed. 72 is the highest it can be set to
|
||||
cl_maxfps "72"
|
||||
// However, and this is important, setting it higher currently
|
||||
// causes more packets to need to be sent. This is bad, so mine is set to
|
||||
// 30 for the moment
|
||||
cl_maxfps "30"
|
||||
// Set to 0 to go faster, 1 is older mode and slower
|
||||
// Or not. Some people say 0 is slower and 1 is faster.
|
||||
// *shrugs* Pick your favorite I guess.
|
||||
|
|
|
@ -142,8 +142,6 @@ 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;
|
||||
|
@ -161,6 +159,8 @@ cvar_t *msg;
|
|||
|
||||
extern cvar_t *cl_hightrack;
|
||||
|
||||
extern void R_Particles_Init_Cvars (void);
|
||||
|
||||
client_static_t cls;
|
||||
client_state_t cl;
|
||||
|
||||
|
@ -1203,7 +1203,7 @@ CL_Init_Cvars (void)
|
|||
show_fps = Cvar_Get ("show_fps", "0", CVAR_NONE, 0,
|
||||
"display realtime frames per second");
|
||||
// Misty: I like to be able to see the time when I play
|
||||
show_time = Cvar_Get ("show_time", "0", CVAR_NONE, 0,
|
||||
show_time = Cvar_Get ("show_time", "0", CVAR_ARCHIVE, 0,
|
||||
"display the current time");
|
||||
host_speeds = Cvar_Get ("host_speeds", "0", CVAR_NONE, 0,
|
||||
"display host processing times");
|
||||
|
@ -1295,8 +1295,8 @@ CL_Init_Cvars (void)
|
|||
msg = Cvar_Get ("msg", "1", CVAR_ARCHIVE | CVAR_USERINFO, Cvar_Info, "Determines the type of messages reported 0 is maximum, 4 is none");
|
||||
noaim = Cvar_Get ("noaim", "0", CVAR_ARCHIVE | CVAR_USERINFO, Cvar_Info,
|
||||
"Auto aim off switch. Set to 1 to turn off.");
|
||||
cl_max_particles = Cvar_Get ("cl_max_particles", "2048", CVAR_ARCHIVE, 0,
|
||||
"Maximum amount of particles to display");
|
||||
// Misty-chan: Initialize particles cvars. Seemed like a good place to put to me. Move as you wish!
|
||||
R_Particles_Init_Cvars ();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -74,7 +74,6 @@ 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;
|
||||
|
||||
|
@ -123,50 +122,55 @@ particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz,
|
|||
}
|
||||
|
||||
/*
|
||||
R_InitParticles
|
||||
R_MaxParticlesCheck
|
||||
|
||||
Misty-chan: Dynamically change the maximum amount of particles on the fly.
|
||||
Thanks to a LOT of help from Taniwha, Deek, Mercury, Lordhavoc, and lots of others.
|
||||
*/
|
||||
|
||||
void
|
||||
R_InitParticles (void)
|
||||
R_MaxParticlesCheck (cvar_t *var)
|
||||
{
|
||||
// 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);
|
||||
// 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
|
||||
the init code check, this will make sure we don't have problems. Also note that grabbing the var->int_val is IMPORTANT:
|
||||
Prevents a segfault since if we grabbed the int_val of cl_max_particles we'd sig11 right here at startup.
|
||||
*/
|
||||
r_numparticles = max(var->int_val, 0);
|
||||
|
||||
/*
|
||||
Enable this to see how many particles are ACTUALLY allocated whenever you do a cl_max_particles change
|
||||
Also note it's damned useful for checking for if this thing is running more than it should!
|
||||
Con_Printf ("%d", r_numparticles);
|
||||
*/
|
||||
|
||||
// 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);
|
||||
|
||||
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");
|
||||
|
||||
GDT_Init ();
|
||||
calloc (r_numparticles, sizeof (particle_t));
|
||||
freeparticles = (particle_t **)
|
||||
calloc (r_numparticles, sizeof (particle_t*));
|
||||
}
|
||||
|
||||
/*
|
||||
R_MaxParticlesCheck
|
||||
R_Particles_Init_Cvars
|
||||
*/
|
||||
/*
|
||||
Misty-chan: This entire section is disabled until it can be fixed
|
||||
|
||||
void
|
||||
R_MaxParticlesCheck (void)
|
||||
R_Particles_Init_Cvars (void)
|
||||
{
|
||||
if (cl_max_particles->int_val == r_numparticles || cl_max_particles->int_val < 0)
|
||||
{
|
||||
return;
|
||||
} else {
|
||||
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");
|
||||
|
||||
freeparticles = (void *)
|
||||
Hunk_AllocName (r_numparticles * sizeof (particle_t), "particles");
|
||||
}
|
||||
// Misty-chan: This is a cvar that does callbacks. Whenever it changes, it calls the function
|
||||
// R_MaxParticlesCheck and therefore is very nifty.
|
||||
Cvar_Get ("cl_max_particles", "2048", CVAR_ARCHIVE, R_MaxParticlesCheck,
|
||||
"Maximum amount of particles to display");
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
R_ClearParticles
|
||||
*/
|
||||
|
@ -556,10 +560,7 @@ R_DrawParticles (void)
|
|||
float scale;
|
||||
particle_t *part;
|
||||
int activeparticles, maxparticle, j, k;
|
||||
/*
|
||||
Disabled until I fix this
|
||||
R_MaxParticlesCheck ();
|
||||
*/
|
||||
|
||||
// LordHavoc: particles should not affect zbuffer
|
||||
glDepthMask (GL_FALSE);
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ extern cvar_t *gl_lerp_anim;
|
|||
|
||||
extern cvar_t *r_netgraph;
|
||||
|
||||
extern void GDT_Init ();
|
||||
qboolean allowskybox; // allow skyboxes? --KB
|
||||
|
||||
/*
|
||||
|
@ -190,9 +191,9 @@ R_Init (void)
|
|||
Cmd_AddCommand ("loadsky", R_LoadSky_f, "Load a skybox");
|
||||
|
||||
R_InitBubble ();
|
||||
|
||||
R_InitParticles ();
|
||||
|
||||
|
||||
GDT_Init ();
|
||||
|
||||
netgraphtexture = texture_extension_number;
|
||||
texture_extension_number++;
|
||||
|
||||
|
|
|
@ -251,8 +251,6 @@ R_Init (void)
|
|||
r_refdef.xOrigin = XCENTERING;
|
||||
r_refdef.yOrigin = YCENTERING;
|
||||
|
||||
R_InitParticles ();
|
||||
|
||||
// TODO: collect 386-specific code in one place
|
||||
#ifdef USE_INTEL_ASM
|
||||
Sys_MakeCodeWriteable ((long) R_EdgeCodeStart,
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
#include "r_dynamic.h"
|
||||
#include "r_local.h"
|
||||
|
||||
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 };
|
||||
int ramp3[8] = { 0x6d, 0x6b, 6, 5, 4, 3 };
|
||||
|
@ -54,40 +52,55 @@ int r_numparticles;
|
|||
vec3_t r_pright, r_pup, r_ppn;
|
||||
cvar_t *r_particles;
|
||||
|
||||
/*
|
||||
R_InitParticles
|
||||
*/
|
||||
void
|
||||
R_InitParticles (void)
|
||||
{
|
||||
// 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, 1);
|
||||
|
||||
particles = (particle_t *)
|
||||
Hunk_AllocName (r_numparticles * sizeof (particle_t), "particles");
|
||||
}
|
||||
|
||||
/*
|
||||
R_MaxParticlesCheck
|
||||
*/
|
||||
/*
|
||||
Misty-chan: Disabled until it is fixed
|
||||
void
|
||||
R_MaxParticlesCheck (void)
|
||||
R_MaxParticlesCheck (cvar_t *var)
|
||||
{
|
||||
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");
|
||||
}
|
||||
// Misty-chan: disabled as it's still not working. Go ahead, try and fix it please :P
|
||||
#if 0
|
||||
// Clear out all the particles. Note this has MASSIVE problems here, it's a lot different than GL that's for sure!
|
||||
R_ClearParticles ();
|
||||
// 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);
|
||||
|
||||
// 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 (!)
|
||||
Con_Printf ("%d", r_numparticles);
|
||||
|
||||
free (particles);
|
||||
|
||||
particles = (particle_t *)
|
||||
calloc (r_numparticles, sizeof (particle_t));
|
||||
|
||||
// My not so successful attempts to get the sw renderer to work on the fly. ATM this causes segfaults anyway. Be wary!
|
||||
particles[0].next = NULL;
|
||||
free_particles = &particles[0];
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
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
|
||||
R_Particles_Init_Cvars (void)
|
||||
{
|
||||
// Does a callback... Currently which does absolutely NOTHING! Joy.
|
||||
cl_max_particles = Cvar_Get ("cl_max_particles", "2048", CVAR_ARCHIVE, R_MaxParticlesCheck,
|
||||
"Maximum amount of particles to display");
|
||||
// This is a temporary hack until R_MaxParticlesCheck is fixed and does NOT belong here. Disable if you're trying to fix above code :)
|
||||
#if 1
|
||||
r_numparticles = max(cl_max_particles->int_val, 1);
|
||||
particles = (particle_t *)
|
||||
calloc (r_numparticles, sizeof (particle_t));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
R_ClearParticles
|
||||
*/
|
||||
|
@ -491,10 +504,6 @@ R_DrawParticles (void)
|
|||
float dvel;
|
||||
float frametime;
|
||||
|
||||
/*
|
||||
Disabled until it is fixed.
|
||||
R_MaxParticlesCheck ();
|
||||
*/
|
||||
D_StartParticles ();
|
||||
|
||||
VectorScale (vright, xscaleshrink, r_pright);
|
||||
|
@ -577,6 +586,5 @@ Disabled until it is fixed.
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
D_EndParticles ();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue