pass integer key reference instead of pointer reference to particle systems, remove switch fallthrough on q64 bsp switch
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6041 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
0382bb7049
commit
904fa4ce64
10 changed files with 100 additions and 112 deletions
|
@ -208,8 +208,8 @@ struct beam_s {
|
||||||
vec3_t start, end;
|
vec3_t start, end;
|
||||||
vec3_t offset; //when attached, this is the offset from the owning entity. probably only z is meaningful.
|
vec3_t offset; //when attached, this is the offset from the owning entity. probably only z is meaningful.
|
||||||
// int particlecolour; //some effects have specific colours. which is weird.
|
// int particlecolour; //some effects have specific colours. which is weird.
|
||||||
trailstate_t *trailstate;
|
trailkey_t trailstate;
|
||||||
trailstate_t *emitstate;
|
trailkey_t emitstate;
|
||||||
};
|
};
|
||||||
|
|
||||||
beam_t *cl_beams;
|
beam_t *cl_beams;
|
||||||
|
@ -237,7 +237,7 @@ typedef struct
|
||||||
model_t *model;
|
model_t *model;
|
||||||
int skinnum;
|
int skinnum;
|
||||||
int traileffect;
|
int traileffect;
|
||||||
trailstate_t *trailstate;
|
trailkey_t trailstate;
|
||||||
} explosion_t;
|
} explosion_t;
|
||||||
|
|
||||||
static explosion_t *cl_explosions;
|
static explosion_t *cl_explosions;
|
||||||
|
@ -2326,7 +2326,7 @@ void CL_ParseTrailParticles(void)
|
||||||
int entityindex;
|
int entityindex;
|
||||||
int effectindex;
|
int effectindex;
|
||||||
vec3_t start, end;
|
vec3_t start, end;
|
||||||
trailstate_t **ts;
|
trailkey_t *tk;
|
||||||
|
|
||||||
entityindex = MSGCL_ReadEntity();
|
entityindex = MSGCL_ReadEntity();
|
||||||
effectindex = (unsigned short)MSG_ReadShort();
|
effectindex = (unsigned short)MSG_ReadShort();
|
||||||
|
@ -2341,12 +2341,12 @@ void CL_ParseTrailParticles(void)
|
||||||
effectindex = CL_TranslateParticleFromServer(effectindex);
|
effectindex = CL_TranslateParticleFromServer(effectindex);
|
||||||
|
|
||||||
if (entityindex>0 && (unsigned int)entityindex < cl.maxlerpents)
|
if (entityindex>0 && (unsigned int)entityindex < cl.maxlerpents)
|
||||||
ts = &cl.lerpents[entityindex].trailstate;
|
tk = &cl.lerpents[entityindex].trailstate;
|
||||||
else
|
else
|
||||||
ts = NULL;
|
tk = NULL;
|
||||||
|
|
||||||
if (P_ParticleTrail(start, end, effectindex, 1, entityindex, NULL, ts))
|
if (P_ParticleTrail(start, end, effectindex, 1, entityindex, NULL, tk))
|
||||||
P_ParticleTrail(start, end, rt_blood, 1, entityindex, NULL, ts);
|
P_ParticleTrail(start, end, rt_blood, 1, entityindex, NULL, tk);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_ParsePointParticles(qboolean compact)
|
void CL_ParsePointParticles(qboolean compact)
|
||||||
|
|
|
@ -584,8 +584,8 @@ typedef struct downloadlist_s {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
//current persistant state
|
//current persistant state
|
||||||
trailstate_t *trailstate; //when to next throw out a trail
|
trailkey_t trailstate; //when to next throw out a trail
|
||||||
trailstate_t *emitstate; //when to next emit
|
trailkey_t emitstate; //when to next emit
|
||||||
|
|
||||||
//current origin
|
//current origin
|
||||||
vec3_t origin; //current render position
|
vec3_t origin; //current render position
|
||||||
|
@ -1084,7 +1084,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
entity_t ent;
|
entity_t ent;
|
||||||
entity_state_t state;
|
entity_state_t state;
|
||||||
trailstate_t *emit;
|
trailkey_t emit;
|
||||||
int mdlidx; /*negative are csqc indexes*/
|
int mdlidx; /*negative are csqc indexes*/
|
||||||
} static_entity_t;
|
} static_entity_t;
|
||||||
|
|
||||||
|
|
|
@ -89,8 +89,8 @@ typedef struct q2centity_s
|
||||||
|
|
||||||
int serverframe; // if not current, this ent isn't in the frame
|
int serverframe; // if not current, this ent isn't in the frame
|
||||||
|
|
||||||
trailstate_t *trailstate;
|
trailkey_t trailstate;
|
||||||
trailstate_t *emitstate;
|
trailkey_t emitstate;
|
||||||
// float trailcount; // for diminishing grenade trails
|
// float trailcount; // for diminishing grenade trails
|
||||||
vec3_t lerp_origin; // for trails (variable hz)
|
vec3_t lerp_origin; // for trails (variable hz)
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ static void PClassic_RunParticleEffect4 (vec3_t org, float radius, int color, in
|
||||||
}
|
}
|
||||||
|
|
||||||
//this function is used as a fallback in case a trail effect is unknown.
|
//this function is used as a fallback in case a trail effect is unknown.
|
||||||
static void PClassic_ParticleTrailIndex (vec3_t start, vec3_t end, int type, float timestep, int color, int crnd, trailstate_t **tsk)
|
static void PClassic_ParticleTrailIndex (vec3_t start, vec3_t end, int type, float timestep, int color, int crnd, trailkey_t *tk)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,11 +328,11 @@ static void PClassic_ShutdownParticles(void)
|
||||||
particles = NULL;
|
particles = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// a classic trailstate is really just a float stored in a pointer variable...
|
// a classic trailstate key is really just a float
|
||||||
// assuming float alignment/size is more strict than pointer
|
// assuming float alignment/size is more strict than our key type
|
||||||
static float Classic_GetLeftover(trailstate_t **tsk)
|
static float Classic_GetLeftover(trailkey_t *tk)
|
||||||
{
|
{
|
||||||
float *f = (float *)tsk;
|
float *f = (float *)tk;
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -340,18 +340,18 @@ static float Classic_GetLeftover(trailstate_t **tsk)
|
||||||
return *f;
|
return *f;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Classic_SetLeftover(trailstate_t **tsk, float leftover)
|
static void Classic_SetLeftover(trailkey_t *tk, float leftover)
|
||||||
{
|
{
|
||||||
float *f = (float *)tsk;
|
float *f = (float *)tk;
|
||||||
|
|
||||||
if (f)
|
if (f)
|
||||||
*f = leftover;
|
*f = leftover;
|
||||||
}
|
}
|
||||||
|
|
||||||
//called when an entity is removed from the world, taking its trailstate with it.
|
//called when an entity is removed from the world, taking its trailstate with it.
|
||||||
static void PClassic_DelinkTrailstate(trailstate_t **tsk)
|
static void PClassic_DelinkTrailstate(trailkey_t *tk)
|
||||||
{
|
{
|
||||||
*tsk = NULL;
|
*tk = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//wipes all the particles ready for the next map.
|
//wipes all the particles ready for the next map.
|
||||||
|
@ -907,7 +907,7 @@ static void Classic_BrightField (vec3_t org)
|
||||||
|
|
||||||
//svc_tempentity support: this is the function that handles 'special' point effects.
|
//svc_tempentity support: this is the function that handles 'special' point effects.
|
||||||
//use the trail state so fast/slow frames keep the correct particle counts on certain every-frame effects
|
//use the trail state so fast/slow frames keep the correct particle counts on certain every-frame effects
|
||||||
static int PClassic_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum, trailstate_t **tsk)
|
static int PClassic_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum, trailkey_t *tk)
|
||||||
{
|
{
|
||||||
switch(typenum&0xff)
|
switch(typenum&0xff)
|
||||||
{
|
{
|
||||||
|
@ -1125,15 +1125,15 @@ int PClassic_PointFile(int c, vec3_t point)
|
||||||
}
|
}
|
||||||
|
|
||||||
//builds a trail from here to there. The trail state can be used to remember how far you got last frame.
|
//builds a trail from here to there. The trail state can be used to remember how far you got last frame.
|
||||||
static int PClassic_ParticleTrail (vec3_t startpos, vec3_t end, int type, float timestep, int dlkey, vec3_t dlaxis[3], trailstate_t **tsk)
|
static int PClassic_ParticleTrail (vec3_t startpos, vec3_t end, int type, float timestep, int dlkey, vec3_t dlaxis[3], trailkey_t *tk)
|
||||||
{
|
{
|
||||||
float leftover;
|
float leftover;
|
||||||
|
|
||||||
if (type == P_INVALID)
|
if (type == P_INVALID)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
leftover = Classic_ParticleTrail(startpos, end, Classic_GetLeftover(tsk), type);
|
leftover = Classic_ParticleTrail(startpos, end, Classic_GetLeftover(tk), type);
|
||||||
Classic_SetLeftover(tsk, leftover);
|
Classic_SetLeftover(tk, leftover);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ static int PNULL_FindParticleType(const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int PNULL_RunParticleEffectTypeString (vec3_t org, vec3_t dir, float count, char *name){return 1;}
|
static int PNULL_RunParticleEffectTypeString (vec3_t org, vec3_t dir, float count, char *name){return 1;}
|
||||||
static int PNULL_ParticleTrail (vec3_t startpos, vec3_t end, int type, float timestep, int dlkey, vec3_t dlaxis[3], trailstate_t **tsk){return 1;}
|
static int PNULL_ParticleTrail (vec3_t startpos, vec3_t end, int type, float timestep, int dlkey, vec3_t dlaxis[3], trailkey_t *tk){return 1;}
|
||||||
static int PNULL_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum, trailstate_t **tsk){return 1;}
|
static int PNULL_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum, trailkey_t *tk){return 1;}
|
||||||
static void PNULL_RunParticleWeather(vec3_t minb, vec3_t maxb, vec3_t dir, float count, int colour, char *efname){}
|
static void PNULL_RunParticleWeather(vec3_t minb, vec3_t maxb, vec3_t dir, float count, int colour, char *efname){}
|
||||||
static void PNULL_RunParticleCube(int typenum, vec3_t minb, vec3_t maxb, vec3_t dir_min, vec3_t dir_max, float count, int colour, qboolean gravity, float jitter){}
|
static void PNULL_RunParticleCube(int typenum, vec3_t minb, vec3_t maxb, vec3_t dir_min, vec3_t dir_max, float count, int colour, qboolean gravity, float jitter){}
|
||||||
static void PNULL_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count){}
|
static void PNULL_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count){}
|
||||||
|
@ -22,7 +22,7 @@ static void PNULL_RunParticleEffect3 (vec3_t org, vec3_t box, int color, int eff
|
||||||
static void PNULL_RunParticleEffect4 (vec3_t org, float radius, int color, int effect, int count){}
|
static void PNULL_RunParticleEffect4 (vec3_t org, float radius, int color, int effect, int count){}
|
||||||
static void PNULL_RunParticleEffectPalette (const char *nameprefix, vec3_t org, vec3_t dir, int color, int count){}
|
static void PNULL_RunParticleEffectPalette (const char *nameprefix, vec3_t org, vec3_t dir, int color, int count){}
|
||||||
|
|
||||||
static void PNULL_ParticleTrailIndex (vec3_t start, vec3_t end, int type, float timestep, int color, int crnd, trailstate_t **tsk){}
|
static void PNULL_ParticleTrailIndex (vec3_t start, vec3_t end, int type, float timestep, int color, int crnd, trailkey_t *tk){}
|
||||||
|
|
||||||
static qboolean PNULL_InitParticles (void)
|
static qboolean PNULL_InitParticles (void)
|
||||||
{
|
{
|
||||||
|
@ -33,9 +33,9 @@ static void PNULL_ShutdownParticles(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PNULL_DelinkTrailstate(trailstate_t **tsk)
|
static void PNULL_DelinkTrailstate(trailkey_t *tk)
|
||||||
{
|
{
|
||||||
*tsk = NULL;
|
*tk = 0;
|
||||||
}
|
}
|
||||||
static void PNULL_ClearParticles (void){}
|
static void PNULL_ClearParticles (void){}
|
||||||
static void PNULL_DrawParticles(void)
|
static void PNULL_DrawParticles(void)
|
||||||
|
|
|
@ -110,7 +110,7 @@ typedef struct particle_s
|
||||||
float angle;
|
float angle;
|
||||||
union {
|
union {
|
||||||
float nextemit;
|
float nextemit;
|
||||||
trailstate_t *trailstate;
|
trailkey_t trailstate;
|
||||||
} state;
|
} state;
|
||||||
// drivers never touch the following fields
|
// drivers never touch the following fields
|
||||||
float rotationspeed;
|
float rotationspeed;
|
||||||
|
@ -146,6 +146,22 @@ typedef struct beamseg_s
|
||||||
float texture_s;
|
float texture_s;
|
||||||
} beamseg_t;
|
} beamseg_t;
|
||||||
|
|
||||||
|
typedef struct trailstate_s {
|
||||||
|
trailkey_t key; // key to check if ts has been overwriten
|
||||||
|
trailkey_t assoc; // assoc linked trail
|
||||||
|
struct beamseg_s* lastbeam; // last beam pointer (flagged with BS_LASTSEG)
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
float lastdist; // last distance used with particle effect
|
||||||
|
float laststop; // last stopping point for particle effect
|
||||||
|
} trail;
|
||||||
|
struct {
|
||||||
|
float statetime; // time to emit effect again (used by spawntime field)
|
||||||
|
float emittime; // used by r_effect emitters
|
||||||
|
} effect;
|
||||||
|
trailkey_t fallbackkey; // passed to fallback system
|
||||||
|
};
|
||||||
|
} trailstate_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct skytris_s {
|
typedef struct skytris_s {
|
||||||
|
@ -4123,33 +4139,27 @@ static void P_CleanTrailstate(trailstate_t *ts)
|
||||||
memset(ts, 0, sizeof(trailstate_t));
|
memset(ts, 0, sizeof(trailstate_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PScript_DelinkTrailstate(trailstate_t **tsk)
|
static void PScript_DelinkTrailstate(trailkey_t *tk)
|
||||||
{
|
{
|
||||||
|
trailkey_t key;
|
||||||
trailstate_t *ts;
|
trailstate_t *ts;
|
||||||
trailstate_t *assoc;
|
|
||||||
|
|
||||||
if (*tsk == NULL)
|
key = *tk;
|
||||||
return; // not linked to a trailstate
|
*tk = 0;
|
||||||
|
|
||||||
ts = *tsk; // store old pointer
|
while (key && key <= r_numtrailstates)
|
||||||
*tsk = NULL; // clear pointer
|
|
||||||
|
|
||||||
if (ts->key != tsk)
|
|
||||||
return; // prevent overwrite
|
|
||||||
|
|
||||||
assoc = ts->assoc; // store assoc
|
|
||||||
P_CleanTrailstate(ts); // clean directly linked trailstate
|
|
||||||
|
|
||||||
// clean trailstates assoc linked
|
|
||||||
while (assoc)
|
|
||||||
{
|
{
|
||||||
ts = assoc->assoc;
|
ts = trailstates + (key - 1);
|
||||||
P_CleanTrailstate(assoc);
|
|
||||||
assoc = ts;
|
if (ts->key != key)
|
||||||
|
break; // prevent overwrite
|
||||||
|
|
||||||
|
key = ts->assoc; // next to clean
|
||||||
|
P_CleanTrailstate(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static trailstate_t *P_NewTrailstate(trailstate_t **key)
|
static trailstate_t *P_NewTrailstate()
|
||||||
{
|
{
|
||||||
trailstate_t *ts;
|
trailstate_t *ts;
|
||||||
|
|
||||||
|
@ -4157,42 +4167,34 @@ static trailstate_t *P_NewTrailstate(trailstate_t **key)
|
||||||
if (ts_cycle >= r_numtrailstates)
|
if (ts_cycle >= r_numtrailstates)
|
||||||
ts_cycle = 0;
|
ts_cycle = 0;
|
||||||
|
|
||||||
// get trailstate
|
|
||||||
ts = trailstates + ts_cycle;
|
ts = trailstates + ts_cycle;
|
||||||
|
|
||||||
// clear trailstate
|
|
||||||
P_CleanTrailstate(ts);
|
P_CleanTrailstate(ts);
|
||||||
|
|
||||||
// set key
|
|
||||||
ts->key = key;
|
|
||||||
|
|
||||||
// advance index cycle
|
|
||||||
ts_cycle++;
|
ts_cycle++;
|
||||||
|
ts->key = ts_cycle; // key is 1 above index, allows 0 to be invalid
|
||||||
|
|
||||||
// return clean trailstate
|
|
||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
static trailstate_t* P_FetchTrailstate(trailstate_t** tsk)
|
static trailstate_t* P_FetchTrailstate(trailkey_t* tk)
|
||||||
{
|
{
|
||||||
trailstate_t* ts;
|
trailstate_t* ts;
|
||||||
|
|
||||||
// trailstate allocation/deallocation
|
// trailstate allocation/deallocation
|
||||||
if (tsk)
|
if (tk)
|
||||||
{
|
{
|
||||||
if (*tsk == NULL)
|
trailkey_t key = *tk;
|
||||||
|
if (key == 0 || key > r_numtrailstates)
|
||||||
{
|
{
|
||||||
ts = P_NewTrailstate(tsk);
|
ts = P_NewTrailstate();
|
||||||
*tsk = ts;
|
*tk = ts->key;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ts = *tsk;
|
ts = trailstates + (key - 1);
|
||||||
|
if (ts->key != key) // trailstate was overwritten
|
||||||
if (ts->key != tsk) // trailstate was overwritten
|
|
||||||
{
|
{
|
||||||
ts = P_NewTrailstate(tsk); // so get a new one
|
ts = P_NewTrailstate(); // so get a new one
|
||||||
*tsk = ts;
|
*tk = ts->key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4658,7 +4660,7 @@ static void PScript_AddDecals(void *vctx, vec3_t *fte_restrict points, size_t nu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int PScript_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum, trailstate_t **tsk)
|
static int PScript_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum, trailkey_t *tk)
|
||||||
{
|
{
|
||||||
part_type_t *ptype = &part_type[typenum];
|
part_type_t *ptype = &part_type[typenum];
|
||||||
int i, j, k, l, spawnspc;
|
int i, j, k, l, spawnspc;
|
||||||
|
@ -4692,9 +4694,9 @@ static int PScript_RunParticleEffectState (vec3_t org, vec3_t dir, float count,
|
||||||
|
|
||||||
// eliminate trailstate if flag set
|
// eliminate trailstate if flag set
|
||||||
if (ptype->flags & PT_NOSTATE)
|
if (ptype->flags & PT_NOSTATE)
|
||||||
tsk = NULL;
|
tk = NULL;
|
||||||
|
|
||||||
ts = P_FetchTrailstate(tsk);
|
ts = P_FetchTrailstate(tk);
|
||||||
|
|
||||||
// get msvc to shut up
|
// get msvc to shut up
|
||||||
j = k = l = 0;
|
j = k = l = 0;
|
||||||
|
@ -5263,8 +5265,8 @@ skip:
|
||||||
// new trailstate
|
// new trailstate
|
||||||
if (ts)
|
if (ts)
|
||||||
{
|
{
|
||||||
tsk = &(ts->assoc);
|
tk = &(ts->assoc);
|
||||||
ts = P_FetchTrailstate(tsk);
|
ts = P_FetchTrailstate(tk);
|
||||||
}
|
}
|
||||||
|
|
||||||
ptype = &part_type[ptype->assoc];
|
ptype = &part_type[ptype->assoc];
|
||||||
|
@ -5550,7 +5552,7 @@ static void PScript_RunParticleEffectPalette (const char *nameprefix, vec3_t org
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_ParticleTrailSpawn (vec3_t startpos, vec3_t end, part_type_t *ptype, float timeinterval, trailstate_t** tsk, int dlkey, vec3_t dlaxis[3])
|
static void P_ParticleTrailSpawn (vec3_t startpos, vec3_t end, part_type_t *ptype, float timeinterval, trailkey_t* tk, int dlkey, vec3_t dlaxis[3])
|
||||||
{
|
{
|
||||||
vec3_t vec, vstep, right, up, start;
|
vec3_t vec, vstep, right, up, start;
|
||||||
float len;
|
float len;
|
||||||
|
@ -5572,9 +5574,9 @@ static void P_ParticleTrailSpawn (vec3_t startpos, vec3_t end, part_type_t *ptyp
|
||||||
|
|
||||||
// eliminate trailstate if flag set
|
// eliminate trailstate if flag set
|
||||||
if (ptype->flags & PT_NOSTATE)
|
if (ptype->flags & PT_NOSTATE)
|
||||||
tsk = NULL;
|
tk = NULL;
|
||||||
|
|
||||||
ts = P_FetchTrailstate(tsk);
|
ts = P_FetchTrailstate(tk);
|
||||||
|
|
||||||
PScript_EffectSpawned(ptype, start, dlaxis, dlkey, 1);
|
PScript_EffectSpawned(ptype, start, dlaxis, dlkey, 1);
|
||||||
|
|
||||||
|
@ -6051,7 +6053,7 @@ static void P_ParticleTrailSpawn (vec3_t startpos, vec3_t end, part_type_t *ptyp
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int PScript_ParticleTrail (vec3_t startpos, vec3_t end, int type, float timeinterval, int dlkey, vec3_t axis[3], trailstate_t **tsk)
|
static int PScript_ParticleTrail (vec3_t startpos, vec3_t end, int type, float timeinterval, int dlkey, vec3_t axis[3], trailkey_t *tk)
|
||||||
{
|
{
|
||||||
part_type_t *ptype = &part_type[type];
|
part_type_t *ptype = &part_type[type];
|
||||||
|
|
||||||
|
@ -6063,8 +6065,8 @@ static int PScript_ParticleTrail (vec3_t startpos, vec3_t end, int type, float t
|
||||||
// also reusing fallback space for emit/trail info will cause some
|
// also reusing fallback space for emit/trail info will cause some
|
||||||
// issues with entities in action during particle reconfiguration
|
// issues with entities in action during particle reconfiguration
|
||||||
// but that shouldn't be happening too often
|
// but that shouldn't be happening too often
|
||||||
trailstate_t* ts = P_FetchTrailstate(tsk);
|
trailstate_t* ts = P_FetchTrailstate(tk);
|
||||||
return fallback->ParticleTrail(startpos, end, type - FALLBACKBIAS, timeinterval, dlkey, axis, &(ts->fallback));
|
return fallback->ParticleTrail(startpos, end, type - FALLBACKBIAS, timeinterval, dlkey, axis, &(ts->fallbackkey));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type < 0 || type >= numparticletypes)
|
if (type < 0 || type >= numparticletypes)
|
||||||
|
@ -6083,11 +6085,11 @@ static int PScript_ParticleTrail (vec3_t startpos, vec3_t end, int type, float t
|
||||||
ptype = &part_type[ptype->inwater];
|
ptype = &part_type[ptype->inwater];
|
||||||
}
|
}
|
||||||
|
|
||||||
P_ParticleTrailSpawn (startpos, end, ptype, timeinterval, tsk, dlkey, axis);
|
P_ParticleTrailSpawn (startpos, end, ptype, timeinterval, tk, dlkey, axis);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PScript_ParticleTrailIndex (vec3_t start, vec3_t end, int type, float timeinterval, int color, int crnd, trailstate_t **tsk)
|
static void PScript_ParticleTrailIndex (vec3_t start, vec3_t end, int type, float timeinterval, int color, int crnd, trailkey_t *tk)
|
||||||
{
|
{
|
||||||
if (type == P_INVALID)
|
if (type == P_INVALID)
|
||||||
type = pe_defaulttrail;
|
type = pe_defaulttrail;
|
||||||
|
@ -6095,7 +6097,7 @@ static void PScript_ParticleTrailIndex (vec3_t start, vec3_t end, int type, floa
|
||||||
{
|
{
|
||||||
part_type[type].colorindex = color;
|
part_type[type].colorindex = color;
|
||||||
part_type[type].colorrand = crnd;
|
part_type[type].colorrand = crnd;
|
||||||
P_ParticleTrail(start, end, type, timeinterval, 0, NULL, tsk);
|
P_ParticleTrail(start, end, type, timeinterval, 0, NULL, tk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -419,7 +419,7 @@ typedef struct csqcedict_s
|
||||||
/*the above is shared with ssqc*/
|
/*the above is shared with ssqc*/
|
||||||
|
|
||||||
//add whatever you wish here
|
//add whatever you wish here
|
||||||
trailstate_t *trailstate;
|
trailkey_t trailstate;
|
||||||
int skinobject;
|
int skinobject;
|
||||||
} csqcedict_t;
|
} csqcedict_t;
|
||||||
|
|
||||||
|
|
|
@ -958,7 +958,7 @@ float CL_TraceLine (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal, int
|
||||||
}
|
}
|
||||||
|
|
||||||
//handy utility...
|
//handy utility...
|
||||||
void P_EmitEffect (vec3_t pos, vec3_t orientation[3], unsigned int modeleflags, int type, trailstate_t **tsk)
|
void P_EmitEffect (vec3_t pos, vec3_t orientation[3], unsigned int modeleflags, int type, trailkey_t *tk)
|
||||||
{
|
{
|
||||||
float count;
|
float count;
|
||||||
if (cl.paused)
|
if (cl.paused)
|
||||||
|
@ -968,16 +968,16 @@ void P_EmitEffect (vec3_t pos, vec3_t orientation[3], unsigned int modeleflags,
|
||||||
if (orientation)
|
if (orientation)
|
||||||
{
|
{
|
||||||
if (modeleflags & MDLF_EMITFORWARDS)
|
if (modeleflags & MDLF_EMITFORWARDS)
|
||||||
pe->RunParticleEffectState(pos, orientation[0], count, type, tsk);
|
pe->RunParticleEffectState(pos, orientation[0], count, type, tk);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vec3_t down;
|
vec3_t down;
|
||||||
VectorNegate(orientation[2], down);
|
VectorNegate(orientation[2], down);
|
||||||
pe->RunParticleEffectState(pos, down, count, type, tsk);
|
pe->RunParticleEffectState(pos, down, count, type, tk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pe->RunParticleEffectState(pos, NULL, count, type, tsk);
|
pe->RunParticleEffectState(pos, NULL, count, type, tk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -166,24 +166,7 @@ typedef enum
|
||||||
extern int pt_q2[];
|
extern int pt_q2[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct beamseg_s;
|
typedef quint32_t trailkey_t;
|
||||||
|
|
||||||
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 {
|
|
||||||
struct {
|
|
||||||
float lastdist; // last distance used with particle effect
|
|
||||||
float laststop; // last stopping point for particle effect
|
|
||||||
} trail;
|
|
||||||
struct {
|
|
||||||
float statetime; // time to emit effect again (used by spawntime field)
|
|
||||||
float emittime; // used by r_effect emitters
|
|
||||||
} effect;
|
|
||||||
struct trailstate_s* fallback;
|
|
||||||
};
|
|
||||||
} trailstate_t;
|
|
||||||
|
|
||||||
#define PARTICLE_Z_CLIP 8.0
|
#define PARTICLE_Z_CLIP 8.0
|
||||||
|
|
||||||
|
@ -218,7 +201,7 @@ void P_ShutdownParticleSystem(void);
|
||||||
void P_Shutdown(void);
|
void P_Shutdown(void);
|
||||||
void P_LoadedModel(struct model_s *mod); /*checks a model's various effects*/
|
void P_LoadedModel(struct model_s *mod); /*checks a model's various effects*/
|
||||||
void P_DefaultTrail (unsigned int entityeffects, unsigned int modelflags, int *trailid, int *trailpalidx);
|
void P_DefaultTrail (unsigned int entityeffects, unsigned int modelflags, int *trailid, int *trailpalidx);
|
||||||
void P_EmitEffect (vec3_t pos, vec3_t orientation[3], unsigned int modeleflags, int type, trailstate_t **tsk);//this is just a wrapper
|
void P_EmitEffect (vec3_t pos, vec3_t orientation[3], unsigned int modeleflags, int type, trailkey_t *tsk);//this is just a wrapper
|
||||||
int P_FindParticleType(const char *efname);
|
int P_FindParticleType(const char *efname);
|
||||||
#ifdef PSET_SCRIPT
|
#ifdef PSET_SCRIPT
|
||||||
void PScript_ClearSurfaceParticles(struct model_s *mod);
|
void PScript_ClearSurfaceParticles(struct model_s *mod);
|
||||||
|
@ -249,8 +232,8 @@ typedef struct {
|
||||||
qboolean (*ParticleQuery) (int type, int body, char *outstr, int outstrlen);
|
qboolean (*ParticleQuery) (int type, int body, char *outstr, int outstrlen);
|
||||||
|
|
||||||
int (*RunParticleEffectTypeString) (vec3_t org, vec3_t dir, float count, char *name);
|
int (*RunParticleEffectTypeString) (vec3_t org, vec3_t dir, float count, char *name);
|
||||||
int (*ParticleTrail) (vec3_t startpos, vec3_t end, int type, float timeinterval, int dlkey, vec3_t dlaxis[3], trailstate_t **tsk);
|
int (*ParticleTrail) (vec3_t startpos, vec3_t end, int type, float timeinterval, int dlkey, vec3_t dlaxis[3], trailkey_t *tk);
|
||||||
int (*RunParticleEffectState) (vec3_t org, vec3_t dir, float count, int typenum, trailstate_t **tsk);
|
int (*RunParticleEffectState) (vec3_t org, vec3_t dir, float count, int typenum, trailkey_t *tk);
|
||||||
void (*RunParticleWeather) (vec3_t minb, vec3_t maxb, vec3_t dir, float count, int colour, char *efname);
|
void (*RunParticleWeather) (vec3_t minb, vec3_t maxb, vec3_t dir, float count, int colour, char *efname);
|
||||||
void (*RunParticleCube) (int typenum, vec3_t minb, vec3_t maxb, vec3_t dir_min, vec3_t dir_max, float count, int colour, qboolean gravity, float jitter); //typenum may be P_INVALID
|
void (*RunParticleCube) (int typenum, vec3_t minb, vec3_t maxb, vec3_t dir_min, vec3_t dir_max, float count, int colour, qboolean gravity, float jitter); //typenum may be P_INVALID
|
||||||
void (*RunParticleEffect) (vec3_t org, vec3_t dir, int color, int count);
|
void (*RunParticleEffect) (vec3_t org, vec3_t dir, int color, int count);
|
||||||
|
@ -259,10 +242,10 @@ typedef struct {
|
||||||
void (*RunParticleEffect4) (vec3_t org, float radius, int color, int effect, int count);
|
void (*RunParticleEffect4) (vec3_t org, float radius, int color, int effect, int count);
|
||||||
void (*RunParticleEffectPalette) (const char *nameprefix, vec3_t org, vec3_t dir, int color, int count);
|
void (*RunParticleEffectPalette) (const char *nameprefix, vec3_t org, vec3_t dir, int color, int count);
|
||||||
|
|
||||||
void (*ParticleTrailIndex) (vec3_t start, vec3_t end, int type, float timeinterval, int color, int crnd, trailstate_t **tsk); //P_INVALID is fine for the type here, you'll get a default trail.
|
void (*ParticleTrailIndex) (vec3_t start, vec3_t end, int type, float timeinterval, int color, int crnd, trailkey_t *tk); //P_INVALID is fine for the type here, you'll get a default trail.
|
||||||
qboolean (*InitParticles) (void);
|
qboolean (*InitParticles) (void);
|
||||||
void (*ShutdownParticles) (void);
|
void (*ShutdownParticles) (void);
|
||||||
void (*DelinkTrailstate) (trailstate_t **tsk);
|
void (*DelinkTrailstate) (trailkey_t *tk);
|
||||||
void (*ClearParticles) (void);
|
void (*ClearParticles) (void);
|
||||||
void (*DrawParticles) (void);
|
void (*DrawParticles) (void);
|
||||||
} particleengine_t;
|
} particleengine_t;
|
||||||
|
|
|
@ -5260,6 +5260,9 @@ static qboolean QDECL Mod_LoadBrushModel (model_t *mod, void *buffer, size_t fsi
|
||||||
{
|
{
|
||||||
case BSPVERSIONQ64:
|
case BSPVERSIONQ64:
|
||||||
subbsp = sb_quake64;
|
subbsp = sb_quake64;
|
||||||
|
mod->fromgame = fg_quake;
|
||||||
|
mod->engineflags |= MDLF_NEEDOVERBRIGHT;
|
||||||
|
break;
|
||||||
case BSPVERSION:
|
case BSPVERSION:
|
||||||
case BSPVERSIONPREREL:
|
case BSPVERSIONPREREL:
|
||||||
mod->fromgame = fg_quake;
|
mod->fromgame = fg_quake;
|
||||||
|
|
Loading…
Reference in a new issue