typedef struct particle_s
{
+ ptype_t type;
vec3_t org;
- float color;
vec3_t vel;
- float die;
- ptype_t type;
- float scale;
rtexture_t *tex;
byte dynlight; // if set the particle will be dynamically lit (if r_dynamicparticles is on), used for smoke and blood
byte rendermode; // a TPOLYTYPE_ value
- byte pad1;
+ byte color;
byte pad2;
+ float die;
+ float scale;
float alpha; // 0-255
float time2; // used for various things (snow fluttering, for example)
- float bounce; // how much bounce-back from a surface the particle hits (0 = no physics, 1 = stop and slide, 2 = keep bouncing forever, 1.5 is typical of bouncing particles)
+ float bounce; // how much bounce-back from a surface the particle hits (0 = no physics, 1 = stop and slide, 2 = keep bouncing forever, 1.5 is typical)
vec3_t oldorg;
vec3_t vel2; // used for snow fluttering (base velocity, wind for instance)
// vec3_t direction; // used by decals
rocketglowparticletexture = R_LoadTexture ("glowparticletexture", 32, 32, &data[0][0][0], TEXF_MIPMAP | TEXF_ALPHA | TEXF_RGBA | TEXF_PRECACHE);
}
-void r_part_start()
+void r_part_start(void)
{
particles = (particle_t *) qmalloc(r_numparticles * sizeof(particle_t));
freeparticles = (void *) qmalloc(r_numparticles * sizeof(particle_t *));
R_InitParticleTexture ();
}
-void r_part_shutdown()
+void r_part_shutdown(void)
{
numparticles = 0;
qfree(particles);
qfree(freeparticles);
}
-void r_part_newmap()
+void r_part_newmap(void)
{
numparticles = 0;
}
void R_ReadPointFile_f (void)
{
- FILE *f;
+ QFile *f;
vec3_t org;
int r;
int c;
sprintf (name,"maps/%s.pts", sv.name);
- COM_FOpenFile (name, &f, false);
+ COM_FOpenFile (name, &f, false, true);
if (!f)
{
Con_Printf ("couldn't open %s\n", name);
c = 0;
for (;;)
{
- r = fscanf (f,"%f %f %f\n", &org[0], &org[1], &org[2]);
+ char *str = Qgetline (f);
+ r = sscanf (str,"%f %f %f\n", &org[0], &org[1], &org[2]);
if (r != 3)
break;
c++;
particle(pt_static, (-c)&15, particletexture, TPOLYTYPE_ALPHA, false, 2, 255, 99999, 0, org[0], org[1], org[2], 0, 0, 0);
}
- fclose (f);
+ Qclose (f);
Con_Printf ("%i points read\n", c);
}
VectorSubtract(end, start, dir);
VectorNormalize(dir);
- if (type == 0) // rocket glow
+ if (type == 0 && host_frametime != 0) // rocket glow
particle(pt_oneframe, 254, rocketglowparticletexture, TPOLYTYPE_ADD, false, 24, 255, 9999, 0, end[0] - 12 * dir[0], end[1] - 12 * dir[1], end[2] - 12 * dir[2], 0, 0, 0);
t = ent->render.trail_time;
R_DrawParticles
===============
*/
-extern cvar_t sv_gravity;
-
void R_MoveParticles (void)
{
particle_t *p;
uprightangles[2] = 0;
AngleVectors (uprightangles, NULL, right2, up2);
- minparticledist = DotProduct(r_refdef.vieworg, vpn) + 16.0f;
+ minparticledist = DotProduct(r_origin, vpn) + 16.0f;
for (i = 0, p = particles;i < numparticles;i++, p++)
{
/*
if (p->type == pt_decal)
{
- VectorSubtract(p->org, r_refdef.vieworg, v);
+ VectorSubtract(p->org, r_origin, v);
if (DotProduct(p->direction, v) < 0)
continue;
}