2009-02-28 14:41:18 +00:00
|
|
|
/*
|
2010-06-17 07:17:09 +00:00
|
|
|
* Copyright (C) 1997-2001 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.
|
|
|
|
*
|
2010-06-18 15:27:55 +00:00
|
|
|
* =======================================================================
|
|
|
|
*
|
|
|
|
* This file implements all specialized client side effects.
|
|
|
|
* E.g. weapon effects, enemy effects, flash, etc.
|
|
|
|
*
|
|
|
|
* =======================================================================
|
2010-06-17 07:17:09 +00:00
|
|
|
*/
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2009-03-03 13:43:32 +00:00
|
|
|
#include "header/client.h"
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
void CL_LogoutEffect (vec3_t org, int type);
|
|
|
|
void CL_ItemRespawnParticles (vec3_t org);
|
2010-06-18 15:38:54 +00:00
|
|
|
void CL_ClearLightStyles (void);
|
|
|
|
void CL_ClearDlights (void);
|
|
|
|
void CL_ClearParticles (void);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
static vec3_t avelocities [NUMVERTEXNORMALS];
|
|
|
|
extern struct model_s *cl_mod_smoke;
|
|
|
|
extern struct model_s *cl_mod_flash;
|
|
|
|
|
2010-06-18 16:28:25 +00:00
|
|
|
extern cparticle_t *active_particles, *free_particles;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-22 15:38:09 +00:00
|
|
|
void CL_AddMuzzleFlash (void) {
|
2009-02-28 14:41:18 +00:00
|
|
|
vec3_t fv, rv;
|
|
|
|
cdlight_t *dl;
|
|
|
|
int i, weapon;
|
|
|
|
centity_t *pl;
|
|
|
|
int silenced;
|
|
|
|
float volume;
|
|
|
|
char soundname[64];
|
|
|
|
|
|
|
|
i = MSG_ReadShort (&net_message);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (i < 1 || i >= MAX_EDICTS)
|
2010-06-22 15:38:09 +00:00
|
|
|
Com_Error (ERR_DROP, "CL_AddMuzzleFlash: bad entity");
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
weapon = MSG_ReadByte (&net_message);
|
|
|
|
silenced = weapon & MZ_SILENCED;
|
|
|
|
weapon &= ~MZ_SILENCED;
|
|
|
|
|
|
|
|
pl = &cl_entities[i];
|
|
|
|
|
|
|
|
dl = CL_AllocDlight (i);
|
|
|
|
VectorCopy (pl->current.origin, dl->origin);
|
|
|
|
AngleVectors (pl->current.angles, fv, rv, NULL);
|
|
|
|
VectorMA (dl->origin, 18, fv, dl->origin);
|
|
|
|
VectorMA (dl->origin, 16, rv, dl->origin);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (silenced)
|
2010-06-17 15:11:51 +00:00
|
|
|
dl->radius = 100.0f + (rand()&31);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2010-06-17 15:11:51 +00:00
|
|
|
dl->radius = 200.0f + (rand()&31);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
dl->minlight = 32;
|
2010-06-17 07:17:09 +00:00
|
|
|
dl->die = cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (silenced)
|
2009-03-01 11:40:49 +00:00
|
|
|
volume = 0.2f;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
|
|
|
volume = 1;
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
switch (weapon) {
|
|
|
|
case MZ_BLASTER:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/blastf1a.wav"), volume, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
case MZ_BLUEHYPERBLASTER:
|
|
|
|
dl->color[0] = 0;
|
|
|
|
dl->color[1] = 0;
|
|
|
|
dl->color[2] = 1;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/hyprbf1a.wav"), volume, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
case MZ_HYPERBLASTER:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/hyprbf1a.wav"), volume, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
case MZ_MACHINEGUN:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
2010-06-17 15:11:51 +00:00
|
|
|
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
|
2010-06-17 07:17:09 +00:00
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
case MZ_SHOTGUN:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/shotgf1b.wav"), volume, ATTN_NORM, 0);
|
|
|
|
S_StartSound (NULL, i, CHAN_AUTO, S_RegisterSound("weapons/shotgr1b.wav"), volume, ATTN_NORM, 0.1f);
|
|
|
|
break;
|
|
|
|
case MZ_SSHOTGUN:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/sshotf1b.wav"), volume, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
case MZ_CHAINGUN1:
|
2010-06-17 15:11:51 +00:00
|
|
|
dl->radius = 200.0f + (rand()&31);
|
2010-06-17 07:17:09 +00:00
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 0.25;
|
|
|
|
dl->color[2] = 0;
|
2010-06-17 15:11:51 +00:00
|
|
|
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
|
2010-06-17 07:17:09 +00:00
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
case MZ_CHAINGUN2:
|
2010-06-17 15:11:51 +00:00
|
|
|
dl->radius = 225.0f + (rand()&31);
|
2010-06-17 07:17:09 +00:00
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 0.5;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
dl->die = cl.time + 0.1; /* long delay */
|
2010-06-17 15:11:51 +00:00
|
|
|
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
|
2010-06-17 07:17:09 +00:00
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
|
2010-06-17 15:11:51 +00:00
|
|
|
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
|
2010-06-17 07:17:09 +00:00
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.05);
|
|
|
|
break;
|
|
|
|
case MZ_CHAINGUN3:
|
2010-06-17 15:11:51 +00:00
|
|
|
dl->radius = 250.0f + (rand()&31);
|
2010-06-17 07:17:09 +00:00
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
dl->die = cl.time + 0.1; /* long delay */
|
2010-06-17 15:11:51 +00:00
|
|
|
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
|
2010-06-17 07:17:09 +00:00
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
|
2010-06-17 15:11:51 +00:00
|
|
|
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
|
2010-06-17 07:17:09 +00:00
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.033f);
|
2010-06-17 15:11:51 +00:00
|
|
|
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
|
2010-06-17 07:17:09 +00:00
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.066f);
|
|
|
|
break;
|
|
|
|
case MZ_RAILGUN:
|
|
|
|
dl->color[0] = 0.5;
|
|
|
|
dl->color[1] = 0.5;
|
|
|
|
dl->color[2] = 1.0;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/railgf1a.wav"), volume, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
case MZ_ROCKET:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 0.5;
|
|
|
|
dl->color[2] = 0.2;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/rocklf1a.wav"), volume, ATTN_NORM, 0);
|
|
|
|
S_StartSound (NULL, i, CHAN_AUTO, S_RegisterSound("weapons/rocklr1b.wav"), volume, ATTN_NORM, 0.1f);
|
|
|
|
break;
|
|
|
|
case MZ_GRENADE:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 0.5;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), volume, ATTN_NORM, 0);
|
|
|
|
S_StartSound (NULL, i, CHAN_AUTO, S_RegisterSound("weapons/grenlr1b.wav"), volume, ATTN_NORM, 0.1f);
|
|
|
|
break;
|
|
|
|
case MZ_BFG:
|
|
|
|
dl->color[0] = 0;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/bfg__f1y.wav"), volume, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ_LOGIN:
|
|
|
|
dl->color[0] = 0;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
dl->die = cl.time + 1;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0);
|
|
|
|
CL_LogoutEffect (pl->current.origin, weapon);
|
|
|
|
break;
|
|
|
|
case MZ_LOGOUT:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 0;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
dl->die = cl.time + 1;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0);
|
|
|
|
CL_LogoutEffect (pl->current.origin, weapon);
|
|
|
|
break;
|
|
|
|
case MZ_RESPAWN:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
dl->die = cl.time + 1.0;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0);
|
|
|
|
CL_LogoutEffect (pl->current.origin, weapon);
|
|
|
|
break;
|
|
|
|
case MZ_PHALANX:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 0.5;
|
|
|
|
dl->color[2] = 0.5;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/plasshot.wav"), volume, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
case MZ_IONRIPPER:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 0.5;
|
|
|
|
dl->color[2] = 0.5;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/rippfire.wav"), volume, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
case MZ_ETF_RIFLE:
|
|
|
|
dl->color[0] = 0.9f;
|
|
|
|
dl->color[1] = 0.7f;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/nail1.wav"), volume, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
case MZ_SHOTGUN2:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/shotg2.wav"), volume, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
case MZ_HEATBEAM:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
dl->die = cl.time + 100;
|
|
|
|
break;
|
|
|
|
case MZ_BLASTER2:
|
|
|
|
dl->color[0] = 0;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/blastf1a.wav"), volume, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
case MZ_TRACKER:
|
|
|
|
/* negative flashes handled the same in gl/soft until CL_AddDLights */
|
|
|
|
dl->color[0] = -1;
|
|
|
|
dl->color[1] = -1;
|
|
|
|
dl->color[2] = -1;
|
|
|
|
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/disint2.wav"), volume, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
case MZ_NUKE1:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 0;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
dl->die = cl.time + 100;
|
|
|
|
break;
|
|
|
|
case MZ_NUKE2:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
dl->die = cl.time + 100;
|
|
|
|
break;
|
|
|
|
case MZ_NUKE4:
|
|
|
|
dl->color[0] = 0;
|
|
|
|
dl->color[1] = 0;
|
|
|
|
dl->color[2] = 1;
|
|
|
|
dl->die = cl.time + 100;
|
|
|
|
break;
|
|
|
|
case MZ_NUKE8:
|
|
|
|
dl->color[0] = 0;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 1;
|
|
|
|
dl->die = cl.time + 100;
|
|
|
|
break;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-22 15:38:09 +00:00
|
|
|
void CL_AddMuzzleFlash2 (void) {
|
2009-02-28 14:41:18 +00:00
|
|
|
int ent;
|
|
|
|
vec3_t origin;
|
2009-03-01 11:40:49 +00:00
|
|
|
unsigned flash_number;
|
2009-02-28 14:41:18 +00:00
|
|
|
cdlight_t *dl;
|
|
|
|
vec3_t forward, right;
|
|
|
|
char soundname[64];
|
|
|
|
|
|
|
|
ent = MSG_ReadShort (&net_message);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (ent < 1 || ent >= MAX_EDICTS)
|
2010-06-22 15:38:09 +00:00
|
|
|
Com_Error (ERR_DROP, "CL_AddMuzzleFlash2: bad entity");
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
flash_number = MSG_ReadByte (&net_message);
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
if (flash_number > 210)
|
2010-06-22 15:38:09 +00:00
|
|
|
Com_Error (ERR_DROP, "CL_AddMuzzleFlash2: bad offset");
|
2009-03-01 11:40:49 +00:00
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
/* locate the origin */
|
2009-02-28 14:41:18 +00:00
|
|
|
AngleVectors (cl_entities[ent].current.angles, forward, right, NULL);
|
|
|
|
origin[0] = cl_entities[ent].current.origin[0] + forward[0] * monster_flash_offset[flash_number][0] + right[0] * monster_flash_offset[flash_number][1];
|
|
|
|
origin[1] = cl_entities[ent].current.origin[1] + forward[1] * monster_flash_offset[flash_number][0] + right[1] * monster_flash_offset[flash_number][1];
|
|
|
|
origin[2] = cl_entities[ent].current.origin[2] + forward[2] * monster_flash_offset[flash_number][0] + right[2] * monster_flash_offset[flash_number][1] + monster_flash_offset[flash_number][2];
|
|
|
|
|
|
|
|
dl = CL_AllocDlight (ent);
|
|
|
|
VectorCopy (origin, dl->origin);
|
2010-06-17 15:11:51 +00:00
|
|
|
dl->radius = 200.0f + (rand()&31);
|
2009-02-28 14:41:18 +00:00
|
|
|
dl->minlight = 32;
|
2010-06-17 07:17:09 +00:00
|
|
|
dl->die = cl.time;
|
|
|
|
|
|
|
|
switch (flash_number) {
|
|
|
|
case MZ2_INFANTRY_MACHINEGUN_1:
|
|
|
|
case MZ2_INFANTRY_MACHINEGUN_2:
|
|
|
|
case MZ2_INFANTRY_MACHINEGUN_3:
|
|
|
|
case MZ2_INFANTRY_MACHINEGUN_4:
|
|
|
|
case MZ2_INFANTRY_MACHINEGUN_5:
|
|
|
|
case MZ2_INFANTRY_MACHINEGUN_6:
|
|
|
|
case MZ2_INFANTRY_MACHINEGUN_7:
|
|
|
|
case MZ2_INFANTRY_MACHINEGUN_8:
|
|
|
|
case MZ2_INFANTRY_MACHINEGUN_9:
|
|
|
|
case MZ2_INFANTRY_MACHINEGUN_10:
|
|
|
|
case MZ2_INFANTRY_MACHINEGUN_11:
|
|
|
|
case MZ2_INFANTRY_MACHINEGUN_12:
|
|
|
|
case MZ2_INFANTRY_MACHINEGUN_13:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
CL_ParticleEffect (origin, vec3_origin, 0, 40);
|
|
|
|
CL_SmokeAndFlash(origin);
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_SOLDIER_MACHINEGUN_1:
|
|
|
|
case MZ2_SOLDIER_MACHINEGUN_2:
|
|
|
|
case MZ2_SOLDIER_MACHINEGUN_3:
|
|
|
|
case MZ2_SOLDIER_MACHINEGUN_4:
|
|
|
|
case MZ2_SOLDIER_MACHINEGUN_5:
|
|
|
|
case MZ2_SOLDIER_MACHINEGUN_6:
|
|
|
|
case MZ2_SOLDIER_MACHINEGUN_7:
|
|
|
|
case MZ2_SOLDIER_MACHINEGUN_8:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
CL_ParticleEffect (origin, vec3_origin, 0, 40);
|
|
|
|
CL_SmokeAndFlash(origin);
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("soldier/solatck3.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_GUNNER_MACHINEGUN_1:
|
|
|
|
case MZ2_GUNNER_MACHINEGUN_2:
|
|
|
|
case MZ2_GUNNER_MACHINEGUN_3:
|
|
|
|
case MZ2_GUNNER_MACHINEGUN_4:
|
|
|
|
case MZ2_GUNNER_MACHINEGUN_5:
|
|
|
|
case MZ2_GUNNER_MACHINEGUN_6:
|
|
|
|
case MZ2_GUNNER_MACHINEGUN_7:
|
|
|
|
case MZ2_GUNNER_MACHINEGUN_8:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
CL_ParticleEffect (origin, vec3_origin, 0, 40);
|
|
|
|
CL_SmokeAndFlash(origin);
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("gunner/gunatck2.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_ACTOR_MACHINEGUN_1:
|
|
|
|
case MZ2_SUPERTANK_MACHINEGUN_1:
|
|
|
|
case MZ2_SUPERTANK_MACHINEGUN_2:
|
|
|
|
case MZ2_SUPERTANK_MACHINEGUN_3:
|
|
|
|
case MZ2_SUPERTANK_MACHINEGUN_4:
|
|
|
|
case MZ2_SUPERTANK_MACHINEGUN_5:
|
|
|
|
case MZ2_SUPERTANK_MACHINEGUN_6:
|
|
|
|
case MZ2_TURRET_MACHINEGUN:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
|
|
|
|
CL_ParticleEffect (origin, vec3_origin, 0, 40);
|
|
|
|
CL_SmokeAndFlash(origin);
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_BOSS2_MACHINEGUN_L1:
|
|
|
|
case MZ2_BOSS2_MACHINEGUN_L2:
|
|
|
|
case MZ2_BOSS2_MACHINEGUN_L3:
|
|
|
|
case MZ2_BOSS2_MACHINEGUN_L4:
|
|
|
|
case MZ2_BOSS2_MACHINEGUN_L5:
|
|
|
|
case MZ2_CARRIER_MACHINEGUN_L1:
|
|
|
|
case MZ2_CARRIER_MACHINEGUN_L2:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
|
|
|
|
CL_ParticleEffect (origin, vec3_origin, 0, 40);
|
|
|
|
CL_SmokeAndFlash(origin);
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NONE, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_SOLDIER_BLASTER_1:
|
|
|
|
case MZ2_SOLDIER_BLASTER_2:
|
|
|
|
case MZ2_SOLDIER_BLASTER_3:
|
|
|
|
case MZ2_SOLDIER_BLASTER_4:
|
|
|
|
case MZ2_SOLDIER_BLASTER_5:
|
|
|
|
case MZ2_SOLDIER_BLASTER_6:
|
|
|
|
case MZ2_SOLDIER_BLASTER_7:
|
|
|
|
case MZ2_SOLDIER_BLASTER_8:
|
|
|
|
case MZ2_TURRET_BLASTER:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("soldier/solatck2.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_FLYER_BLASTER_1:
|
|
|
|
case MZ2_FLYER_BLASTER_2:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("flyer/flyatck3.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_MEDIC_BLASTER_1:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("medic/medatck1.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_HOVER_BLASTER_1:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("hover/hovatck1.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_FLOAT_BLASTER_1:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("floater/fltatck1.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_SOLDIER_SHOTGUN_1:
|
|
|
|
case MZ2_SOLDIER_SHOTGUN_2:
|
|
|
|
case MZ2_SOLDIER_SHOTGUN_3:
|
|
|
|
case MZ2_SOLDIER_SHOTGUN_4:
|
|
|
|
case MZ2_SOLDIER_SHOTGUN_5:
|
|
|
|
case MZ2_SOLDIER_SHOTGUN_6:
|
|
|
|
case MZ2_SOLDIER_SHOTGUN_7:
|
|
|
|
case MZ2_SOLDIER_SHOTGUN_8:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
CL_SmokeAndFlash(origin);
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("soldier/solatck1.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_TANK_BLASTER_1:
|
|
|
|
case MZ2_TANK_BLASTER_2:
|
|
|
|
case MZ2_TANK_BLASTER_3:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/tnkatck3.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_TANK_MACHINEGUN_1:
|
|
|
|
case MZ2_TANK_MACHINEGUN_2:
|
|
|
|
case MZ2_TANK_MACHINEGUN_3:
|
|
|
|
case MZ2_TANK_MACHINEGUN_4:
|
|
|
|
case MZ2_TANK_MACHINEGUN_5:
|
|
|
|
case MZ2_TANK_MACHINEGUN_6:
|
|
|
|
case MZ2_TANK_MACHINEGUN_7:
|
|
|
|
case MZ2_TANK_MACHINEGUN_8:
|
|
|
|
case MZ2_TANK_MACHINEGUN_9:
|
|
|
|
case MZ2_TANK_MACHINEGUN_10:
|
|
|
|
case MZ2_TANK_MACHINEGUN_11:
|
|
|
|
case MZ2_TANK_MACHINEGUN_12:
|
|
|
|
case MZ2_TANK_MACHINEGUN_13:
|
|
|
|
case MZ2_TANK_MACHINEGUN_14:
|
|
|
|
case MZ2_TANK_MACHINEGUN_15:
|
|
|
|
case MZ2_TANK_MACHINEGUN_16:
|
|
|
|
case MZ2_TANK_MACHINEGUN_17:
|
|
|
|
case MZ2_TANK_MACHINEGUN_18:
|
|
|
|
case MZ2_TANK_MACHINEGUN_19:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
CL_ParticleEffect (origin, vec3_origin, 0, 40);
|
|
|
|
CL_SmokeAndFlash(origin);
|
2010-06-17 15:11:51 +00:00
|
|
|
Com_sprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav", 'a' + (char) (rand() % 5));
|
2010-06-17 07:17:09 +00:00
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound(soundname), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_CHICK_ROCKET_1:
|
|
|
|
case MZ2_TURRET_ROCKET:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 0.5f;
|
|
|
|
dl->color[2] = 0.2f;
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("chick/chkatck2.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_TANK_ROCKET_1:
|
|
|
|
case MZ2_TANK_ROCKET_2:
|
|
|
|
case MZ2_TANK_ROCKET_3:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 0.5f;
|
|
|
|
dl->color[2] = 0.2f;
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/tnkatck1.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_SUPERTANK_ROCKET_1:
|
|
|
|
case MZ2_SUPERTANK_ROCKET_2:
|
|
|
|
case MZ2_SUPERTANK_ROCKET_3:
|
|
|
|
case MZ2_BOSS2_ROCKET_1:
|
|
|
|
case MZ2_BOSS2_ROCKET_2:
|
|
|
|
case MZ2_BOSS2_ROCKET_3:
|
|
|
|
case MZ2_BOSS2_ROCKET_4:
|
|
|
|
case MZ2_CARRIER_ROCKET_1:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 0.5f;
|
|
|
|
dl->color[2] = 0.2f;
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/rocket.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_GUNNER_GRENADE_1:
|
|
|
|
case MZ2_GUNNER_GRENADE_2:
|
|
|
|
case MZ2_GUNNER_GRENADE_3:
|
|
|
|
case MZ2_GUNNER_GRENADE_4:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 0.5;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("gunner/gunatck3.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_GLADIATOR_RAILGUN_1:
|
|
|
|
case MZ2_CARRIER_RAILGUN:
|
|
|
|
case MZ2_WIDOW_RAIL:
|
|
|
|
dl->color[0] = 0.5;
|
|
|
|
dl->color[1] = 0.5;
|
|
|
|
dl->color[2] = 1.0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_MAKRON_BFG:
|
|
|
|
dl->color[0] = 0.5;
|
|
|
|
dl->color[1] = 1 ;
|
|
|
|
dl->color[2] = 0.5;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_MAKRON_BLASTER_1:
|
|
|
|
case MZ2_MAKRON_BLASTER_2:
|
|
|
|
case MZ2_MAKRON_BLASTER_3:
|
|
|
|
case MZ2_MAKRON_BLASTER_4:
|
|
|
|
case MZ2_MAKRON_BLASTER_5:
|
|
|
|
case MZ2_MAKRON_BLASTER_6:
|
|
|
|
case MZ2_MAKRON_BLASTER_7:
|
|
|
|
case MZ2_MAKRON_BLASTER_8:
|
|
|
|
case MZ2_MAKRON_BLASTER_9:
|
|
|
|
case MZ2_MAKRON_BLASTER_10:
|
|
|
|
case MZ2_MAKRON_BLASTER_11:
|
|
|
|
case MZ2_MAKRON_BLASTER_12:
|
|
|
|
case MZ2_MAKRON_BLASTER_13:
|
|
|
|
case MZ2_MAKRON_BLASTER_14:
|
|
|
|
case MZ2_MAKRON_BLASTER_15:
|
|
|
|
case MZ2_MAKRON_BLASTER_16:
|
|
|
|
case MZ2_MAKRON_BLASTER_17:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("makron/blaster.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_JORG_MACHINEGUN_L1:
|
|
|
|
case MZ2_JORG_MACHINEGUN_L2:
|
|
|
|
case MZ2_JORG_MACHINEGUN_L3:
|
|
|
|
case MZ2_JORG_MACHINEGUN_L4:
|
|
|
|
case MZ2_JORG_MACHINEGUN_L5:
|
|
|
|
case MZ2_JORG_MACHINEGUN_L6:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
CL_ParticleEffect (origin, vec3_origin, 0, 40);
|
|
|
|
CL_SmokeAndFlash(origin);
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("boss3/xfire.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_JORG_MACHINEGUN_R1:
|
|
|
|
case MZ2_JORG_MACHINEGUN_R2:
|
|
|
|
case MZ2_JORG_MACHINEGUN_R3:
|
|
|
|
case MZ2_JORG_MACHINEGUN_R4:
|
|
|
|
case MZ2_JORG_MACHINEGUN_R5:
|
|
|
|
case MZ2_JORG_MACHINEGUN_R6:
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
CL_ParticleEffect (origin, vec3_origin, 0, 40);
|
|
|
|
CL_SmokeAndFlash(origin);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_JORG_BFG_1:
|
|
|
|
dl->color[0] = 0.5;
|
|
|
|
dl->color[1] = 1 ;
|
|
|
|
dl->color[2] = 0.5;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_BOSS2_MACHINEGUN_R1:
|
|
|
|
case MZ2_BOSS2_MACHINEGUN_R2:
|
|
|
|
case MZ2_BOSS2_MACHINEGUN_R3:
|
|
|
|
case MZ2_BOSS2_MACHINEGUN_R4:
|
|
|
|
case MZ2_BOSS2_MACHINEGUN_R5:
|
|
|
|
case MZ2_CARRIER_MACHINEGUN_R1:
|
|
|
|
case MZ2_CARRIER_MACHINEGUN_R2:
|
|
|
|
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
|
|
|
|
CL_ParticleEffect (origin, vec3_origin, 0, 40);
|
|
|
|
CL_SmokeAndFlash(origin);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_STALKER_BLASTER:
|
|
|
|
case MZ2_DAEDALUS_BLASTER:
|
|
|
|
case MZ2_MEDIC_BLASTER_2:
|
|
|
|
case MZ2_WIDOW_BLASTER:
|
|
|
|
case MZ2_WIDOW_BLASTER_SWEEP1:
|
|
|
|
case MZ2_WIDOW_BLASTER_SWEEP2:
|
|
|
|
case MZ2_WIDOW_BLASTER_SWEEP3:
|
|
|
|
case MZ2_WIDOW_BLASTER_SWEEP4:
|
|
|
|
case MZ2_WIDOW_BLASTER_SWEEP5:
|
|
|
|
case MZ2_WIDOW_BLASTER_SWEEP6:
|
|
|
|
case MZ2_WIDOW_BLASTER_SWEEP7:
|
|
|
|
case MZ2_WIDOW_BLASTER_SWEEP8:
|
|
|
|
case MZ2_WIDOW_BLASTER_SWEEP9:
|
|
|
|
case MZ2_WIDOW_BLASTER_100:
|
|
|
|
case MZ2_WIDOW_BLASTER_90:
|
|
|
|
case MZ2_WIDOW_BLASTER_80:
|
|
|
|
case MZ2_WIDOW_BLASTER_70:
|
|
|
|
case MZ2_WIDOW_BLASTER_60:
|
|
|
|
case MZ2_WIDOW_BLASTER_50:
|
|
|
|
case MZ2_WIDOW_BLASTER_40:
|
|
|
|
case MZ2_WIDOW_BLASTER_30:
|
|
|
|
case MZ2_WIDOW_BLASTER_20:
|
|
|
|
case MZ2_WIDOW_BLASTER_10:
|
|
|
|
case MZ2_WIDOW_BLASTER_0:
|
|
|
|
case MZ2_WIDOW_BLASTER_10L:
|
|
|
|
case MZ2_WIDOW_BLASTER_20L:
|
|
|
|
case MZ2_WIDOW_BLASTER_30L:
|
|
|
|
case MZ2_WIDOW_BLASTER_40L:
|
|
|
|
case MZ2_WIDOW_BLASTER_50L:
|
|
|
|
case MZ2_WIDOW_BLASTER_60L:
|
|
|
|
case MZ2_WIDOW_BLASTER_70L:
|
|
|
|
case MZ2_WIDOW_RUN_1:
|
|
|
|
case MZ2_WIDOW_RUN_2:
|
|
|
|
case MZ2_WIDOW_RUN_3:
|
|
|
|
case MZ2_WIDOW_RUN_4:
|
|
|
|
case MZ2_WIDOW_RUN_5:
|
|
|
|
case MZ2_WIDOW_RUN_6:
|
|
|
|
case MZ2_WIDOW_RUN_7:
|
|
|
|
case MZ2_WIDOW_RUN_8:
|
|
|
|
dl->color[0] = 0;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/tnkatck3.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_WIDOW_DISRUPTOR:
|
|
|
|
dl->color[0] = -1;
|
|
|
|
dl->color[1] = -1;
|
|
|
|
dl->color[2] = -1;
|
|
|
|
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("weapons/disint2.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MZ2_WIDOW_PLASMABEAM:
|
|
|
|
case MZ2_WIDOW2_BEAMER_1:
|
|
|
|
case MZ2_WIDOW2_BEAMER_2:
|
|
|
|
case MZ2_WIDOW2_BEAMER_3:
|
|
|
|
case MZ2_WIDOW2_BEAMER_4:
|
|
|
|
case MZ2_WIDOW2_BEAMER_5:
|
|
|
|
case MZ2_WIDOW2_BEAM_SWEEP_1:
|
|
|
|
case MZ2_WIDOW2_BEAM_SWEEP_2:
|
|
|
|
case MZ2_WIDOW2_BEAM_SWEEP_3:
|
|
|
|
case MZ2_WIDOW2_BEAM_SWEEP_4:
|
|
|
|
case MZ2_WIDOW2_BEAM_SWEEP_5:
|
|
|
|
case MZ2_WIDOW2_BEAM_SWEEP_6:
|
|
|
|
case MZ2_WIDOW2_BEAM_SWEEP_7:
|
|
|
|
case MZ2_WIDOW2_BEAM_SWEEP_8:
|
|
|
|
case MZ2_WIDOW2_BEAM_SWEEP_9:
|
|
|
|
case MZ2_WIDOW2_BEAM_SWEEP_10:
|
|
|
|
case MZ2_WIDOW2_BEAM_SWEEP_11:
|
2010-06-17 15:11:51 +00:00
|
|
|
dl->radius = 300.0f + (rand()&100);
|
2010-06-17 07:17:09 +00:00
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
|
|
|
dl->die = cl.time + 200;
|
|
|
|
break;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_TeleporterParticles (entity_state_t *ent) {
|
2009-02-28 14:41:18 +00:00
|
|
|
int i, j;
|
|
|
|
cparticle_t *p;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
for (i=0 ; i<8 ; i++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2009-02-28 14:41:18 +00:00
|
|
|
p->color = 0xdb;
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
for (j=0 ; j<2 ; j++) {
|
2010-06-17 15:11:51 +00:00
|
|
|
p->org[j] = ent->origin[j] - 16 + (rand()&31);
|
2009-02-28 14:41:18 +00:00
|
|
|
p->vel[j] = crand()*14;
|
|
|
|
}
|
|
|
|
|
2010-06-17 15:11:51 +00:00
|
|
|
p->org[2] = ent->origin[2] - 8 + (rand()&7);
|
|
|
|
p->vel[2] = 80 + (rand()&7);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
p->accel[0] = p->accel[1] = 0;
|
|
|
|
p->accel[2] = -PARTICLE_GRAVITY;
|
|
|
|
p->alpha = 1.0;
|
|
|
|
|
|
|
|
p->alphavel = -0.5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_LogoutEffect (vec3_t org, int type) {
|
2009-02-28 14:41:18 +00:00
|
|
|
int i, j;
|
|
|
|
cparticle_t *p;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
for (i=0 ; i<500 ; i++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (type == MZ_LOGIN)
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = 0xd0 + (rand()&7);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else if (type == MZ_LOGOUT)
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = 0x40 + (rand()&7);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = 0xe0 + (rand()&7);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
p->org[0] = org[0] - 16 + frand()*32;
|
|
|
|
p->org[1] = org[1] - 16 + frand()*32;
|
|
|
|
p->org[2] = org[2] - 24 + frand()*56;
|
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++)
|
|
|
|
p->vel[j] = crand()*20;
|
|
|
|
|
|
|
|
p->accel[0] = p->accel[1] = 0;
|
|
|
|
p->accel[2] = -PARTICLE_GRAVITY;
|
|
|
|
p->alpha = 1.0;
|
|
|
|
|
|
|
|
p->alphavel = -1.0 / (1.0 + frand()*0.3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_ItemRespawnParticles (vec3_t org) {
|
2009-02-28 14:41:18 +00:00
|
|
|
int i, j;
|
|
|
|
cparticle_t *p;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
for (i=0 ; i<64 ; i++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = 0xd4 + (rand()&3);
|
2009-02-28 14:41:18 +00:00
|
|
|
p->org[0] = org[0] + crand()*8;
|
|
|
|
p->org[1] = org[1] + crand()*8;
|
|
|
|
p->org[2] = org[2] + crand()*8;
|
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++)
|
|
|
|
p->vel[j] = crand()*8;
|
|
|
|
|
|
|
|
p->accel[0] = p->accel[1] = 0;
|
|
|
|
p->accel[2] = -PARTICLE_GRAVITY*0.2;
|
|
|
|
p->alpha = 1.0;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -1.0f / (1.0f + frand()*0.3f);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_ExplosionParticles (vec3_t org) {
|
2009-02-28 14:41:18 +00:00
|
|
|
int i, j;
|
|
|
|
cparticle_t *p;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
for (i=0 ; i<256 ; i++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = 0xe0 + (rand()&7);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->org[j] = org[j] + ((rand()%32)-16);
|
|
|
|
p->vel[j] = (rand()%384)-192;
|
|
|
|
}
|
|
|
|
|
|
|
|
p->accel[0] = p->accel[1] = 0;
|
|
|
|
p->accel[2] = -PARTICLE_GRAVITY;
|
|
|
|
p->alpha = 1.0;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -0.8f / (0.5f + frand()*0.3f);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_BigTeleportParticles (vec3_t org) {
|
2009-02-28 14:41:18 +00:00
|
|
|
int i;
|
|
|
|
cparticle_t *p;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
float angle, dist;
|
|
|
|
static int colortable[4] = {2*8,13*8,21*8,18*8};
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
for (i=0 ; i<4096 ; i++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = colortable[rand()&3];
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-17 15:11:51 +00:00
|
|
|
angle = M_PI*2*(rand()&1023)/1023.0f;
|
|
|
|
dist = (float)(rand()&31);
|
2009-03-01 11:40:49 +00:00
|
|
|
p->org[0] = org[0] + (float)cos(angle)*dist;
|
2010-06-17 15:11:51 +00:00
|
|
|
p->vel[0] = (float)cos(angle)*(70+(rand()&63));
|
2009-03-01 11:40:49 +00:00
|
|
|
p->accel[0] = -(float)cos(angle)*100;
|
|
|
|
|
|
|
|
p->org[1] = org[1] + (float)sin(angle)*dist;
|
2010-06-17 15:11:51 +00:00
|
|
|
p->vel[1] = (float)sin(angle)*(70+(rand()&63));
|
2009-03-01 11:40:49 +00:00
|
|
|
p->accel[1] = -(float)sin(angle)*100;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-17 15:11:51 +00:00
|
|
|
p->org[2] = org[2] + 8 + (rand()%90);
|
|
|
|
p->vel[2] = -100 + (rand()&31);
|
2009-02-28 14:41:18 +00:00
|
|
|
p->accel[2] = PARTICLE_GRAVITY*4;
|
|
|
|
p->alpha = 1.0;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -0.3f / (0.5f + frand()*0.3f);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-18 19:47:24 +00:00
|
|
|
/*
|
|
|
|
* Wall impact puffs
|
|
|
|
*/
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_BlasterParticles (vec3_t org, vec3_t dir) {
|
2009-02-28 14:41:18 +00:00
|
|
|
int i, j;
|
|
|
|
cparticle_t *p;
|
|
|
|
float d;
|
|
|
|
int count;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
count = 40;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (i=0 ; i<count ; i++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = 0xe0 + (rand()&7);
|
|
|
|
d = rand()&15;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
2010-06-17 15:11:51 +00:00
|
|
|
p->org[j] = org[j] + ((rand()&7)-4) + d*dir[j];
|
2009-02-28 14:41:18 +00:00
|
|
|
p->vel[j] = dir[j] * 30 + crand()*40;
|
|
|
|
}
|
|
|
|
|
|
|
|
p->accel[0] = p->accel[1] = 0;
|
|
|
|
p->accel[2] = -PARTICLE_GRAVITY;
|
|
|
|
p->alpha = 1.0;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -1.0f / (0.5f + frand()*0.3f);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_BlasterTrail (vec3_t start, vec3_t end) {
|
2009-02-28 14:41:18 +00:00
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
2009-03-01 11:40:49 +00:00
|
|
|
int len;
|
2009-02-28 14:41:18 +00:00
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
|
|
|
int dec;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
2009-03-01 11:40:49 +00:00
|
|
|
len = (int)VectorNormalize (vec);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
dec = 5;
|
|
|
|
VectorScale (vec, 5, vec);
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
while (len > 0) {
|
2009-02-28 14:41:18 +00:00
|
|
|
len -= dec;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
p->alpha = 1.0;
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -1.0f / (0.3f+frand()*0.2f);
|
2009-02-28 14:41:18 +00:00
|
|
|
p->color = 0xe0;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->org[j] = move[j] + crand();
|
|
|
|
p->vel[j] = crand()*5;
|
|
|
|
p->accel[j] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_QuadTrail (vec3_t start, vec3_t end) {
|
2009-02-28 14:41:18 +00:00
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
2009-03-01 11:40:49 +00:00
|
|
|
int len;
|
2009-02-28 14:41:18 +00:00
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
|
|
|
int dec;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
2009-03-01 11:40:49 +00:00
|
|
|
len = (int)VectorNormalize (vec);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
dec = 5;
|
|
|
|
VectorScale (vec, 5, vec);
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
while (len > 0) {
|
2009-02-28 14:41:18 +00:00
|
|
|
len -= dec;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
p->alpha = 1.0;
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -1.0f / (0.8f+frand()*0.2f);
|
2009-02-28 14:41:18 +00:00
|
|
|
p->color = 115;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->org[j] = move[j] + crand()*16;
|
|
|
|
p->vel[j] = crand()*5;
|
|
|
|
p->accel[j] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_FlagTrail (vec3_t start, vec3_t end, int color) {
|
2009-02-28 14:41:18 +00:00
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
2009-03-01 11:40:49 +00:00
|
|
|
int len;
|
2009-02-28 14:41:18 +00:00
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
|
|
|
int dec;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
2009-03-01 11:40:49 +00:00
|
|
|
len = (int)VectorNormalize (vec);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
dec = 5;
|
|
|
|
VectorScale (vec, 5, vec);
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
while (len > 0) {
|
2009-02-28 14:41:18 +00:00
|
|
|
len -= dec;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
p->alpha = 1.0;
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -1.0f / (0.8f+frand()*0.2f);
|
2009-02-28 14:41:18 +00:00
|
|
|
p->color = color;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->org[j] = move[j] + crand()*16;
|
|
|
|
p->vel[j] = crand()*5;
|
|
|
|
p->accel[j] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags) {
|
2009-02-28 14:41:18 +00:00
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
2009-03-01 11:40:49 +00:00
|
|
|
int len;
|
2009-02-28 14:41:18 +00:00
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
|
|
|
float dec;
|
|
|
|
float orgscale;
|
|
|
|
float velscale;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
dec = 0.5;
|
|
|
|
VectorScale (vec, dec, vec);
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
if (old->trailcount > 900) {
|
2009-02-28 14:41:18 +00:00
|
|
|
orgscale = 4;
|
|
|
|
velscale = 15;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
} else if (old->trailcount > 800) {
|
2009-02-28 14:41:18 +00:00
|
|
|
orgscale = 2;
|
|
|
|
velscale = 10;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
} else {
|
2009-02-28 14:41:18 +00:00
|
|
|
orgscale = 1;
|
|
|
|
velscale = 5;
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
while (len > 0) {
|
2009-02-28 14:41:18 +00:00
|
|
|
len -= dec;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
/* drop less particles as it flies */
|
2010-06-17 15:11:51 +00:00
|
|
|
if ((rand()&1023) < old->trailcount) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
if (flags & EF_GIB) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->alpha = 1.0;
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -1.0f / (1+frand()*0.4f);
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = 0xe8 + (rand()&7);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->org[j] = move[j] + crand()*orgscale;
|
|
|
|
p->vel[j] = crand()*velscale;
|
|
|
|
p->accel[j] = 0;
|
|
|
|
}
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p->vel[2] -= PARTICLE_GRAVITY;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
} else if (flags & EF_GREENGIB) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->alpha = 1.0;
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -1.0f / (1+frand()*0.4f);
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = 0xdb + (rand()&7);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (j=0; j< 3; j++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->org[j] = move[j] + crand()*orgscale;
|
|
|
|
p->vel[j] = crand()*velscale;
|
|
|
|
p->accel[j] = 0;
|
|
|
|
}
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p->vel[2] -= PARTICLE_GRAVITY;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
} else {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->alpha = 1.0;
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -1.0f / (1+frand()*0.2f);
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = 4 + (rand()&7);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->org[j] = move[j] + crand()*orgscale;
|
|
|
|
p->vel[j] = crand()*velscale;
|
|
|
|
}
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p->accel[2] = 20;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
old->trailcount -= 5;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (old->trailcount < 100)
|
|
|
|
old->trailcount = 100;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void MakeNormalVectors (vec3_t forward, vec3_t right, vec3_t up) {
|
|
|
|
float d;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
/* this rotate and negate guarantees a vector
|
|
|
|
* not colinear with the original */
|
2009-02-28 14:41:18 +00:00
|
|
|
right[1] = -forward[0];
|
|
|
|
right[2] = forward[1];
|
|
|
|
right[0] = forward[2];
|
|
|
|
|
|
|
|
d = DotProduct (right, forward);
|
|
|
|
VectorMA (right, -d, forward, right);
|
|
|
|
VectorNormalize (right);
|
|
|
|
CrossProduct (right, forward, up);
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_RocketTrail (vec3_t start, vec3_t end, centity_t *old) {
|
2009-02-28 14:41:18 +00:00
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
2009-03-01 11:40:49 +00:00
|
|
|
int len;
|
2009-02-28 14:41:18 +00:00
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
2009-03-01 11:40:49 +00:00
|
|
|
int dec;
|
|
|
|
float time;
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
/* smoke */
|
2009-02-28 14:41:18 +00:00
|
|
|
CL_DiminishingTrail (start, end, old, EF_ROCKET);
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
/* fire */
|
2009-02-28 14:41:18 +00:00
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
2009-03-01 11:40:49 +00:00
|
|
|
len = (int)VectorNormalize (vec);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
dec = 1;
|
|
|
|
VectorScale (vec, dec, vec);
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
while (len > 0) {
|
2009-02-28 14:41:18 +00:00
|
|
|
len -= dec;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
2010-06-17 15:11:51 +00:00
|
|
|
if ( (rand()&7) == 0) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
VectorClear (p->accel);
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
p->alpha = 1.0;
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -1.0f / (1+frand()*0.2f);
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = 0xdc + (rand()&3);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->org[j] = move[j] + crand()*5;
|
|
|
|
p->vel[j] = crand()*20;
|
|
|
|
}
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p->accel[2] = -PARTICLE_GRAVITY;
|
|
|
|
}
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_RailTrail (vec3_t start, vec3_t end) {
|
2009-02-28 14:41:18 +00:00
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
2009-03-01 11:40:49 +00:00
|
|
|
int len;
|
2009-02-28 14:41:18 +00:00
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
|
|
|
float dec;
|
|
|
|
vec3_t right, up;
|
|
|
|
int i;
|
|
|
|
float d, c, s;
|
|
|
|
vec3_t dir;
|
|
|
|
byte clr = 0x74;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
MakeNormalVectors (vec, right, up);
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
for (i=0 ; i<len ; i++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2009-02-28 14:41:18 +00:00
|
|
|
VectorClear (p->accel);
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
d = i * 0.1f;
|
|
|
|
c = (float)cos(d);
|
|
|
|
s = (float)sin(d);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
VectorScale (right, c, dir);
|
|
|
|
VectorMA (dir, s, up, dir);
|
|
|
|
|
|
|
|
p->alpha = 1.0;
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -1.0f / (1+frand()*0.2f);
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = clr + (rand()&7);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->org[j] = move[j] + dir[j]*3;
|
|
|
|
p->vel[j] = dir[j]*6;
|
|
|
|
}
|
|
|
|
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
|
|
|
|
dec = 0.75;
|
|
|
|
VectorScale (vec, dec, vec);
|
|
|
|
VectorCopy (start, move);
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
while (len > 0) {
|
2009-02-28 14:41:18 +00:00
|
|
|
len -= dec;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2009-02-28 14:41:18 +00:00
|
|
|
VectorClear (p->accel);
|
|
|
|
|
|
|
|
p->alpha = 1.0;
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -1.0f / (0.6f+frand()*0.2f);
|
2009-02-28 14:41:18 +00:00
|
|
|
p->color = 0x0 + (rand()&15);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->org[j] = move[j] + crand()*3;
|
|
|
|
p->vel[j] = crand()*3;
|
|
|
|
p->accel[j] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_IonripperTrail (vec3_t start, vec3_t ent) {
|
2009-02-28 14:41:18 +00:00
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
2009-03-01 11:40:49 +00:00
|
|
|
int len;
|
2009-02-28 14:41:18 +00:00
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
|
|
|
int dec;
|
2010-06-17 07:17:09 +00:00
|
|
|
int left = 0;
|
|
|
|
float time;
|
2009-03-01 11:40:49 +00:00
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (ent, start, vec);
|
2009-03-01 11:40:49 +00:00
|
|
|
len = (int)VectorNormalize (vec);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
dec = 5;
|
|
|
|
VectorScale (vec, 5, vec);
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
while (len > 0) {
|
2009-02-28 14:41:18 +00:00
|
|
|
len -= dec;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2009-02-28 14:41:18 +00:00
|
|
|
p->alpha = 0.5;
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -1.0f / (0.3f + frand() * 0.2f);
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = 0xe4 + (rand()&3);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (j=0; j<3; j++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->org[j] = move[j];
|
|
|
|
p->accel[j] = 0;
|
|
|
|
}
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
if (left) {
|
2009-02-28 14:41:18 +00:00
|
|
|
left = 0;
|
|
|
|
p->vel[0] = 10;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
} else {
|
2009-02-28 14:41:18 +00:00
|
|
|
left = 1;
|
|
|
|
p->vel[0] = -10;
|
|
|
|
}
|
|
|
|
|
|
|
|
p->vel[1] = 0;
|
|
|
|
p->vel[2] = 0;
|
|
|
|
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_BubbleTrail (vec3_t start, vec3_t end) {
|
2009-02-28 14:41:18 +00:00
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
2009-03-01 11:40:49 +00:00
|
|
|
int len;
|
2009-02-28 14:41:18 +00:00
|
|
|
int i, j;
|
|
|
|
cparticle_t *p;
|
|
|
|
float dec;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
dec = 32;
|
|
|
|
VectorScale (vec, dec, vec);
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
for (i=0 ; i<len ; i+=32) {
|
2009-02-28 14:41:18 +00:00
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
|
|
|
VectorClear (p->accel);
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
p->alpha = 1.0;
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -1.0f / (1+frand()*0.2f);
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = 4 + (rand()&7);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->org[j] = move[j] + crand()*2;
|
|
|
|
p->vel[j] = crand()*5;
|
|
|
|
}
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p->vel[2] += 6;
|
|
|
|
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_FlyParticles (vec3_t origin, int count) {
|
2009-02-28 14:41:18 +00:00
|
|
|
int i;
|
|
|
|
cparticle_t *p;
|
|
|
|
float angle;
|
2009-03-01 11:40:49 +00:00
|
|
|
float sp, sy, cp, cy;
|
2009-02-28 14:41:18 +00:00
|
|
|
vec3_t forward;
|
|
|
|
float dist = 64;
|
|
|
|
float ltime;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (count > NUMVERTEXNORMALS)
|
|
|
|
count = NUMVERTEXNORMALS;
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
if (!avelocities[0][0]) {
|
2009-02-28 14:41:18 +00:00
|
|
|
for (i=0 ; i<NUMVERTEXNORMALS*3 ; i++)
|
2010-06-17 15:11:51 +00:00
|
|
|
avelocities[0][i] = (rand()&255) * 0.01f;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
ltime = time / 1000.0f;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (i=0 ; i<count ; i+=2) {
|
2009-02-28 14:41:18 +00:00
|
|
|
angle = ltime * avelocities[i][0];
|
2009-03-01 11:40:49 +00:00
|
|
|
sy = (float)sin(angle);
|
|
|
|
cy = (float)cos(angle);
|
2009-02-28 14:41:18 +00:00
|
|
|
angle = ltime * avelocities[i][1];
|
2009-03-01 11:40:49 +00:00
|
|
|
sp = (float)sin(angle);
|
|
|
|
cp = (float)cos(angle);
|
2009-02-28 14:41:18 +00:00
|
|
|
angle = ltime * avelocities[i][2];
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
forward[0] = cp*cy;
|
|
|
|
forward[1] = cp*sy;
|
|
|
|
forward[2] = -sp;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
dist = (float)sin(ltime + i)*64;
|
2010-06-17 12:38:53 +00:00
|
|
|
p->org[0] = origin[0] + bytedirs[i][0]*dist + forward[0] * 16;
|
|
|
|
p->org[1] = origin[1] + bytedirs[i][1]*dist + forward[1] * 16;
|
|
|
|
p->org[2] = origin[2] + bytedirs[i][2]*dist + forward[2] * 16;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
VectorClear (p->vel);
|
|
|
|
VectorClear (p->accel);
|
|
|
|
|
|
|
|
p->color = 0;
|
|
|
|
p->colorvel = 0;
|
|
|
|
p->alpha = 1;
|
|
|
|
p->alphavel = -100;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_FlyEffect (centity_t *ent, vec3_t origin) {
|
2009-02-28 14:41:18 +00:00
|
|
|
int n;
|
|
|
|
int count;
|
|
|
|
int starttime;
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
if (ent->fly_stoptime < cl.time) {
|
2009-02-28 14:41:18 +00:00
|
|
|
starttime = cl.time;
|
|
|
|
ent->fly_stoptime = cl.time + 60000;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
} else {
|
2009-02-28 14:41:18 +00:00
|
|
|
starttime = ent->fly_stoptime - 60000;
|
|
|
|
}
|
|
|
|
|
|
|
|
n = cl.time - starttime;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (n < 20000)
|
2009-03-01 11:40:49 +00:00
|
|
|
count = (int)n * 162 / 20000.0;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
else {
|
2009-02-28 14:41:18 +00:00
|
|
|
n = ent->fly_stoptime - cl.time;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (n < 20000)
|
2009-03-01 11:40:49 +00:00
|
|
|
count = (int)n * 162 / 20000.0;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
|
|
|
count = 162;
|
|
|
|
}
|
|
|
|
|
|
|
|
CL_FlyParticles (origin, count);
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_BfgParticles (entity_t *ent) {
|
2009-02-28 14:41:18 +00:00
|
|
|
int i;
|
|
|
|
cparticle_t *p;
|
|
|
|
float angle;
|
2009-03-01 11:40:49 +00:00
|
|
|
float sp, sy, cp, cy;
|
2009-02-28 14:41:18 +00:00
|
|
|
vec3_t forward;
|
|
|
|
float dist = 64;
|
|
|
|
vec3_t v;
|
|
|
|
float ltime;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
if (!avelocities[0][0]) {
|
2009-02-28 14:41:18 +00:00
|
|
|
for (i=0 ; i<NUMVERTEXNORMALS*3 ; i++)
|
2010-06-17 15:11:51 +00:00
|
|
|
avelocities[0][i] = (rand()&255) * 0.01f;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
ltime = time / 1000.0;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (i=0 ; i<NUMVERTEXNORMALS ; i++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
angle = ltime * avelocities[i][0];
|
2009-03-01 11:40:49 +00:00
|
|
|
sy = (float)sin(angle);
|
|
|
|
cy = (float)cos(angle);
|
2009-02-28 14:41:18 +00:00
|
|
|
angle = ltime * avelocities[i][1];
|
2009-03-01 11:40:49 +00:00
|
|
|
sp = (float)sin(angle);
|
|
|
|
cp = (float)cos(angle);
|
2009-02-28 14:41:18 +00:00
|
|
|
angle = ltime * avelocities[i][2];
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
forward[0] = cp*cy;
|
|
|
|
forward[1] = cp*sy;
|
|
|
|
forward[2] = -sp;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
dist = (float)sin(ltime + i)*64;
|
2010-06-17 12:38:53 +00:00
|
|
|
p->org[0] = ent->origin[0] + bytedirs[i][0]*dist + forward[0] * 16;
|
|
|
|
p->org[1] = ent->origin[1] + bytedirs[i][1]*dist + forward[1] * 16;
|
|
|
|
p->org[2] = ent->origin[2] + bytedirs[i][2]*dist + forward[2] * 16;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
VectorClear (p->vel);
|
|
|
|
VectorClear (p->accel);
|
|
|
|
|
|
|
|
VectorSubtract (p->org, ent->origin, v);
|
2009-03-01 11:40:49 +00:00
|
|
|
dist = VectorLength(v) / 90.0f;
|
|
|
|
p->color = (int)floor (0xd0 + dist * 7);
|
2009-02-28 14:41:18 +00:00
|
|
|
p->colorvel = 0;
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alpha = 1.0f - dist;
|
2009-02-28 14:41:18 +00:00
|
|
|
p->alphavel = -100;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_TrapParticles (entity_t *ent) {
|
2009-02-28 14:41:18 +00:00
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
|
|
|
vec3_t start, end;
|
2009-03-01 11:40:49 +00:00
|
|
|
int len;
|
2009-02-28 14:41:18 +00:00
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
|
|
|
int dec;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
ent->origin[2]-=14;
|
|
|
|
VectorCopy (ent->origin, start);
|
|
|
|
VectorCopy (ent->origin, end);
|
|
|
|
end[2]+=64;
|
|
|
|
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
2009-03-01 11:40:49 +00:00
|
|
|
len = (int)VectorNormalize (vec);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
dec = 5;
|
|
|
|
VectorScale (vec, 5, vec);
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
while (len > 0) {
|
2009-02-28 14:41:18 +00:00
|
|
|
len -= dec;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
p->alpha = 1.0;
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -1.0f / (0.3f+frand()*0.2f);
|
2009-02-28 14:41:18 +00:00
|
|
|
p->color = 0xe0;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
p->org[j] = move[j] + crand();
|
|
|
|
p->vel[j] = crand()*15;
|
|
|
|
p->accel[j] = 0;
|
|
|
|
}
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p->accel[2] = PARTICLE_GRAVITY;
|
|
|
|
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2010-06-17 07:17:09 +00:00
|
|
|
int i, j, k;
|
|
|
|
cparticle_t *p;
|
|
|
|
float vel;
|
|
|
|
vec3_t dir;
|
|
|
|
vec3_t org;
|
|
|
|
|
|
|
|
ent->origin[2]+=14;
|
|
|
|
VectorCopy (ent->origin, org);
|
|
|
|
|
|
|
|
for (i=-2 ; i<=2 ; i+=4)
|
|
|
|
for (j=-2 ; j<=2 ; j+=4)
|
|
|
|
for (k=-2 ; k<=4 ; k+=4) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
|
|
|
p->time = time;
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = 0xe0 + (rand()&3);
|
2010-06-17 07:17:09 +00:00
|
|
|
p->alpha = 1.0;
|
2010-06-17 15:11:51 +00:00
|
|
|
p->alphavel = -1.0f / (0.3f + (rand()&7) * 0.02f);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2010-06-17 15:11:51 +00:00
|
|
|
p->org[0] = org[0] + i + ((rand()&23) * crand());
|
|
|
|
p->org[1] = org[1] + j + ((rand()&23) * crand());
|
|
|
|
p->org[2] = org[2] + k + ((rand()&23) * crand());
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
dir[0] = j * 8.0f;
|
|
|
|
dir[1] = i * 8.0f;
|
|
|
|
dir[2] = k * 8.0f;
|
|
|
|
|
|
|
|
VectorNormalize (dir);
|
2010-06-17 15:11:51 +00:00
|
|
|
vel = (float)(50 + (rand()&63));
|
2010-06-17 07:17:09 +00:00
|
|
|
VectorScale (dir, vel, p->vel);
|
|
|
|
|
|
|
|
p->accel[0] = p->accel[1] = 0;
|
|
|
|
p->accel[2] = -PARTICLE_GRAVITY;
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_BFGExplosionParticles (vec3_t org) {
|
2009-02-28 14:41:18 +00:00
|
|
|
int i, j;
|
|
|
|
cparticle_t *p;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
for (i=0 ; i<256 ; i++) {
|
2009-02-28 14:41:18 +00:00
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = 0xd0 + (rand()&7);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
2010-06-17 15:11:51 +00:00
|
|
|
p->org[j] = org[j] + ((rand()%32)-16);
|
|
|
|
p->vel[j] = (rand()%384)-192;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
p->accel[0] = p->accel[1] = 0;
|
|
|
|
p->accel[2] = -PARTICLE_GRAVITY;
|
|
|
|
p->alpha = 1.0;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->alphavel = -0.8f / (0.5f + frand()*0.3f);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_TeleportParticles (vec3_t org) {
|
2009-02-28 14:41:18 +00:00
|
|
|
int i, j, k;
|
|
|
|
cparticle_t *p;
|
|
|
|
float vel;
|
|
|
|
vec3_t dir;
|
2009-03-01 11:40:49 +00:00
|
|
|
float time;
|
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
for (i=-16 ; i<=16 ; i+=4)
|
|
|
|
for (j=-16 ; j<=16 ; j+=4)
|
2010-06-17 07:17:09 +00:00
|
|
|
for (k=-16 ; k<=32 ; k+=4) {
|
2009-02-28 14:41:18 +00:00
|
|
|
if (!free_particles)
|
|
|
|
return;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
p->time = time;
|
2010-06-17 15:11:51 +00:00
|
|
|
p->color = 7 + (rand()&7);
|
2009-02-28 14:41:18 +00:00
|
|
|
p->alpha = 1.0;
|
2010-06-17 15:11:51 +00:00
|
|
|
p->alphavel = -1.0f / (0.3f + (rand()&7) * 0.02f);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2010-06-17 15:11:51 +00:00
|
|
|
p->org[0] = org[0] + i + (rand()&3);
|
|
|
|
p->org[1] = org[1] + j + (rand()&3);
|
|
|
|
p->org[2] = org[2] + k + (rand()&3);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
2009-03-01 11:40:49 +00:00
|
|
|
dir[0] = j*8.0f;
|
|
|
|
dir[1] = i*8.0f;
|
|
|
|
dir[2] = k*8.0f;
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
VectorNormalize (dir);
|
2010-06-17 15:11:51 +00:00
|
|
|
vel = (float)(50 + (rand()&63));
|
2009-02-28 14:41:18 +00:00
|
|
|
VectorScale (dir, vel, p->vel);
|
|
|
|
|
|
|
|
p->accel[0] = p->accel[1] = 0;
|
|
|
|
p->accel[2] = -PARTICLE_GRAVITY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-06-17 07:17:09 +00:00
|
|
|
* An entity has just been parsed that has an event value the female
|
|
|
|
* events are there for backwards compatability
|
|
|
|
*/
|
2009-02-28 14:41:18 +00:00
|
|
|
extern struct sfx_s *cl_sfx_footsteps[4];
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_EntityEvent (entity_state_t *ent) {
|
|
|
|
switch (ent->event) {
|
|
|
|
case EV_ITEM_RESPAWN:
|
|
|
|
S_StartSound (NULL, ent->number, CHAN_WEAPON, S_RegisterSound("items/respawn1.wav"), 1, ATTN_IDLE, 0);
|
|
|
|
CL_ItemRespawnParticles (ent->origin);
|
|
|
|
break;
|
|
|
|
case EV_PLAYER_TELEPORT:
|
|
|
|
S_StartSound (NULL, ent->number, CHAN_WEAPON, S_RegisterSound("misc/tele1.wav"), 1, ATTN_IDLE, 0);
|
|
|
|
CL_TeleportParticles (ent->origin);
|
|
|
|
break;
|
|
|
|
case EV_FOOTSTEP:
|
|
|
|
|
|
|
|
if (cl_footsteps->value)
|
2010-06-17 15:11:51 +00:00
|
|
|
S_StartSound (NULL, ent->number, CHAN_BODY, cl_sfx_footsteps[rand()&3], 1, ATTN_NORM, 0);
|
2010-06-17 07:17:09 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
case EV_FALLSHORT:
|
|
|
|
S_StartSound (NULL, ent->number, CHAN_AUTO, S_RegisterSound ("player/land1.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
case EV_FALL:
|
|
|
|
S_StartSound (NULL, ent->number, CHAN_AUTO, S_RegisterSound ("*fall2.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
case EV_FALLFAR:
|
|
|
|
S_StartSound (NULL, ent->number, CHAN_AUTO, S_RegisterSound ("*fall1.wav"), 1, ATTN_NORM, 0);
|
|
|
|
break;
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2010-06-17 07:17:09 +00:00
|
|
|
void CL_ClearEffects (void) {
|
2009-02-28 14:41:18 +00:00
|
|
|
CL_ClearParticles ();
|
|
|
|
CL_ClearDlights ();
|
|
|
|
CL_ClearLightStyles ();
|
|
|
|
}
|
2010-06-18 15:38:54 +00:00
|
|
|
|
2010-06-18 16:28:25 +00:00
|
|
|
void CL_Flashlight (int ent, vec3_t pos) {
|
|
|
|
cdlight_t *dl;
|
|
|
|
|
|
|
|
dl = CL_AllocDlight (ent);
|
|
|
|
VectorCopy (pos, dl->origin);
|
|
|
|
dl->radius = 400;
|
|
|
|
dl->minlight = 250;
|
|
|
|
dl->die = cl.time + 100;
|
|
|
|
dl->color[0] = 1;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_ColorFlash (vec3_t pos, int ent, float intensity, float r, float g, float b) {
|
|
|
|
cdlight_t *dl;
|
|
|
|
|
|
|
|
if((vidref_val == VIDREF_SOFT) && ((r < 0) || (g<0) || (b<0))) {
|
|
|
|
intensity = -intensity;
|
|
|
|
r = -r;
|
|
|
|
g = -g;
|
|
|
|
b = -b;
|
|
|
|
}
|
|
|
|
|
|
|
|
dl = CL_AllocDlight (ent);
|
|
|
|
VectorCopy (pos, dl->origin);
|
|
|
|
dl->radius = intensity;
|
|
|
|
dl->minlight = 250;
|
|
|
|
dl->die = cl.time + 100;
|
|
|
|
dl->color[0] = r;
|
|
|
|
dl->color[1] = g;
|
|
|
|
dl->color[2] = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_DebugTrail (vec3_t start, vec3_t end) {
|
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
|
|
|
float len;
|
|
|
|
cparticle_t *p;
|
|
|
|
float dec;
|
|
|
|
vec3_t right, up;
|
|
|
|
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
MakeNormalVectors (vec, right, up);
|
|
|
|
|
|
|
|
dec = 3;
|
|
|
|
VectorScale (vec, dec, vec);
|
|
|
|
VectorCopy (start, move);
|
|
|
|
|
|
|
|
while (len > 0) {
|
|
|
|
len -= dec;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
|
|
|
p->time = (float)cl.time;
|
|
|
|
VectorClear (p->accel);
|
|
|
|
VectorClear (p->vel);
|
|
|
|
p->alpha = 1.0;
|
|
|
|
p->alphavel = -0.1f;
|
|
|
|
p->color = 0x74 + (rand()&7);
|
|
|
|
VectorCopy (move, p->org);
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_SmokeTrail (vec3_t start, vec3_t end, int colorStart, int colorRun, int spacing) {
|
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
|
|
|
float len, time;
|
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
|
|
|
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
VectorScale (vec, spacing, vec);
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
|
|
|
|
|
|
|
while (len > 0) {
|
|
|
|
len -= spacing;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
|
|
|
|
p->alpha = 1.0;
|
|
|
|
p->alphavel = -1.0f / (1+frand()*0.5f);
|
|
|
|
p->color = colorStart + (float)(rand() % colorRun);
|
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
|
|
|
p->org[j] = move[j] + crand()*3;
|
|
|
|
p->accel[j] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
p->vel[2] = 20 + crand()*5;
|
|
|
|
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_ForceWall (vec3_t start, vec3_t end, int color8) {
|
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
|
|
|
|
|
|
|
float len, time;
|
|
|
|
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
VectorScale (vec, 4, vec);
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
|
|
|
|
|
|
|
while (len > 0) {
|
|
|
|
len -= 4;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (frand() > 0.3) {
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
|
|
|
|
p->alpha = 1.0;
|
|
|
|
p->alphavel = -1.0f / (3.0+frand()*0.5f);
|
|
|
|
p->color = color8;
|
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
|
|
|
p->org[j] = move[j] + crand()*3;
|
|
|
|
p->accel[j] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
p->vel[0] = 0;
|
|
|
|
p->vel[1] = 0;
|
|
|
|
p->vel[2] = -40 - (crand()*10);
|
|
|
|
}
|
|
|
|
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CL_BubbleTrail2 (lets you control the # of bubbles by setting the distance between the spawns)
|
|
|
|
*/
|
|
|
|
void CL_BubbleTrail2 (vec3_t start, vec3_t end, int dist) {
|
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
|
|
|
float len, time;
|
|
|
|
int i;
|
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
|
|
|
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
VectorScale (vec, dist, vec);
|
|
|
|
|
|
|
|
for (i=0 ; i<len ; i+=dist) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
|
|
|
VectorClear (p->accel);
|
|
|
|
p->time = time;
|
|
|
|
|
|
|
|
p->alpha = 1.0;
|
|
|
|
p->alphavel = -1.0f / (1+frand()*0.1f);
|
|
|
|
p->color = 4 + (rand()&7);
|
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
|
|
|
p->org[j] = move[j] + crand()*2;
|
|
|
|
p->vel[j] = crand()*10;
|
|
|
|
}
|
|
|
|
|
|
|
|
p->org[2] -= 4;
|
|
|
|
p->vel[2] += 20;
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_Heatbeam (vec3_t start, vec3_t forward) {
|
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
|
|
|
float len;
|
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
|
|
|
vec3_t right, up;
|
|
|
|
float i;
|
|
|
|
float c, s;
|
|
|
|
vec3_t dir;
|
|
|
|
float ltime;
|
|
|
|
float step = 32.0, rstep;
|
|
|
|
float start_pt;
|
|
|
|
float rot;
|
|
|
|
float variance;
|
|
|
|
float time;
|
|
|
|
vec3_t end;
|
|
|
|
|
|
|
|
VectorMA (start, 4096, forward, end);
|
|
|
|
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
VectorCopy (cl.v_right, right);
|
|
|
|
VectorCopy (cl.v_up, up);
|
|
|
|
|
|
|
|
if (vidref_val == VIDREF_GL) {
|
|
|
|
VectorMA (move, -0.5, right, move);
|
|
|
|
VectorMA (move, -0.5, up, move);
|
|
|
|
}
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
|
|
|
|
|
|
|
ltime = (float) cl.time/1000.0f;
|
|
|
|
start_pt = (float)fmod(ltime*96.0f,step);
|
|
|
|
VectorMA (move, start_pt, vec, move);
|
|
|
|
|
|
|
|
VectorScale (vec, step, vec);
|
|
|
|
|
|
|
|
rstep = M_PI/10.0f;
|
|
|
|
|
|
|
|
for (i=start_pt ; i<len ; i+=step) {
|
|
|
|
if (i>step*5) /* don't bother after the 5th ring */
|
|
|
|
break;
|
|
|
|
|
|
|
|
for (rot = 0; rot < M_PI*2; rot += rstep) {
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
VectorClear (p->accel);
|
|
|
|
variance = 0.5;
|
|
|
|
c = (float)cos(rot)*variance;
|
|
|
|
s = (float)sin(rot)*variance;
|
|
|
|
|
|
|
|
/* trim it so it looks like it's starting at the origin */
|
|
|
|
if (i < 10) {
|
|
|
|
VectorScale (right, c*(i/10.0f), dir);
|
|
|
|
VectorMA (dir, s*(i/10.0f), up, dir);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
VectorScale (right, c, dir);
|
|
|
|
VectorMA (dir, s, up, dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
p->alpha = 0.5;
|
|
|
|
p->alphavel = -1000.0;
|
|
|
|
p->color = 223 - (rand()&7);
|
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
|
|
|
p->org[j] = move[j] + dir[j]*3;
|
|
|
|
p->vel[j] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
*Puffs with velocity along direction, with some randomness thrown in
|
|
|
|
*/
|
|
|
|
void CL_ParticleSteamEffect (vec3_t org, vec3_t dir, int color, int count, int magnitude) {
|
|
|
|
int i, j;
|
|
|
|
cparticle_t *p;
|
|
|
|
float d, time;
|
|
|
|
vec3_t r, u;
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
|
|
|
MakeNormalVectors (dir, r, u);
|
|
|
|
|
|
|
|
for (i=0 ; i<count ; i++) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
p->color = color + (rand()&7);
|
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
|
|
|
p->org[j] = org[j] + magnitude*0.1f*crand();
|
|
|
|
}
|
|
|
|
|
|
|
|
VectorScale (dir, magnitude, p->vel);
|
|
|
|
d = crand()*magnitude/3;
|
|
|
|
VectorMA (p->vel, d, r, p->vel);
|
|
|
|
d = crand()*magnitude/3;
|
|
|
|
VectorMA (p->vel, d, u, p->vel);
|
|
|
|
|
|
|
|
p->accel[0] = p->accel[1] = 0;
|
|
|
|
p->accel[2] = -PARTICLE_GRAVITY/2;
|
|
|
|
p->alpha = 1.0;
|
|
|
|
|
|
|
|
p->alphavel = -1.0f / (0.5f + frand()*0.3f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_ParticleSteamEffect2 (cl_sustain_t *self) {
|
|
|
|
int i, j;
|
|
|
|
cparticle_t *p;
|
|
|
|
float d;
|
|
|
|
vec3_t r, u;
|
|
|
|
vec3_t dir;
|
|
|
|
|
|
|
|
VectorCopy (self->dir, dir);
|
|
|
|
MakeNormalVectors (dir, r, u);
|
|
|
|
|
|
|
|
for (i=0 ; i<self->count ; i++) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
|
|
|
p->time = cl.time;
|
|
|
|
p->color = self->color + (rand()&7);
|
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
|
|
|
p->org[j] = self->org[j] + self->magnitude*0.1*crand();
|
|
|
|
}
|
|
|
|
|
|
|
|
VectorScale (dir, self->magnitude, p->vel);
|
|
|
|
d = crand()*self->magnitude/3;
|
|
|
|
VectorMA (p->vel, d, r, p->vel);
|
|
|
|
d = crand()*self->magnitude/3;
|
|
|
|
VectorMA (p->vel, d, u, p->vel);
|
|
|
|
|
|
|
|
p->accel[0] = p->accel[1] = 0;
|
|
|
|
p->accel[2] = -PARTICLE_GRAVITY/2;
|
|
|
|
p->alpha = 1.0;
|
|
|
|
|
|
|
|
p->alphavel = -1.0 / (0.5 + frand()*0.3);
|
|
|
|
}
|
|
|
|
|
|
|
|
self->nextthink += self->thinkinterval;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_TrackerTrail (vec3_t start, vec3_t end, int particleColor) {
|
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
|
|
|
vec3_t forward,right,up,angle_dir;
|
|
|
|
float len;
|
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
|
|
|
int dec;
|
|
|
|
float dist;
|
|
|
|
float time;
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
VectorCopy(vec, forward);
|
|
|
|
AngleVectors2 (forward, angle_dir);
|
|
|
|
AngleVectors (angle_dir, forward, right, up);
|
|
|
|
|
|
|
|
dec = 3;
|
|
|
|
VectorScale (vec, 3, vec);
|
|
|
|
|
|
|
|
while (len > 0) {
|
|
|
|
len -= dec;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
|
|
|
|
p->alpha = 1.0;
|
|
|
|
p->alphavel = -2.0;
|
|
|
|
p->color = particleColor;
|
|
|
|
dist = DotProduct(move, forward);
|
|
|
|
VectorMA(move, 8 * cos(dist), up, p->org);
|
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
|
|
|
p->vel[j] = 0;
|
|
|
|
p->accel[j] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
p->vel[2] = 5;
|
|
|
|
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_Tracker_Shell(vec3_t origin) {
|
|
|
|
vec3_t dir;
|
|
|
|
int i;
|
|
|
|
cparticle_t *p;
|
|
|
|
float time;
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
|
|
|
|
|
|
|
for(i=0; i<300; i++) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
|
|
|
|
p->alpha = 1.0;
|
|
|
|
p->alphavel = INSTANT_PARTICLE;
|
|
|
|
p->color = 0;
|
|
|
|
dir[0] = crand();
|
|
|
|
dir[1] = crand();
|
|
|
|
dir[2] = crand();
|
|
|
|
VectorNormalize(dir);
|
|
|
|
|
|
|
|
VectorMA(origin, 40, dir, p->org);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_MonsterPlasma_Shell(vec3_t origin) {
|
|
|
|
vec3_t dir;
|
|
|
|
int i;
|
|
|
|
cparticle_t *p;
|
|
|
|
float time;
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
|
|
|
|
|
|
|
for(i=0; i<40; i++) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
|
|
|
|
p->alpha = 1.0;
|
|
|
|
p->alphavel = INSTANT_PARTICLE;
|
|
|
|
p->color = 0xe0;
|
|
|
|
dir[0] = crand();
|
|
|
|
dir[1] = crand();
|
|
|
|
dir[2] = crand();
|
|
|
|
VectorNormalize(dir);
|
|
|
|
|
|
|
|
VectorMA(origin, 10, dir, p->org);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_Widowbeamout (cl_sustain_t *self) {
|
|
|
|
vec3_t dir;
|
|
|
|
int i;
|
|
|
|
cparticle_t *p;
|
|
|
|
static int colortable[4] = {2*8,13*8,21*8,18*8};
|
|
|
|
float ratio;
|
|
|
|
float time;
|
|
|
|
|
|
|
|
ratio = 1.0f - (((float)self->endtime - (float)cl.time)/2100.0f);
|
|
|
|
time = (float)cl.time;
|
|
|
|
|
|
|
|
for(i=0; i<300; i++) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
|
|
|
|
p->alpha = 1.0;
|
|
|
|
p->alphavel = INSTANT_PARTICLE;
|
|
|
|
p->color = colortable[rand()&3];
|
|
|
|
dir[0] = crand();
|
|
|
|
dir[1] = crand();
|
|
|
|
dir[2] = crand();
|
|
|
|
VectorNormalize(dir);
|
|
|
|
|
|
|
|
VectorMA(self->org, (45.0 * ratio), dir, p->org);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_Nukeblast (cl_sustain_t *self) {
|
|
|
|
vec3_t dir;
|
|
|
|
int i;
|
|
|
|
cparticle_t *p;
|
|
|
|
static int colortable[4] = {110, 112, 114, 116};
|
|
|
|
float ratio;
|
|
|
|
float time;
|
|
|
|
|
|
|
|
ratio = 1.0f - (((float)self->endtime - (float)cl.time)/1000.0f);
|
|
|
|
time = (float)cl.time;
|
|
|
|
|
|
|
|
for(i=0; i<700; i++) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
|
|
|
|
p->alpha = 1.0;
|
|
|
|
p->alphavel = INSTANT_PARTICLE;
|
|
|
|
p->color = colortable[rand()&3];
|
|
|
|
dir[0] = crand();
|
|
|
|
dir[1] = crand();
|
|
|
|
dir[2] = crand();
|
|
|
|
VectorNormalize(dir);
|
|
|
|
|
|
|
|
VectorMA(self->org, (200.0 * ratio), dir, p->org);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_WidowSplash (vec3_t org) {
|
|
|
|
static int colortable[4] = {2*8,13*8,21*8,18*8};
|
|
|
|
int i;
|
|
|
|
cparticle_t *p;
|
|
|
|
vec3_t dir;
|
|
|
|
float time;
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
|
|
|
|
|
|
|
for (i=0 ; i<256 ; i++) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
p->color = colortable[rand()&3];
|
|
|
|
dir[0] = crand();
|
|
|
|
dir[1] = crand();
|
|
|
|
dir[2] = crand();
|
|
|
|
VectorNormalize(dir);
|
|
|
|
VectorMA(org, 45.0, dir, p->org);
|
|
|
|
VectorMA(vec3_origin, 40.0, dir, p->vel);
|
|
|
|
|
|
|
|
p->accel[0] = p->accel[1] = 0;
|
|
|
|
p->alpha = 1.0;
|
|
|
|
|
|
|
|
p->alphavel = -0.8f / (0.5f + frand()*0.3f);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_Tracker_Explode(vec3_t origin) {
|
|
|
|
vec3_t dir, backdir;
|
|
|
|
int i;
|
|
|
|
cparticle_t *p;
|
|
|
|
float time;
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
|
|
|
|
|
|
|
for(i=0; i<300; i++) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
|
|
|
|
p->alpha = 1.0;
|
|
|
|
p->alphavel = -1.0;
|
|
|
|
p->color = 0;
|
|
|
|
dir[0] = crand();
|
|
|
|
dir[1] = crand();
|
|
|
|
dir[2] = crand();
|
|
|
|
VectorNormalize(dir);
|
|
|
|
VectorScale(dir, -1, backdir);
|
|
|
|
|
|
|
|
VectorMA(origin, 64, dir, p->org);
|
|
|
|
VectorScale(backdir, 64, p->vel);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_TagTrail (vec3_t start, vec3_t end, int color) {
|
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
|
|
|
float len;
|
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
|
|
|
int dec;
|
|
|
|
float time;
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
|
|
|
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
dec = 5;
|
|
|
|
VectorScale (vec, 5, vec);
|
|
|
|
|
|
|
|
while (len >= 0) {
|
|
|
|
len -= dec;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
|
|
|
|
p->alpha = 1.0;
|
|
|
|
p->alphavel = -1.0f / (0.8f+frand()*0.2f);
|
|
|
|
p->color = color;
|
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
|
|
|
p->org[j] = move[j] + crand()*16;
|
|
|
|
p->vel[j] = crand()*5;
|
|
|
|
p->accel[j] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_ColorExplosionParticles (vec3_t org, int color, int run) {
|
|
|
|
int i;
|
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
|
|
|
float time;
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
|
|
|
|
|
|
|
for (i=0 ; i<128 ; i++) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
p->color = color + (rand() % run);
|
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
|
|
|
p->org[j] = org[j] + ((rand()%32)-16);
|
|
|
|
p->vel[j] = (rand()%256)-128;
|
|
|
|
}
|
|
|
|
|
|
|
|
p->accel[0] = p->accel[1] = 0;
|
|
|
|
p->accel[2] = -PARTICLE_GRAVITY;
|
|
|
|
p->alpha = 1.0;
|
|
|
|
|
|
|
|
p->alphavel = -0.4f / (0.6f + frand()*0.2f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Like the steam effect, but unaffected by gravity
|
|
|
|
*/
|
|
|
|
void CL_ParticleSmokeEffect (vec3_t org, vec3_t dir, int color, int count, int magnitude) {
|
|
|
|
int i, j;
|
|
|
|
cparticle_t *p;
|
|
|
|
float d;
|
|
|
|
vec3_t r, u;
|
|
|
|
float time;
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
|
|
|
|
|
|
|
MakeNormalVectors (dir, r, u);
|
|
|
|
|
|
|
|
for (i=0 ; i<count ; i++) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
p->color = color + (rand()&7);
|
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
|
|
|
p->org[j] = org[j] + magnitude*0.1f*crand();
|
|
|
|
}
|
|
|
|
|
|
|
|
VectorScale (dir, magnitude, p->vel);
|
|
|
|
d = crand()*magnitude/3;
|
|
|
|
VectorMA (p->vel, d, r, p->vel);
|
|
|
|
d = crand()*magnitude/3;
|
|
|
|
VectorMA (p->vel, d, u, p->vel);
|
|
|
|
|
|
|
|
p->accel[0] = p->accel[1] = p->accel[2] = 0;
|
|
|
|
p->alpha = 1.0;
|
|
|
|
|
|
|
|
p->alphavel = -1.0f / (0.5f + frand()*0.3f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Wall impact puffs (Green)
|
|
|
|
*/
|
|
|
|
void CL_BlasterParticles2 (vec3_t org, vec3_t dir, unsigned int color) {
|
|
|
|
int i, j;
|
|
|
|
cparticle_t *p;
|
|
|
|
float d;
|
|
|
|
int count;
|
|
|
|
float time;
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
|
|
|
|
|
|
|
count = 40;
|
|
|
|
|
|
|
|
for (i=0 ; i<count ; i++) {
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
p->color = color + (rand()&7);
|
|
|
|
d = (float)(rand()&15);
|
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
|
|
|
p->org[j] = org[j] + ((rand()&7)-4) + d*dir[j];
|
|
|
|
p->vel[j] = dir[j] * 30 + crand()*40;
|
|
|
|
}
|
|
|
|
|
|
|
|
p->accel[0] = p->accel[1] = 0;
|
|
|
|
p->accel[2] = -PARTICLE_GRAVITY;
|
|
|
|
p->alpha = 1.0;
|
|
|
|
|
|
|
|
p->alphavel = -1.0f / (0.5f + frand()*0.3f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Green!
|
|
|
|
*/
|
|
|
|
void CL_BlasterTrail2 (vec3_t start, vec3_t end) {
|
|
|
|
vec3_t move;
|
|
|
|
vec3_t vec;
|
|
|
|
float len;
|
|
|
|
int j;
|
|
|
|
cparticle_t *p;
|
|
|
|
int dec;
|
|
|
|
float time;
|
|
|
|
|
|
|
|
time = (float)cl.time;
|
|
|
|
|
|
|
|
VectorCopy (start, move);
|
|
|
|
VectorSubtract (end, start, vec);
|
|
|
|
len = VectorNormalize (vec);
|
|
|
|
|
|
|
|
dec = 5;
|
|
|
|
VectorScale (vec, 5, vec);
|
|
|
|
|
|
|
|
while (len > 0) {
|
|
|
|
len -= dec;
|
|
|
|
|
|
|
|
if (!free_particles)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = free_particles;
|
|
|
|
free_particles = p->next;
|
|
|
|
p->next = active_particles;
|
|
|
|
active_particles = p;
|
|
|
|
VectorClear (p->accel);
|
|
|
|
|
|
|
|
p->time = time;
|
|
|
|
|
|
|
|
p->alpha = 1.0;
|
|
|
|
p->alphavel = -1.0f / (float)(0.3f+frand()*0.2f);
|
|
|
|
|
|
|
|
for (j=0 ; j<3 ; j++) {
|
|
|
|
p->org[j] = move[j] + crand();
|
|
|
|
p->vel[j] = crand()*5;
|
|
|
|
p->accel[j] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
VectorAdd (move, vec, move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|