mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-16 17:01:53 +00:00
make the raw particle creation functions available and use them for creating the location marker effect rather than WizSpikeEffect
This commit is contained in:
parent
755820d8b2
commit
d1e2b6b7d2
6 changed files with 133 additions and 6 deletions
|
@ -64,6 +64,12 @@ typedef enum {
|
|||
pt_flame
|
||||
} ptype_t;
|
||||
|
||||
typedef enum {
|
||||
part_tex_dot,
|
||||
part_tex_spark,
|
||||
part_tex_smoke,
|
||||
} ptextype_t;
|
||||
|
||||
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
|
||||
typedef struct particle_s
|
||||
{
|
||||
|
@ -71,7 +77,7 @@ typedef struct particle_s
|
|||
vec3_t org;
|
||||
int color;
|
||||
float alpha;
|
||||
int tex;
|
||||
ptextype_t tex;
|
||||
float scale;
|
||||
// drivers never touch the following fields
|
||||
vec3_t vel;
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
#include "QF/mathlib.h"
|
||||
|
||||
#include "d_iface.h"
|
||||
|
||||
typedef enum {
|
||||
PE_UNKNOWN,
|
||||
PE_GUNSHOT,
|
||||
|
@ -76,6 +78,12 @@ void R_PushDlights (const vec3_t entorigin);
|
|||
struct cvar_s;
|
||||
void R_MaxDlightsCheck (struct cvar_s *var);
|
||||
void R_Particles_Init_Cvars (void);
|
||||
void R_Particle_New (ptype_t type, int texnum, const vec3_t org, float scale,
|
||||
const vec3_t vel, float die, int color, float alpha,
|
||||
float ramp);
|
||||
void R_Particle_NewRandom (ptype_t type, int texnum, const vec3_t org,
|
||||
int org_fuzz, float scale, int vel_fuzz, float die,
|
||||
int color, float alpha, float ramp);
|
||||
void R_InitBubble (void);
|
||||
|
||||
void R_InitParticles (void);
|
||||
|
|
|
@ -64,10 +64,6 @@ 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, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 };
|
||||
|
||||
int part_tex_dot = 0;
|
||||
int part_tex_spark = 1;
|
||||
int part_tex_smoke = 2;
|
||||
|
||||
int pVAsize;
|
||||
int *pVAindices;
|
||||
varray_t2f_c4ub_v3f_t *particleVertexArray;
|
||||
|
@ -1772,3 +1768,23 @@ R_Particles_Init_Cvars (void)
|
|||
{
|
||||
R_ParticleFunctionInit ();
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
R_Particle_New (ptype_t type, int texnum, const vec3_t org, float scale,
|
||||
const vec3_t vel, float die, int color, float alpha, float ramp)
|
||||
{
|
||||
if (numparticles >= r_maxparticles)
|
||||
return;
|
||||
particle_new (type, texnum, org, scale, vel, die, color, alpha, ramp);
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
R_Particle_NewRandom (ptype_t type, int texnum, const vec3_t org, int org_fuzz,
|
||||
float scale, int vel_fuzz, float die, int color,
|
||||
float alpha, float ramp)
|
||||
{
|
||||
if (numparticles >= r_maxparticles)
|
||||
return;
|
||||
particle_new_random (type, texnum, org, org_fuzz, scale, vel_fuzz, die,
|
||||
color, alpha, ramp);
|
||||
}
|
||||
|
|
|
@ -871,3 +871,48 @@ R_Particles_Init_Cvars (void)
|
|||
{
|
||||
R_ParticleFunctionInit ();
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
R_Particle_New (ptype_t type, int texnum, const vec3_t org, float scale,
|
||||
const vec3_t vel, float die, int color, float alpha, float ramp)
|
||||
{
|
||||
particle_t *p;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (org, p->org);
|
||||
p->color = color;
|
||||
p->tex = texnum;
|
||||
p->scale = scale;
|
||||
p->alpha = alpha;
|
||||
VectorCopy (vel, p->vel);
|
||||
p->type = type;
|
||||
p->die = die;
|
||||
p->ramp = ramp;
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
R_Particle_NewRandom (ptype_t type, int texnum, const vec3_t org, int org_fuzz,
|
||||
float scale, int vel_fuzz, float die, int color,
|
||||
float alpha, float ramp)
|
||||
{
|
||||
float o_fuzz = org_fuzz, v_fuzz = vel_fuzz;
|
||||
int rnd;
|
||||
vec3_t porg, pvel;
|
||||
|
||||
rnd = rand ();
|
||||
porg[0] = o_fuzz * ((rnd & 63) - 31.5) / 63.0 + org[0];
|
||||
porg[1] = o_fuzz * (((rnd >> 5) & 63) - 31.5) / 63.0 + org[1];
|
||||
porg[2] = o_fuzz * (((rnd >> 10) & 63) - 31.5) / 63.0 + org[2];
|
||||
rnd = rand ();
|
||||
pvel[0] = v_fuzz * ((rnd & 63) - 31.5) / 63.0;
|
||||
pvel[1] = v_fuzz * (((rnd >> 5) & 63) - 31.5) / 63.0;
|
||||
pvel[2] = v_fuzz * (((rnd >> 10) & 63) - 31.5) / 63.0;
|
||||
|
||||
R_Particle_New (type, texnum, porg, scale, pvel, die, color, alpha, ramp);
|
||||
}
|
||||
|
|
|
@ -881,3 +881,48 @@ R_Particles_Init_Cvars (void)
|
|||
{
|
||||
R_ParticleFunctionInit ();
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
R_Particle_New (ptype_t type, int texnum, const vec3_t org, float scale,
|
||||
const vec3_t vel, float die, int color, float alpha, float ramp)
|
||||
{
|
||||
particle_t *p;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (org, p->org);
|
||||
p->color = color;
|
||||
p->tex = texnum;
|
||||
p->scale = scale;
|
||||
p->alpha = alpha;
|
||||
VectorCopy (vel, p->vel);
|
||||
p->type = type;
|
||||
p->die = die;
|
||||
p->ramp = ramp;
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
R_Particle_NewRandom (ptype_t type, int texnum, const vec3_t org, int org_fuzz,
|
||||
float scale, int vel_fuzz, float die, int color,
|
||||
float alpha, float ramp)
|
||||
{
|
||||
float o_fuzz = org_fuzz, v_fuzz = vel_fuzz;
|
||||
int rnd;
|
||||
vec3_t porg, pvel;
|
||||
|
||||
rnd = rand ();
|
||||
porg[0] = o_fuzz * ((rnd & 63) - 31.5) / 63.0 + org[0];
|
||||
porg[1] = o_fuzz * (((rnd >> 5) & 63) - 31.5) / 63.0 + org[1];
|
||||
porg[2] = o_fuzz * (((rnd >> 10) & 63) - 31.5) / 63.0 + org[2];
|
||||
rnd = rand ();
|
||||
pvel[0] = v_fuzz * ((rnd & 63) - 31.5) / 63.0;
|
||||
pvel[1] = v_fuzz * (((rnd >> 5) & 63) - 31.5) / 63.0;
|
||||
pvel[2] = v_fuzz * (((rnd >> 10) & 63) - 31.5) / 63.0;
|
||||
|
||||
R_Particle_New (type, texnum, porg, scale, pvel, die, color, alpha, ramp);
|
||||
}
|
||||
|
|
|
@ -1164,6 +1164,7 @@ CL_EmitEntities (void)
|
|||
dlight_t *dl;
|
||||
location_t *nearloc;
|
||||
vec3_t trueloc;
|
||||
int i;
|
||||
|
||||
nearloc = locs_find (r_origin);
|
||||
if (nearloc) {
|
||||
|
@ -1178,7 +1179,13 @@ CL_EmitEntities (void)
|
|||
dl->color[3] = 0.7;
|
||||
}
|
||||
VectorCopy (nearloc->loc, trueloc);
|
||||
R_WizSpikeEffect (trueloc);
|
||||
R_Particle_New (pt_smokecloud, part_tex_smoke, trueloc, 2.0,
|
||||
vec3_origin, r_realtime + 9.0, 254,
|
||||
0.25 + qfrandom (0.125), 0.0);
|
||||
for (i = 0; i < 15; i++)
|
||||
R_Particle_NewRandom (pt_fallfade, part_tex_dot, trueloc, 12,
|
||||
0.7, 96, r_realtime + 5.0,
|
||||
104 + (rand () & 7), 1.0, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue