2004-08-23 00:15:46 +00:00
|
|
|
#ifndef _PARTICLES_H_
|
|
|
|
#define _PARTICLES_H_
|
|
|
|
|
|
|
|
extern int pt_explosion,
|
|
|
|
pt_pointfile,
|
|
|
|
pt_entityparticles,
|
|
|
|
pt_darkfield,
|
|
|
|
pt_blob,
|
|
|
|
pt_blood,
|
|
|
|
pt_lightningblood,
|
|
|
|
pt_gunshot,
|
|
|
|
pt_wizspike,
|
|
|
|
pt_knightspike,
|
|
|
|
pt_spike,
|
|
|
|
pt_superspike,
|
|
|
|
pt_lavasplash,
|
|
|
|
pt_teleportsplash,
|
|
|
|
pt_blasterparticles,
|
|
|
|
pt_torch,
|
|
|
|
pt_flame,
|
|
|
|
pt_bullet,
|
|
|
|
pt_superbullet,
|
|
|
|
pe_default;
|
|
|
|
|
2005-03-15 22:51:01 +00:00
|
|
|
extern int rt_blastertrail,
|
|
|
|
rt_railtrail,
|
|
|
|
rt_bubbletrail,
|
|
|
|
rt_rocket,
|
|
|
|
rt_grenade,
|
|
|
|
rt_gib,
|
|
|
|
rt_lightning1,
|
|
|
|
rt_lightning2,
|
2005-05-18 23:15:58 +00:00
|
|
|
rt_lightning3,
|
|
|
|
pt_lightning1_end,
|
|
|
|
pt_lightning2_end,
|
|
|
|
pt_lightning3_end;
|
2005-03-15 22:51:01 +00:00
|
|
|
|
|
|
|
/*
|
2004-08-23 00:15:46 +00:00
|
|
|
extern int rt_rocket_trail,
|
|
|
|
rt_smoke,
|
|
|
|
rt_blood,
|
|
|
|
rt_tracer,
|
|
|
|
rt_slight_blood,
|
|
|
|
rt_tracer2,
|
|
|
|
rt_voor_trail,
|
|
|
|
rt_fireball,
|
|
|
|
rt_ice,
|
|
|
|
rt_spit,
|
|
|
|
rt_spell,
|
|
|
|
rt_vorpal,
|
|
|
|
rt_setstaff,
|
|
|
|
rt_magicmissile,
|
|
|
|
rt_boneshard,
|
|
|
|
rt_scarab,
|
|
|
|
rt_acidball,
|
|
|
|
rt_bloodshot,
|
|
|
|
rt_blastertrail,
|
|
|
|
rt_railtrail,
|
|
|
|
rt_bubbletrail;
|
2005-03-15 22:51:01 +00:00
|
|
|
*/
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
|
|
|
|
typedef struct particle_s
|
|
|
|
{
|
2005-05-13 10:42:48 +00:00
|
|
|
struct particle_s *next;
|
|
|
|
float die;
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
// driver-usable fields
|
|
|
|
vec3_t org;
|
2005-05-13 10:42:48 +00:00
|
|
|
float color; //used by sw renderer. To be removed.
|
2004-08-23 00:15:46 +00:00
|
|
|
vec3_t rgb;
|
|
|
|
float alpha;
|
2004-10-03 22:52:02 +00:00
|
|
|
float scale;
|
|
|
|
|
2005-05-13 10:42:48 +00:00
|
|
|
vec3_t vel; //renderer uses for sparks
|
2004-10-15 18:21:57 +00:00
|
|
|
float angle;
|
|
|
|
float nextemit;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
// drivers never touch the following fields
|
2005-05-13 10:42:48 +00:00
|
|
|
float rotationspeed;
|
|
|
|
} particle_t;
|
2004-10-03 22:52:02 +00:00
|
|
|
|
2005-05-13 10:42:48 +00:00
|
|
|
typedef struct clippeddecal_s
|
|
|
|
{
|
|
|
|
struct clippeddecal_s *next;
|
2004-08-23 00:15:46 +00:00
|
|
|
float die;
|
2005-05-13 10:42:48 +00:00
|
|
|
|
|
|
|
vec3_t center;
|
|
|
|
vec3_t vertex[3];
|
|
|
|
vec2_t texcoords[3];
|
|
|
|
|
|
|
|
vec3_t rgb;
|
|
|
|
float alpha;
|
|
|
|
} clippeddecal_t;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2004-10-15 00:00:15 +00:00
|
|
|
#define BS_LASTSEG 0x1 // no draw to next, no delete
|
|
|
|
#define BS_DEAD 0x2 // segment is dead
|
|
|
|
#define BS_NODRAW 0x4 // only used for lerp switching
|
|
|
|
|
|
|
|
typedef struct beamseg_s
|
|
|
|
{
|
|
|
|
struct beamseg_s *next; // next in beamseg list
|
2005-05-13 10:42:48 +00:00
|
|
|
|
|
|
|
particle_t *p;
|
2004-10-15 00:00:15 +00:00
|
|
|
int flags; // flags for beamseg
|
|
|
|
vec3_t dir;
|
2004-10-15 00:25:17 +00:00
|
|
|
|
|
|
|
float texture_s;
|
2004-10-15 00:00:15 +00:00
|
|
|
} beamseg_t;
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#define PARTICLE_Z_CLIP 8.0
|
|
|
|
|
|
|
|
#define frandom() (rand()*(1.0f/RAND_MAX))
|
|
|
|
#define crandom() (rand()*(2.0f/RAND_MAX)-1.0f)
|
|
|
|
#define hrandom() (rand()*(1.0f/RAND_MAX)-0.5f)
|
|
|
|
|
2005-03-10 03:55:18 +00:00
|
|
|
//main functions
|
|
|
|
void P_DrawParticles (void);
|
|
|
|
void P_InitParticles (void);
|
|
|
|
void P_ClearParticles (void);
|
|
|
|
void P_NewServer(void);
|
|
|
|
|
|
|
|
//allocate a new effect
|
|
|
|
int P_ParticleTypeForName(char *name);
|
2005-03-18 06:13:36 +00:00
|
|
|
int P_AllocateParticleType(char *name); //find one if it exists, or create if it doesn't.
|
2005-05-18 23:15:58 +00:00
|
|
|
int P_FindParticleType(char *name); //checks if particle description 'name' exists, returns -1 if not.
|
|
|
|
|
2005-03-18 06:13:36 +00:00
|
|
|
qboolean P_DescriptionIsLoaded(char *name); //returns true if it's usable.
|
2005-03-10 03:55:18 +00:00
|
|
|
|
|
|
|
void P_SkyTri(float *v1, float *v2, float *v3, struct msurface_s *surf);
|
|
|
|
|
2005-03-15 22:51:01 +00:00
|
|
|
// default particle effect
|
2005-03-10 03:55:18 +00:00
|
|
|
void P_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count); //aka: the particle builtin.
|
2005-03-15 22:51:01 +00:00
|
|
|
|
|
|
|
//wierd effects
|
2005-03-10 03:55:18 +00:00
|
|
|
void P_RunParticleEffect2 (vec3_t org, vec3_t dmin, vec3_t dmax, int color, int effect, int count); //these three are needed for hexen2.
|
|
|
|
void P_RunParticleEffect3 (vec3_t org, vec3_t box, int color, int effect, int count);
|
|
|
|
void P_RunParticleEffect4 (vec3_t org, float radius, int color, int effect, int count);
|
|
|
|
|
|
|
|
void P_DarkFieldParticles (float *org, qbyte colour);
|
|
|
|
void P_EntityParticles (float *org, qbyte colour, float *radius); //nq's EF_BRIGHTFIELD
|
|
|
|
void P_TorchEffect (vec3_t pos, int type); //particles centered around a model, called every frame for those models.
|
|
|
|
|
|
|
|
//functions that spawn point effects (basically just pass throughs)
|
|
|
|
void P_BlobExplosion (vec3_t org); //tarbaby explosion or TF emp.
|
|
|
|
void P_ParticleExplosion (vec3_t org); //rocket explosion (sprite is allocated seperatly :( )
|
|
|
|
void P_LavaSplash (vec3_t org); //cthon dying, or a gas grenade.
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
float lastdist;
|
|
|
|
struct beamseg_s *lastbeam; // last beam point
|
|
|
|
} trailstate_t;
|
|
|
|
//the core spawn function for trails. (trailstate can be null)
|
|
|
|
int P_ParticleTrail (vec3_t start, vec3_t end, int type, trailstate_t *trailstate);
|
|
|
|
|
|
|
|
void P_DefaultTrail (struct model_s *model); //fills in the default particle properties for a loaded model. Should already have the model flags set.
|
|
|
|
|
|
|
|
//the core spawn function for point effects
|
|
|
|
int P_RunParticleEffectType(vec3_t org, vec3_t dir, float count, int type); //1 if failed.
|
2005-03-15 02:57:02 +00:00
|
|
|
int P_RunParticleEffectTypeString (vec3_t org, vec3_t dir, float count, char *name); //1 if failed.
|
2005-03-10 03:55:18 +00:00
|
|
|
|
|
|
|
void P_EmitSkyEffectTris(struct model_s *mod, struct msurface_s *fa);
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|