2004-08-23 00:15:46 +00:00
|
|
|
#ifndef _PARTICLES_H_
|
|
|
|
#define _PARTICLES_H_
|
|
|
|
|
|
|
|
extern int pt_explosion,
|
|
|
|
pt_pointfile,
|
|
|
|
pt_entityparticles,
|
|
|
|
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,
|
2005-10-08 22:35:20 +00:00
|
|
|
pe_default,
|
|
|
|
pe_defaulttrail;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
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
|
|
|
|
2005-05-30 04:34:47 +00:00
|
|
|
struct beamseg_s;
|
|
|
|
|
|
|
|
typedef struct trailstate_s {
|
|
|
|
struct trailstate_s **key; // key to check if ts has been overwriten
|
|
|
|
struct trailstate_s *assoc; // assoc linked trail
|
|
|
|
struct beamseg_s *lastbeam; // last beam pointer (flagged with BS_LASTSEG)
|
|
|
|
union {
|
|
|
|
float lastdist; // last distance used with particle effect
|
2005-08-06 22:39:28 +00:00
|
|
|
float statetime; // time to emit effect again (used by spawntime field)
|
|
|
|
};
|
|
|
|
union {
|
|
|
|
float laststop; // last stopping point for particle effect
|
|
|
|
float emittime; // used by r_effect emitters
|
2005-05-30 04:34:47 +00:00
|
|
|
};
|
|
|
|
} trailstate_t;
|
|
|
|
|
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;
|
2005-05-30 04:34:47 +00:00
|
|
|
union {
|
|
|
|
float nextemit;
|
|
|
|
trailstate_t *trailstate;
|
|
|
|
};
|
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-07-03 15:16:20 +00:00
|
|
|
int P_DescriptionIsLoaded(char *name); //returns true if it's usable.
|
2005-10-07 02:10:27 +00:00
|
|
|
qboolean P_TypeIsLoaded(int effect);
|
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);
|
|
|
|
|
2005-08-06 22:39:28 +00:00
|
|
|
void P_EmitEffect (vec3_t pos, int type, trailstate_t **tsk); //particles centered around a model, called every frame for those models.
|
2005-03-10 03:55:18 +00:00
|
|
|
|
|
|
|
//functions that spawn point effects (basically just pass throughs)
|
|
|
|
void P_BlobExplosion (vec3_t org); //tarbaby explosion or TF emp.
|
|
|
|
void P_LavaSplash (vec3_t org); //cthon dying, or a gas grenade.
|
2005-08-03 23:14:59 +00:00
|
|
|
void P_RunParticleCube(vec3_t minb, vec3_t maxb, vec3_t dir, float count, int colour, qboolean gravity, float jitter);
|
|
|
|
void P_RunParticleWeather(vec3_t minb, vec3_t maxb, vec3_t dir, float count, int colour, char *efname);
|
2005-03-10 03:55:18 +00:00
|
|
|
|
|
|
|
//the core spawn function for trails. (trailstate can be null)
|
2005-05-30 04:34:47 +00:00
|
|
|
int P_ParticleTrail (vec3_t start, vec3_t end, int type, trailstate_t **trailstate);
|
2005-10-08 22:35:20 +00:00
|
|
|
void P_ParticleTrailIndex (vec3_t start, vec3_t end, int color, int rndcolor, trailstate_t **trailstate);
|
2005-03-10 03:55:18 +00:00
|
|
|
|
|
|
|
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
|
2005-08-06 22:39:28 +00:00
|
|
|
int P_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum, trailstate_t **tsk); //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-08-06 22:39:28 +00:00
|
|
|
#define P_RunParticleEffectType(a,b,c,d) P_RunParticleEffectState(a,b,c,d,NULL)
|
2005-03-10 03:55:18 +00:00
|
|
|
|
|
|
|
void P_EmitSkyEffectTris(struct model_s *mod, struct msurface_s *fa);
|
|
|
|
|
2005-05-30 11:05:44 +00:00
|
|
|
// trailstate functions
|
|
|
|
void P_DelinkTrailstate(trailstate_t **tsk);
|
|
|
|
|
2005-09-08 22:52:46 +00:00
|
|
|
typedef enum { BM_BLEND, BM_BLENDCOLOUR, BM_ADD, BM_SUBTRACT } blendmode_t;
|
2005-07-29 01:12:09 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|