2004-08-23 00:15:46 +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 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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
// cl_tent.c -- client side temporary entities
|
|
|
|
|
|
|
|
#include "quakedef.h"
|
|
|
|
#include "particles.h"
|
|
|
|
entity_state_t *CL_FindPacketEntity(int num);
|
|
|
|
|
|
|
|
#define R_AddDecals(a) //disabled for now
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
int
|
|
|
|
pt_gunshot=P_INVALID,
|
|
|
|
ptdp_gunshotquad=P_INVALID,
|
|
|
|
pt_spike=P_INVALID,
|
|
|
|
ptdp_spikequad=P_INVALID,
|
|
|
|
pt_superspike=P_INVALID,
|
|
|
|
ptdp_superspikequad=P_INVALID,
|
|
|
|
pt_wizspike=P_INVALID,
|
|
|
|
pt_knightspike=P_INVALID,
|
|
|
|
pt_explosion=P_INVALID,
|
|
|
|
ptdp_explosionquad=P_INVALID,
|
|
|
|
pt_tarexplosion=P_INVALID,
|
|
|
|
pt_teleportsplash=P_INVALID,
|
|
|
|
pt_lavasplash=P_INVALID,
|
|
|
|
ptdp_smallflash=P_INVALID,
|
|
|
|
ptdp_flamejet=P_INVALID,
|
|
|
|
ptdp_flame=P_INVALID,
|
|
|
|
ptdp_blood=P_INVALID,
|
|
|
|
ptdp_spark=P_INVALID,
|
|
|
|
ptdp_plasmaburn=P_INVALID,
|
|
|
|
ptdp_tei_g3=P_INVALID,
|
|
|
|
ptdp_tei_smoke=P_INVALID,
|
|
|
|
ptdp_tei_bigexplosion=P_INVALID,
|
|
|
|
ptdp_tei_plasmahit=P_INVALID,
|
|
|
|
ptdp_stardust=P_INVALID,
|
|
|
|
rt_rocket=P_INVALID,
|
|
|
|
rt_grenade=P_INVALID,
|
|
|
|
rt_blood=P_INVALID,
|
|
|
|
rt_wizspike=P_INVALID,
|
|
|
|
rt_slightblood=P_INVALID,
|
|
|
|
rt_knightspike=P_INVALID,
|
|
|
|
rt_vorespike=P_INVALID,
|
|
|
|
rtdp_neharasmoke=P_INVALID,
|
|
|
|
rtdp_nexuizplasma=P_INVALID,
|
|
|
|
rtdp_glowtrail=P_INVALID,
|
|
|
|
|
|
|
|
ptqw_blood=P_INVALID,
|
|
|
|
ptqw_lightningblood=P_INVALID,
|
|
|
|
|
|
|
|
ptq2_blood=P_INVALID,
|
|
|
|
rtq2_railtrail=P_INVALID,
|
|
|
|
rtq2_blastertrail=P_INVALID,
|
|
|
|
ptq2_blasterparticles=P_INVALID,
|
|
|
|
rtq2_bubbletrail=P_INVALID,
|
|
|
|
rtq2_gib=P_INVALID,
|
|
|
|
rtq2_rocket=P_INVALID,
|
|
|
|
rtq2_grenade=P_INVALID,
|
|
|
|
|
|
|
|
rtqw_railtrail=P_INVALID,
|
|
|
|
rtfte_lightning1=P_INVALID,
|
|
|
|
ptfte_lightning1_end=P_INVALID,
|
|
|
|
rtfte_lightning2=P_INVALID,
|
|
|
|
ptfte_lightning2_end=P_INVALID,
|
|
|
|
rtfte_lightning3=P_INVALID,
|
|
|
|
ptfte_lightning3_end=P_INVALID,
|
|
|
|
ptfte_bullet=P_INVALID,
|
|
|
|
ptfte_superbullet=P_INVALID;
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#ifdef Q2CLIENT
|
|
|
|
typedef enum
|
|
|
|
{
|
2005-03-28 00:11:59 +00:00
|
|
|
Q2TE_GUNSHOT, //0
|
2004-08-23 00:15:46 +00:00
|
|
|
Q2TE_BLOOD,
|
|
|
|
Q2TE_BLASTER,
|
|
|
|
Q2TE_RAILTRAIL,
|
|
|
|
Q2TE_SHOTGUN,
|
|
|
|
Q2TE_EXPLOSION1,
|
|
|
|
Q2TE_EXPLOSION2,
|
|
|
|
Q2TE_ROCKET_EXPLOSION,
|
|
|
|
Q2TE_GRENADE_EXPLOSION,
|
|
|
|
Q2TE_SPARKS,
|
2005-03-28 00:11:59 +00:00
|
|
|
Q2TE_SPLASH, //10
|
2004-08-23 00:15:46 +00:00
|
|
|
Q2TE_BUBBLETRAIL,
|
|
|
|
Q2TE_SCREEN_SPARKS,
|
|
|
|
Q2TE_SHIELD_SPARKS,
|
|
|
|
Q2TE_BULLET_SPARKS,
|
|
|
|
Q2TE_LASER_SPARKS,
|
|
|
|
Q2TE_PARASITE_ATTACK,
|
|
|
|
Q2TE_ROCKET_EXPLOSION_WATER,
|
|
|
|
Q2TE_GRENADE_EXPLOSION_WATER,
|
|
|
|
Q2TE_MEDIC_CABLE_ATTACK,
|
2005-03-28 00:11:59 +00:00
|
|
|
Q2TE_BFG_EXPLOSION, //20
|
2004-08-23 00:15:46 +00:00
|
|
|
Q2TE_BFG_BIGEXPLOSION,
|
|
|
|
Q2TE_BOSSTPORT, // used as '22' in a map, so DON'T RENUMBER!!!
|
|
|
|
Q2TE_BFG_LASER,
|
|
|
|
Q2TE_GRAPPLE_CABLE,
|
|
|
|
Q2TE_WELDING_SPARKS,
|
|
|
|
Q2TE_GREENBLOOD,
|
|
|
|
Q2TE_BLUEHYPERBLASTER,
|
|
|
|
Q2TE_PLASMA_EXPLOSION,
|
|
|
|
Q2TE_TUNNEL_SPARKS,
|
|
|
|
//ROGUE
|
2005-03-28 00:11:59 +00:00
|
|
|
Q2TE_BLASTER2, //30
|
2004-08-23 00:15:46 +00:00
|
|
|
Q2TE_RAILTRAIL2,
|
|
|
|
Q2TE_FLAME,
|
|
|
|
Q2TE_LIGHTNING,
|
|
|
|
Q2TE_DEBUGTRAIL,
|
|
|
|
Q2TE_PLAIN_EXPLOSION,
|
|
|
|
Q2TE_FLASHLIGHT,
|
|
|
|
Q2TE_FORCEWALL,
|
|
|
|
Q2TE_HEATBEAM,
|
|
|
|
Q2TE_MONSTER_HEATBEAM,
|
2005-03-28 00:11:59 +00:00
|
|
|
Q2TE_STEAM, //40
|
2004-08-23 00:15:46 +00:00
|
|
|
Q2TE_BUBBLETRAIL2,
|
|
|
|
Q2TE_MOREBLOOD,
|
|
|
|
Q2TE_HEATBEAM_SPARKS,
|
|
|
|
Q2TE_HEATBEAM_STEAM,
|
|
|
|
Q2TE_CHAINFIST_SMOKE,
|
|
|
|
Q2TE_ELECTRIC_SPARKS,
|
|
|
|
Q2TE_TRACKER_EXPLOSION,
|
|
|
|
Q2TE_TELEPORT_EFFECT,
|
|
|
|
Q2TE_DBALL_GOAL,
|
2005-03-28 00:11:59 +00:00
|
|
|
Q2TE_WIDOWBEAMOUT, //50
|
2004-08-23 00:15:46 +00:00
|
|
|
Q2TE_NUKEBLAST,
|
|
|
|
Q2TE_WIDOWSPLASH,
|
|
|
|
Q2TE_EXPLOSION1_BIG,
|
|
|
|
Q2TE_EXPLOSION1_NP,
|
2006-02-22 23:42:00 +00:00
|
|
|
Q2TE_FLECHETTE,
|
2004-08-23 00:15:46 +00:00
|
|
|
//ROGUE
|
2006-02-22 23:42:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
//CODERED
|
|
|
|
CRTE_LEADERBLASTER, //56
|
|
|
|
CRTE_BLASTER_MUZZLEFLASH,
|
|
|
|
CRTE_BLUE_MUZZLEFLASH,
|
|
|
|
CRTE_SMART_MUZZLEFLASH,
|
|
|
|
CRTE_LEADERFIELD, //60
|
|
|
|
CRTE_DEATHFIELD,
|
|
|
|
CRTE_BLASTERBEAM,
|
|
|
|
CRTE_STAIN,
|
|
|
|
CRTE_FIRE,
|
|
|
|
CRTE_CABLEGUT,
|
|
|
|
CRTE_SMOKE
|
|
|
|
//CODERED
|
2004-08-23 00:15:46 +00:00
|
|
|
} temp_event_t;
|
|
|
|
|
|
|
|
#define Q2SPLASH_UNKNOWN 0
|
|
|
|
#define Q2SPLASH_SPARKS 1
|
|
|
|
#define Q2SPLASH_BLUE_WATER 2
|
|
|
|
#define Q2SPLASH_BROWN_WATER 3
|
|
|
|
#define Q2SPLASH_SLIME 4
|
|
|
|
#define Q2SPLASH_LAVA 5
|
|
|
|
#define Q2SPLASH_BLOOD 6
|
|
|
|
#endif
|
|
|
|
|
2005-08-03 23:14:59 +00:00
|
|
|
#define MAX_BEAMS 64
|
2004-08-23 00:15:46 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int entity;
|
|
|
|
short tag;
|
|
|
|
qbyte flags;
|
|
|
|
qbyte type;
|
|
|
|
qbyte skin;
|
|
|
|
struct model_s *model;
|
|
|
|
float endtime;
|
|
|
|
float alpha;
|
|
|
|
vec3_t start, end;
|
2005-05-18 23:15:58 +00:00
|
|
|
int particleeffect;
|
2005-05-30 04:34:47 +00:00
|
|
|
trailstate_t *trailstate;
|
2005-08-06 22:39:28 +00:00
|
|
|
trailstate_t *emitstate;
|
2004-08-23 00:15:46 +00:00
|
|
|
} beam_t;
|
|
|
|
|
|
|
|
beam_t cl_beams[MAX_BEAMS];
|
|
|
|
|
2010-08-28 17:14:38 +00:00
|
|
|
#define MAX_EXPLOSIONS 256
|
2004-08-23 00:15:46 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
vec3_t origin;
|
2005-03-18 06:14:07 +00:00
|
|
|
vec3_t oldorigin;
|
2010-08-28 17:14:38 +00:00
|
|
|
vec3_t velocity;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
int firstframe;
|
|
|
|
int numframes;
|
|
|
|
|
|
|
|
int type;
|
2005-09-04 05:48:26 +00:00
|
|
|
vec3_t angles;
|
|
|
|
int flags;
|
|
|
|
float alpha;
|
2004-08-23 00:15:46 +00:00
|
|
|
float start;
|
2005-05-26 12:55:34 +00:00
|
|
|
float framerate;
|
2004-08-23 00:15:46 +00:00
|
|
|
model_t *model;
|
2005-03-18 06:14:07 +00:00
|
|
|
int skinnum;
|
2004-08-23 00:15:46 +00:00
|
|
|
} explosion_t;
|
|
|
|
|
|
|
|
explosion_t cl_explosions[MAX_EXPLOSIONS];
|
|
|
|
|
2006-05-28 21:56:04 +00:00
|
|
|
static int explosions_running;
|
|
|
|
static int beams_running;
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
sfx_t *cl_sfx_wizhit;
|
|
|
|
sfx_t *cl_sfx_knighthit;
|
|
|
|
sfx_t *cl_sfx_tink1;
|
|
|
|
sfx_t *cl_sfx_ric1;
|
|
|
|
sfx_t *cl_sfx_ric2;
|
|
|
|
sfx_t *cl_sfx_ric3;
|
|
|
|
sfx_t *cl_sfx_r_exp3;
|
|
|
|
|
2010-07-11 02:22:39 +00:00
|
|
|
cvar_t cl_expsprite = CVAR("cl_expsprite", "0");
|
|
|
|
cvar_t r_explosionlight = CVARC("r_explosionlight", "1", Cvar_Limiter_ZeroToOne_Callback);
|
|
|
|
cvar_t cl_truelightning = CVARF("cl_truelightning", "0", CVAR_SEMICHEAT);
|
|
|
|
cvar_t cl_beam_trace = CVAR("cl_beam_trace", "0");
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2005-07-14 01:57:34 +00:00
|
|
|
typedef struct {
|
|
|
|
sfx_t **sfx;
|
|
|
|
char *efname;
|
|
|
|
} tentsfx_t;
|
|
|
|
tentsfx_t tentsfx[] =
|
|
|
|
{
|
|
|
|
{&cl_sfx_wizhit, "wizard/hit.wav"},
|
|
|
|
{&cl_sfx_knighthit, "hknight/hit.wav"},
|
|
|
|
{&cl_sfx_tink1, "weapons/tink1.wav"},
|
|
|
|
{&cl_sfx_ric1, "weapons/ric1.wav"},
|
|
|
|
{&cl_sfx_ric2, "weapons/ric2.wav"},
|
|
|
|
{&cl_sfx_ric3, "weapons/ric3.wav"},
|
|
|
|
{&cl_sfx_r_exp3, "weapons/r_exp3.wav"}
|
|
|
|
};
|
2005-08-27 23:28:39 +00:00
|
|
|
|
|
|
|
vec3_t playerbeam_end[MAX_SPLITS];
|
2010-12-05 02:46:07 +00:00
|
|
|
|
|
|
|
struct associatedeffect
|
|
|
|
{
|
|
|
|
struct associatedeffect *next;
|
|
|
|
char mname[MAX_QPATH];
|
|
|
|
char pname[MAX_QPATH];
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
AE_TRAIL,
|
|
|
|
AE_EMIT,
|
|
|
|
AE_REPLACE
|
|
|
|
} type;
|
|
|
|
} *associatedeffect;
|
|
|
|
void CL_AssociateEffect_f(void)
|
|
|
|
{
|
|
|
|
char *modelname = Cmd_Argv(1);
|
|
|
|
char *effectname = Cmd_Argv(2);
|
|
|
|
int type = atoi(Cmd_Argv(3));
|
|
|
|
struct associatedeffect *ae;
|
|
|
|
if (!strcmp(Cmd_Argv(0), "r_trail"))
|
|
|
|
type = AE_TRAIL;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (type)
|
|
|
|
type = AE_REPLACE;
|
|
|
|
else
|
|
|
|
type = AE_EMIT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
|
|
|
strstr(modelname, "player") ||
|
|
|
|
strstr(modelname, "eyes") ||
|
|
|
|
strstr(modelname, "flag") ||
|
|
|
|
strstr(modelname, "tf_stan") ||
|
|
|
|
strstr(modelname, ".bsp") ||
|
|
|
|
strstr(modelname, "turr"))
|
|
|
|
{
|
|
|
|
Con_Printf("Sorry: Not allowed to attach effects to model \"%s\"\n", modelname);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strlen (modelname) >= MAX_QPATH || strlen(effectname) >= MAX_QPATH)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/*replace the old one if it exists*/
|
|
|
|
for(ae = associatedeffect; ae; ae = ae->next)
|
|
|
|
{
|
|
|
|
if (!strcmp(ae->mname, modelname))
|
|
|
|
if ((ae->type==AE_TRAIL) == (type==AE_TRAIL))
|
|
|
|
{
|
|
|
|
strcpy(ae->pname, effectname);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!ae)
|
|
|
|
{
|
|
|
|
ae = Z_Malloc(sizeof(*ae));
|
|
|
|
ae->type = type;
|
|
|
|
strcpy(ae->mname, modelname);
|
|
|
|
strcpy(ae->pname, effectname);
|
|
|
|
ae->next = associatedeffect;
|
|
|
|
associatedeffect = ae;
|
|
|
|
}
|
|
|
|
|
|
|
|
//FIXME: overkill
|
|
|
|
CL_RegisterParticles();
|
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
/*
|
|
|
|
=================
|
|
|
|
CL_ParseTEnts
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
void CL_InitTEnts (void)
|
|
|
|
{
|
2005-07-14 01:57:34 +00:00
|
|
|
int i;
|
|
|
|
for (i = 0; i < sizeof(tentsfx)/sizeof(tentsfx[0]); i++)
|
|
|
|
{
|
2005-07-16 00:53:08 +00:00
|
|
|
if (COM_FCheckExists(va("sound/%s", tentsfx[i].efname)))
|
2005-07-14 01:57:34 +00:00
|
|
|
*tentsfx[i].sfx = S_PrecacheSound (tentsfx[i].efname);
|
|
|
|
else
|
|
|
|
*tentsfx[i].sfx = NULL;
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2011-01-30 01:32:30 +00:00
|
|
|
Cmd_AddCommand("r_effect", CL_AssociateEffect_f);
|
|
|
|
Cmd_AddCommand("r_trail", CL_AssociateEffect_f);
|
2010-12-05 02:46:07 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
Cvar_Register (&cl_expsprite, "Temporary entity control");
|
2004-10-10 06:32:29 +00:00
|
|
|
Cvar_Register (&cl_truelightning, "Temporary entity control");
|
2005-08-27 23:28:39 +00:00
|
|
|
Cvar_Register (&cl_beam_trace, "Temporary entity control");
|
2005-07-20 08:04:46 +00:00
|
|
|
Cvar_Register (&r_explosionlight, "Temporary entity control");
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
2010-12-05 02:46:07 +00:00
|
|
|
void CL_ShutdownTEnts (void)
|
|
|
|
{
|
|
|
|
struct associatedeffect *ae;
|
|
|
|
while(associatedeffect)
|
|
|
|
{
|
|
|
|
ae = associatedeffect;
|
|
|
|
associatedeffect = ae->next;
|
|
|
|
BZ_Free(ae);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void P_LoadedModel(model_t *mod)
|
|
|
|
{
|
|
|
|
struct associatedeffect *ae;
|
|
|
|
|
|
|
|
mod->particleeffect = P_INVALID;
|
|
|
|
mod->particletrail = P_INVALID;
|
|
|
|
mod->engineflags &= ~(MDLF_NODEFAULTTRAIL | MDLF_ENGULPHS);
|
|
|
|
for(ae = associatedeffect; ae; ae = ae->next)
|
|
|
|
{
|
|
|
|
if (!strcmp(ae->mname, mod->name))
|
|
|
|
{
|
|
|
|
switch(ae->type)
|
|
|
|
{
|
|
|
|
case AE_TRAIL:
|
|
|
|
mod->particletrail = P_FindParticleType(ae->pname);
|
|
|
|
break;
|
|
|
|
case AE_EMIT:
|
|
|
|
mod->particleeffect = P_FindParticleType(ae->pname);
|
|
|
|
mod->engineflags &= ~MDLF_ENGULPHS;
|
|
|
|
break;
|
|
|
|
case AE_REPLACE:
|
|
|
|
mod->particleeffect = P_FindParticleType(ae->pname);
|
|
|
|
mod->engineflags |= MDLF_ENGULPHS;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (mod->particletrail == P_INVALID)
|
|
|
|
P_DefaultTrail(mod);
|
|
|
|
}
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
void CL_RegisterParticles(void)
|
|
|
|
{
|
2010-12-05 02:46:07 +00:00
|
|
|
model_t *mod;
|
|
|
|
extern model_t mod_known[];
|
|
|
|
extern int mod_numknown;
|
|
|
|
int i;
|
|
|
|
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
|
|
|
|
{
|
|
|
|
if (!mod->needload)
|
|
|
|
{
|
|
|
|
P_LoadedModel(mod);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pt_gunshot = P_FindParticleType("TE_GUNSHOT"); /*shotgun*/
|
|
|
|
ptdp_gunshotquad = P_FindParticleType("TE_GUNSHOTQUAD"); /*DP: quadded shotgun*/
|
|
|
|
pt_spike = P_FindParticleType("TE_SPIKE"); /*nailgun*/
|
|
|
|
ptdp_spikequad = P_FindParticleType("TE_SPIKEQUAD"); /*DP: quadded nailgun*/
|
|
|
|
pt_superspike = P_FindParticleType("TE_SUPERSPIKE"); /*nailgun*/
|
|
|
|
ptdp_superspikequad = P_FindParticleType("TE_SUPERSPIKEQUAD"); /*DP: quadded nailgun*/
|
|
|
|
pt_wizspike = P_FindParticleType("TE_WIZSPIKE"); //scrag missile impact
|
|
|
|
pt_knightspike = P_FindParticleType("TE_KNIGHTSPIKE"); //hellknight missile impact
|
|
|
|
pt_explosion = P_FindParticleType("TE_EXPLOSION");/*rocket/grenade launcher impacts/far too many things*/
|
|
|
|
ptdp_explosionquad = P_FindParticleType("TE_EXPLOSIONQUAD"); /*nailgun*/
|
|
|
|
pt_tarexplosion = P_FindParticleType("TE_TAREXPLOSION");//tarbaby/spawn dying.
|
|
|
|
pt_teleportsplash = P_FindParticleType("TE_TELEPORT");/*teleporters*/
|
|
|
|
pt_lavasplash = P_FindParticleType("TE_LAVASPLASH"); //e1m7 boss dying.
|
|
|
|
ptdp_smallflash = P_FindParticleType("TE_SMALLFLASH"); //DP:
|
|
|
|
ptdp_flamejet = P_FindParticleType("TE_FLAMEJET"); //DP:
|
|
|
|
ptdp_flame = P_FindParticleType("EF_FLAME"); //DP:
|
|
|
|
ptdp_blood = P_FindParticleType("TE_BLOOD"); /*when you hit something with the shotgun/axe/nailgun - nq uses the general particle builtin*/
|
|
|
|
ptdp_spark = P_FindParticleType("TE_SPARK");//DPTE_SPARK
|
|
|
|
ptdp_plasmaburn = P_FindParticleType("TE_PLASMABURN");
|
|
|
|
ptdp_tei_g3 = P_FindParticleType("TE_TEI_G3");
|
|
|
|
ptdp_tei_smoke = P_FindParticleType("TE_TEI_SMOKE");
|
|
|
|
ptdp_tei_bigexplosion = P_FindParticleType("TE_TEI_BIGEXPLOSION");
|
|
|
|
ptdp_tei_plasmahit = P_FindParticleType("TE_TEI_PLASMAHIT");
|
|
|
|
ptdp_stardust = P_FindParticleType("EF_STARDUST");
|
|
|
|
rt_rocket = P_FindParticleType("TR_ROCKET"); /*rocket trail*/
|
|
|
|
rt_grenade = P_FindParticleType("TR_GRENADE"); /*grenade trail*/
|
|
|
|
rt_blood = P_FindParticleType("TR_BLOOD"); /*blood trail*/
|
|
|
|
rt_wizspike = P_FindParticleType("TR_WIZSPIKE");
|
|
|
|
rt_slightblood = P_FindParticleType("TR_SLIGHTBLOOD");
|
|
|
|
rt_knightspike = P_FindParticleType("TR_KNIGHTSPIKE");
|
|
|
|
rt_vorespike = P_FindParticleType("TR_VORESPIKE");
|
|
|
|
rtdp_neharasmoke = P_FindParticleType("TR_NEHAHRASMOKE");
|
|
|
|
rtdp_nexuizplasma = P_FindParticleType("TR_NEXUIZPLASMA");
|
|
|
|
rtdp_glowtrail = P_FindParticleType("TR_GLOWTRAIL");
|
|
|
|
/*internal to psystem*/ P_FindParticleType("SVC_PARTICLE");
|
|
|
|
|
|
|
|
ptqw_blood = P_FindParticleType("TE_BLOOD");
|
|
|
|
ptqw_lightningblood = P_FindParticleType("TE_LIGHTNINGBLOOD");
|
2008-11-09 22:29:28 +00:00
|
|
|
|
2010-12-05 02:46:07 +00:00
|
|
|
ptq2_blood = P_FindParticleType("TE_BLOOD");
|
|
|
|
rtq2_railtrail = P_FindParticleType("TR_RAILTRAIL");
|
|
|
|
rtq2_blastertrail = P_FindParticleType("TR_BLASTERTRAIL");
|
|
|
|
ptq2_blasterparticles = P_FindParticleType("TE_BLASTERPARTICLES");
|
|
|
|
rtq2_bubbletrail = P_FindParticleType("TE_BUBBLETRAIL");
|
|
|
|
rtq2_gib = P_FindParticleType("TR_GIB");
|
|
|
|
rtq2_rocket = P_FindParticleType("TR_ROCKET");
|
|
|
|
rtq2_grenade = P_FindParticleType("TR_GRENADE");
|
|
|
|
|
|
|
|
rtqw_railtrail = P_FindParticleType("TE_RAILTRAIL");
|
|
|
|
rtfte_lightning1 = P_FindParticleType("TE_LIGHTNING1");
|
|
|
|
ptfte_lightning1_end = P_FindParticleType("TE_LIGHTNING1_END");
|
|
|
|
rtfte_lightning2 = P_FindParticleType("TE_LIGHTNING2");
|
|
|
|
ptfte_lightning2_end = P_FindParticleType("TE_LIGHTNING2_END");
|
|
|
|
rtfte_lightning3 = P_FindParticleType("TE_LIGHTNING3");
|
|
|
|
ptfte_lightning3_end = P_FindParticleType("TE_LIGHTNING3_END");
|
|
|
|
ptfte_bullet = P_FindParticleType("TE_BULLET");
|
|
|
|
ptfte_superbullet = P_FindParticleType("TE_SUPERBULLET");
|
2008-11-09 22:29:28 +00:00
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#ifdef Q2CLIENT
|
|
|
|
enum {
|
|
|
|
q2cl_mod_explode,
|
|
|
|
q2cl_mod_smoke,
|
|
|
|
q2cl_mod_flash,
|
|
|
|
q2cl_mod_parasite_segment,
|
|
|
|
q2cl_mod_grapple_cable,
|
|
|
|
q2cl_mod_parasite_tip,
|
|
|
|
q2cl_mod_explo4,
|
|
|
|
q2cl_mod_bfg_explo,
|
|
|
|
q2cl_mod_powerscreen,
|
|
|
|
q2cl_mod_max
|
|
|
|
};
|
|
|
|
typedef struct {
|
|
|
|
char *modelname;
|
|
|
|
|
|
|
|
} tentmodels_t;
|
|
|
|
tentmodels_t q2tentmodels[q2cl_mod_max] = {
|
|
|
|
{"models/objects/explode/tris.md2"},
|
|
|
|
{"models/objects/smoke/tris.md2"},
|
|
|
|
{"models/objects/flash/tris.md2"},
|
|
|
|
{"models/monsters/parasite/segment/tris.md2"},
|
|
|
|
{"models/ctf/segment/tris.md2"},
|
|
|
|
{"models/monsters/parasite/tip/tris.md2"},
|
|
|
|
{"models/objects/r_explode/tris.md2"},
|
|
|
|
{"sprites/s_bfg2.sp2"},
|
|
|
|
{"models/items/armor/effect/tris.md2"}
|
|
|
|
};
|
|
|
|
|
|
|
|
int CLQ2_RegisterTEntModels (void)
|
|
|
|
{
|
|
|
|
// int i;
|
|
|
|
// for (i = 0; i < q2cl_mod_max; i++)
|
|
|
|
// if (!CL_CheckOrDownloadFile(q2tentmodels[i].modelname, false))
|
|
|
|
// return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
CL_ClearTEnts
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
void CL_ClearTEnts (void)
|
|
|
|
{
|
|
|
|
memset (&cl_beams, 0, sizeof(cl_beams));
|
|
|
|
memset (&cl_explosions, 0, sizeof(cl_explosions));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
CL_AllocExplosion
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
explosion_t *CL_AllocExplosion (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
float time;
|
|
|
|
int index;
|
|
|
|
|
2006-05-28 21:56:04 +00:00
|
|
|
for (i=0; i < explosions_running; i++)
|
|
|
|
{
|
2004-08-23 00:15:46 +00:00
|
|
|
if (!cl_explosions[i].model)
|
|
|
|
{
|
|
|
|
cl_explosions[i].firstframe = -1;
|
2005-05-26 12:55:34 +00:00
|
|
|
cl_explosions[i].framerate = 10;
|
2004-08-23 00:15:46 +00:00
|
|
|
return &cl_explosions[i];
|
|
|
|
}
|
2006-05-28 21:56:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (i == explosions_running && i != MAX_EXPLOSIONS)
|
|
|
|
{
|
|
|
|
explosions_running++;
|
|
|
|
cl_explosions[i].firstframe = -1;
|
|
|
|
cl_explosions[i].framerate = 10;
|
|
|
|
return &cl_explosions[i];
|
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
// find the oldest explosion
|
|
|
|
time = cl.time;
|
|
|
|
index = 0;
|
|
|
|
|
|
|
|
for (i=0 ; i<MAX_EXPLOSIONS ; i++)
|
|
|
|
if (cl_explosions[i].start < time)
|
|
|
|
{
|
|
|
|
time = cl_explosions[i].start;
|
|
|
|
index = i;
|
|
|
|
}
|
|
|
|
cl_explosions[index].firstframe = -1;
|
2005-05-26 12:55:34 +00:00
|
|
|
cl_explosions[index].framerate = 10;
|
2004-08-23 00:15:46 +00:00
|
|
|
return &cl_explosions[index];
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
CL_ParseBeam
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
beam_t *CL_NewBeam (int entity, int tag)
|
|
|
|
{
|
|
|
|
beam_t *b;
|
|
|
|
int i;
|
2005-08-03 23:14:59 +00:00
|
|
|
|
|
|
|
// override any beam with the same entity (unless they used world)
|
|
|
|
if (entity)
|
2005-07-28 04:11:38 +00:00
|
|
|
{
|
2006-05-28 21:56:04 +00:00
|
|
|
for (i=0, b=cl_beams; i < beams_running; i++, b++)
|
2005-07-28 04:11:38 +00:00
|
|
|
if (b->entity == entity && b->tag == tag)
|
|
|
|
{
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
// find a free beam
|
2006-05-28 21:56:04 +00:00
|
|
|
for (i=0, b=cl_beams; i < beams_running; i++, b++)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2005-07-28 00:11:42 +00:00
|
|
|
if (!b->model)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
}
|
2006-05-28 21:56:04 +00:00
|
|
|
|
|
|
|
if (i == beams_running && i != MAX_BEAMS)
|
|
|
|
{
|
|
|
|
beams_running++;
|
|
|
|
return &cl_beams[i];
|
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#define STREAM_ATTACHED 16
|
|
|
|
#define STREAM_TRANSLUCENT 32
|
2005-08-03 23:14:59 +00:00
|
|
|
void CL_AddBeam (int tent, int ent, vec3_t start, vec3_t end) //fixme: use TE_ numbers instead of 0 - 5
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
beam_t *b;
|
|
|
|
|
|
|
|
model_t *m;
|
2005-05-18 23:15:58 +00:00
|
|
|
int btype, etype;
|
2005-08-27 23:28:39 +00:00
|
|
|
int i;
|
2005-08-06 22:39:28 +00:00
|
|
|
vec3_t impact, normal;
|
|
|
|
vec3_t extra;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
switch(tent)
|
|
|
|
{
|
|
|
|
case 0:
|
2005-09-08 22:52:46 +00:00
|
|
|
if (ent < 0 && ent >= -512) //a zquake concept. ent between -1 and -maxplayers is to be taken to be a railtrail from a particular player instead of a beam.
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2005-10-08 22:35:20 +00:00
|
|
|
// TODO: add support for those finnicky colored railtrails...
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_ParticleTrail(start, end, rtqw_railtrail, NULL))
|
2005-10-08 22:35:20 +00:00
|
|
|
P_ParticleTrailIndex(start, end, 208, 8, NULL);
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
default:
|
2005-05-15 18:49:04 +00:00
|
|
|
m = Mod_ForName("progs/bolt.mdl", false);
|
2008-11-09 22:29:28 +00:00
|
|
|
btype = rtfte_lightning1;
|
|
|
|
etype = ptfte_lightning1_end;
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2004-08-31 09:16:56 +00:00
|
|
|
if (ent < 0 && ent >= -MAX_CLIENTS) //based on the railgun concept - this adds a rogue style TE_BEAM effect.
|
2005-05-18 23:15:58 +00:00
|
|
|
{
|
2005-08-03 23:14:59 +00:00
|
|
|
case 5:
|
2004-08-31 09:16:56 +00:00
|
|
|
m = Mod_ForName("progs/beam.mdl", false); //remember to precache!
|
2005-05-18 23:15:58 +00:00
|
|
|
btype = P_FindParticleType("te_beam");
|
2005-06-14 04:52:10 +00:00
|
|
|
etype = P_FindParticleType("te_beam_end");
|
2005-05-18 23:15:58 +00:00
|
|
|
}
|
2004-08-31 09:16:56 +00:00
|
|
|
else
|
2005-05-18 23:15:58 +00:00
|
|
|
{
|
2005-05-15 18:49:04 +00:00
|
|
|
m = Mod_ForName("progs/bolt2.mdl", false);
|
2008-11-09 22:29:28 +00:00
|
|
|
btype = rtfte_lightning2;
|
|
|
|
etype = ptfte_lightning2_end;
|
2005-05-18 23:15:58 +00:00
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2005-05-15 18:49:04 +00:00
|
|
|
m = Mod_ForName("progs/bolt3.mdl", false);
|
2008-11-09 22:29:28 +00:00
|
|
|
btype = rtfte_lightning3;
|
|
|
|
etype = ptfte_lightning3_end;
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
#ifdef Q2CLIENT
|
|
|
|
case 3:
|
|
|
|
m = Mod_ForName(q2tentmodels[q2cl_mod_parasite_segment].modelname, false);
|
2005-05-18 23:15:58 +00:00
|
|
|
btype = P_FindParticleType("te_parasite_attack");
|
|
|
|
etype = P_FindParticleType("te_parasite_attack_end");
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
m = Mod_ForName(q2tentmodels[q2cl_mod_grapple_cable].modelname, false);
|
2005-05-18 23:15:58 +00:00
|
|
|
btype = P_FindParticleType("te_grapple_cable");
|
|
|
|
etype = P_FindParticleType("te_grapple_cable_end");
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-04-06 00:34:32 +00:00
|
|
|
if (!m || m->needload)
|
|
|
|
CL_CheckOrEnqueDownloadFile(m->name, NULL, 0);
|
|
|
|
|
2005-08-27 23:28:39 +00:00
|
|
|
// save end position for truelightning
|
|
|
|
if (ent)
|
|
|
|
{
|
2006-05-28 21:56:04 +00:00
|
|
|
for (i = 0; i < cl.splitclients; i++)
|
2005-08-27 23:28:39 +00:00
|
|
|
{
|
2008-05-17 16:11:42 +00:00
|
|
|
if (ent == (autocam[i]?(spec_track[i]+1):(cl.playernum[i]+1)))
|
2005-08-27 23:28:39 +00:00
|
|
|
{
|
|
|
|
VectorCopy(end, playerbeam_end[i]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (etype >= 0 && cls.state == ca_active && etype != P_INVALID)
|
2005-03-29 13:52:15 +00:00
|
|
|
{
|
2009-11-04 21:16:50 +00:00
|
|
|
if (cl_beam_trace.ival)
|
2005-09-09 02:01:30 +00:00
|
|
|
{
|
|
|
|
VectorSubtract(end, start, normal);
|
|
|
|
VectorNormalize(normal);
|
|
|
|
VectorMA(end, 4, normal, extra); //extend the end-point by four
|
|
|
|
if (!TraceLineN(start, extra, impact, normal))
|
|
|
|
etype = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
VectorCopy(end, impact);
|
|
|
|
normal[0] = normal[1] = normal[2] = 0;
|
|
|
|
}
|
2005-03-29 13:52:15 +00:00
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
b = CL_NewBeam(ent, -1);
|
|
|
|
if (!b)
|
|
|
|
{
|
|
|
|
Con_Printf ("beam list overflow!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
b->entity = ent;
|
|
|
|
b->model = m;
|
|
|
|
b->tag = -1;
|
|
|
|
b->flags |= /*STREAM_ATTACHED|*/1;
|
|
|
|
b->endtime = cl.time + 0.2;
|
|
|
|
b->alpha = 1;
|
2005-05-18 23:15:58 +00:00
|
|
|
b->particleeffect = btype;
|
2004-08-23 00:15:46 +00:00
|
|
|
VectorCopy (start, b->start);
|
|
|
|
VectorCopy (end, b->end);
|
2005-08-06 22:39:28 +00:00
|
|
|
|
|
|
|
if (etype >= 0)
|
|
|
|
{
|
|
|
|
P_RunParticleEffectState (impact, normal, 1, etype, &(b->emitstate));
|
|
|
|
R_AddDecals(end);
|
|
|
|
R_AddStain(end, -10, -10, -10, 20);
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2005-08-03 23:14:59 +00:00
|
|
|
void CL_ParseBeam (int tent)
|
|
|
|
{
|
|
|
|
int ent;
|
|
|
|
vec3_t start, end;
|
|
|
|
|
|
|
|
ent = MSG_ReadShort ();
|
|
|
|
|
|
|
|
start[0] = MSG_ReadCoord ();
|
|
|
|
start[1] = MSG_ReadCoord ();
|
|
|
|
start[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
end[0] = MSG_ReadCoord ();
|
|
|
|
end[1] = MSG_ReadCoord ();
|
|
|
|
end[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
CL_AddBeam(tent, ent, start, end);
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
void CL_ParseStream (int type)
|
|
|
|
{
|
|
|
|
int ent;
|
|
|
|
vec3_t start, end;
|
|
|
|
beam_t *b, *b2;
|
|
|
|
int flags;
|
|
|
|
int tag;
|
|
|
|
float duration;
|
|
|
|
int skin;
|
|
|
|
|
|
|
|
ent = MSG_ReadShort();
|
|
|
|
flags = MSG_ReadByte();
|
|
|
|
tag = flags&15;
|
|
|
|
flags-=tag;
|
|
|
|
duration = (float)MSG_ReadByte()*0.05;
|
|
|
|
skin = 0;
|
2010-08-16 02:03:02 +00:00
|
|
|
if(type == TEH2_STREAM_COLORBEAM)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
skin = MSG_ReadByte();
|
|
|
|
}
|
|
|
|
start[0] = MSG_ReadCoord();
|
|
|
|
start[1] = MSG_ReadCoord();
|
|
|
|
start[2] = MSG_ReadCoord();
|
|
|
|
end[0] = MSG_ReadCoord();
|
|
|
|
end[1] = MSG_ReadCoord();
|
|
|
|
end[2] = MSG_ReadCoord();
|
|
|
|
|
|
|
|
b = CL_NewBeam(ent, tag);
|
|
|
|
if (!b)
|
|
|
|
{
|
|
|
|
Con_Printf ("beam list overflow!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
b->entity = ent;
|
|
|
|
b->tag = tag;
|
|
|
|
b->flags = flags;
|
|
|
|
b->model = NULL;
|
|
|
|
b->endtime = cl.time + duration;
|
|
|
|
b->alpha = 1;
|
2010-08-28 17:14:38 +00:00
|
|
|
b->skin = skin;
|
2004-08-23 00:15:46 +00:00
|
|
|
VectorCopy (start, b->start);
|
|
|
|
VectorCopy (end, b->end);
|
|
|
|
|
|
|
|
switch(type)
|
|
|
|
{
|
2010-08-16 02:03:02 +00:00
|
|
|
case TEH2_STREAM_LIGHTNING_SMALL:
|
|
|
|
b->model = Mod_ForName("models/stltng2.mdl", true);
|
|
|
|
b->flags |= 2;
|
|
|
|
b->particleeffect = P_FindParticleType("te_stream_lightning_small");
|
|
|
|
break;
|
|
|
|
case TEH2_STREAM_LIGHTNING:
|
|
|
|
b->model = Mod_ForName("models/stlghtng.mdl", true);
|
|
|
|
b->flags |= 2;
|
|
|
|
b->particleeffect = P_FindParticleType("te_stream_lightning");
|
|
|
|
break;
|
|
|
|
case TEH2_STREAM_ICECHUNKS:
|
2004-08-23 00:15:46 +00:00
|
|
|
b->model = Mod_ForName("models/stice.mdl", true);
|
|
|
|
b->flags |= 2;
|
2008-11-09 22:29:28 +00:00
|
|
|
b->particleeffect = P_FindParticleType("te_stream_icechunks");
|
2004-08-23 00:15:46 +00:00
|
|
|
R_AddStain(end, -10, -10, 0, 20);
|
|
|
|
break;
|
2010-08-16 02:03:02 +00:00
|
|
|
case TEH2_STREAM_SUNSTAFF1:
|
2004-08-23 00:15:46 +00:00
|
|
|
b->model = Mod_ForName("models/stsunsf1.mdl", true);
|
2008-11-09 22:29:28 +00:00
|
|
|
b->particleeffect = P_FindParticleType("te_stream_sunstaff1");
|
2005-05-18 23:15:58 +00:00
|
|
|
if (b->particleeffect < 0)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2005-05-18 23:15:58 +00:00
|
|
|
b2 = CL_NewBeam(ent, tag+128);
|
|
|
|
if (b2)
|
|
|
|
{
|
|
|
|
memcpy(b2, b, sizeof(*b2));
|
|
|
|
b2->model = Mod_ForName("models/stsunsf2.mdl", true);
|
|
|
|
b2->alpha = 0.5;
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-08-16 02:03:02 +00:00
|
|
|
case TEH2_STREAM_SUNSTAFF2:
|
2004-08-23 00:15:46 +00:00
|
|
|
b->model = Mod_ForName("models/stsunsf1.mdl", true);
|
2008-11-09 22:29:28 +00:00
|
|
|
b->particleeffect = P_FindParticleType("te_stream_sunstaff2");
|
2004-08-23 00:15:46 +00:00
|
|
|
R_AddStain(end, -10, -10, -10, 20);
|
|
|
|
break;
|
2010-08-28 17:14:38 +00:00
|
|
|
case TEH2_STREAM_COLORBEAM:
|
|
|
|
b->model = Mod_ForName("models/stclrbm.mdl", true);
|
|
|
|
b->particleeffect = P_FindParticleType("te_stream_colorbeam");
|
|
|
|
break;
|
2011-01-30 01:32:30 +00:00
|
|
|
case TEH2_STREAM_GAZE:
|
|
|
|
b->model = Mod_ForName("stmedgaz.mdl", true);
|
|
|
|
b->particleeffect = P_FindParticleType("te_stream_gaze");
|
|
|
|
break;
|
2010-08-16 02:03:02 +00:00
|
|
|
default:
|
2010-08-28 17:14:38 +00:00
|
|
|
Con_Printf("CL_ParseStream: type %i\n", type);
|
2010-08-16 02:03:02 +00:00
|
|
|
break;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
CL_ParseTEnt
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef NQPROT
|
|
|
|
void CL_ParseTEnt (qboolean nqprot)
|
|
|
|
#else
|
|
|
|
void CL_ParseTEnt (void)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
#ifndef NQPROT
|
|
|
|
#define nqprot false //it's easier
|
|
|
|
#endif
|
|
|
|
int type;
|
|
|
|
vec3_t pos, pos2;
|
|
|
|
dlight_t *dl;
|
|
|
|
int rnd;
|
|
|
|
// explosion_t *ex;
|
2005-08-03 23:14:59 +00:00
|
|
|
int cnt, colour;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
type = MSG_ReadByte ();
|
2008-11-09 22:29:28 +00:00
|
|
|
|
|
|
|
#ifdef CSQC_DAT
|
|
|
|
if (type != TE_GUNSHOT)
|
|
|
|
{
|
|
|
|
//I know I'm going to regret this.
|
|
|
|
if (CSQC_ParseTempEntity((unsigned char)type))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case TE_WIZSPIKE: // spike hitting wall
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
R_AddStain(pos, -10, 0, -10, 20);
|
|
|
|
|
2005-03-10 03:55:18 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, pt_wizspike))
|
|
|
|
P_RunParticleEffect (pos, vec3_origin, 20, 30);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_wizhit, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_KNIGHTSPIKE: // spike hitting wall
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
R_AddStain(pos, -10, -10, -10, 20);
|
|
|
|
|
2005-03-10 03:55:18 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, pt_knightspike))
|
|
|
|
P_RunParticleEffect (pos, vec3_origin, 226, 20);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_knighthit, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_SPIKEQUAD:
|
2005-07-08 00:37:52 +00:00
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
R_AddStain(pos, -10, -10, -10, 20);
|
|
|
|
R_AddDecals(pos);
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, ptdp_spikequad))
|
2005-07-08 00:37:52 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, pt_spike))
|
|
|
|
if (P_RunParticleEffectType(pos, NULL, 10, pt_gunshot))
|
|
|
|
P_RunParticleEffect (pos, vec3_origin, 0, 10);
|
|
|
|
|
|
|
|
if ( rand() % 5 )
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1, 0);
|
2005-07-08 00:37:52 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
rnd = rand() & 3;
|
|
|
|
if (rnd == 1)
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric1, pos, 1, 1, 0);
|
2005-07-08 00:37:52 +00:00
|
|
|
else if (rnd == 2)
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric2, pos, 1, 1, 0);
|
2005-07-08 00:37:52 +00:00
|
|
|
else
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric3, pos, 1, 1, 0);
|
2005-07-08 00:37:52 +00:00
|
|
|
}
|
|
|
|
break;
|
2004-08-23 00:15:46 +00:00
|
|
|
case TE_SPIKE: // spike hitting wall
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
R_AddStain(pos, -10, -10, -10, 20);
|
|
|
|
R_AddDecals(pos);
|
|
|
|
|
2005-03-10 03:55:18 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, pt_spike))
|
|
|
|
if (P_RunParticleEffectType(pos, NULL, 10, pt_gunshot))
|
|
|
|
P_RunParticleEffect (pos, vec3_origin, 0, 10);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2005-07-08 00:37:52 +00:00
|
|
|
if ( rand() % 5 )
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1, 0);
|
2005-07-08 00:37:52 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
rnd = rand() & 3;
|
|
|
|
if (rnd == 1)
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric1, pos, 1, 1, 0);
|
2005-07-08 00:37:52 +00:00
|
|
|
else if (rnd == 2)
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric2, pos, 1, 1, 0);
|
2005-07-08 00:37:52 +00:00
|
|
|
else
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric3, pos, 1, 1, 0);
|
2005-07-08 00:37:52 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_SUPERSPIKEQUAD: // super spike hitting wall
|
2005-07-08 00:37:52 +00:00
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
R_AddStain(pos, -10, -10, -10, 20);
|
|
|
|
R_AddDecals(pos);
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, ptdp_superspikequad))
|
2005-07-08 00:37:52 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, pt_superspike))
|
|
|
|
if (P_RunParticleEffectType(pos, NULL, 2, pt_spike))
|
|
|
|
if (P_RunParticleEffectType(pos, NULL, 20, pt_gunshot))
|
|
|
|
P_RunParticleEffect (pos, vec3_origin, 0, 20);
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
if ( rand() % 5 )
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
rnd = rand() & 3;
|
|
|
|
if (rnd == 1)
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric1, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
else if (rnd == 2)
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric2, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric3, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TE_SUPERSPIKE: // super spike hitting wall
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
R_AddStain(pos, -10, -10, -10, 20);
|
|
|
|
R_AddDecals(pos);
|
|
|
|
|
2005-03-10 03:55:18 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, pt_superspike))
|
|
|
|
if (P_RunParticleEffectType(pos, NULL, 2, pt_spike))
|
|
|
|
if (P_RunParticleEffectType(pos, NULL, 20, pt_gunshot))
|
|
|
|
P_RunParticleEffect (pos, vec3_origin, 0, 20);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
if ( rand() % 5 )
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
rnd = rand() & 3;
|
|
|
|
if (rnd == 1)
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric1, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
else if (rnd == 2)
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric2, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric3, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
#ifdef PEXT_TE_BULLET
|
|
|
|
case TE_BULLET:
|
|
|
|
if (!(cls.fteprotocolextensions & PEXT_TE_BULLET))
|
2005-09-18 02:12:30 +00:00
|
|
|
Host_EndGame("Thought PEXT_TE_BULLET was disabled");
|
2004-08-23 00:15:46 +00:00
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
R_AddStain(pos, -10, -10, -10, 20);
|
|
|
|
R_AddDecals(pos);
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, ptfte_bullet))
|
2005-03-10 03:55:18 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 10, pt_gunshot))
|
|
|
|
P_RunParticleEffect (pos, vec3_origin, 0, 10);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
if ( rand() % 5 )
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
rnd = rand() & 3;
|
|
|
|
if (rnd == 1)
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric1, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
else if (rnd == 2)
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric2, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric3, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TE_SUPERBULLET:
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
R_AddStain(pos, -10, -10, -10, 20);
|
|
|
|
R_AddDecals(pos);
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, ptfte_superbullet))
|
|
|
|
if (P_RunParticleEffectType(pos, NULL, 2, ptfte_bullet))
|
2005-03-10 03:55:18 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 20, pt_gunshot))
|
|
|
|
P_RunParticleEffect (pos, vec3_origin, 0, 20);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
if ( rand() % 5 )
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_tink1, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
rnd = rand() & 3;
|
|
|
|
if (rnd == 1)
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric1, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
else if (rnd == 2)
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric2, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_ric3, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_EXPLOSIONQUAD: // rocket explosion
|
2005-07-08 00:37:52 +00:00
|
|
|
// particles
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, ptdp_explosionquad))
|
2005-10-08 22:35:20 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
|
|
|
|
P_RunParticleEffect(pos, NULL, 107, 1024); // should be 97-111
|
|
|
|
|
|
|
|
R_AddStain(pos, -1, -1, -1, 100);
|
2005-07-08 00:37:52 +00:00
|
|
|
|
|
|
|
// light
|
2005-08-26 22:56:51 +00:00
|
|
|
if (r_explosionlight.value)
|
|
|
|
{
|
2005-07-20 08:04:46 +00:00
|
|
|
dl = CL_AllocDlight (0);
|
|
|
|
VectorCopy (pos, dl->origin);
|
2006-04-21 05:23:51 +00:00
|
|
|
dl->radius = 150 + r_explosionlight.value*200;
|
2005-07-20 08:04:46 +00:00
|
|
|
dl->die = cl.time + 1;
|
|
|
|
dl->decay = 300;
|
2005-07-08 00:37:52 +00:00
|
|
|
|
2005-07-20 08:04:46 +00:00
|
|
|
dl->color[0] = 0.2;
|
|
|
|
dl->color[1] = 0.155;
|
|
|
|
dl->color[2] = 0.05;
|
|
|
|
dl->channelfade[0] = 0.196;
|
|
|
|
dl->channelfade[1] = 0.23;
|
|
|
|
dl->channelfade[2] = 0.12;
|
|
|
|
}
|
2005-07-08 00:37:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
// sound
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1, 0);
|
2005-07-08 00:37:52 +00:00
|
|
|
|
|
|
|
// sprite
|
2009-11-04 21:16:50 +00:00
|
|
|
if (cl_expsprite.ival) // temp hopefully
|
2005-07-08 00:37:52 +00:00
|
|
|
{
|
|
|
|
explosion_t *ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (pos, ex->origin);
|
|
|
|
ex->start = cl.time;
|
|
|
|
ex->model = Mod_ForName ("progs/s_explod.spr", true);
|
|
|
|
}
|
|
|
|
break;
|
2004-08-23 00:15:46 +00:00
|
|
|
case TE_EXPLOSION: // rocket explosion
|
|
|
|
// particles
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
2005-10-08 22:35:20 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
|
|
|
|
P_RunParticleEffect(pos, NULL, 107, 1024); // should be 97-111
|
|
|
|
|
|
|
|
R_AddStain(pos, -1, -1, -1, 100);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
// light
|
2005-08-26 22:56:51 +00:00
|
|
|
if (r_explosionlight.value)
|
|
|
|
{
|
2005-08-26 21:59:36 +00:00
|
|
|
dl = CL_AllocDlight (0);
|
|
|
|
VectorCopy (pos, dl->origin);
|
2006-04-21 05:23:51 +00:00
|
|
|
dl->radius = 150 + r_explosionlight.value*200;
|
2005-08-26 21:59:36 +00:00
|
|
|
dl->die = cl.time + 1;
|
|
|
|
dl->decay = 300;
|
|
|
|
|
|
|
|
dl->color[0] = 0.2;
|
|
|
|
dl->color[1] = 0.155;
|
|
|
|
dl->color[2] = 0.05;
|
|
|
|
dl->channelfade[0] = 0.196;
|
|
|
|
dl->channelfade[1] = 0.23;
|
|
|
|
dl->channelfade[2] = 0.12;
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
// sound
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
// sprite
|
2009-11-04 21:16:50 +00:00
|
|
|
if (cl_expsprite.ival && !nqprot) // temp hopefully
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
explosion_t *ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (pos, ex->origin);
|
|
|
|
ex->start = cl.time;
|
|
|
|
ex->model = Mod_ForName ("progs/s_explod.spr", true);
|
|
|
|
}
|
|
|
|
break;
|
2005-07-14 01:57:34 +00:00
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_EXPLOSIONRGB:
|
2005-07-14 01:57:34 +00:00
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
2005-10-08 22:35:20 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
|
|
|
|
P_RunParticleEffect(pos, NULL, 107, 1024); // should be 97-111
|
|
|
|
|
|
|
|
R_AddStain(pos, -1, -1, -1, 100);
|
|
|
|
|
2005-07-14 01:57:34 +00:00
|
|
|
|
|
|
|
// light
|
2005-08-26 22:56:51 +00:00
|
|
|
if (r_explosionlight.value)
|
|
|
|
{
|
2005-07-20 08:04:46 +00:00
|
|
|
dl = CL_AllocDlight (0);
|
|
|
|
VectorCopy (pos, dl->origin);
|
2006-04-21 05:23:51 +00:00
|
|
|
dl->radius = 150 + r_explosionlight.value*200;
|
2005-07-20 08:04:46 +00:00
|
|
|
dl->die = cl.time + 0.5;
|
|
|
|
dl->decay = 300;
|
2005-07-14 01:57:34 +00:00
|
|
|
|
2005-07-20 08:04:46 +00:00
|
|
|
dl->color[0] = 0.4f*MSG_ReadByte()/255.0f;
|
|
|
|
dl->color[1] = 0.4f*MSG_ReadByte()/255.0f;
|
|
|
|
dl->color[2] = 0.4f*MSG_ReadByte()/255.0f;
|
|
|
|
dl->channelfade[0] = 0;
|
|
|
|
dl->channelfade[1] = 0;
|
|
|
|
dl->channelfade[2] = 0;
|
|
|
|
}
|
2005-07-14 01:57:34 +00:00
|
|
|
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1, 0);
|
2005-07-14 01:57:34 +00:00
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_TEI_BIGEXPLOSION:
|
2005-07-14 01:57:34 +00:00
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, ptdp_tei_bigexplosion))
|
2005-10-08 22:35:20 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
|
|
|
|
P_RunParticleEffect(pos, NULL, 107, 1024); // should be 97-111
|
|
|
|
|
|
|
|
R_AddStain(pos, -1, -1, -1, 100);
|
2005-07-14 01:57:34 +00:00
|
|
|
|
|
|
|
// light
|
2005-08-26 22:56:51 +00:00
|
|
|
if (r_explosionlight.value)
|
|
|
|
{
|
2005-08-26 21:59:36 +00:00
|
|
|
dl = CL_AllocDlight (0);
|
|
|
|
VectorCopy (pos, dl->origin);
|
|
|
|
// no point in doing this the fuh/ez way
|
2006-04-21 05:23:51 +00:00
|
|
|
dl->radius = 500*r_explosionlight.value;
|
2005-08-26 21:59:36 +00:00
|
|
|
dl->die = cl.time + 1;
|
|
|
|
dl->decay = 500;
|
|
|
|
|
|
|
|
dl->color[0] = 0.4f;
|
|
|
|
dl->color[1] = 0.3f;
|
|
|
|
dl->color[2] = 0.15f;
|
|
|
|
dl->channelfade[0] = 0;
|
|
|
|
dl->channelfade[1] = 0;
|
|
|
|
dl->channelfade[2] = 0;
|
|
|
|
}
|
2005-07-14 01:57:34 +00:00
|
|
|
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1, 0);
|
2005-07-14 01:57:34 +00:00
|
|
|
break;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
case TE_TAREXPLOSION: // tarbaby explosion
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
2008-11-09 22:29:28 +00:00
|
|
|
P_RunParticleEffectType(pos, NULL, 1, pt_tarexplosion);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_LIGHTNING1: // lightning bolts
|
|
|
|
case TE_LIGHTNING2: // lightning bolts
|
|
|
|
CL_ParseBeam (type - TE_LIGHTNING1);
|
|
|
|
break;
|
2004-08-26 07:38:52 +00:00
|
|
|
case TE_LIGHTNING3: // lightning bolts
|
|
|
|
CL_ParseBeam (2);
|
|
|
|
break;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
case TE_LAVASPLASH:
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
2008-11-09 22:29:28 +00:00
|
|
|
P_RunParticleEffectType(pos, NULL, 1, pt_lavasplash);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_TELEPORT:
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
2005-03-15 22:51:01 +00:00
|
|
|
P_RunParticleEffectType(pos, NULL, 1, pt_teleportsplash);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_GUNSHOTQUAD: // bullet hitting wall
|
2005-07-08 00:37:52 +00:00
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
R_AddStain(pos, -10, -10, -10, 20);
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, ptdp_gunshotquad))
|
2005-07-08 00:37:52 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, pt_gunshot))
|
|
|
|
P_RunParticleEffect (pos, vec3_origin, 0, 20);
|
|
|
|
|
|
|
|
break;
|
2004-08-23 00:15:46 +00:00
|
|
|
case TE_GUNSHOT: // bullet hitting wall
|
|
|
|
if (nqprot)
|
|
|
|
cnt = 1;
|
|
|
|
else
|
|
|
|
cnt = MSG_ReadByte ();
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
R_AddStain(pos, -10, -10, -10, 20);
|
|
|
|
|
2005-03-10 03:55:18 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, cnt, pt_gunshot))
|
|
|
|
P_RunParticleEffect (pos, vec3_origin, 0, 20*cnt);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEQW_BLOOD: // bullets hitting body
|
2004-08-23 00:15:46 +00:00
|
|
|
cnt = MSG_ReadByte ();
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
R_AddStain(pos, 0, -10, -10, 40);
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, cnt, ptqw_blood))
|
|
|
|
if (P_RunParticleEffectType(pos, NULL, cnt, ptdp_blood))
|
|
|
|
P_RunParticleEffect (pos, vec3_origin, 73, 20*cnt);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEQW_LIGHTNINGBLOOD: // lightning hitting body
|
2004-08-23 00:15:46 +00:00
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
R_AddStain(pos, 1, -10, -10, 20);
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, ptqw_lightningblood))
|
2005-03-10 03:55:18 +00:00
|
|
|
P_RunParticleEffect (pos, vec3_origin, 225, 50);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_RAILTRAIL:
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
pos2[0] = MSG_ReadCoord ();
|
|
|
|
pos2[1] = MSG_ReadCoord ();
|
|
|
|
pos2[2] = MSG_ReadCoord ();
|
2005-10-08 22:35:20 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_ParticleTrail(pos, pos2, rtqw_railtrail, NULL))
|
|
|
|
if (P_ParticleTrail(pos, pos2, rtq2_railtrail, NULL))
|
|
|
|
P_ParticleTrailIndex(pos, pos2, 208, 8, NULL);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
2010-08-16 02:03:02 +00:00
|
|
|
case TEH2_STREAM_LIGHTNING_SMALL:
|
|
|
|
case TEH2_STREAM_CHAIN:
|
|
|
|
case TEH2_STREAM_SUNSTAFF1:
|
|
|
|
case TEH2_STREAM_SUNSTAFF2:
|
|
|
|
case TEH2_STREAM_LIGHTNING:
|
|
|
|
case TEH2_STREAM_COLORBEAM:
|
|
|
|
case TEH2_STREAM_ICECHUNKS:
|
|
|
|
case TEH2_STREAM_GAZE:
|
|
|
|
case TEH2_STREAM_FAMINE:
|
2004-08-23 00:15:46 +00:00
|
|
|
CL_ParseStream (type);
|
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_BLOOD:
|
2004-11-20 00:56:15 +00:00
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
pos2[0] = MSG_ReadChar ();
|
|
|
|
pos2[1] = MSG_ReadChar ();
|
|
|
|
pos2[2] = MSG_ReadChar ();
|
|
|
|
|
|
|
|
cnt = MSG_ReadByte ();
|
2005-05-18 23:15:58 +00:00
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
P_RunParticleEffectType(pos, pos2, cnt, ptdp_blood);
|
2004-11-20 00:56:15 +00:00
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_SPARK:
|
2004-11-20 00:56:15 +00:00
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
pos2[0] = MSG_ReadChar ();
|
|
|
|
pos2[1] = MSG_ReadChar ();
|
|
|
|
pos2[2] = MSG_ReadChar ();
|
|
|
|
|
|
|
|
cnt = MSG_ReadByte ();
|
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
P_RunParticleEffectType(pos, pos2, cnt, ptdp_spark);
|
2004-11-20 00:56:15 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_BLOODSHOWER:
|
2005-05-15 18:49:04 +00:00
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
pos2[0] = MSG_ReadCoord ();
|
|
|
|
pos2[1] = MSG_ReadCoord ();
|
|
|
|
pos2[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
cnt = MSG_ReadCoord (); //speed
|
|
|
|
|
|
|
|
cnt = MSG_ReadShort ();
|
|
|
|
|
|
|
|
{
|
|
|
|
VectorAdd(pos, pos2, pos);
|
|
|
|
VectorScale(pos, 0.5, pos);
|
2005-07-14 01:57:34 +00:00
|
|
|
P_RunParticleEffectTypeString(pos, NULL, cnt, "te_bloodshower");
|
2005-05-15 18:49:04 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_SMALLFLASH:
|
2004-11-20 00:56:15 +00:00
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
2005-03-13 21:00:26 +00:00
|
|
|
|
|
|
|
// light
|
|
|
|
dl = CL_AllocDlight (0);
|
|
|
|
VectorCopy (pos, dl->origin);
|
|
|
|
dl->radius = 200;
|
|
|
|
dl->decay = 1000;
|
|
|
|
dl->die = cl.time + 0.2;
|
|
|
|
dl->color[0] = 0.4;
|
|
|
|
dl->color[1] = 0.4;
|
|
|
|
dl->color[2] = 0.4;
|
2004-11-20 00:56:15 +00:00
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_CUSTOMFLASH:
|
2004-11-20 00:56:15 +00:00
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
// light
|
|
|
|
dl = CL_AllocDlight (0);
|
|
|
|
VectorCopy (pos, dl->origin);
|
|
|
|
dl->radius = MSG_ReadByte()*8;
|
|
|
|
pos2[0] = (MSG_ReadByte() + 1) * (1.0 / 256.0);
|
|
|
|
dl->die = cl.time + pos2[0];
|
|
|
|
dl->decay = dl->radius / pos2[0];
|
2005-03-13 21:00:26 +00:00
|
|
|
|
|
|
|
// DP's range is 0-2 for lights, FTE is 0-0.4.. 255/637.5 = 0.4
|
|
|
|
dl->color[0] = MSG_ReadByte()*(1.0f/637.5f);
|
|
|
|
dl->color[1] = MSG_ReadByte()*(1.0f/637.5f);
|
|
|
|
dl->color[2] = MSG_ReadByte()*(1.0f/637.5f);
|
2004-11-20 00:56:15 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_FLAMEJET:
|
2005-03-13 21:00:26 +00:00
|
|
|
// origin
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
2004-11-26 06:06:43 +00:00
|
|
|
|
2005-03-13 21:00:26 +00:00
|
|
|
// velocity
|
|
|
|
pos2[0] = MSG_ReadCoord ();
|
|
|
|
pos2[1] = MSG_ReadCoord ();
|
|
|
|
pos2[2] = MSG_ReadCoord ();
|
2004-11-26 06:06:43 +00:00
|
|
|
|
2005-03-13 21:00:26 +00:00
|
|
|
// count
|
|
|
|
cnt = MSG_ReadByte ();
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, pos2, cnt, ptdp_flamejet))
|
2005-03-15 02:57:02 +00:00
|
|
|
P_RunParticleEffect (pos, pos2, 232, cnt);
|
2004-11-26 06:06:43 +00:00
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_PLASMABURN:
|
2005-03-13 21:00:26 +00:00
|
|
|
// origin
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
|
|
|
|
|
|
|
// light
|
|
|
|
dl = CL_AllocDlight (0);
|
|
|
|
VectorCopy (pos, dl->origin);
|
|
|
|
dl->radius = 200;
|
|
|
|
dl->decay = 1000;
|
|
|
|
dl->die = cl.time + 0.2;
|
|
|
|
dl->color[0] = 0.2;
|
|
|
|
dl->color[1] = 0.2;
|
|
|
|
dl->color[2] = 0.2;
|
|
|
|
|
|
|
|
// stain (Hopefully this is close to how DP does it)
|
|
|
|
R_AddStain(pos, -10, -10, -10, 30);
|
2004-11-26 06:06:43 +00:00
|
|
|
|
2005-10-08 22:35:20 +00:00
|
|
|
if (P_ParticleTrail(pos, pos2, P_FindParticleType("te_plasmaburn"), NULL))
|
|
|
|
P_ParticleTrailIndex(pos, pos2, 15, 0, NULL);
|
2004-11-26 06:06:43 +00:00
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_TEI_G3: //nexuiz's nex beam
|
2005-04-16 16:21:27 +00:00
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
2004-11-20 00:56:15 +00:00
|
|
|
|
2005-04-16 16:21:27 +00:00
|
|
|
pos2[0] = MSG_ReadCoord ();
|
|
|
|
pos2[1] = MSG_ReadCoord ();
|
|
|
|
pos2[2] = MSG_ReadCoord ();
|
2004-11-20 00:56:15 +00:00
|
|
|
|
2005-04-16 16:21:27 +00:00
|
|
|
//sigh...
|
|
|
|
MSG_ReadCoord ();
|
|
|
|
MSG_ReadCoord ();
|
|
|
|
MSG_ReadCoord ();
|
2004-11-20 00:56:15 +00:00
|
|
|
|
2005-10-08 22:35:20 +00:00
|
|
|
if (P_ParticleTrail(pos, pos2, P_FindParticleType("te_nexbeam"), NULL))
|
|
|
|
P_ParticleTrailIndex(pos, pos2, 15, 0, NULL);
|
2004-11-20 00:56:15 +00:00
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_SMOKE:
|
2005-05-13 10:42:48 +00:00
|
|
|
//org
|
|
|
|
pos[0] = MSG_ReadCoord ();
|
2005-07-01 19:23:00 +00:00
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
2005-05-13 10:42:48 +00:00
|
|
|
|
|
|
|
//dir
|
|
|
|
pos2[0] = MSG_ReadCoord ();
|
2005-07-01 19:23:00 +00:00
|
|
|
pos2[1] = MSG_ReadCoord ();
|
|
|
|
pos2[2] = MSG_ReadCoord ();
|
2005-05-13 10:42:48 +00:00
|
|
|
|
|
|
|
//count
|
|
|
|
cnt = MSG_ReadByte ();
|
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
P_RunParticleEffectType(pos, pos2, cnt, ptdp_tei_smoke);
|
2005-05-13 10:42:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_TEI_PLASMAHIT:
|
2005-04-16 16:21:27 +00:00
|
|
|
pos[0] = MSG_ReadCoord ();
|
|
|
|
pos[1] = MSG_ReadCoord ();
|
|
|
|
pos[2] = MSG_ReadCoord ();
|
2004-11-20 00:56:15 +00:00
|
|
|
|
2005-04-16 16:21:27 +00:00
|
|
|
//dir
|
|
|
|
pos2[0] = MSG_ReadCoord ();
|
|
|
|
pos2[1] = MSG_ReadCoord ();
|
|
|
|
pos2[2] = MSG_ReadCoord ();
|
|
|
|
cnt = MSG_ReadByte ();
|
2004-11-20 00:56:15 +00:00
|
|
|
|
2005-04-16 16:21:27 +00:00
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
P_RunParticleEffectType(pos, pos2, cnt, ptdp_tei_plasmahit);
|
2005-04-16 16:21:27 +00:00
|
|
|
}
|
2004-11-20 00:56:15 +00:00
|
|
|
break;
|
|
|
|
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_PARTICLECUBE:
|
2005-08-03 23:14:59 +00:00
|
|
|
{
|
|
|
|
vec3_t dir;
|
|
|
|
int jitter;
|
|
|
|
int gravity;
|
|
|
|
|
|
|
|
//min
|
|
|
|
pos[0] = MSG_ReadCoord();
|
|
|
|
pos[1] = MSG_ReadCoord();
|
|
|
|
pos[2] = MSG_ReadCoord();
|
|
|
|
|
|
|
|
//max
|
|
|
|
pos2[0] = MSG_ReadCoord();
|
|
|
|
pos2[1] = MSG_ReadCoord();
|
|
|
|
pos2[2] = MSG_ReadCoord();
|
|
|
|
|
|
|
|
//dir
|
|
|
|
dir[0] = MSG_ReadCoord();
|
|
|
|
dir[1] = MSG_ReadCoord();
|
|
|
|
dir[2] = MSG_ReadCoord();
|
|
|
|
|
|
|
|
cnt = MSG_ReadShort(); //count
|
|
|
|
colour = MSG_ReadByte (); //colour
|
|
|
|
gravity = MSG_ReadByte (); //gravity flag
|
|
|
|
jitter = MSG_ReadCoord(); //jitter
|
|
|
|
|
|
|
|
P_RunParticleCube(pos, pos2, dir, cnt, colour, gravity, jitter);
|
|
|
|
}
|
|
|
|
break;
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_PARTICLERAIN:
|
2005-08-03 23:14:59 +00:00
|
|
|
{
|
|
|
|
vec3_t dir;
|
|
|
|
|
|
|
|
//min
|
|
|
|
pos[0] = MSG_ReadCoord();
|
|
|
|
pos[1] = MSG_ReadCoord();
|
|
|
|
pos[2] = MSG_ReadCoord();
|
|
|
|
|
|
|
|
//max
|
|
|
|
pos2[0] = MSG_ReadCoord();
|
|
|
|
pos2[1] = MSG_ReadCoord();
|
|
|
|
pos2[2] = MSG_ReadCoord();
|
|
|
|
|
|
|
|
//dir
|
|
|
|
dir[0] = MSG_ReadCoord();
|
|
|
|
dir[1] = MSG_ReadCoord();
|
|
|
|
dir[2] = MSG_ReadCoord();
|
|
|
|
|
|
|
|
cnt = MSG_ReadShort(); //count
|
|
|
|
colour = MSG_ReadByte (); //colour
|
|
|
|
|
|
|
|
P_RunParticleWeather(pos, pos2, dir, cnt, colour, "rain");
|
|
|
|
}
|
|
|
|
break;
|
2010-03-25 22:56:11 +00:00
|
|
|
case TEDP_PARTICLESNOW:
|
2005-08-03 23:14:59 +00:00
|
|
|
{
|
|
|
|
vec3_t dir;
|
|
|
|
|
|
|
|
//min
|
|
|
|
pos[0] = MSG_ReadCoord();
|
|
|
|
pos[1] = MSG_ReadCoord();
|
|
|
|
pos[2] = MSG_ReadCoord();
|
|
|
|
|
|
|
|
//max
|
|
|
|
pos2[0] = MSG_ReadCoord();
|
|
|
|
pos2[1] = MSG_ReadCoord();
|
|
|
|
pos2[2] = MSG_ReadCoord();
|
|
|
|
|
|
|
|
//dir
|
|
|
|
dir[0] = MSG_ReadCoord();
|
|
|
|
dir[1] = MSG_ReadCoord();
|
|
|
|
dir[2] = MSG_ReadCoord();
|
|
|
|
|
|
|
|
cnt = MSG_ReadShort(); //count
|
|
|
|
colour = MSG_ReadByte (); //colour
|
|
|
|
|
|
|
|
P_RunParticleWeather(pos, pos2, dir, cnt, colour, "snow");
|
|
|
|
}
|
|
|
|
break;
|
2005-07-14 01:57:34 +00:00
|
|
|
|
2005-08-03 23:14:59 +00:00
|
|
|
default:
|
2004-08-23 00:15:46 +00:00
|
|
|
Host_EndGame ("CL_ParseTEnt: bad type - %i", type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MSG_ReadPos (vec3_t pos);
|
|
|
|
void MSG_ReadDir (vec3_t dir);
|
|
|
|
typedef struct {
|
2010-08-28 17:14:38 +00:00
|
|
|
char name[64];
|
2004-08-23 00:15:46 +00:00
|
|
|
int netstyle;
|
|
|
|
int particleeffecttype;
|
|
|
|
char stain[3];
|
|
|
|
qbyte radius;
|
|
|
|
vec3_t dlightrgb;
|
|
|
|
float dlightradius;
|
|
|
|
float dlighttime;
|
2004-08-30 06:07:13 +00:00
|
|
|
vec3_t dlightcfade;
|
2004-08-23 00:15:46 +00:00
|
|
|
} clcustomtents_t;
|
|
|
|
|
|
|
|
clcustomtents_t customtenttype[255]; //network based.
|
|
|
|
void CL_ParseCustomTEnt(void)
|
|
|
|
{
|
|
|
|
int count;
|
|
|
|
vec3_t pos;
|
|
|
|
vec3_t pos2;
|
|
|
|
vec3_t dir;
|
|
|
|
char *str;
|
|
|
|
clcustomtents_t *t;
|
|
|
|
int type = MSG_ReadByte();
|
2010-08-28 17:14:38 +00:00
|
|
|
qboolean failed;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2005-01-29 02:26:42 +00:00
|
|
|
if (type == 255) //255 is register
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
type = MSG_ReadByte();
|
|
|
|
if (type == 255)
|
|
|
|
Host_EndGame("Custom temp type 255 isn't valid\n");
|
|
|
|
t = &customtenttype[type];
|
|
|
|
|
|
|
|
t->netstyle = MSG_ReadByte();
|
|
|
|
str = MSG_ReadString();
|
2010-08-28 17:14:38 +00:00
|
|
|
Q_strncpyz(t->name, str, sizeof(t->name));
|
2010-12-05 02:46:07 +00:00
|
|
|
t->particleeffecttype = P_FindParticleType(str);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
if (t->netstyle & CTE_STAINS)
|
|
|
|
{
|
|
|
|
t->stain[0] = MSG_ReadChar();
|
|
|
|
t->stain[1] = MSG_ReadChar();
|
|
|
|
t->stain[2] = MSG_ReadChar();
|
|
|
|
t->radius = MSG_ReadByte();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
t->radius = 0;
|
|
|
|
if (t->netstyle & CTE_GLOWS)
|
|
|
|
{
|
|
|
|
t->dlightrgb[0] = MSG_ReadByte()/255.0f;
|
|
|
|
t->dlightrgb[1] = MSG_ReadByte()/255.0f;
|
|
|
|
t->dlightrgb[2] = MSG_ReadByte()/255.0f;
|
|
|
|
t->dlightradius = MSG_ReadByte();
|
|
|
|
t->dlighttime = MSG_ReadByte()/16.0f;
|
2004-08-30 06:07:13 +00:00
|
|
|
if (t->netstyle & CTE_CHANNELFADE)
|
|
|
|
{
|
|
|
|
t->dlightcfade[0] = MSG_ReadByte()/64.0f;
|
|
|
|
t->dlightcfade[1] = MSG_ReadByte()/64.0f;
|
|
|
|
t->dlightcfade[2] = MSG_ReadByte()/64.0f;
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
t->dlighttime = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
t = &customtenttype[type];
|
|
|
|
|
|
|
|
if (t->netstyle & CTE_ISBEAM)
|
|
|
|
{
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadPos (pos2);
|
2010-08-28 17:14:38 +00:00
|
|
|
failed = P_ParticleTrail(pos, pos2, t->particleeffecttype, NULL);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (t->netstyle & CTE_CUSTOMCOUNT)
|
|
|
|
count = MSG_ReadByte();
|
|
|
|
else
|
|
|
|
count = 1;
|
|
|
|
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
VectorCopy(pos, pos2);
|
|
|
|
|
2010-08-28 17:14:38 +00:00
|
|
|
if (t->netstyle & CTE_CUSTOMVELOCITY)
|
|
|
|
{
|
|
|
|
dir[0] = MSG_ReadCoord();
|
|
|
|
dir[1] = MSG_ReadCoord();
|
|
|
|
dir[2] = MSG_ReadCoord();
|
|
|
|
failed = P_RunParticleEffectType(pos, dir, count, t->particleeffecttype);
|
|
|
|
}
|
|
|
|
else if (t->netstyle & CTE_CUSTOMDIRECTION)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
MSG_ReadDir (dir);
|
2010-08-28 17:14:38 +00:00
|
|
|
failed = P_RunParticleEffectType(pos, dir, count, t->particleeffecttype);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2010-08-28 17:14:38 +00:00
|
|
|
else failed = P_RunParticleEffectType(pos, NULL, count, t->particleeffecttype);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
2010-08-28 17:14:38 +00:00
|
|
|
if (failed)
|
2011-01-30 01:32:30 +00:00
|
|
|
Con_DPrintf("Failed to create effect %s\n", t->name);
|
2010-08-28 17:14:38 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
if (t->netstyle & CTE_STAINS)
|
|
|
|
{ //added at pos2 - end of trail
|
|
|
|
R_AddStain(pos2, t->stain[0], t->stain[1], t->stain[2], 40);
|
|
|
|
}
|
|
|
|
if (t->netstyle & CTE_GLOWS)
|
|
|
|
{ //added at pos1 firer's end.
|
|
|
|
dlight_t *dl;
|
|
|
|
dl = CL_AllocDlight (0);
|
|
|
|
VectorCopy (pos, dl->origin);
|
|
|
|
dl->radius = t->dlightradius*4;
|
|
|
|
dl->die = cl.time + t->dlighttime;
|
|
|
|
dl->decay = t->radius/t->dlighttime;
|
|
|
|
|
|
|
|
dl->color[0] = t->dlightrgb[0];
|
|
|
|
dl->color[1] = t->dlightrgb[1];
|
|
|
|
dl->color[2] = t->dlightrgb[2];
|
|
|
|
|
2004-08-30 06:07:13 +00:00
|
|
|
if (t->netstyle & CTE_CHANNELFADE)
|
|
|
|
{
|
|
|
|
dl->channelfade[0] = t->dlightcfade[0];
|
|
|
|
dl->channelfade[1] = t->dlightcfade[1];
|
|
|
|
dl->channelfade[2] = t->dlightcfade[2];
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2004-08-23 00:15:46 +00:00
|
|
|
if (dl->color[0] < 0)
|
|
|
|
dl->channelfade[0] = 0;
|
|
|
|
else
|
|
|
|
dl->channelfade[0] = dl->color[0]/t->dlighttime;
|
|
|
|
|
|
|
|
if (dl->color[1] < 0)
|
|
|
|
dl->channelfade[1] = 0;
|
|
|
|
else
|
|
|
|
dl->channelfade[1] = dl->color[0]/t->dlighttime;
|
|
|
|
|
|
|
|
if (dl->color[2] < 0)
|
|
|
|
dl->channelfade[2] = 0;
|
|
|
|
else
|
|
|
|
dl->channelfade[2] = dl->color[0]/t->dlighttime;
|
2004-08-30 06:07:13 +00:00
|
|
|
*/
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
void CL_ClearCustomTEnts(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < sizeof(customtenttype)/sizeof(customtenttype[0]); i++)
|
|
|
|
customtenttype[i].particleeffecttype = -1;
|
|
|
|
}
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
void CLDP_ParseTrailParticles(void)
|
|
|
|
{
|
|
|
|
int entityindex;
|
|
|
|
int effectindex;
|
|
|
|
vec3_t start, end;
|
|
|
|
trailstate_t **ts;
|
|
|
|
|
|
|
|
entityindex = (unsigned short)MSG_ReadShort();
|
|
|
|
effectindex = (unsigned short)MSG_ReadShort();
|
|
|
|
|
|
|
|
start[0] = MSG_ReadCoord();
|
|
|
|
start[1] = MSG_ReadCoord();
|
|
|
|
start[2] = MSG_ReadCoord();
|
|
|
|
end[0] = MSG_ReadCoord();
|
|
|
|
end[1] = MSG_ReadCoord();
|
|
|
|
end[2] = MSG_ReadCoord();
|
|
|
|
|
|
|
|
if (entityindex && (unsigned int)entityindex < MAX_EDICTS)
|
|
|
|
ts = &cl.lerpents[entityindex].trailstate;
|
|
|
|
else
|
|
|
|
ts = NULL;
|
|
|
|
|
2010-12-05 02:46:07 +00:00
|
|
|
effectindex = P_FindParticleType(COM_Effectinfo_ForNumber(effectindex));
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_ParticleTrail(start, end, effectindex, ts))
|
|
|
|
P_ParticleTrail(start, end, rt_blood, ts);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CLDP_ParsePointParticles(qboolean compact)
|
|
|
|
{
|
|
|
|
vec3_t org, dir;
|
|
|
|
unsigned int count, effectindex;
|
|
|
|
|
|
|
|
effectindex = (unsigned short)MSG_ReadShort();
|
|
|
|
org[0] = MSG_ReadCoord();
|
|
|
|
org[1] = MSG_ReadCoord();
|
|
|
|
org[2] = MSG_ReadCoord();
|
|
|
|
if (compact)
|
|
|
|
{
|
|
|
|
dir[0] = dir[1] = dir[2] = 0;
|
|
|
|
count = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dir[0] = MSG_ReadCoord();
|
|
|
|
dir[1] = MSG_ReadCoord();
|
|
|
|
dir[2] = MSG_ReadCoord();
|
|
|
|
count = (unsigned short)MSG_ReadShort();
|
|
|
|
}
|
|
|
|
|
2010-12-05 02:46:07 +00:00
|
|
|
effectindex = P_FindParticleType(COM_Effectinfo_ForNumber(effectindex));
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(org, dir, count, effectindex))
|
|
|
|
P_RunParticleEffect (org, dir, 15, 15);
|
|
|
|
}
|
|
|
|
|
2005-03-10 03:55:18 +00:00
|
|
|
void CLNQ_ParseParticleEffect (void)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
vec3_t org, dir;
|
2011-02-27 15:01:56 +00:00
|
|
|
int i, msgcount, color;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
org[i] = MSG_ReadCoord ();
|
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
dir[i] = MSG_ReadChar () * (1.0/16);
|
|
|
|
msgcount = MSG_ReadByte ();
|
|
|
|
color = MSG_ReadByte ();
|
|
|
|
|
|
|
|
if (msgcount == 255)
|
2011-02-27 15:01:56 +00:00
|
|
|
{
|
|
|
|
// treat as spriteless explosion (qtest/some mods require this)
|
|
|
|
if (P_RunParticleEffectType(org, NULL, 1, pt_explosion))
|
|
|
|
P_RunParticleEffect(org, NULL, 107, 1024); // should be 97-111
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
2011-02-27 15:01:56 +00:00
|
|
|
P_RunParticleEffect (org, dir, color, msgcount);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2005-03-10 03:55:18 +00:00
|
|
|
void CL_ParseParticleEffect2 (void)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
vec3_t org, dmin, dmax;
|
|
|
|
int i, msgcount, color, effect;
|
|
|
|
|
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
org[i] = MSG_ReadCoord ();
|
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
dmin[i] = MSG_ReadFloat ();
|
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
dmax[i] = MSG_ReadFloat ();
|
|
|
|
color = MSG_ReadShort ();
|
|
|
|
msgcount = MSG_ReadByte ();
|
|
|
|
effect = MSG_ReadByte ();
|
|
|
|
|
2005-03-10 03:55:18 +00:00
|
|
|
P_RunParticleEffect2 (org, dmin, dmax, color, effect, msgcount);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2005-03-10 03:55:18 +00:00
|
|
|
void CL_ParseParticleEffect3 (void)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
vec3_t org, box;
|
|
|
|
int i, msgcount, color, effect;
|
|
|
|
|
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
org[i] = MSG_ReadCoord ();
|
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
box[i] = MSG_ReadByte ();
|
|
|
|
color = MSG_ReadShort ();
|
|
|
|
msgcount = MSG_ReadByte ();
|
|
|
|
effect = MSG_ReadByte ();
|
|
|
|
|
2005-03-10 03:55:18 +00:00
|
|
|
P_RunParticleEffect3 (org, box, color, effect, msgcount);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2005-03-10 03:55:18 +00:00
|
|
|
void CL_ParseParticleEffect4 (void)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
vec3_t org;
|
|
|
|
int i, msgcount, color, effect;
|
|
|
|
float radius;
|
|
|
|
|
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
org[i] = MSG_ReadCoord ();
|
|
|
|
radius = MSG_ReadByte();
|
|
|
|
color = MSG_ReadShort ();
|
|
|
|
msgcount = MSG_ReadByte ();
|
|
|
|
effect = MSG_ReadByte ();
|
|
|
|
|
2005-03-10 03:55:18 +00:00
|
|
|
P_RunParticleEffect4 (org, radius, color, effect, msgcount);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
2010-08-28 17:14:38 +00:00
|
|
|
void CL_SpawnSpriteEffect(vec3_t org, vec3_t dir, model_t *model, int startframe, int framecount, int framerate, float alpha)
|
2005-07-01 19:23:00 +00:00
|
|
|
{
|
|
|
|
explosion_t *ex;
|
|
|
|
|
|
|
|
ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (org, ex->origin);
|
|
|
|
ex->start = cl.time;
|
|
|
|
ex->model = model;
|
|
|
|
ex->firstframe = startframe;
|
|
|
|
ex->numframes = framecount;
|
|
|
|
ex->framerate = framerate;
|
2010-08-28 17:14:38 +00:00
|
|
|
ex->alpha = alpha;
|
2005-07-01 19:23:00 +00:00
|
|
|
|
|
|
|
ex->angles[0] = 0;
|
|
|
|
ex->angles[1] = 0;
|
|
|
|
ex->angles[2] = 0;
|
2010-08-28 17:14:38 +00:00
|
|
|
|
|
|
|
if (dir)
|
|
|
|
VectorCopy(dir, ex->velocity);
|
|
|
|
else
|
|
|
|
VectorClear(ex->velocity);
|
2005-07-01 19:23:00 +00:00
|
|
|
}
|
2004-11-20 00:56:15 +00:00
|
|
|
|
|
|
|
// [vector] org [byte] modelindex [byte] startframe [byte] framecount [byte] framerate
|
|
|
|
// [vector] org [short] modelindex [short] startframe [byte] framecount [byte] framerate
|
|
|
|
void CL_ParseEffect (qboolean effect2)
|
|
|
|
{
|
|
|
|
vec3_t org;
|
|
|
|
int modelindex;
|
|
|
|
int startframe;
|
|
|
|
int framecount;
|
|
|
|
int framerate;
|
|
|
|
|
|
|
|
org[0] = MSG_ReadCoord();
|
|
|
|
org[1] = MSG_ReadCoord();
|
|
|
|
org[2] = MSG_ReadCoord();
|
|
|
|
|
|
|
|
if (effect2)
|
|
|
|
modelindex = MSG_ReadShort();
|
|
|
|
else
|
|
|
|
modelindex = MSG_ReadByte();
|
|
|
|
|
|
|
|
if (effect2)
|
|
|
|
startframe = MSG_ReadShort();
|
|
|
|
else
|
|
|
|
startframe = MSG_ReadByte();
|
|
|
|
|
|
|
|
framecount = MSG_ReadByte();
|
|
|
|
framerate = MSG_ReadByte();
|
|
|
|
|
|
|
|
|
2010-08-28 17:14:38 +00:00
|
|
|
CL_SpawnSpriteEffect(org, vec3_origin, cl.model_precache[modelindex], startframe, framecount, framerate, 1);
|
2004-11-20 00:56:15 +00:00
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#ifdef Q2CLIENT
|
|
|
|
void CL_SmokeAndFlash(vec3_t origin)
|
|
|
|
{
|
|
|
|
explosion_t *ex;
|
|
|
|
|
|
|
|
ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (origin, ex->origin);
|
2005-03-18 06:14:07 +00:00
|
|
|
VectorClear(ex->angles);
|
2004-08-23 00:15:46 +00:00
|
|
|
// ex->type = ex_misc;
|
2005-03-18 06:14:07 +00:00
|
|
|
ex->numframes = 4;
|
|
|
|
ex->flags = Q2RF_TRANSLUCENT;
|
|
|
|
ex->start = cl.time;
|
2004-08-23 00:15:46 +00:00
|
|
|
ex->model = Mod_ForName (q2tentmodels[q2cl_mod_smoke].modelname, false);
|
|
|
|
|
|
|
|
ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (origin, ex->origin);
|
2005-03-18 06:14:07 +00:00
|
|
|
VectorClear(ex->angles);
|
2004-08-23 00:15:46 +00:00
|
|
|
// ex->type = ex_flash;
|
2005-03-18 06:14:07 +00:00
|
|
|
ex->flags = Q2RF_FULLBRIGHT;
|
|
|
|
ex->numframes = 2;
|
|
|
|
ex->start = cl.time;
|
2004-08-23 00:15:46 +00:00
|
|
|
ex->model = Mod_ForName (q2tentmodels[q2cl_mod_flash].modelname, false);
|
|
|
|
}
|
|
|
|
|
2005-03-18 06:14:07 +00:00
|
|
|
void CL_Laser (vec3_t start, vec3_t end, int colors)
|
|
|
|
{
|
|
|
|
explosion_t *ex = CL_AllocExplosion();
|
|
|
|
ex->firstframe = 0;
|
|
|
|
ex->numframes = 10;
|
|
|
|
ex->alpha = 0.33f;
|
2010-07-11 02:22:39 +00:00
|
|
|
ex->model = NULL;
|
2005-03-18 06:14:07 +00:00
|
|
|
ex->skinnum = (colors >> ((rand() % 4)*8)) & 0xff;
|
|
|
|
VectorCopy (start, ex->origin);
|
|
|
|
VectorCopy (end, ex->oldorigin);
|
|
|
|
ex->flags = Q2RF_TRANSLUCENT | Q2RF_BEAM;
|
|
|
|
ex->start = cl.time;
|
2005-10-08 22:35:20 +00:00
|
|
|
ex->framerate = 100; // smoother fading
|
2005-03-18 06:14:07 +00:00
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
static qbyte splash_color[] = {0x00, 0xe0, 0xb0, 0x50, 0xd0, 0xe0, 0xe8};
|
|
|
|
|
|
|
|
#define ATTN_NONE 0
|
|
|
|
#define ATTN_NORM 1
|
|
|
|
#define ATTN_STATIC 1
|
|
|
|
void Q2S_StartSound(vec3_t origin, int entnum, int entchannel, sfx_t *sfx, float fvol, float attenuation, float timeofs)
|
|
|
|
{
|
2006-05-10 07:35:19 +00:00
|
|
|
S_StartSoundDelayed(entnum, entchannel, sfx, origin, fvol, attenuation, timeofs);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
void CLQ2_ParseTEnt (void)
|
|
|
|
{
|
|
|
|
int type;
|
|
|
|
vec3_t pos, pos2, dir;
|
|
|
|
explosion_t *ex;
|
|
|
|
int cnt;
|
|
|
|
int color;
|
|
|
|
int r;
|
|
|
|
// int ent;
|
|
|
|
// int magnitude;
|
|
|
|
|
|
|
|
type = MSG_ReadByte ();
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case Q2TE_BLOOD: // bullet hitting flesh
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadDir (dir);
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, dir, 1, ptq2_blood))
|
|
|
|
if (P_RunParticleEffectType(pos, dir, 1, ptqw_blood))
|
|
|
|
P_RunParticleEffect(pos, dir, 0xe8, 60);
|
2004-08-23 00:15:46 +00:00
|
|
|
R_AddStain(pos, 0, -10, -10, 40);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_GUNSHOT: // bullet hitting wall
|
|
|
|
case Q2TE_SPARKS:
|
|
|
|
case Q2TE_BULLET_SPARKS:
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadDir (dir);
|
|
|
|
if (type == Q2TE_GUNSHOT)
|
2005-03-10 03:55:18 +00:00
|
|
|
P_RunParticleEffect (pos, dir, 0, 40);
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
2005-03-10 03:55:18 +00:00
|
|
|
P_RunParticleEffect (pos, dir, 0xe0, 6);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
R_AddStain(pos, -10, -10, -10, 20);
|
|
|
|
|
|
|
|
if (type != Q2TE_SPARKS)
|
|
|
|
{
|
|
|
|
CL_SmokeAndFlash(pos);
|
|
|
|
|
2005-03-15 22:51:01 +00:00
|
|
|
// impact sound (nope, not the same as Q1...)
|
2004-08-23 00:15:46 +00:00
|
|
|
cnt = rand()&15;
|
|
|
|
if (cnt == 1)
|
2005-03-15 22:51:01 +00:00
|
|
|
Q2S_StartSound (pos, 0, 0, S_PrecacheSound ("world/ric1.wav"), 1, ATTN_NORM, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
else if (cnt == 2)
|
2005-03-15 22:51:01 +00:00
|
|
|
Q2S_StartSound (pos, 0, 0, S_PrecacheSound ("world/ric2.wav"), 1, ATTN_NORM, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
else if (cnt == 3)
|
2005-03-15 22:51:01 +00:00
|
|
|
Q2S_StartSound (pos, 0, 0, S_PrecacheSound ("world/ric3.wav"), 1, ATTN_NORM, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_SCREEN_SPARKS:
|
|
|
|
case Q2TE_SHIELD_SPARKS:
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadDir (dir);
|
|
|
|
if (type == Q2TE_SCREEN_SPARKS)
|
2005-03-10 03:55:18 +00:00
|
|
|
P_RunParticleEffect (pos, dir, 0xd0, 40);
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
2005-03-10 03:55:18 +00:00
|
|
|
P_RunParticleEffect (pos, dir, 0xb0, 40);
|
2004-08-23 00:15:46 +00:00
|
|
|
//FIXME : replace or remove this sound
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, S_PrecacheSound ("weapons/lashit.wav"), pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_SHOTGUN: // bullet hitting wall
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadDir (dir);
|
2005-03-10 03:55:18 +00:00
|
|
|
P_RunParticleEffect (pos, dir, 0, 20);
|
2005-03-18 06:14:07 +00:00
|
|
|
CL_SmokeAndFlash(pos);
|
2004-08-23 00:15:46 +00:00
|
|
|
R_AddStain(pos, -10, -10, -10, 20);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_SPLASH: // bullet hitting water
|
|
|
|
cnt = MSG_ReadByte ();
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadDir (dir);
|
|
|
|
r = MSG_ReadByte ();
|
|
|
|
if (r > 6)
|
|
|
|
color = 0x00;
|
|
|
|
else
|
|
|
|
color = splash_color[r];
|
2005-03-10 03:55:18 +00:00
|
|
|
P_RunParticleEffect (pos, dir, color, cnt);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
if (r == Q2SPLASH_SPARKS)
|
|
|
|
{
|
|
|
|
r = rand() & 3;
|
2005-03-15 22:51:01 +00:00
|
|
|
if (r == 1)
|
|
|
|
Q2S_StartSound (pos, 0, 0, S_PrecacheSound ("world/spark5.wav"), 1, ATTN_NORM, 0);
|
|
|
|
else if (r == 2)
|
|
|
|
Q2S_StartSound (pos, 0, 0, S_PrecacheSound ("world/spark6.wav"), 1, ATTN_NORM, 0);
|
|
|
|
else
|
|
|
|
Q2S_StartSound (pos, 0, 0, S_PrecacheSound ("world/spark7.wav"), 1, ATTN_NORM, 0);
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
// if (r == 0)
|
|
|
|
// Q2S_StartSound (pos, 0, 0, cl_sfx_spark5, 1, ATTN_STATIC, 0);
|
|
|
|
// else if (r == 1)
|
|
|
|
// Q2S_StartSound (pos, 0, 0, cl_sfx_spark6, 1, ATTN_STATIC, 0);
|
|
|
|
// else
|
|
|
|
// Q2S_StartSound (pos, 0, 0, cl_sfx_spark7, 1, ATTN_STATIC, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_LASER_SPARKS:
|
|
|
|
cnt = MSG_ReadByte ();
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadDir (dir);
|
|
|
|
color = MSG_ReadByte ();
|
2005-03-10 03:55:18 +00:00
|
|
|
P_RunParticleEffect (pos, dir, color, cnt);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
// RAFAEL
|
|
|
|
case Q2TE_BLUEHYPERBLASTER:
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadPos (dir);
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, dir, 1, ptq2_blasterparticles))
|
2005-03-15 22:51:01 +00:00
|
|
|
P_RunParticleEffect (pos, dir, 0xe0, 40);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_BLASTER: // blaster hitting wall
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadDir (dir);
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, dir, 1, ptq2_blasterparticles))
|
2005-03-15 22:51:01 +00:00
|
|
|
P_RunParticleEffect (pos, dir, 0xe0, 40);
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
R_AddStain(pos, 0, -5, -10, 20);
|
|
|
|
|
|
|
|
ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (pos, ex->origin);
|
|
|
|
ex->start = cl.time;
|
|
|
|
ex->model = Mod_ForName (q2tentmodels[q2cl_mod_explode].modelname, false);
|
|
|
|
ex->firstframe = 0;
|
|
|
|
ex->numframes = 4;
|
2010-07-11 02:22:39 +00:00
|
|
|
ex->flags = Q2RF_FULLBRIGHT|Q2RF_ADDITIVE|RF_NOSHADOW;
|
2005-09-04 05:48:26 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
ex->angles[0] = acos(dir[2])/M_PI*180;
|
|
|
|
// PMM - fixed to correct for pitch of 0
|
|
|
|
if (dir[0])
|
|
|
|
ex->angles[1] = atan2(dir[1], dir[0])/M_PI*180;
|
|
|
|
else if (dir[1] > 0)
|
|
|
|
ex->angles[1] = 90;
|
|
|
|
else if (dir[1] < 0)
|
|
|
|
ex->angles[1] = 270;
|
|
|
|
else
|
|
|
|
ex->angles[1] = 0;
|
|
|
|
ex->angles[0]*=-1;
|
2005-03-15 22:51:01 +00:00
|
|
|
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, S_PrecacheSound ("weapons/lashit.wav"), pos, 1, 1, 0);
|
2005-09-04 05:48:26 +00:00
|
|
|
|
|
|
|
// light
|
|
|
|
if (r_explosionlight.value)
|
|
|
|
{
|
|
|
|
dlight_t *dl;
|
|
|
|
dl = CL_AllocDlight (0);
|
|
|
|
VectorCopy (pos, dl->origin);
|
2006-04-21 05:23:51 +00:00
|
|
|
dl->radius = 150 * r_explosionlight.value;
|
2005-09-04 05:48:26 +00:00
|
|
|
dl->die = cl.time + 0.4;
|
|
|
|
dl->decay = 400;
|
|
|
|
dl->color[0] = 0.2;
|
|
|
|
dl->color[1] = 0.2;
|
|
|
|
dl->color[2] = 0.0;
|
|
|
|
dl->channelfade[0] = 0.5;
|
|
|
|
dl->channelfade[1] = 0.51;
|
|
|
|
dl->channelfade[2] = 0.0;
|
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_RAILTRAIL: // railgun effect
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadPos (pos2);
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_ParticleTrail(pos, pos2, rtq2_railtrail, NULL))
|
2005-10-08 22:35:20 +00:00
|
|
|
P_ParticleTrailIndex(pos, pos2, 0x74, 8, NULL);
|
2005-03-15 22:51:01 +00:00
|
|
|
Q2S_StartSound (pos, 0, 0, S_PrecacheSound ("weapons/railgf1a.wav"), 1, ATTN_NORM, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_EXPLOSION2:
|
|
|
|
case Q2TE_GRENADE_EXPLOSION:
|
|
|
|
case Q2TE_GRENADE_EXPLOSION_WATER:
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
|
2005-10-08 22:35:20 +00:00
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
|
|
|
|
P_RunParticleEffect(pos, NULL, 0xe0, 256);
|
|
|
|
|
|
|
|
R_AddStain(pos, -1, -1, -1, 100);
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
// light
|
2005-08-26 22:56:51 +00:00
|
|
|
if (r_explosionlight.value)
|
|
|
|
{
|
2004-08-23 00:15:46 +00:00
|
|
|
dlight_t *dl;
|
2005-07-20 08:04:46 +00:00
|
|
|
dl = CL_AllocDlight (0);
|
|
|
|
VectorCopy (pos, dl->origin);
|
2006-04-21 05:23:51 +00:00
|
|
|
dl->radius = 150 + r_explosionlight.value*200;
|
2005-07-20 08:04:46 +00:00
|
|
|
dl->die = cl.time + 0.5;
|
|
|
|
dl->decay = 300;
|
|
|
|
dl->color[0] = 0.2;
|
|
|
|
dl->color[1] = 0.1;
|
|
|
|
dl->color[2] = 0.1;
|
2005-09-04 05:48:26 +00:00
|
|
|
dl->channelfade[0] = 0.36;
|
|
|
|
dl->channelfade[1] = 0.19;
|
|
|
|
dl->channelfade[2] = 0.19;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// sound
|
2005-03-15 22:51:01 +00:00
|
|
|
if (type == Q2TE_GRENADE_EXPLOSION_WATER)
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, S_PrecacheSound ("weapons/xpld_wat.wav"), pos, 1, 1, 0);
|
2005-03-15 22:51:01 +00:00
|
|
|
else
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, S_PrecacheSound ("weapons/grenlx1a.wav"), pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
// sprite
|
|
|
|
/*
|
|
|
|
if (!R_ParticleExplosionHeart(pos))
|
|
|
|
{
|
|
|
|
ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (pos, ex->origin);
|
|
|
|
VectorClear(ex->angles);
|
|
|
|
ex->start = cl.time;
|
|
|
|
ex->model = Mod_ForName (q2tentmodels[q2cl_mod_explo4].modelname, true);
|
|
|
|
ex->firstframe = 30;
|
|
|
|
ex->numframes = 19;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
/*
|
|
|
|
ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (pos, ex->ent.origin);
|
|
|
|
ex->type = ex_poly;
|
|
|
|
ex->ent.flags = RF_FULLBRIGHT;
|
|
|
|
ex->start = cl.frame.servertime - 100;
|
|
|
|
ex->light = 350;
|
|
|
|
ex->lightcolor[0] = 1.0;
|
|
|
|
ex->lightcolor[1] = 0.5;
|
|
|
|
ex->lightcolor[2] = 0.5;
|
|
|
|
ex->ent.model = cl_mod_explo4;
|
|
|
|
ex->frames = 19;
|
|
|
|
ex->baseframe = 30;
|
|
|
|
ex->ent.angles[1] = rand() % 360;
|
|
|
|
CL_ExplosionParticles (pos);
|
|
|
|
if (type == TE_GRENADE_EXPLOSION_WATER)
|
|
|
|
Q2S_StartSound (pos, 0, 0, cl_sfx_watrexp, 1, ATTN_NORM, 0);
|
|
|
|
else
|
|
|
|
Q2S_StartSound (pos, 0, 0, cl_sfx_grenexp, 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
*/
|
|
|
|
// RAFAEL
|
|
|
|
case Q2TE_PLASMA_EXPLOSION:
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
/* ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (pos, ex->ent.origin);
|
|
|
|
ex->type = ex_poly;
|
|
|
|
ex->ent.flags = RF_FULLBRIGHT;
|
|
|
|
ex->start = cl.frame.servertime - 100;
|
|
|
|
ex->light = 350;
|
|
|
|
ex->lightcolor[0] = 1.0;
|
|
|
|
ex->lightcolor[1] = 0.5;
|
|
|
|
ex->lightcolor[2] = 0.5;
|
|
|
|
ex->ent.angles[1] = rand() % 360;
|
|
|
|
ex->ent.model = cl_mod_explo4;
|
|
|
|
if (frand() < 0.5)
|
|
|
|
ex->baseframe = 15;
|
|
|
|
ex->frames = 15;
|
|
|
|
CL_ExplosionParticles (pos);
|
|
|
|
Q2S_StartSound (pos, 0, 0, cl_sfx_rockexp, 1, ATTN_NORM, 0);
|
|
|
|
*/ break;
|
|
|
|
|
|
|
|
case Q2TE_EXPLOSION1:
|
|
|
|
case Q2TE_EXPLOSION1_BIG: // PMM
|
|
|
|
case Q2TE_ROCKET_EXPLOSION:
|
|
|
|
case Q2TE_ROCKET_EXPLOSION_WATER:
|
|
|
|
case Q2TE_EXPLOSION1_NP: // PMM
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
|
2005-03-15 22:51:01 +00:00
|
|
|
// particle effect
|
|
|
|
if (type != Q2TE_EXPLOSION1_BIG && type != Q2TE_EXPLOSION1_NP)
|
2005-10-08 22:35:20 +00:00
|
|
|
{
|
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
|
|
|
|
P_RunParticleEffect(pos, NULL, 0xe0, 256);
|
|
|
|
|
|
|
|
R_AddStain(pos, -1, -1, -1, 100);
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
// light
|
2005-08-26 22:56:51 +00:00
|
|
|
if (r_explosionlight.value)
|
|
|
|
{
|
2004-08-23 00:15:46 +00:00
|
|
|
dlight_t *dl;
|
2005-07-20 08:04:46 +00:00
|
|
|
dl = CL_AllocDlight (0);
|
|
|
|
VectorCopy (pos, dl->origin);
|
2006-04-21 05:23:51 +00:00
|
|
|
dl->radius = 150 + r_explosionlight.value*200;
|
2005-07-20 08:04:46 +00:00
|
|
|
dl->die = cl.time + 0.5;
|
|
|
|
dl->decay = 300;
|
|
|
|
dl->color[0] = 0.2;
|
|
|
|
dl->color[1] = 0.1;
|
|
|
|
dl->color[2] = 0.08;
|
2005-09-04 05:48:26 +00:00
|
|
|
dl->channelfade[0] = 0.36;
|
|
|
|
dl->channelfade[1] = 0.19;
|
|
|
|
dl->channelfade[2] = 0.19;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// sound
|
2005-03-15 22:51:01 +00:00
|
|
|
if (type == Q2TE_ROCKET_EXPLOSION_WATER)
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, S_PrecacheSound ("weapons/xpld_wat.wav"), pos, 1, 1, 0);
|
2005-03-15 22:51:01 +00:00
|
|
|
else
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, S_PrecacheSound ("weapons/rocklx1a.wav"), pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
// sprite
|
|
|
|
/* if (!R_ParticleExplosionHeart(pos))
|
|
|
|
{
|
|
|
|
ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (pos, ex->origin);
|
|
|
|
VectorClear(ex->angles);
|
|
|
|
ex->start = cl.time;
|
|
|
|
ex->model = Mod_ForName (q2tentmodels[q2cl_mod_explo4].modelname, false);
|
|
|
|
if (rand()&1)
|
|
|
|
ex->firstframe = 15;
|
|
|
|
else
|
|
|
|
ex->firstframe = 0;
|
|
|
|
ex->numframes = 15;
|
|
|
|
}*/
|
|
|
|
break;
|
|
|
|
/*
|
|
|
|
ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (pos, ex->ent.origin);
|
|
|
|
ex->type = ex_poly;
|
|
|
|
ex->ent.flags = RF_FULLBRIGHT;
|
|
|
|
ex->start = cl.frame.servertime - 100;
|
|
|
|
ex->light = 350;
|
|
|
|
ex->lightcolor[0] = 1.0;
|
|
|
|
ex->lightcolor[1] = 0.5;
|
|
|
|
ex->lightcolor[2] = 0.5;
|
|
|
|
ex->ent.angles[1] = rand() % 360;
|
|
|
|
if (type != TE_EXPLOSION1_BIG) // PMM
|
|
|
|
ex->ent.model = cl_mod_explo4; // PMM
|
|
|
|
else
|
|
|
|
ex->ent.model = cl_mod_explo4_big;
|
|
|
|
if (frand() < 0.5)
|
|
|
|
ex->baseframe = 15;
|
|
|
|
ex->frames = 15;
|
|
|
|
if ((type != TE_EXPLOSION1_BIG) && (type != TE_EXPLOSION1_NP)) // PMM
|
|
|
|
CL_ExplosionParticles (pos); // PMM
|
|
|
|
if (type == TE_ROCKET_EXPLOSION_WATER)
|
|
|
|
Q2S_StartSound (pos, 0, 0, cl_sfx_watrexp, 1, ATTN_NORM, 0);
|
|
|
|
else
|
|
|
|
Q2S_StartSound (pos, 0, 0, cl_sfx_rockexp, 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
*/ case Q2TE_BFG_EXPLOSION:
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
/* ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (pos, ex->ent.origin);
|
|
|
|
ex->type = ex_poly;
|
|
|
|
ex->flags = RF_FULLBRIGHT;
|
|
|
|
ex->start = cl.q2frame.servertime - 100;
|
|
|
|
ex->light = 350;
|
|
|
|
ex->lightcolor[0] = 0.0;
|
|
|
|
ex->lightcolor[1] = 1.0;
|
|
|
|
ex->lightcolor[2] = 0.0;
|
|
|
|
ex->model = cl_mod_bfg_explo;
|
|
|
|
ex->flags |= RF_TRANSLUCENT;
|
|
|
|
ex->alpha = 0.30;
|
|
|
|
ex->frames = 4;
|
|
|
|
*/ break;
|
|
|
|
|
|
|
|
case Q2TE_BFG_BIGEXPLOSION:
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
// CL_BFGExplosionParticles (pos);
|
2005-10-08 22:35:20 +00:00
|
|
|
if (P_RunParticleEffectTypeString(pos, dir, 1, "te_bfg_bigexplosion"))
|
|
|
|
P_RunParticleEffect(pos, dir, 0xd0, 256); // TODO: x+(r%8) unstead of x&7+(r&7)
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_BFG_LASER:
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadPos (pos2);
|
2005-03-18 06:14:07 +00:00
|
|
|
CL_Laser(pos, pos2, 0xd0d1d2d3);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_BUBBLETRAIL:
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadPos (pos2);
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_ParticleTrail(pos, pos2, rtq2_bubbletrail, NULL))
|
2005-10-08 22:35:20 +00:00
|
|
|
P_ParticleTrailIndex(pos, pos2, 4, 8, NULL);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_PARASITE_ATTACK:
|
|
|
|
case Q2TE_MEDIC_CABLE_ATTACK:
|
|
|
|
CL_ParseBeam (3);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_BOSSTPORT: // boss teleporting to station
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
/* CL_BigTeleportParticles (pos);
|
|
|
|
*/ Q2S_StartSound (pos, 0, 0, S_PrecacheSound ("misc/bigtele.wav"), 1, ATTN_NONE, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_GRAPPLE_CABLE:
|
|
|
|
CL_ParseBeam (4);
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
break;
|
|
|
|
|
|
|
|
// RAFAEL
|
|
|
|
case Q2TE_WELDING_SPARKS:
|
|
|
|
cnt = MSG_ReadByte ();
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadDir (dir);
|
|
|
|
color = MSG_ReadByte ();
|
2005-10-08 22:35:20 +00:00
|
|
|
|
|
|
|
// TODO: fix to Q2's standards
|
|
|
|
P_RunParticleEffect(pos, dir, color, cnt);
|
2004-08-23 00:15:46 +00:00
|
|
|
/* CL_ParticleEffect2 (pos, dir, color, cnt);
|
|
|
|
|
|
|
|
ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (pos, ex->ent.origin);
|
|
|
|
ex->type = ex_flash;
|
|
|
|
// note to self
|
|
|
|
// we need a better no draw flag
|
|
|
|
ex->ent.flags = RF_BEAM;
|
|
|
|
ex->start = cl.frame.servertime - 0.1;
|
|
|
|
ex->light = 100 + (rand()%75);
|
|
|
|
ex->lightcolor[0] = 1.0;
|
|
|
|
ex->lightcolor[1] = 1.0;
|
|
|
|
ex->lightcolor[2] = 0.3;
|
|
|
|
ex->ent.model = cl_mod_flash;
|
|
|
|
ex->frames = 2;
|
|
|
|
*/ break;
|
|
|
|
|
|
|
|
case Q2TE_GREENBLOOD:
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadDir (dir);
|
2005-10-08 22:35:20 +00:00
|
|
|
if (P_RunParticleEffectTypeString(pos, dir, 1, "te_greenblood"))
|
|
|
|
P_RunParticleEffect(pos, dir, 0xdf, 30); // TODO: x+(r%8) unstead of x&7+(r&7)
|
2004-08-23 00:15:46 +00:00
|
|
|
// CL_ParticleEffect2 (pos, dir, 0xdf, 30);
|
|
|
|
break;
|
|
|
|
|
|
|
|
// RAFAEL
|
|
|
|
case Q2TE_TUNNEL_SPARKS:
|
|
|
|
cnt = MSG_ReadByte ();
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadDir (dir);
|
|
|
|
color = MSG_ReadByte ();
|
|
|
|
// CL_ParticleEffect3 (pos, dir, color, cnt);
|
|
|
|
break;
|
|
|
|
|
|
|
|
//=============
|
|
|
|
//PGM
|
|
|
|
// PMM -following code integrated for flechette (different color)
|
|
|
|
case Q2TE_BLASTER2: // green blaster hitting wall
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadDir (dir);
|
2005-09-04 05:48:26 +00:00
|
|
|
|
|
|
|
if (P_RunParticleEffectTypeString(pos, dir, 1, "te_blaster2"))
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, dir, 1, ptq2_blasterparticles))
|
2005-09-04 05:48:26 +00:00
|
|
|
P_RunParticleEffect (pos, dir, 0xd0, 40);
|
|
|
|
|
|
|
|
R_AddStain(pos, -10, 0, -10, 20);
|
|
|
|
|
|
|
|
ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (pos, ex->origin);
|
|
|
|
ex->start = cl.time;
|
|
|
|
ex->model = Mod_ForName (q2tentmodels[q2cl_mod_explode].modelname, false);
|
|
|
|
ex->firstframe = 0;
|
|
|
|
ex->numframes = 4;
|
2010-07-11 02:22:39 +00:00
|
|
|
ex->flags = Q2RF_FULLBRIGHT|RF_NOSHADOW;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2005-09-04 05:48:26 +00:00
|
|
|
ex->angles[0] = acos(dir[2])/M_PI*180;
|
|
|
|
// PMM - fixed to correct for pitch of 0
|
|
|
|
if (dir[0])
|
|
|
|
ex->angles[1] = atan2(dir[1], dir[0])/M_PI*180;
|
|
|
|
else if (dir[1] > 0)
|
|
|
|
ex->angles[1] = 90;
|
|
|
|
else if (dir[1] < 0)
|
|
|
|
ex->angles[1] = 270;
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
2005-09-04 05:48:26 +00:00
|
|
|
ex->angles[1] = 0;
|
|
|
|
ex->angles[0]*=-1;
|
|
|
|
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, S_PrecacheSound ("weapons/lashit.wav"), pos, 1, 1, 0);
|
2005-09-04 05:48:26 +00:00
|
|
|
|
|
|
|
// light
|
|
|
|
if (r_explosionlight.value)
|
|
|
|
{
|
|
|
|
dlight_t *dl;
|
|
|
|
dl = CL_AllocDlight (0);
|
|
|
|
VectorCopy (pos, dl->origin);
|
2006-04-21 05:23:51 +00:00
|
|
|
dl->radius = 150 * r_explosionlight.value;
|
2005-09-04 05:48:26 +00:00
|
|
|
dl->die = cl.time + 0.4;
|
|
|
|
dl->decay = 400;
|
|
|
|
dl->color[0] = 0.01;
|
|
|
|
dl->color[1] = 0.2;
|
|
|
|
dl->color[2] = 0.01;
|
|
|
|
dl->channelfade[0] = 0.1;
|
|
|
|
dl->channelfade[1] = 0.5;
|
|
|
|
dl->channelfade[2] = 0.1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_FLECHETTE: // blue blaster effect
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadDir (dir);
|
|
|
|
|
|
|
|
if (P_RunParticleEffectTypeString(pos, dir, 1, "te_blaster2"))
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, dir, 1, ptq2_blasterparticles))
|
2005-09-04 05:48:26 +00:00
|
|
|
P_RunParticleEffect (pos, dir, 0x6f, 40);
|
|
|
|
|
|
|
|
R_AddStain(pos, -10, -2, 0, 20);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
ex = CL_AllocExplosion ();
|
2005-09-04 05:48:26 +00:00
|
|
|
VectorCopy (pos, ex->origin);
|
|
|
|
ex->start = cl.time;
|
|
|
|
ex->model = Mod_ForName (q2tentmodels[q2cl_mod_explode].modelname, false);
|
|
|
|
ex->firstframe = 0;
|
|
|
|
ex->numframes = 4;
|
2010-07-11 02:22:39 +00:00
|
|
|
ex->flags = Q2RF_FULLBRIGHT|RF_NOSHADOW;
|
2005-09-04 05:48:26 +00:00
|
|
|
|
|
|
|
ex->angles[0] = acos(dir[2])/M_PI*180;
|
2004-08-23 00:15:46 +00:00
|
|
|
// PMM - fixed to correct for pitch of 0
|
|
|
|
if (dir[0])
|
2005-09-04 05:48:26 +00:00
|
|
|
ex->angles[1] = atan2(dir[1], dir[0])/M_PI*180;
|
2004-08-23 00:15:46 +00:00
|
|
|
else if (dir[1] > 0)
|
2005-09-04 05:48:26 +00:00
|
|
|
ex->angles[1] = 90;
|
2004-08-23 00:15:46 +00:00
|
|
|
else if (dir[1] < 0)
|
2005-09-04 05:48:26 +00:00
|
|
|
ex->angles[1] = 270;
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
2005-09-04 05:48:26 +00:00
|
|
|
ex->angles[1] = 0;
|
|
|
|
ex->angles[0]*=-1;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2010-11-06 23:05:29 +00:00
|
|
|
S_StartSound (-2, 0, S_PrecacheSound ("weapons/lashit.wav"), pos, 1, 1, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2005-09-04 05:48:26 +00:00
|
|
|
// light
|
|
|
|
if (r_explosionlight.value)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2005-09-04 05:48:26 +00:00
|
|
|
dlight_t *dl;
|
|
|
|
dl = CL_AllocDlight (0);
|
|
|
|
VectorCopy (pos, dl->origin);
|
2006-04-21 05:23:51 +00:00
|
|
|
dl->radius = 150 * r_explosionlight.value;
|
2005-09-04 05:48:26 +00:00
|
|
|
dl->die = cl.time + 0.4;
|
|
|
|
dl->decay = 400;
|
|
|
|
dl->color[0] = 0.038;
|
|
|
|
dl->color[1] = 0.082;
|
|
|
|
dl->color[2] = 0.150;
|
|
|
|
dl->channelfade[0] = 0.085;
|
|
|
|
dl->channelfade[1] = 0.180;
|
|
|
|
dl->channelfade[2] = 0.300;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2005-09-04 05:48:26 +00:00
|
|
|
break;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2006-02-22 23:42:00 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
case Q2TE_LIGHTNING:
|
2006-02-22 23:42:00 +00:00
|
|
|
CL_ParseBeam(TE_LIGHTNING1);
|
|
|
|
Q2S_StartSound (pos, 0, 0, S_PrecacheSound("weapons/tesla.wav"), 1, ATTN_NORM, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
2006-02-22 23:42:00 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
case Q2TE_DEBUGTRAIL:
|
2005-03-28 00:11:59 +00:00
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadPos (pos2);
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_ParticleTrail(pos, pos2, P_FindParticleType("te_debugtrail"), NULL))
|
2005-10-08 22:35:20 +00:00
|
|
|
P_ParticleTrailIndex(pos, pos2, 116, 8, NULL);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_PLAIN_EXPLOSION:
|
2005-03-28 00:11:59 +00:00
|
|
|
MSG_ReadPos (pos);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
ex = CL_AllocExplosion ();
|
2005-03-28 00:11:59 +00:00
|
|
|
VectorCopy (pos, ex->origin);
|
|
|
|
// ex->type = ex_poly;
|
2010-07-11 02:22:39 +00:00
|
|
|
ex->flags = Q2RF_FULLBRIGHT|RF_NOSHADOW;
|
2005-03-28 00:11:59 +00:00
|
|
|
ex->angles[1] = rand() % 360;
|
|
|
|
ex->model = Mod_ForName (q2tentmodels[q2cl_mod_explo4].modelname, false);
|
|
|
|
if (rand() < RAND_MAX/2)
|
|
|
|
ex->firstframe = 15;
|
|
|
|
ex->numframes = 15;
|
|
|
|
Q2S_StartSound (pos, 0, 0, S_PrecacheSound("weapons/rocklx1a.wav"), 1, ATTN_NORM, 0);
|
2005-09-04 05:48:26 +00:00
|
|
|
|
|
|
|
// light
|
|
|
|
if (r_explosionlight.value)
|
|
|
|
{
|
|
|
|
dlight_t *dl;
|
|
|
|
dl = CL_AllocDlight (0);
|
|
|
|
VectorCopy (pos, dl->origin);
|
2006-04-21 05:23:51 +00:00
|
|
|
dl->radius = 150 + r_explosionlight.value*200;
|
2005-09-04 05:48:26 +00:00
|
|
|
dl->die = cl.time + 0.5;
|
|
|
|
dl->decay = 300;
|
|
|
|
dl->color[0] = 0.2;
|
|
|
|
dl->color[1] = 0.1;
|
|
|
|
dl->color[2] = 0.08;
|
|
|
|
dl->channelfade[0] = 0.36;
|
|
|
|
dl->channelfade[1] = 0.19;
|
|
|
|
dl->channelfade[2] = 0.19;
|
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
2005-03-28 00:11:59 +00:00
|
|
|
/*
|
2004-08-23 00:15:46 +00:00
|
|
|
case Q2TE_FLASHLIGHT:
|
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
ent = MSG_ReadShort(&net_message);
|
|
|
|
CL_Flashlight(ent, pos);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_FORCEWALL:
|
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadPos(&net_message, pos2);
|
|
|
|
color = MSG_ReadByte (&net_message);
|
|
|
|
CL_ForceWall(pos, pos2, color);
|
|
|
|
break;
|
2006-02-22 23:42:00 +00:00
|
|
|
*/
|
2004-08-23 00:15:46 +00:00
|
|
|
case Q2TE_HEATBEAM:
|
2006-02-22 23:42:00 +00:00
|
|
|
MSG_ReadPos(pos);
|
|
|
|
MSG_ReadPos(pos2);
|
|
|
|
// ent = CL_ParsePlayerBeam (cl_mod_heatbeam);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
2006-02-22 23:42:00 +00:00
|
|
|
/*
|
2004-08-23 00:15:46 +00:00
|
|
|
case Q2TE_MONSTER_HEATBEAM:
|
|
|
|
ent = CL_ParsePlayerBeam (cl_mod_monster_heatbeam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_HEATBEAM_SPARKS:
|
|
|
|
// cnt = MSG_ReadByte (&net_message);
|
|
|
|
cnt = 50;
|
|
|
|
MSG_ReadPos (&net_message, pos);
|
|
|
|
MSG_ReadDir (&net_message, dir);
|
|
|
|
// r = MSG_ReadByte (&net_message);
|
|
|
|
// magnitude = MSG_ReadShort (&net_message);
|
|
|
|
r = 8;
|
|
|
|
magnitude = 60;
|
|
|
|
color = r & 0xff;
|
|
|
|
CL_ParticleSteamEffect (pos, dir, color, cnt, magnitude);
|
|
|
|
S_StartSound (pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_HEATBEAM_STEAM:
|
|
|
|
// cnt = MSG_ReadByte (&net_message);
|
|
|
|
cnt = 20;
|
|
|
|
MSG_ReadPos (&net_message, pos);
|
|
|
|
MSG_ReadDir (&net_message, dir);
|
|
|
|
// r = MSG_ReadByte (&net_message);
|
|
|
|
// magnitude = MSG_ReadShort (&net_message);
|
|
|
|
// color = r & 0xff;
|
|
|
|
color = 0xe0;
|
|
|
|
magnitude = 60;
|
|
|
|
CL_ParticleSteamEffect (pos, dir, color, cnt, magnitude);
|
|
|
|
S_StartSound (pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_STEAM:
|
|
|
|
CL_ParseSteam();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_BUBBLETRAIL2:
|
|
|
|
// cnt = MSG_ReadByte (&net_message);
|
|
|
|
cnt = 8;
|
|
|
|
MSG_ReadPos (&net_message, pos);
|
|
|
|
MSG_ReadPos (&net_message, pos2);
|
|
|
|
CL_BubbleTrail2 (pos, pos2, cnt);
|
|
|
|
S_StartSound (pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
|
|
|
|
break;
|
2005-10-08 22:35:20 +00:00
|
|
|
*/
|
2004-08-23 00:15:46 +00:00
|
|
|
case Q2TE_MOREBLOOD:
|
2005-10-08 22:35:20 +00:00
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadDir (dir);
|
|
|
|
if (P_RunParticleEffectTypeString(pos, dir, 1, "te_moreblood"))
|
2008-11-09 22:29:28 +00:00
|
|
|
if (P_RunParticleEffectType(pos, dir, 4, ptqw_blood))
|
2005-10-08 22:35:20 +00:00
|
|
|
P_RunParticleEffect(pos, dir, 0xe8, 250);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
2005-10-08 22:35:20 +00:00
|
|
|
/*
|
2004-08-23 00:15:46 +00:00
|
|
|
case Q2TE_CHAINFIST_SMOKE:
|
|
|
|
dir[0]=0; dir[1]=0; dir[2]=1;
|
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
CL_ParticleSmokeEffect (pos, dir, 0, 20, 20);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_ELECTRIC_SPARKS:
|
|
|
|
MSG_ReadPos (&net_message, pos);
|
|
|
|
MSG_ReadDir (&net_message, dir);
|
|
|
|
// CL_ParticleEffect (pos, dir, 109, 40);
|
|
|
|
CL_ParticleEffect (pos, dir, 0x75, 40);
|
|
|
|
//FIXME : replace or remove this sound
|
|
|
|
S_StartSound (pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
2005-09-04 05:48:26 +00:00
|
|
|
*/
|
2004-08-23 00:15:46 +00:00
|
|
|
case Q2TE_TRACKER_EXPLOSION:
|
2005-09-04 05:48:26 +00:00
|
|
|
MSG_ReadPos (pos);
|
|
|
|
|
|
|
|
// effect
|
2005-10-08 22:35:20 +00:00
|
|
|
if (P_RunParticleEffectTypeString(pos, NULL, 1, "te_tracker_explosion"))
|
|
|
|
P_RunParticleEffect(pos, NULL, 0, 128); // TODO: needs to be nonrandom instead of 0+r%8
|
2005-09-04 05:48:26 +00:00
|
|
|
|
|
|
|
// light
|
|
|
|
// light
|
|
|
|
if (r_explosionlight.value)
|
|
|
|
{
|
|
|
|
dlight_t *dl;
|
|
|
|
dl = CL_AllocDlight (0);
|
|
|
|
VectorCopy (pos, dl->origin);
|
2006-04-21 05:23:51 +00:00
|
|
|
dl->radius = 150 * r_explosionlight.value;
|
2005-09-04 05:48:26 +00:00
|
|
|
dl->die = cl.time + 0.1;
|
|
|
|
dl->minlight = 250;
|
|
|
|
dl->color[0] = -0.2;
|
|
|
|
dl->color[1] = -0.2;
|
|
|
|
dl->color[2] = -0.2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// sound
|
|
|
|
Q2S_StartSound (pos, 0, 0, S_PrecacheSound("weapons/disrupthit.wav"), 1, ATTN_NORM, 0);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
case Q2TE_TELEPORT_EFFECT:
|
|
|
|
case Q2TE_DBALL_GOAL:
|
2005-03-15 22:51:01 +00:00
|
|
|
MSG_ReadPos (pos);
|
|
|
|
if (P_RunParticleEffectType(pos, NULL, 1, pt_teleportsplash))
|
2005-05-18 23:15:58 +00:00
|
|
|
P_RunParticleEffect(pos, NULL, 8, 768);
|
2005-03-15 22:51:01 +00:00
|
|
|
// This effect won't match ---
|
|
|
|
// Color should be 7+(rand()%8)
|
2005-05-18 23:15:58 +00:00
|
|
|
// not 8&~7+(rand()%8)
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
2006-04-08 06:43:42 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
case Q2TE_WIDOWBEAMOUT:
|
2006-04-08 06:43:42 +00:00
|
|
|
// this one is really annoying, it's supposed to be a random choice
|
|
|
|
// between 2*8, 13*8, 21*8, 18*8, and it respreads every frame
|
|
|
|
// into a circle but it could be faked well enough, well except for
|
|
|
|
// the fact that these effects have ids associated with them
|
|
|
|
// sort of how beams have ents associated
|
2006-04-16 03:55:55 +00:00
|
|
|
MSG_ReadShort(); // id
|
2006-04-08 06:43:42 +00:00
|
|
|
if (P_RunParticleEffectTypeString(pos, NULL, 1, "te_widowbeamout"))
|
|
|
|
P_RunParticleEffect(pos, NULL, 13*8, 300);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_NUKEBLAST:
|
2006-04-08 06:43:42 +00:00
|
|
|
// same problem as te_widowbeamout, but colors are a bit easier to manage
|
|
|
|
// and there's no id to read in
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
if (P_RunParticleEffectTypeString(pos, NULL, 1, "te_nukeblast"))
|
|
|
|
P_RunParticleEffect(pos, NULL, 110, 700);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Q2TE_WIDOWSPLASH:
|
2006-04-08 06:43:42 +00:00
|
|
|
// there's the color issue like with te_widowbeamout, but the particles
|
|
|
|
// are spawned in an immediate circle and not substained, so it's much
|
|
|
|
// easier to manage
|
2005-10-08 22:35:20 +00:00
|
|
|
MSG_ReadPos (pos);
|
|
|
|
if (P_RunParticleEffectTypeString(pos, NULL, 1, "te_widowsplash"))
|
|
|
|
P_RunParticleEffect(pos, NULL, 13*8, 256);
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
//PGM
|
|
|
|
//==============
|
2005-10-08 22:35:20 +00:00
|
|
|
|
2006-02-22 23:42:00 +00:00
|
|
|
|
|
|
|
case CRTE_LEADERBLASTER:
|
|
|
|
Host_EndGame ("CLQ2_ParseTEnt: bad/non-implemented type %i", type);
|
|
|
|
case CRTE_BLASTER_MUZZLEFLASH:
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (pos, ex->origin);
|
2010-07-11 02:22:39 +00:00
|
|
|
ex->flags = Q2RF_FULLBRIGHT|RF_NOSHADOW;
|
2006-02-22 23:42:00 +00:00
|
|
|
ex->start = cl.q2frame.servertime - 100;
|
2009-11-04 21:16:50 +00:00
|
|
|
CL_NewDlightRGB(0, pos, 350, 0.5, 0.2, 0.1, 0);
|
2006-02-22 23:42:00 +00:00
|
|
|
P_RunParticleEffectTypeString(pos, NULL, 1, "te_muzzleflash");
|
|
|
|
break;
|
|
|
|
case CRTE_BLUE_MUZZLEFLASH:
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (pos, ex->origin);
|
2010-07-11 02:22:39 +00:00
|
|
|
ex->flags = Q2RF_FULLBRIGHT|RF_NOSHADOW;
|
2006-02-22 23:42:00 +00:00
|
|
|
ex->start = cl.q2frame.servertime - 100;
|
2009-11-04 21:16:50 +00:00
|
|
|
CL_NewDlightRGB(0, pos, 350, 0.5, 0.2, 0.1, 0);
|
2006-02-22 23:42:00 +00:00
|
|
|
P_RunParticleEffectTypeString(pos, NULL, 1, "te_blue_muzzleflash");
|
|
|
|
break;
|
|
|
|
case CRTE_SMART_MUZZLEFLASH:
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (pos, ex->origin);
|
2010-07-11 02:22:39 +00:00
|
|
|
ex->flags = Q2RF_FULLBRIGHT|RF_NOSHADOW;
|
2006-02-22 23:42:00 +00:00
|
|
|
ex->start = cl.q2frame.servertime - 100;
|
2009-11-04 21:16:50 +00:00
|
|
|
CL_NewDlightRGB(0, pos, 350, 0.5, 0.2, 0, 0.2);
|
2006-02-22 23:42:00 +00:00
|
|
|
P_RunParticleEffectTypeString(pos, NULL, 1, "te_smart_muzzleflash");
|
|
|
|
break;
|
|
|
|
case CRTE_LEADERFIELD:
|
|
|
|
Host_EndGame ("CLQ2_ParseTEnt: bad/non-implemented type %i", type);
|
|
|
|
case CRTE_DEATHFIELD:
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
ex = CL_AllocExplosion ();
|
|
|
|
VectorCopy (pos, ex->origin);
|
2010-07-11 02:22:39 +00:00
|
|
|
ex->flags = Q2RF_FULLBRIGHT|RF_NOSHADOW;
|
2006-02-22 23:42:00 +00:00
|
|
|
ex->start = cl.q2frame.servertime - 100;
|
2009-11-04 21:16:50 +00:00
|
|
|
CL_NewDlightRGB(0, pos, 350, 0.5, 0.2, 0, 0.2);
|
2006-02-22 23:42:00 +00:00
|
|
|
P_RunParticleEffectTypeString(pos, NULL, 1, "te_deathfield");
|
|
|
|
break;
|
|
|
|
case CRTE_BLASTERBEAM:
|
|
|
|
MSG_ReadPos (pos);
|
|
|
|
MSG_ReadPos (pos2);
|
|
|
|
CLQ2_BlasterTrail2 (pos, pos2);
|
|
|
|
break;
|
|
|
|
case CRTE_STAIN:
|
|
|
|
Host_EndGame ("CLQ2_ParseTEnt: bad/non-implemented type %i", type);
|
|
|
|
case CRTE_FIRE:
|
|
|
|
Host_EndGame ("CLQ2_ParseTEnt: bad/non-implemented type %i", type);
|
|
|
|
case CRTE_CABLEGUT:
|
|
|
|
Host_EndGame ("CLQ2_ParseTEnt: bad/non-implemented type %i", type);
|
|
|
|
case CRTE_SMOKE:
|
|
|
|
Host_EndGame ("CLQ2_ParseTEnt: bad/non-implemented type %i", type);
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
default:
|
|
|
|
Host_EndGame ("CLQ2_ParseTEnt: bad/non-implemented type %i", type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
CL_NewTempEntity
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
entity_t *CL_NewTempEntity (void)
|
|
|
|
{
|
|
|
|
entity_t *ent;
|
|
|
|
|
|
|
|
if (cl_numvisedicts == MAX_VISEDICTS)
|
|
|
|
return NULL;
|
|
|
|
ent = &cl_visedicts[cl_numvisedicts];
|
|
|
|
cl_numvisedicts++;
|
|
|
|
ent->keynum = 0;
|
|
|
|
|
|
|
|
memset (ent, 0, sizeof(*ent));
|
|
|
|
|
|
|
|
#ifdef PEXT_SCALE
|
|
|
|
ent->scale = 1;
|
|
|
|
#endif
|
2006-02-27 00:42:25 +00:00
|
|
|
ent->shaderRGBAf[0] = 1;
|
|
|
|
ent->shaderRGBAf[1] = 1;
|
|
|
|
ent->shaderRGBAf[2] = 1;
|
|
|
|
ent->shaderRGBAf[3] = 1;
|
2004-08-23 00:15:46 +00:00
|
|
|
return ent;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
CL_UpdateBeams
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
void CL_UpdateBeams (void)
|
|
|
|
{
|
2007-08-06 14:22:58 +00:00
|
|
|
int bnum;
|
2005-08-27 23:28:39 +00:00
|
|
|
int i, j;
|
2004-08-23 00:15:46 +00:00
|
|
|
beam_t *b;
|
|
|
|
vec3_t dist, org;
|
2005-10-07 02:08:44 +00:00
|
|
|
float *vieworg;
|
2004-08-23 00:15:46 +00:00
|
|
|
float d;
|
|
|
|
entity_t *ent;
|
|
|
|
entity_state_t *st;
|
|
|
|
float yaw, pitch;
|
|
|
|
float forward, offset;
|
2006-05-28 21:56:04 +00:00
|
|
|
int lastrunningbeam = -1;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2005-01-13 16:29:20 +00:00
|
|
|
extern cvar_t cl_truelightning, v_viewheight;
|
2004-10-10 06:32:29 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
// update lightning
|
2007-08-06 14:22:58 +00:00
|
|
|
for (bnum=0, b=cl_beams; bnum < beams_running; bnum++, b++)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2005-05-30 04:34:47 +00:00
|
|
|
if (!b->model)
|
2004-08-23 00:15:46 +00:00
|
|
|
continue;
|
2005-05-30 04:34:47 +00:00
|
|
|
|
|
|
|
if (b->endtime < cl.time)
|
|
|
|
{
|
2009-11-05 03:07:52 +00:00
|
|
|
if (!cl.paused)
|
2009-11-04 21:16:50 +00:00
|
|
|
{ /*don't let lightning decay while paused*/
|
|
|
|
P_DelinkTrailstate(&b->trailstate);
|
|
|
|
P_DelinkTrailstate(&b->emitstate);
|
|
|
|
b->model = NULL;
|
|
|
|
continue;
|
|
|
|
}
|
2005-05-30 04:34:47 +00:00
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2007-08-06 14:26:40 +00:00
|
|
|
lastrunningbeam = bnum;
|
2006-05-28 21:56:04 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
// if coming from the player, update the start position
|
2005-08-27 23:28:39 +00:00
|
|
|
if ((b->flags & 1) && b->entity > 0 && b->entity <= MAX_CLIENTS)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2005-10-07 02:08:44 +00:00
|
|
|
for (j = 0; j < cl.splitclients; j++)
|
2004-10-10 06:32:29 +00:00
|
|
|
{
|
2008-01-23 21:05:18 +00:00
|
|
|
if (b->entity == ((cl.spectator&&autocam[j])?spec_track[j]+1:(cl.playernum[j]+1)))
|
2005-08-03 23:14:59 +00:00
|
|
|
{
|
2005-08-27 23:28:39 +00:00
|
|
|
player_state_t *pl;
|
|
|
|
// VectorSubtract(cl.simorg, b->start, org);
|
|
|
|
// VectorAdd(b->end, org, b->end); //move the end point by simorg-start
|
|
|
|
|
2005-10-07 02:08:44 +00:00
|
|
|
pl = &cl.frames[cl.parsecount&UPDATE_MASK].playerstate[b->entity-1];
|
2009-01-30 04:20:46 +00:00
|
|
|
if (pl->messagenum == cl.parsecount || cls.protocol == CP_NETQUAKE)
|
2005-08-27 23:28:39 +00:00
|
|
|
{
|
|
|
|
vec3_t fwd, org, ang;
|
|
|
|
float delta, f, len;
|
|
|
|
|
2005-10-07 02:08:44 +00:00
|
|
|
if (cl.spectator && autocam[j])
|
|
|
|
{
|
|
|
|
vieworg = pl->origin;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
vieworg = cl.simorg[j];
|
|
|
|
|
|
|
|
VectorCopy (vieworg, b->start);
|
2005-08-27 23:28:39 +00:00
|
|
|
b->start[2] += cl.crouch[j] + bound(-7, v_viewheight.value, 4);
|
|
|
|
|
|
|
|
f = bound(0, cl_truelightning.value, 1);
|
|
|
|
|
|
|
|
if (!f)
|
|
|
|
break;
|
|
|
|
|
2005-10-07 02:08:44 +00:00
|
|
|
VectorSubtract (playerbeam_end[j], vieworg, org);
|
2005-08-27 23:28:39 +00:00
|
|
|
len = VectorLength(org);
|
|
|
|
org[2] -= 22; // adjust for view height
|
|
|
|
vectoangles (org, ang);
|
|
|
|
|
|
|
|
// lerp pitch
|
|
|
|
ang[0] = -ang[0];
|
|
|
|
if (ang[0] < -180)
|
|
|
|
ang[0] += 360;
|
|
|
|
ang[0] += (cl.simangles[j][0] - ang[0]) * f;
|
|
|
|
|
|
|
|
// lerp yaw
|
|
|
|
delta = cl.simangles[j][1] - ang[1];
|
|
|
|
if (delta > 180)
|
|
|
|
delta -= 360;
|
|
|
|
if (delta < -180)
|
|
|
|
delta += 360;
|
|
|
|
ang[1] += delta * f;
|
|
|
|
ang[2] = 0;
|
|
|
|
|
|
|
|
AngleVectors (ang, fwd, ang, ang);
|
|
|
|
VectorCopy(fwd, ang);
|
|
|
|
VectorScale (fwd, len, fwd);
|
|
|
|
VectorCopy (cl.simorg[j], org);
|
|
|
|
org[2] += 16;
|
|
|
|
VectorAdd (org, fwd, b->end);
|
|
|
|
|
2009-11-04 21:16:50 +00:00
|
|
|
if (cl_beam_trace.ival)
|
2005-08-27 23:28:39 +00:00
|
|
|
{
|
|
|
|
vec3_t normal;
|
|
|
|
VectorMA(org, len+4, ang, fwd);
|
|
|
|
if (TraceLineN(org, fwd, ang, normal))
|
|
|
|
VectorCopy (ang, b->end);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2005-08-03 23:14:59 +00:00
|
|
|
}
|
2004-10-10 06:32:29 +00:00
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
else if (b->flags & STREAM_ATTACHED)
|
|
|
|
{
|
|
|
|
player_state_t *pl;
|
|
|
|
st = CL_FindPacketEntity(b->entity);
|
|
|
|
if (st)
|
|
|
|
{
|
|
|
|
VectorCopy(st->origin, b->start);
|
|
|
|
}
|
|
|
|
else if (b->entity <= MAX_CLIENTS && b->entity > 0)
|
|
|
|
{
|
|
|
|
pl = &cl.frames[cl.parsecount&UPDATE_MASK].playerstate[b->entity-1];
|
|
|
|
VectorCopy(pl->origin, b->start);
|
|
|
|
b->start[2]+=16;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// calculate pitch and yaw
|
|
|
|
VectorSubtract (b->end, b->start, dist);
|
|
|
|
|
|
|
|
if (dist[1] == 0 && dist[0] == 0)
|
|
|
|
{
|
|
|
|
yaw = 0;
|
|
|
|
if (dist[2] > 0)
|
|
|
|
pitch = 90;
|
|
|
|
else
|
|
|
|
pitch = 270;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
yaw = (int) (atan2(dist[1], dist[0]) * 180 / M_PI);
|
|
|
|
if (yaw < 0)
|
|
|
|
yaw += 360;
|
|
|
|
|
|
|
|
forward = sqrt (dist[0]*dist[0] + dist[1]*dist[1]);
|
|
|
|
pitch = (int) (atan2(dist[2], forward) * 180 / M_PI);
|
|
|
|
if (pitch < 0)
|
|
|
|
pitch += 360;
|
|
|
|
}
|
|
|
|
|
2009-11-04 21:16:50 +00:00
|
|
|
if (ruleset_allow_particle_lightning.ival)
|
2007-08-23 21:25:18 +00:00
|
|
|
if (b->particleeffect >= 0 && !P_ParticleTrail(b->start, b->end, b->particleeffect, &b->trailstate))
|
|
|
|
continue;
|
2004-10-19 16:10:14 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
// add new entities for the lightning
|
|
|
|
VectorCopy (b->start, org);
|
|
|
|
d = VectorNormalize(dist);
|
|
|
|
|
|
|
|
if(b->flags & 2)
|
|
|
|
{
|
|
|
|
offset = (int)(cl.time*40)%30;
|
|
|
|
for(i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
org[i] += dist[i]*offset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
while (d > 0)
|
|
|
|
{
|
|
|
|
ent = CL_NewTempEntity ();
|
|
|
|
if (!ent)
|
|
|
|
return;
|
|
|
|
VectorCopy (org, ent->origin);
|
|
|
|
ent->model = b->model;
|
|
|
|
ent->drawflags |= MLS_ABSLIGHT;
|
|
|
|
ent->abslight = 192;
|
2006-02-27 00:42:25 +00:00
|
|
|
ent->shaderRGBAf[3] = b->alpha;
|
2004-11-17 18:10:46 +00:00
|
|
|
|
|
|
|
ent->angles[0] = -pitch;
|
2004-08-23 00:15:46 +00:00
|
|
|
ent->angles[1] = yaw;
|
2008-01-08 23:34:41 +00:00
|
|
|
ent->angles[2] = rand()%360;
|
2004-11-17 18:10:46 +00:00
|
|
|
AngleVectors(ent->angles, ent->axis[0], ent->axis[1], ent->axis[2]);
|
|
|
|
ent->angles[0] = pitch;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
org[i] += dist[i]*30;
|
|
|
|
d -= 30;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-28 21:56:04 +00:00
|
|
|
beams_running = lastrunningbeam+1;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
CL_UpdateExplosions
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
void CL_UpdateExplosions (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
float f;
|
|
|
|
int of;
|
|
|
|
int numframes;
|
|
|
|
int firstframe;
|
|
|
|
explosion_t *ex;
|
|
|
|
entity_t *ent;
|
2006-05-28 21:56:04 +00:00
|
|
|
int lastrunningexplosion = -1;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2006-05-28 21:56:04 +00:00
|
|
|
for (i=0, ex=cl_explosions; i < explosions_running; i++, ex++)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2010-07-11 02:22:39 +00:00
|
|
|
if (!ex->model && !ex->flags)
|
2004-08-23 00:15:46 +00:00
|
|
|
continue;
|
2006-05-28 21:56:04 +00:00
|
|
|
|
|
|
|
lastrunningexplosion = i;
|
2005-05-26 12:55:34 +00:00
|
|
|
f = ex->framerate*(cl.time - ex->start);
|
2004-08-23 00:15:46 +00:00
|
|
|
if (ex->firstframe >= 0)
|
|
|
|
{
|
|
|
|
firstframe = ex->firstframe;
|
|
|
|
numframes = ex->numframes;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
firstframe = 0;
|
|
|
|
numframes = ex->model->numframes;
|
|
|
|
}
|
|
|
|
|
|
|
|
of = (int)f-1;
|
|
|
|
if ((int)f >= numframes || (int)f < 0)
|
|
|
|
{
|
|
|
|
ex->model = NULL;
|
2010-07-11 02:22:39 +00:00
|
|
|
ex->flags = 0;
|
2004-08-23 00:15:46 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (of < 0)
|
|
|
|
of = 0;
|
|
|
|
|
|
|
|
ent = CL_NewTempEntity ();
|
|
|
|
if (!ent)
|
|
|
|
return;
|
2010-08-28 17:14:38 +00:00
|
|
|
VectorMA (ex->origin, f, ex->velocity, ent->origin);
|
2005-03-18 06:14:07 +00:00
|
|
|
VectorCopy (ex->oldorigin, ent->oldorigin);
|
2004-08-23 00:15:46 +00:00
|
|
|
VectorCopy (ex->angles, ent->angles);
|
2005-03-18 06:14:07 +00:00
|
|
|
ent->skinnum = ex->skinnum;
|
|
|
|
ent->angles[0]*=-1;
|
|
|
|
AngleVectors(ent->angles, ent->axis[0], ent->axis[1], ent->axis[2]);
|
|
|
|
VectorInverse(ent->axis[1]);
|
2004-08-23 00:15:46 +00:00
|
|
|
ent->model = ex->model;
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
ent->framestate.g[FS_REG].frame[1] = (int)f+firstframe;
|
|
|
|
ent->framestate.g[FS_REG].frame[0] = of+firstframe;
|
|
|
|
ent->framestate.g[FS_REG].lerpfrac = (f - (int)f);
|
|
|
|
if (ent->model->type == mod_sprite)
|
2010-08-28 17:14:38 +00:00
|
|
|
ent->shaderRGBAf[3] = ex->alpha; /*sprites don't fade over time, the animation should do it*/
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
else
|
2010-08-28 17:14:38 +00:00
|
|
|
ent->shaderRGBAf[3] = (1.0 - f/(numframes))*ex->alpha;
|
2005-03-18 06:14:07 +00:00
|
|
|
ent->flags = ex->flags;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2006-05-28 21:56:04 +00:00
|
|
|
|
|
|
|
explosions_running = lastrunningexplosion + 1;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
entity_state_t *CL_FindPacketEntity(int num);
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
CL_UpdateTEnts
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
void CL_UpdateTEnts (void)
|
|
|
|
{
|
|
|
|
CL_UpdateBeams ();
|
|
|
|
CL_UpdateExplosions ();
|
|
|
|
}
|