2009-07-17 22:28:16 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the included (GNU.txt) GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
*/
|
2004-08-23 00:15:46 +00:00
|
|
|
#include "quakedef.h"
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
#define NUMVERTEXNORMALS 162
|
|
|
|
float r_avertexnormals[NUMVERTEXNORMALS][3] = {
|
|
|
|
#include "anorms.h"
|
|
|
|
};
|
2005-10-10 01:16:58 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
void R_Rockettrail_Callback(struct cvar_s *var, char *oldvalue)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
model_t *mod;
|
|
|
|
extern model_t mod_known[];
|
|
|
|
extern int mod_numknown;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (cls.state == ca_disconnected)
|
|
|
|
return; // don't bother parsing while disconnected
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
|
|
|
|
{
|
2010-12-05 02:46:07 +00:00
|
|
|
if (!mod->needload)
|
2011-10-27 15:46:36 +00:00
|
|
|
if (mod->flags & MF_ROCKET)
|
2010-12-05 02:46:07 +00:00
|
|
|
P_DefaultTrail(mod);
|
2008-11-09 22:29:28 +00:00
|
|
|
}
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
void R_Grenadetrail_Callback(struct cvar_s *var, char *oldvalue)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
model_t *mod;
|
|
|
|
extern model_t mod_known[];
|
|
|
|
extern int mod_numknown;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (cls.state == ca_disconnected)
|
|
|
|
return; // don't bother parsing while disconnected
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
|
|
|
|
{
|
2010-12-05 02:46:07 +00:00
|
|
|
if (!mod->needload)
|
2011-10-27 15:46:36 +00:00
|
|
|
if (mod->flags & MF_GRENADE)
|
2010-12-05 02:46:07 +00:00
|
|
|
P_DefaultTrail(mod);
|
2008-11-09 22:29:28 +00:00
|
|
|
}
|
|
|
|
}
|
2005-03-10 03:55:18 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
particleengine_t pe_null;
|
|
|
|
particleengine_t pe_classic;
|
|
|
|
particleengine_t pe_darkplaces;
|
2010-07-11 02:22:39 +00:00
|
|
|
particleengine_t pe_qmb;
|
2008-11-09 22:29:28 +00:00
|
|
|
particleengine_t pe_script;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
particleengine_t *particlesystem[] =
|
|
|
|
{
|
|
|
|
&pe_script,
|
|
|
|
&pe_darkplaces,
|
2010-07-11 02:22:39 +00:00
|
|
|
&pe_qmb,
|
2008-11-09 22:29:28 +00:00
|
|
|
&pe_classic,
|
|
|
|
&pe_null,
|
2009-10-06 00:22:28 +00:00
|
|
|
NULL,
|
2008-11-09 22:29:28 +00:00
|
|
|
};
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
void R_ParticleSystem_Callback(struct cvar_s *var, char *oldvalue)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
if (pe)
|
2010-07-13 09:49:38 +00:00
|
|
|
{
|
2011-06-18 12:25:36 +00:00
|
|
|
CL_ClearTEntParticleState();
|
|
|
|
CL_ClearLerpEntsParticleState();
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
pe->ShutdownParticles();
|
2010-07-13 09:49:38 +00:00
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2010-05-01 22:47:47 +00:00
|
|
|
if (!qrenderer)
|
2010-07-13 09:49:38 +00:00
|
|
|
{
|
2010-05-01 22:47:47 +00:00
|
|
|
pe = &pe_null;
|
2010-07-13 09:49:38 +00:00
|
|
|
}
|
2010-05-01 22:47:47 +00:00
|
|
|
else
|
2008-11-09 22:29:28 +00:00
|
|
|
{
|
2010-05-01 22:47:47 +00:00
|
|
|
pe = NULL;
|
|
|
|
for (i = 0; particlesystem[i]; i++)
|
2008-11-09 22:29:28 +00:00
|
|
|
{
|
2010-05-01 22:47:47 +00:00
|
|
|
if ( (particlesystem[i]->name1 && !stricmp(var->string, particlesystem[i]->name1))
|
|
|
|
|| (particlesystem[i]->name2 && !stricmp(var->string, particlesystem[i]->name2)))
|
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
pe = particlesystem[i];
|
2010-05-01 22:47:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!pe)
|
|
|
|
if (particlesystem[i]->name1)
|
|
|
|
pe = particlesystem[i];
|
|
|
|
}
|
2008-11-09 22:29:28 +00:00
|
|
|
}
|
|
|
|
if (!pe)
|
|
|
|
Sys_Error("No particle system available. Please recompile.");
|
2005-05-30 04:34:47 +00:00
|
|
|
|
2010-07-11 02:22:39 +00:00
|
|
|
if (!pe->InitParticles())
|
|
|
|
{
|
|
|
|
Con_Printf("Particlesystem %s failed to init\n", pe->name1);
|
|
|
|
pe = &pe_null;
|
|
|
|
pe->InitParticles();
|
|
|
|
}
|
2008-11-09 22:29:28 +00:00
|
|
|
pe->ClearParticles();
|
|
|
|
CL_RegisterParticles();
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2010-07-11 02:22:39 +00:00
|
|
|
cvar_t r_rockettrail = CVARFC("r_rockettrail", "1", CVAR_SEMICHEAT, R_Rockettrail_Callback);
|
|
|
|
cvar_t r_grenadetrail = CVARFC("r_grenadetrail", "1", CVAR_SEMICHEAT, R_Grenadetrail_Callback);
|
2012-04-24 12:22:50 +00:00
|
|
|
cvar_t r_particlesystem = CVARFC("r_particlesystem", IFMINIMAL("classic", "script"), CVAR_SEMICHEAT|CVAR_ARCHIVE, R_ParticleSystem_Callback);
|
|
|
|
cvar_t r_particledesc = CVARAF("r_particledesc", "classic", "r_particlesdesc", CVAR_SEMICHEAT|CVAR_ARCHIVE);
|
2004-08-23 00:15:46 +00:00
|
|
|
extern cvar_t r_bouncysparks;
|
|
|
|
extern cvar_t r_part_rain;
|
|
|
|
extern cvar_t r_bloodstains;
|
2005-10-09 01:36:42 +00:00
|
|
|
extern cvar_t gl_part_flame;
|
2011-12-26 15:19:13 +00:00
|
|
|
cvar_t r_part_rain_quantity = CVARF("r_part_rain_quantity", "1", CVAR_ARCHIVE);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2011-12-26 15:19:13 +00:00
|
|
|
cvar_t r_particle_tracelimit = CVARFD("r_particle_tracelimit", "200", CVAR_ARCHIVE, "Number of traces to allow per frame for particle physics.");
|
2010-07-11 02:22:39 +00:00
|
|
|
cvar_t r_part_sparks = CVAR("r_part_sparks", "1");
|
|
|
|
cvar_t r_part_sparks_trifan = CVAR("r_part_sparks_trifan", "1");
|
|
|
|
cvar_t r_part_sparks_textured = CVAR("r_part_sparks_textured", "1");
|
|
|
|
cvar_t r_part_beams = CVAR("r_part_beams", "1");
|
2011-12-26 15:19:13 +00:00
|
|
|
cvar_t r_part_contentswitch = CVARFD("r_part_contentswitch", "1", CVAR_ARCHIVE, "Enable particle effects to change based on content (ex. water).");
|
2012-04-24 12:22:50 +00:00
|
|
|
cvar_t r_part_density = CVARF("r_part_density", "1", CVAR_ARCHIVE);
|
2004-09-07 18:21:08 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
particleengine_t *pe;
|
2005-09-08 22:52:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
void P_InitParticleSystem(void)
|
|
|
|
{
|
|
|
|
char *particlecvargroupname = "Particle effects";
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
Cvar_Register(&r_particlesystem, "Particles");
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
//particles
|
2010-12-05 02:46:07 +00:00
|
|
|
Cvar_Register(&r_particledesc, particlecvargroupname);
|
2008-11-09 22:29:28 +00:00
|
|
|
Cvar_Register(&r_bouncysparks, particlecvargroupname);
|
|
|
|
Cvar_Register(&r_part_rain, particlecvargroupname);
|
2006-09-17 00:59:22 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
Cvar_Register(&r_part_rain_quantity, particlecvargroupname);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
Cvar_Register(&r_particle_tracelimit, particlecvargroupname);
|
|
|
|
|
|
|
|
Cvar_Register(&r_part_sparks, particlecvargroupname);
|
|
|
|
Cvar_Register(&r_part_sparks_trifan, particlecvargroupname);
|
|
|
|
Cvar_Register(&r_part_sparks_textured, particlecvargroupname);
|
|
|
|
Cvar_Register(&r_part_beams, particlecvargroupname);
|
|
|
|
Cvar_Register(&r_part_contentswitch, particlecvargroupname);
|
2012-04-24 07:59:11 +00:00
|
|
|
Cvar_Register(&r_part_density, particlecvargroupname);
|
2008-11-09 22:29:28 +00:00
|
|
|
|
|
|
|
Cvar_Register (&gl_part_flame, particlecvargroupname);
|
2011-06-18 05:41:10 +00:00
|
|
|
|
|
|
|
Cvar_Register (&r_rockettrail, particlecvargroupname);
|
|
|
|
Cvar_Register (&r_grenadetrail, particlecvargroupname);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 01:32:30 +00:00
|
|
|
void P_Shutdown(void)
|
|
|
|
{
|
2012-07-21 04:43:31 +00:00
|
|
|
CL_ClearLerpEntsParticleState();
|
2011-01-30 01:32:30 +00:00
|
|
|
if (pe)
|
|
|
|
{
|
|
|
|
pe->ShutdownParticles();
|
|
|
|
}
|
|
|
|
pe = NULL;
|
|
|
|
}
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
#ifdef Q2BSPS
|
|
|
|
qboolean Q2TraceLineN (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
vec3_t nul = {0,0,0};
|
2012-01-17 07:57:46 +00:00
|
|
|
trace_t trace = CM_BoxTrace(pmove.physents[0].model, start, end, nul, nul, MASK_WORLDSOLID);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (trace.fraction < 1)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
VectorCopy (trace.plane.normal, normal);
|
|
|
|
VectorCopy (trace.endpos, impact);
|
|
|
|
return true;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2008-11-09 22:29:28 +00:00
|
|
|
return false;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2008-11-09 22:29:28 +00:00
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
qboolean TraceLineN (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
trace_t trace;
|
|
|
|
float len, bestlen;
|
2004-08-23 00:15:46 +00:00
|
|
|
int i;
|
2008-11-09 22:29:28 +00:00
|
|
|
vec3_t delta, ts, te;
|
|
|
|
physent_t *pe;
|
|
|
|
qboolean clipped=false;
|
2010-08-28 17:14:38 +00:00
|
|
|
vec3_t axis[3];
|
2008-11-09 22:29:28 +00:00
|
|
|
|
|
|
|
memset (&trace, 0, sizeof(trace));
|
|
|
|
|
|
|
|
VectorSubtract(end, start, delta);
|
|
|
|
bestlen = Length(delta);
|
|
|
|
|
|
|
|
VectorCopy (end, impact);
|
|
|
|
|
|
|
|
for (i=0 ; i< pmove.numphysent ; i++)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
pe = &pmove.physents[i];
|
2009-03-03 01:52:30 +00:00
|
|
|
if (pe->nonsolid)
|
|
|
|
continue;
|
2011-10-27 15:46:36 +00:00
|
|
|
if (pe->model && !pe->model->needload)
|
2008-11-09 22:29:28 +00:00
|
|
|
{
|
|
|
|
VectorSubtract(start, pe->origin, ts);
|
|
|
|
VectorSubtract(end, pe->origin, te);
|
2010-08-28 17:14:38 +00:00
|
|
|
if (pe->angles[0] || pe->angles[1] || pe->angles[2])
|
|
|
|
{
|
|
|
|
AngleVectors(pe->angles, axis[0], axis[1], axis[2]);
|
|
|
|
VectorNegate(axis[1], axis[1]);
|
2012-01-17 07:57:46 +00:00
|
|
|
pe->model->funcs.NativeTrace(pe->model, 0, 0, axis, ts, te, vec3_origin, vec3_origin, MASK_WORLDSOLID, &trace);
|
2010-08-28 17:14:38 +00:00
|
|
|
}
|
|
|
|
else
|
2012-01-17 07:57:46 +00:00
|
|
|
pe->model->funcs.NativeTrace(pe->model, 0, 0, NULL, ts, te, vec3_origin, vec3_origin, MASK_WORLDSOLID, &trace);
|
2008-11-09 22:29:28 +00:00
|
|
|
if (trace.fraction<1)
|
|
|
|
{
|
|
|
|
VectorSubtract(trace.endpos, ts, delta);
|
|
|
|
len = Length(delta);
|
|
|
|
if (len < bestlen)
|
|
|
|
{
|
|
|
|
bestlen = len;
|
2010-07-11 02:22:39 +00:00
|
|
|
if (normal)
|
|
|
|
VectorCopy (trace.plane.normal, normal);
|
2008-11-09 22:29:28 +00:00
|
|
|
VectorAdd (pe->origin, trace.endpos, impact);
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
clipped=true;
|
|
|
|
}
|
|
|
|
if (trace.startsolid)
|
|
|
|
{
|
|
|
|
VectorNormalize(delta);
|
2010-07-11 02:22:39 +00:00
|
|
|
if (normal)
|
|
|
|
{
|
|
|
|
normal[0] = -delta[0];
|
|
|
|
normal[1] = -delta[1];
|
|
|
|
normal[2] = -delta[2];
|
|
|
|
}
|
2012-01-17 07:57:46 +00:00
|
|
|
VectorCopy (end, impact);
|
|
|
|
return false;
|
2008-11-09 22:29:28 +00:00
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (clipped)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-07-01 19:23:00 +00:00
|
|
|
return false;
|
2008-11-09 22:29:28 +00:00
|
|
|
}
|
2005-03-10 03:55:18 +00:00
|
|
|
}
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
//handy utility...
|
|
|
|
void P_EmitEffect (vec3_t pos, int type, trailstate_t **tsk)
|
2005-09-08 22:52:46 +00:00
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
if (cl.paused)
|
|
|
|
return;
|
|
|
|
|
2009-11-17 00:15:44 +00:00
|
|
|
pe->RunParticleEffectState(pos, NULL, ((host_frametime>0.1)?0.1:host_frametime), type, tsk);
|
2005-09-08 22:52:46 +00:00
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// P_SelectableTrail: given default/opposite effects, model pointer, and a user selection cvar
|
|
|
|
// changes model to the appropriate trail effect and default trail index
|
|
|
|
void P_SelectableTrail(model_t *model, cvar_t *selection, int mdleffect, int mdlcidx, int oppeffect, int oppcidx)
|
2005-05-17 02:36:54 +00:00
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
int select = (int)(selection->value);
|
|
|
|
|
|
|
|
switch (select)
|
2005-05-17 02:36:54 +00:00
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
case 0: // check for string, otherwise no trail
|
|
|
|
if (selection->string[0] == '0')
|
2007-05-25 22:16:29 +00:00
|
|
|
{
|
2013-03-12 22:54:54 +00:00
|
|
|
model->particletrail = P_INVALID;
|
|
|
|
model->traildefaultindex = -1;
|
2008-11-09 22:29:28 +00:00
|
|
|
break;
|
2007-05-25 22:16:29 +00:00
|
|
|
}
|
|
|
|
else
|
2005-05-17 02:36:54 +00:00
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
int effect = P_FindParticleType(selection->string);
|
2005-05-17 02:36:54 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (effect >= 0)
|
2007-05-25 22:16:29 +00:00
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
model->particletrail = effect;
|
|
|
|
model->traildefaultindex = mdlcidx;
|
|
|
|
break;
|
2007-05-25 22:16:29 +00:00
|
|
|
}
|
2005-05-17 02:36:54 +00:00
|
|
|
}
|
2008-11-09 22:29:28 +00:00
|
|
|
// fall through to default (so semicheat will work properly)
|
|
|
|
case 1: // default model effect
|
2007-05-25 22:16:29 +00:00
|
|
|
default:
|
2008-11-09 22:29:28 +00:00
|
|
|
model->particletrail = mdleffect;
|
|
|
|
model->traildefaultindex = mdlcidx;
|
|
|
|
break;
|
|
|
|
case 2: // opposite effect
|
|
|
|
model->particletrail = oppeffect;
|
|
|
|
model->traildefaultindex= oppcidx;
|
|
|
|
break;
|
|
|
|
case 3: // alt rocket effect
|
2010-12-05 02:46:07 +00:00
|
|
|
model->particletrail = P_FindParticleType("TR_ALTROCKET");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 107;
|
|
|
|
break;
|
|
|
|
case 4: // gib
|
2010-12-05 02:46:07 +00:00
|
|
|
model->particletrail = P_FindParticleType("TR_BLOOD");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 70;
|
|
|
|
break;
|
|
|
|
case 5: // zombie gib
|
2010-12-05 02:46:07 +00:00
|
|
|
model->particletrail = P_FindParticleType("TR_SLIGHTBLOOD");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 70;
|
|
|
|
break;
|
|
|
|
case 6: // Scrag tracer
|
2010-12-05 02:46:07 +00:00
|
|
|
model->particletrail = P_FindParticleType("TR_WIZSPIKE");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 60;
|
|
|
|
break;
|
|
|
|
case 7: // Knight tracer
|
2010-12-05 02:46:07 +00:00
|
|
|
model->particletrail = P_FindParticleType("TR_KNIGHTSPIKE");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 238;
|
|
|
|
break;
|
|
|
|
case 8: // Vore tracer
|
2010-12-05 02:46:07 +00:00
|
|
|
model->particletrail = P_FindParticleType("TR_VORESPIKE");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 154;
|
|
|
|
break;
|
|
|
|
case 9: // rail trail
|
2011-06-18 13:05:14 +00:00
|
|
|
model->particletrail = P_FindParticleType("TE_RAILTRAIL");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 15;
|
2007-05-25 22:16:29 +00:00
|
|
|
break;
|
2005-05-17 02:36:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
//figure out which particle trail to use for the given model, filling in its values as required.
|
|
|
|
void P_DefaultTrail (model_t *model)
|
|
|
|
{
|
|
|
|
// TODO: EF_BRIGHTFIELD should probably be handled in here somewhere
|
|
|
|
// TODO: make trail default color into RGB values instead of indexes
|
|
|
|
if (model->engineflags & MDLF_NODEFAULTTRAIL)
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
|
2011-10-27 15:46:36 +00:00
|
|
|
if (model->flags & MF_ROCKET)
|
2010-12-05 02:46:07 +00:00
|
|
|
P_SelectableTrail(model, &r_rockettrail, P_FindParticleType("TR_ROCKET"), 109, P_FindParticleType("TR_GRENADE"), 6);
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MF_GRENADE)
|
2010-12-05 02:46:07 +00:00
|
|
|
P_SelectableTrail(model, &r_grenadetrail, P_FindParticleType("TR_GRENADE"), 6, P_FindParticleType("TR_ROCKET"), 109);
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MF_GIB)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2010-12-05 02:46:07 +00:00
|
|
|
model->particletrail = P_FindParticleType("TR_BLOOD");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 70;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MF_TRACER)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2010-12-05 02:46:07 +00:00
|
|
|
model->particletrail = P_FindParticleType("TR_WIZSPIKE");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 60;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MF_ZOMGIB)
|
2005-01-04 19:19:51 +00:00
|
|
|
{
|
2010-12-05 02:46:07 +00:00
|
|
|
model->particletrail = P_FindParticleType("TR_SLIGHTBLOOD");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 70;
|
2005-01-04 19:19:51 +00:00
|
|
|
}
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MF_TRACER2)
|
2005-01-04 19:19:51 +00:00
|
|
|
{
|
2010-12-05 02:46:07 +00:00
|
|
|
model->particletrail = P_FindParticleType("TR_KNIGHTSPIKE");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 238;
|
2005-01-04 19:19:51 +00:00
|
|
|
}
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MF_TRACER3)
|
2006-08-20 00:47:13 +00:00
|
|
|
{
|
2010-12-05 02:46:07 +00:00
|
|
|
model->particletrail = P_FindParticleType("TR_VORESPIKE");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 154;
|
2006-08-20 00:47:13 +00:00
|
|
|
}
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MFH2_BLOODSHOT) //these are the hexen2 ones.
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2011-06-18 13:05:14 +00:00
|
|
|
model->particletrail = P_FindParticleType("tr_bloodshot");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 136;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MFH2_FIREBALL)
|
2005-06-22 17:10:13 +00:00
|
|
|
{
|
2011-06-18 13:05:14 +00:00
|
|
|
model->particletrail = P_FindParticleType("tr_fireball");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 424;
|
2005-06-22 17:10:13 +00:00
|
|
|
}
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MFH2_ACIDBALL)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2011-06-18 13:05:14 +00:00
|
|
|
model->particletrail = P_FindParticleType("tr_acidball");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 440;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MFH2_ICE)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2011-06-18 13:05:14 +00:00
|
|
|
model->particletrail = P_FindParticleType("tr_ice");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 408;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MFH2_SPIT)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2011-06-18 13:05:14 +00:00
|
|
|
model->particletrail = P_FindParticleType("tr_spit");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 260;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MFH2_SPELL)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2011-06-18 13:05:14 +00:00
|
|
|
model->particletrail = P_FindParticleType("tr_spell");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 260;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MFH2_VORP_MISSILE)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2011-06-18 13:05:14 +00:00
|
|
|
model->particletrail = P_FindParticleType("tr_vorpmissile");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 302;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MFH2_SET_STAFF)
|
2005-11-26 23:11:19 +00:00
|
|
|
{
|
2011-06-18 13:05:14 +00:00
|
|
|
model->particletrail = P_FindParticleType("tr_setstaff");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 424;
|
2005-11-26 23:11:19 +00:00
|
|
|
}
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MFH2_MAGICMISSILE)
|
2005-11-26 23:11:19 +00:00
|
|
|
{
|
2011-06-18 13:05:14 +00:00
|
|
|
model->particletrail = P_FindParticleType("tr_magicmissile");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 149;
|
2005-11-26 23:11:19 +00:00
|
|
|
}
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MFH2_BONESHARD)
|
2005-11-26 23:11:19 +00:00
|
|
|
{
|
2011-06-18 13:05:14 +00:00
|
|
|
model->particletrail = P_FindParticleType("tr_boneshard");
|
2008-11-09 22:29:28 +00:00
|
|
|
model->traildefaultindex = 384;
|
2005-11-26 23:11:19 +00:00
|
|
|
}
|
2011-10-27 15:46:36 +00:00
|
|
|
else if (model->flags & MFH2_SCARAB)
|
2005-11-26 23:11:19 +00:00
|
|
|
{
|
2011-06-18 13:05:14 +00:00
|
|
|
model->particletrail = P_FindParticleType("tr_scarab");
|
2005-11-26 23:11:19 +00:00
|
|
|
model->traildefaultindex = 254;
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
2011-06-18 12:25:36 +00:00
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
model->particletrail = P_INVALID;
|
2011-06-18 12:25:36 +00:00
|
|
|
model->traildefaultindex = -1;
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|