2009-02-28 14:41:18 +00:00
|
|
|
/*
|
2010-06-18 14:51:25 +00:00
|
|
|
* Copyright (C) 1997-2001 Id Software, Inc.
|
|
|
|
*
|
2010-07-13 18:19:42 +00:00
|
|
|
* 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.
|
2010-06-18 14:51:25 +00:00
|
|
|
*
|
2010-07-13 18:19:42 +00:00
|
|
|
* 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.
|
2010-06-18 14:51:25 +00:00
|
|
|
*
|
|
|
|
* See the GNU General Public License for more details.
|
|
|
|
*
|
2010-07-13 18:19:42 +00:00
|
|
|
* 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 14:51:25 +00:00
|
|
|
*
|
2010-06-18 16:45:44 +00:00
|
|
|
* =======================================================================
|
|
|
|
*
|
|
|
|
* This file implements all temporary (dynamic created) entities
|
|
|
|
*
|
|
|
|
* =======================================================================
|
2010-06-18 14:51:25 +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
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
ex_free, ex_explosion, ex_misc, ex_flash, ex_mflash, ex_poly, ex_poly2
|
|
|
|
} exptype_t;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
exptype_t type;
|
|
|
|
entity_t ent;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
int frames;
|
|
|
|
float light;
|
|
|
|
vec3_t lightcolor;
|
|
|
|
float start;
|
|
|
|
int baseframe;
|
2009-02-28 14:41:18 +00:00
|
|
|
} explosion_t;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
#define MAX_EXPLOSIONS 64
|
|
|
|
#define MAX_BEAMS 64
|
|
|
|
#define MAX_LASERS 64
|
2010-06-18 16:45:44 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
explosion_t cl_explosions[MAX_EXPLOSIONS];
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int entity;
|
|
|
|
int dest_entity;
|
|
|
|
struct model_s *model;
|
|
|
|
int endtime;
|
|
|
|
vec3_t offset;
|
|
|
|
vec3_t start, end;
|
2009-02-28 14:41:18 +00:00
|
|
|
} beam_t;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
beam_t cl_beams[MAX_BEAMS];
|
|
|
|
beam_t cl_playerbeams[MAX_BEAMS];
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
entity_t ent;
|
|
|
|
int endtime;
|
2009-02-28 14:41:18 +00:00
|
|
|
} laser_t;
|
2012-07-22 13:34:45 +00:00
|
|
|
laser_t cl_lasers[MAX_LASERS];
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
cl_sustain_t cl_sustains[MAX_SUSTAINS];
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
extern void CL_TeleportParticles(vec3_t org);
|
|
|
|
void CL_BlasterParticles(vec3_t org, vec3_t dir);
|
|
|
|
void CL_BFGExplosionParticles(vec3_t org);
|
|
|
|
void CL_BlueBlasterParticles(vec3_t org, vec3_t dir);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void CL_ExplosionParticles(vec3_t org);
|
|
|
|
void CL_Explosion_Particle(vec3_t org, float size,
|
|
|
|
qboolean large, qboolean rocket);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
#define EXPLOSION_PARTICLES(x) CL_ExplosionParticles((x));
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
struct sfx_s *cl_sfx_ric1;
|
|
|
|
struct sfx_s *cl_sfx_ric2;
|
|
|
|
struct sfx_s *cl_sfx_ric3;
|
|
|
|
struct sfx_s *cl_sfx_lashit;
|
|
|
|
struct sfx_s *cl_sfx_spark5;
|
|
|
|
struct sfx_s *cl_sfx_spark6;
|
|
|
|
struct sfx_s *cl_sfx_spark7;
|
|
|
|
struct sfx_s *cl_sfx_railg;
|
|
|
|
struct sfx_s *cl_sfx_rockexp;
|
|
|
|
struct sfx_s *cl_sfx_grenexp;
|
|
|
|
struct sfx_s *cl_sfx_watrexp;
|
|
|
|
struct sfx_s *cl_sfx_plasexp;
|
|
|
|
struct sfx_s *cl_sfx_footsteps[4];
|
|
|
|
|
|
|
|
struct model_s *cl_mod_explode;
|
|
|
|
struct model_s *cl_mod_smoke;
|
|
|
|
struct model_s *cl_mod_flash;
|
|
|
|
struct model_s *cl_mod_parasite_segment;
|
|
|
|
struct model_s *cl_mod_grapple_cable;
|
|
|
|
struct model_s *cl_mod_parasite_tip;
|
|
|
|
struct model_s *cl_mod_explo4;
|
|
|
|
struct model_s *cl_mod_bfg_explo;
|
|
|
|
struct model_s *cl_mod_powerscreen;
|
|
|
|
struct model_s *cl_mod_plasmaexplo;
|
|
|
|
|
|
|
|
struct sfx_s *cl_sfx_lightning;
|
|
|
|
struct sfx_s *cl_sfx_disrexp;
|
|
|
|
struct model_s *cl_mod_lightning;
|
|
|
|
struct model_s *cl_mod_heatbeam;
|
|
|
|
struct model_s *cl_mod_monster_heatbeam;
|
|
|
|
struct model_s *cl_mod_explo4_big;
|
|
|
|
|
|
|
|
void
|
|
|
|
CL_RegisterTEntSounds(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char name[MAX_QPATH];
|
|
|
|
|
|
|
|
cl_sfx_ric1 = S_RegisterSound("world/ric1.wav");
|
|
|
|
cl_sfx_ric2 = S_RegisterSound("world/ric2.wav");
|
|
|
|
cl_sfx_ric3 = S_RegisterSound("world/ric3.wav");
|
2009-02-28 14:41:18 +00:00
|
|
|
cl_sfx_lashit = S_RegisterSound("weapons/lashit.wav");
|
2012-07-22 13:34:45 +00:00
|
|
|
cl_sfx_spark5 = S_RegisterSound("world/spark5.wav");
|
|
|
|
cl_sfx_spark6 = S_RegisterSound("world/spark6.wav");
|
|
|
|
cl_sfx_spark7 = S_RegisterSound("world/spark7.wav");
|
|
|
|
cl_sfx_railg = S_RegisterSound("weapons/railgf1a.wav");
|
|
|
|
cl_sfx_rockexp = S_RegisterSound("weapons/rocklx1a.wav");
|
|
|
|
cl_sfx_grenexp = S_RegisterSound("weapons/grenlx1a.wav");
|
|
|
|
cl_sfx_watrexp = S_RegisterSound("weapons/xpld_wat.wav");
|
|
|
|
S_RegisterSound("player/land1.wav");
|
|
|
|
|
|
|
|
S_RegisterSound("player/fall2.wav");
|
|
|
|
S_RegisterSound("player/fall1.wav");
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
Com_sprintf(name, sizeof(name), "player/step%i.wav", i + 1);
|
|
|
|
cl_sfx_footsteps[i] = S_RegisterSound(name);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
cl_sfx_lightning = S_RegisterSound("weapons/tesla.wav");
|
|
|
|
cl_sfx_disrexp = S_RegisterSound("weapons/disrupthit.wav");
|
2010-06-18 14:51:25 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_RegisterTEntModels(void)
|
|
|
|
{
|
|
|
|
cl_mod_explode = re.RegisterModel("models/objects/explode/tris.md2");
|
|
|
|
cl_mod_smoke = re.RegisterModel("models/objects/smoke/tris.md2");
|
|
|
|
cl_mod_flash = re.RegisterModel("models/objects/flash/tris.md2");
|
|
|
|
cl_mod_parasite_segment = re.RegisterModel("models/monsters/parasite/segment/tris.md2");
|
|
|
|
cl_mod_grapple_cable = re.RegisterModel("models/ctf/segment/tris.md2");
|
|
|
|
cl_mod_parasite_tip = re.RegisterModel("models/monsters/parasite/tip/tris.md2");
|
|
|
|
cl_mod_explo4 = re.RegisterModel("models/objects/r_explode/tris.md2");
|
|
|
|
cl_mod_bfg_explo = re.RegisterModel("sprites/s_bfg2.sp2");
|
|
|
|
cl_mod_powerscreen = re.RegisterModel("models/items/armor/effect/tris.md2");
|
|
|
|
|
|
|
|
re.RegisterModel("models/objects/laser/tris.md2");
|
|
|
|
re.RegisterModel("models/objects/grenade2/tris.md2");
|
|
|
|
re.RegisterModel("models/weapons/v_machn/tris.md2");
|
|
|
|
re.RegisterModel("models/weapons/v_handgr/tris.md2");
|
|
|
|
re.RegisterModel("models/weapons/v_shotg2/tris.md2");
|
|
|
|
re.RegisterModel("models/objects/gibs/bone/tris.md2");
|
|
|
|
re.RegisterModel("models/objects/gibs/sm_meat/tris.md2");
|
|
|
|
re.RegisterModel("models/objects/gibs/bone2/tris.md2");
|
|
|
|
|
|
|
|
re.RegisterPic("w_machinegun");
|
|
|
|
re.RegisterPic("a_bullets");
|
|
|
|
re.RegisterPic("i_health");
|
|
|
|
re.RegisterPic("a_grenades");
|
|
|
|
|
|
|
|
cl_mod_explo4_big = re.RegisterModel("models/objects/r_explode2/tris.md2");
|
|
|
|
cl_mod_lightning = re.RegisterModel("models/proj/lightning/tris.md2");
|
|
|
|
cl_mod_heatbeam = re.RegisterModel("models/proj/beam/tris.md2");
|
|
|
|
cl_mod_monster_heatbeam = re.RegisterModel("models/proj/widowbeam/tris.md2");
|
2010-06-18 14:51:25 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_ClearTEnts(void)
|
|
|
|
{
|
|
|
|
memset(cl_beams, 0, sizeof(cl_beams));
|
|
|
|
memset(cl_explosions, 0, sizeof(cl_explosions));
|
|
|
|
memset(cl_lasers, 0, sizeof(cl_lasers));
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
memset(cl_playerbeams, 0, sizeof(cl_playerbeams));
|
|
|
|
memset(cl_sustains, 0, sizeof(cl_sustains));
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
explosion_t *
|
|
|
|
CL_AllocExplosion(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
float time;
|
|
|
|
int index;
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_EXPLOSIONS; i++)
|
|
|
|
{
|
|
|
|
if (cl_explosions[i].type == ex_free)
|
|
|
|
{
|
|
|
|
memset(&cl_explosions[i], 0, sizeof(cl_explosions[i]));
|
2009-02-28 14:41:18 +00:00
|
|
|
return &cl_explosions[i];
|
|
|
|
}
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
/* find the oldest explosion */
|
2009-03-02 21:39:50 +00:00
|
|
|
time = (float)cl.time;
|
2009-02-28 14:41:18 +00:00
|
|
|
index = 0;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0; i < MAX_EXPLOSIONS; i++)
|
|
|
|
{
|
|
|
|
if (cl_explosions[i].start < time)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
time = cl_explosions[i].start;
|
|
|
|
index = i;
|
|
|
|
}
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
memset(&cl_explosions[index], 0, sizeof(cl_explosions[index]));
|
2009-02-28 14:41:18 +00:00
|
|
|
return &cl_explosions[index];
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_SmokeAndFlash(vec3_t origin)
|
|
|
|
{
|
|
|
|
explosion_t *ex;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
ex = CL_AllocExplosion();
|
|
|
|
VectorCopy(origin, ex->ent.origin);
|
2009-02-28 14:41:18 +00:00
|
|
|
ex->type = ex_misc;
|
|
|
|
ex->frames = 4;
|
|
|
|
ex->ent.flags = RF_TRANSLUCENT;
|
2009-03-02 21:39:50 +00:00
|
|
|
ex->start = cl.frame.servertime - 100.0f;
|
2009-02-28 14:41:18 +00:00
|
|
|
ex->ent.model = cl_mod_smoke;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
ex = CL_AllocExplosion();
|
|
|
|
VectorCopy(origin, ex->ent.origin);
|
2009-02-28 14:41:18 +00:00
|
|
|
ex->type = ex_flash;
|
|
|
|
ex->ent.flags = RF_FULLBRIGHT;
|
|
|
|
ex->frames = 2;
|
2009-03-02 21:39:50 +00:00
|
|
|
ex->start = cl.frame.servertime - 100.0f;
|
2009-02-28 14:41:18 +00:00
|
|
|
ex->ent.model = cl_mod_flash;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_ParseParticles(void)
|
|
|
|
{
|
|
|
|
int color, count;
|
|
|
|
vec3_t pos, dir;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
color = MSG_ReadByte(&net_message);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
count = MSG_ReadByte(&net_message);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
CL_ParticleEffect(pos, dir, color, count);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_ParseBeam(struct model_s *model)
|
|
|
|
{
|
|
|
|
int ent;
|
|
|
|
vec3_t start, end;
|
|
|
|
beam_t *b;
|
|
|
|
int i;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
ent = MSG_ReadShort(&net_message);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, start);
|
|
|
|
MSG_ReadPos(&net_message, end);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
/* override any beam with the same entity */
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++)
|
|
|
|
{
|
|
|
|
if (b->entity == ent)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
b->entity = ent;
|
|
|
|
b->model = model;
|
|
|
|
b->endtime = cl.time + 200;
|
2012-07-22 13:34:45 +00:00
|
|
|
VectorCopy(start, b->start);
|
|
|
|
VectorCopy(end, b->end);
|
|
|
|
VectorClear(b->offset);
|
2009-03-02 21:39:50 +00:00
|
|
|
return;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
/* find a free beam */
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++)
|
|
|
|
{
|
|
|
|
if (!b->model || (b->endtime < cl.time))
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
b->entity = ent;
|
|
|
|
b->model = model;
|
|
|
|
b->endtime = cl.time + 200;
|
2012-07-22 13:34:45 +00:00
|
|
|
VectorCopy(start, b->start);
|
|
|
|
VectorCopy(end, b->end);
|
|
|
|
VectorClear(b->offset);
|
2009-03-02 21:39:50 +00:00
|
|
|
return;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
Com_Printf("beam list overflow!\n");
|
2009-03-02 21:39:50 +00:00
|
|
|
return;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_ParseBeam2(struct model_s *model)
|
|
|
|
{
|
|
|
|
int ent;
|
|
|
|
vec3_t start, end, offset;
|
|
|
|
beam_t *b;
|
|
|
|
int i;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
ent = MSG_ReadShort(&net_message);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, start);
|
|
|
|
MSG_ReadPos(&net_message, end);
|
|
|
|
MSG_ReadPos(&net_message, offset);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
/* override any beam with the same entity */
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++)
|
|
|
|
{
|
|
|
|
if (b->entity == ent)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
b->entity = ent;
|
|
|
|
b->model = model;
|
|
|
|
b->endtime = cl.time + 200;
|
2012-07-22 13:34:45 +00:00
|
|
|
VectorCopy(start, b->start);
|
|
|
|
VectorCopy(end, b->end);
|
|
|
|
VectorCopy(offset, b->offset);
|
2009-03-02 21:39:50 +00:00
|
|
|
return;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
/* find a free beam */
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++)
|
|
|
|
{
|
|
|
|
if (!b->model || (b->endtime < cl.time))
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
b->entity = ent;
|
|
|
|
b->model = model;
|
2010-06-18 14:51:25 +00:00
|
|
|
b->endtime = cl.time + 200;
|
2012-07-22 13:34:45 +00:00
|
|
|
VectorCopy(start, b->start);
|
|
|
|
VectorCopy(end, b->end);
|
|
|
|
VectorCopy(offset, b->offset);
|
2009-03-02 21:39:50 +00:00
|
|
|
return;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
Com_Printf("beam list overflow!\n");
|
2009-03-02 21:39:50 +00:00
|
|
|
return;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-06-18 14:51:25 +00:00
|
|
|
* adds to the cl_playerbeam array instead of the cl_beams array
|
|
|
|
*/
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_ParsePlayerBeam(struct model_s *model)
|
|
|
|
{
|
|
|
|
int ent;
|
|
|
|
vec3_t start, end, offset;
|
|
|
|
beam_t *b;
|
|
|
|
int i;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
ent = MSG_ReadShort(&net_message);
|
2009-03-02 22:13:15 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, start);
|
|
|
|
MSG_ReadPos(&net_message, end);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
/* network optimization */
|
2009-03-02 22:13:15 +00:00
|
|
|
if (model == cl_mod_heatbeam)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-03-02 22:13:15 +00:00
|
|
|
VectorSet(offset, 2, 7, -3);
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
else if (model == cl_mod_monster_heatbeam)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
model = cl_mod_heatbeam;
|
|
|
|
VectorSet(offset, 0, 0, 0);
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MSG_ReadPos(&net_message, offset);
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
/* Override any beam with the same entity
|
2012-07-22 13:34:45 +00:00
|
|
|
For player beams, we only want one per
|
|
|
|
player (entity) so... */
|
|
|
|
for (i = 0, b = cl_playerbeams; i < MAX_BEAMS; i++, b++)
|
|
|
|
{
|
|
|
|
if (b->entity == ent)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
b->entity = ent;
|
|
|
|
b->model = model;
|
|
|
|
b->endtime = cl.time + 200;
|
2012-07-22 13:34:45 +00:00
|
|
|
VectorCopy(start, b->start);
|
|
|
|
VectorCopy(end, b->end);
|
|
|
|
VectorCopy(offset, b->offset);
|
2009-03-02 21:39:50 +00:00
|
|
|
return;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
/* find a free beam */
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0, b = cl_playerbeams; i < MAX_BEAMS; i++, b++)
|
|
|
|
{
|
|
|
|
if (!b->model || (b->endtime < cl.time))
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
b->entity = ent;
|
|
|
|
b->model = model;
|
2012-07-22 13:34:45 +00:00
|
|
|
b->endtime = cl.time + 100; /* this needs to be 100 to
|
|
|
|
prevent multiple heatbeams */
|
|
|
|
VectorCopy(start, b->start);
|
|
|
|
VectorCopy(end, b->end);
|
|
|
|
VectorCopy(offset, b->offset);
|
2009-03-02 21:39:50 +00:00
|
|
|
return;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
Com_Printf("beam list overflow!\n");
|
2009-03-02 22:13:15 +00:00
|
|
|
return;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
int
|
|
|
|
CL_ParseLightning(struct model_s *model)
|
|
|
|
{
|
|
|
|
int srcEnt, destEnt;
|
|
|
|
vec3_t start, end;
|
|
|
|
beam_t *b;
|
|
|
|
int i;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
srcEnt = MSG_ReadShort(&net_message);
|
|
|
|
destEnt = MSG_ReadShort(&net_message);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, start);
|
|
|
|
MSG_ReadPos(&net_message, end);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
/* override any beam with the same
|
|
|
|
source AND destination entities */
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++)
|
|
|
|
{
|
|
|
|
if ((b->entity == srcEnt) && (b->dest_entity == destEnt))
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
b->entity = srcEnt;
|
|
|
|
b->dest_entity = destEnt;
|
|
|
|
b->model = model;
|
|
|
|
b->endtime = cl.time + 200;
|
2012-07-22 13:34:45 +00:00
|
|
|
VectorCopy(start, b->start);
|
|
|
|
VectorCopy(end, b->end);
|
|
|
|
VectorClear(b->offset);
|
2009-02-28 14:41:18 +00:00
|
|
|
return srcEnt;
|
|
|
|
}
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
/* find a free beam */
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++)
|
|
|
|
{
|
|
|
|
if (!b->model || (b->endtime < cl.time))
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
b->entity = srcEnt;
|
|
|
|
b->dest_entity = destEnt;
|
|
|
|
b->model = model;
|
|
|
|
b->endtime = cl.time + 200;
|
2012-07-22 13:34:45 +00:00
|
|
|
VectorCopy(start, b->start);
|
|
|
|
VectorCopy(end, b->end);
|
|
|
|
VectorClear(b->offset);
|
2009-02-28 14:41:18 +00:00
|
|
|
return srcEnt;
|
|
|
|
}
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
Com_Printf("beam list overflow!\n");
|
2009-02-28 14:41:18 +00:00
|
|
|
return srcEnt;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_ParseLaser(int colors)
|
|
|
|
{
|
|
|
|
vec3_t start;
|
|
|
|
vec3_t end;
|
|
|
|
laser_t *l;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
MSG_ReadPos(&net_message, start);
|
|
|
|
MSG_ReadPos(&net_message, end);
|
|
|
|
|
|
|
|
for (i = 0, l = cl_lasers; i < MAX_LASERS; i++, l++)
|
|
|
|
{
|
|
|
|
if (l->endtime < cl.time)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
l->ent.flags = RF_TRANSLUCENT | RF_BEAM;
|
2012-07-22 13:34:45 +00:00
|
|
|
VectorCopy(start, l->ent.origin);
|
|
|
|
VectorCopy(end, l->ent.oldorigin);
|
2009-03-02 21:39:50 +00:00
|
|
|
l->ent.alpha = 0.30f;
|
2012-07-22 13:34:45 +00:00
|
|
|
l->ent.skinnum = (colors >> ((randk() % 4) * 8)) & 0xff;
|
2009-02-28 14:41:18 +00:00
|
|
|
l->ent.model = NULL;
|
|
|
|
l->ent.frame = 4;
|
|
|
|
l->endtime = cl.time + 100;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_ParseSteam(void)
|
|
|
|
{
|
|
|
|
vec3_t pos, dir;
|
|
|
|
int id, i;
|
|
|
|
int r;
|
|
|
|
int cnt;
|
|
|
|
int color;
|
|
|
|
int magnitude;
|
|
|
|
cl_sustain_t *s, *free_sustain;
|
|
|
|
|
|
|
|
id = MSG_ReadShort(&net_message); /* an id of -1 is an instant effect */
|
|
|
|
|
|
|
|
if (id != -1) /* sustains */
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
free_sustain = NULL;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0, s = cl_sustains; i < MAX_SUSTAINS; i++, s++)
|
|
|
|
{
|
|
|
|
if (s->id == 0)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
free_sustain = s;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (free_sustain)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
s->id = id;
|
2012-07-22 13:34:45 +00:00
|
|
|
s->count = MSG_ReadByte(&net_message);
|
|
|
|
MSG_ReadPos(&net_message, s->org);
|
|
|
|
MSG_ReadDir(&net_message, s->dir);
|
|
|
|
r = MSG_ReadByte(&net_message);
|
2009-02-28 14:41:18 +00:00
|
|
|
s->color = r & 0xff;
|
2012-07-22 13:34:45 +00:00
|
|
|
s->magnitude = MSG_ReadShort(&net_message);
|
|
|
|
s->endtime = cl.time + MSG_ReadLong(&net_message);
|
2009-02-28 14:41:18 +00:00
|
|
|
s->think = CL_ParticleSteamEffect2;
|
|
|
|
s->thinkinterval = 100;
|
|
|
|
s->nextthink = cl.time;
|
|
|
|
}
|
2012-07-22 13:34:45 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
MSG_ReadByte(&net_message);
|
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
|
|
|
MSG_ReadByte(&net_message);
|
|
|
|
MSG_ReadShort(&net_message);
|
|
|
|
MSG_ReadLong(&net_message); /* really interval */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
/* instant */
|
2012-07-22 13:34:45 +00:00
|
|
|
cnt = MSG_ReadByte(&net_message);
|
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
|
|
|
r = MSG_ReadByte(&net_message);
|
|
|
|
magnitude = MSG_ReadShort(&net_message);
|
2009-02-28 14:41:18 +00:00
|
|
|
color = r & 0xff;
|
2012-07-22 13:34:45 +00:00
|
|
|
CL_ParticleSteamEffect(pos, dir, color, cnt, magnitude);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_ParseWidow(void)
|
|
|
|
{
|
|
|
|
vec3_t pos;
|
|
|
|
int id, i;
|
|
|
|
cl_sustain_t *s, *free_sustain;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
id = MSG_ReadShort(&net_message);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
free_sustain = NULL;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0, s = cl_sustains; i < MAX_SUSTAINS; i++, s++)
|
|
|
|
{
|
|
|
|
if (s->id == 0)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
free_sustain = s;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (free_sustain)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
s->id = id;
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, s->org);
|
2009-02-28 14:41:18 +00:00
|
|
|
s->endtime = cl.time + 2100;
|
|
|
|
s->think = CL_Widowbeamout;
|
|
|
|
s->thinkinterval = 1;
|
|
|
|
s->nextthink = cl.time;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
/* no free sustains */
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_ParseNuke(void)
|
|
|
|
{
|
|
|
|
vec3_t pos;
|
|
|
|
int i;
|
|
|
|
cl_sustain_t *s, *free_sustain;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
free_sustain = NULL;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0, s = cl_sustains; i < MAX_SUSTAINS; i++, s++)
|
|
|
|
{
|
|
|
|
if (s->id == 0)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
free_sustain = s;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (free_sustain)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
s->id = 21000;
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, s->org);
|
2009-02-28 14:41:18 +00:00
|
|
|
s->endtime = cl.time + 1000;
|
|
|
|
s->think = CL_Nukeblast;
|
|
|
|
s->thinkinterval = 1;
|
|
|
|
s->nextthink = cl.time;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
/* no free sustains */
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static byte splash_color[] = {0x00, 0xe0, 0xb0, 0x50, 0xd0, 0xe0, 0xe8};
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_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(&net_message);
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
case TE_BLOOD: /* bullet hitting flesh */
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
|
|
|
CL_ParticleEffect(pos, dir, 0xe8, 60);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
case TE_GUNSHOT: /* bullet hitting wall */
|
|
|
|
case TE_SPARKS:
|
|
|
|
case TE_BULLET_SPARKS:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
if (type == TE_GUNSHOT)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
CL_ParticleEffect(pos, dir, 0, 40);
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
CL_ParticleEffect(pos, dir, 0xe0, 6);
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (type != TE_SPARKS)
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
CL_SmokeAndFlash(pos);
|
|
|
|
/* impact sound */
|
2012-07-22 13:34:45 +00:00
|
|
|
cnt = randk() & 15;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
if (cnt == 1)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_ric1, 1, ATTN_NORM, 0);
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
else if (cnt == 2)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_ric2, 1, ATTN_NORM, 0);
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
else if (cnt == 3)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_ric3, 1, ATTN_NORM, 0);
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_SCREEN_SPARKS:
|
|
|
|
case TE_SHIELD_SPARKS:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
if (type == TE_SCREEN_SPARKS)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
CL_ParticleEffect(pos, dir, 0xd0, 40);
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
CL_ParticleEffect(pos, dir, 0xb0, 40);
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_SHOTGUN: /* bullet hitting wall */
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
|
|
|
CL_ParticleEffect(pos, dir, 0, 20);
|
2009-02-28 14:41:18 +00:00
|
|
|
CL_SmokeAndFlash(pos);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_SPLASH: /* bullet hitting water */
|
2012-07-22 13:34:45 +00:00
|
|
|
cnt = MSG_ReadByte(&net_message);
|
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
|
|
|
r = MSG_ReadByte(&net_message);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
if (r > 6)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
color = 0x00;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
color = splash_color[r];
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
CL_ParticleEffect(pos, dir, color, cnt);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (r == SPLASH_SPARKS)
|
|
|
|
{
|
2012-06-02 09:55:12 +00:00
|
|
|
r = randk() & 3;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
if (r == 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_spark5, 1, ATTN_STATIC, 0);
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
else if (r == 1)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_spark6, 1, ATTN_STATIC, 0);
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_spark7, 1, ATTN_STATIC, 0);
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
case TE_LASER_SPARKS:
|
2012-07-22 13:34:45 +00:00
|
|
|
cnt = MSG_ReadByte(&net_message);
|
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
|
|
|
color = MSG_ReadByte(&net_message);
|
|
|
|
CL_ParticleEffect2(pos, dir, color, cnt);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
case TE_BLUEHYPERBLASTER:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadPos(&net_message, dir);
|
|
|
|
CL_BlasterParticles(pos, dir);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
case TE_BLASTER: /* blaster hitting wall */
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
|
|
|
CL_BlasterParticles(pos, dir);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
ex = CL_AllocExplosion();
|
|
|
|
VectorCopy(pos, ex->ent.origin);
|
|
|
|
ex->ent.angles[0] = (float)acos(dir[2]) / M_PI * 180;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
if (dir[0])
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
ex->ent.angles[1] = (float)atan2(dir[1], dir[0]) / M_PI * 180;
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
else if (dir[1] > 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->ent.angles[1] = 90;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
else if (dir[1] < 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->ent.angles[1] = 270;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->ent.angles[1] = 0;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->type = ex_misc;
|
2012-07-22 10:51:53 +00:00
|
|
|
ex->ent.flags = 0;
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->start = cl.frame.servertime - 100.0f;
|
|
|
|
ex->light = 150;
|
|
|
|
ex->lightcolor[0] = 1;
|
2009-02-28 14:41:18 +00:00
|
|
|
ex->lightcolor[1] = 1;
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->ent.model = cl_mod_explode;
|
|
|
|
ex->frames = 4;
|
2012-07-22 13:34:45 +00:00
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
case TE_RAILTRAIL: /* railgun effect */
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadPos(&net_message, pos2);
|
|
|
|
CL_RailTrail(pos, pos2);
|
|
|
|
S_StartSound(pos2, 0, 0, cl_sfx_railg, 1, ATTN_NORM, 0);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
case TE_EXPLOSION2:
|
|
|
|
case TE_GRENADE_EXPLOSION:
|
|
|
|
case TE_GRENADE_EXPLOSION_WATER:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
ex = CL_AllocExplosion();
|
|
|
|
VectorCopy(pos, ex->ent.origin);
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->type = ex_poly;
|
2012-07-22 13:34:45 +00:00
|
|
|
ex->ent.flags = RF_FULLBRIGHT | RF_NOSHADOW;
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->start = cl.frame.servertime - 100.0f;
|
|
|
|
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;
|
2012-06-02 09:55:12 +00:00
|
|
|
ex->ent.angles[1] = (float)(randk() % 360);
|
2012-07-22 13:34:45 +00:00
|
|
|
EXPLOSION_PARTICLES(pos);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
if (type == TE_GRENADE_EXPLOSION_WATER)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_watrexp, 1, ATTN_NORM, 0);
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_grenexp, 1, ATTN_NORM, 0);
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
case TE_PLASMA_EXPLOSION:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
ex = CL_AllocExplosion();
|
|
|
|
VectorCopy(pos, ex->ent.origin);
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->type = ex_poly;
|
2012-07-22 13:34:45 +00:00
|
|
|
ex->ent.flags = RF_FULLBRIGHT | RF_NOSHADOW;
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->start = cl.frame.servertime - 100.0f;
|
|
|
|
ex->light = 350;
|
|
|
|
ex->lightcolor[0] = 1.0;
|
|
|
|
ex->lightcolor[1] = 0.5;
|
|
|
|
ex->lightcolor[2] = 0.5;
|
2012-06-02 09:55:12 +00:00
|
|
|
ex->ent.angles[1] = (float)(randk() % 360);
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->ent.model = cl_mod_explo4;
|
|
|
|
|
2012-06-02 09:55:12 +00:00
|
|
|
if (frandk() < 0.5)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->baseframe = 15;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
ex->frames = 15;
|
2012-07-22 13:34:45 +00:00
|
|
|
EXPLOSION_PARTICLES(pos);
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_rockexp, 1, ATTN_NORM, 0);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
case TE_EXPLOSION1_BIG:
|
|
|
|
case TE_EXPLOSION1_NP:
|
|
|
|
case TE_EXPLOSION1:
|
|
|
|
case TE_ROCKET_EXPLOSION:
|
|
|
|
case TE_ROCKET_EXPLOSION_WATER:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
ex = CL_AllocExplosion();
|
|
|
|
VectorCopy(pos, ex->ent.origin);
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->type = ex_poly;
|
2012-07-22 13:34:45 +00:00
|
|
|
ex->ent.flags = RF_FULLBRIGHT | RF_NOSHADOW;
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->start = cl.frame.servertime - 100.0f;
|
|
|
|
ex->light = 350;
|
|
|
|
ex->lightcolor[0] = 1.0;
|
|
|
|
ex->lightcolor[1] = 0.5;
|
|
|
|
ex->lightcolor[2] = 0.5;
|
2012-06-02 09:55:12 +00:00
|
|
|
ex->ent.angles[1] = (float)(randk() % 360);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
if (type != TE_EXPLOSION1_BIG)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->ent.model = cl_mod_explo4;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->ent.model = cl_mod_explo4_big;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-06-02 09:55:12 +00:00
|
|
|
if (frandk() < 0.5)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->baseframe = 15;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->frames = 15;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
if ((type != TE_EXPLOSION1_BIG) && (type != TE_EXPLOSION1_NP))
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
EXPLOSION_PARTICLES(pos);
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
if (type == TE_ROCKET_EXPLOSION_WATER)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_watrexp, 1, ATTN_NORM, 0);
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_rockexp, 1, ATTN_NORM, 0);
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
case TE_BFG_EXPLOSION:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
ex = CL_AllocExplosion();
|
|
|
|
VectorCopy(pos, ex->ent.origin);
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->type = ex_poly;
|
2012-07-22 13:34:45 +00:00
|
|
|
ex->ent.flags = RF_FULLBRIGHT | RF_NOSHADOW;
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->start = cl.frame.servertime - 100.0f;
|
|
|
|
ex->light = 350;
|
|
|
|
ex->lightcolor[0] = 0.0;
|
|
|
|
ex->lightcolor[1] = 1.0;
|
|
|
|
ex->lightcolor[2] = 0.0;
|
|
|
|
ex->ent.model = cl_mod_bfg_explo;
|
|
|
|
ex->ent.flags |= RF_TRANSLUCENT;
|
|
|
|
ex->ent.alpha = 0.30f;
|
|
|
|
ex->frames = 4;
|
|
|
|
break;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
case TE_BFG_BIGEXPLOSION:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
CL_BFGExplosionParticles(pos);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_BFG_LASER:
|
2012-07-22 13:34:45 +00:00
|
|
|
CL_ParseLaser(0xd0d1d2d3);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_BUBBLETRAIL:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadPos(&net_message, pos2);
|
|
|
|
CL_BubbleTrail(pos, pos2);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_PARASITE_ATTACK:
|
|
|
|
case TE_MEDIC_CABLE_ATTACK:
|
2012-07-22 13:34:45 +00:00
|
|
|
CL_ParseBeam(cl_mod_parasite_segment);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_BOSSTPORT: /* boss teleporting to station */
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
CL_BigTeleportParticles(pos);
|
|
|
|
S_StartSound(pos, 0, 0, S_RegisterSound(
|
|
|
|
"misc/bigtele.wav"), 1, ATTN_NONE, 0);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_GRAPPLE_CABLE:
|
2012-07-22 13:34:45 +00:00
|
|
|
CL_ParseBeam2(cl_mod_grapple_cable);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_WELDING_SPARKS:
|
2012-07-22 13:34:45 +00:00
|
|
|
cnt = MSG_ReadByte(&net_message);
|
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
|
|
|
color = MSG_ReadByte(&net_message);
|
|
|
|
CL_ParticleEffect2(pos, dir, color, cnt);
|
|
|
|
|
|
|
|
ex = CL_AllocExplosion();
|
|
|
|
VectorCopy(pos, ex->ent.origin);
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->type = ex_flash;
|
|
|
|
ex->ent.flags = RF_BEAM;
|
|
|
|
ex->start = cl.frame.servertime - 0.1f;
|
2012-07-22 13:34:45 +00:00
|
|
|
ex->light = 100 + (float)(randk() % 75);
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->lightcolor[0] = 1.0f;
|
|
|
|
ex->lightcolor[1] = 1.0f;
|
|
|
|
ex->lightcolor[2] = 0.3f;
|
|
|
|
ex->ent.model = cl_mod_flash;
|
|
|
|
ex->frames = 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_GREENBLOOD:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
|
|
|
CL_ParticleEffect2(pos, dir, 0xdf, 30);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
case TE_TUNNEL_SPARKS:
|
2012-07-22 13:34:45 +00:00
|
|
|
cnt = MSG_ReadByte(&net_message);
|
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
|
|
|
color = MSG_ReadByte(&net_message);
|
|
|
|
CL_ParticleEffect3(pos, dir, color, cnt);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_BLASTER2:
|
|
|
|
case TE_FLECHETTE:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
if (type == TE_BLASTER2)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
CL_BlasterParticles2(pos, dir, 0xd0);
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
CL_BlasterParticles2(pos, dir, 0x6f);
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
ex = CL_AllocExplosion();
|
|
|
|
VectorCopy(pos, ex->ent.origin);
|
|
|
|
ex->ent.angles[0] = (float)acos(dir[2]) / M_PI * 180;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
if (dir[0])
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
ex->ent.angles[1] = (float)atan2(dir[1], dir[0]) / M_PI * 180;
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
else if (dir[1] > 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->ent.angles[1] = 90;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
else if (dir[1] < 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->ent.angles[1] = 270;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->ent.angles[1] = 0;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
ex->type = ex_misc;
|
2012-07-22 13:34:45 +00:00
|
|
|
ex->ent.flags = RF_FULLBRIGHT | RF_TRANSLUCENT;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
if (type == TE_BLASTER2)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->ent.skinnum = 1;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
else /* flechette */
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->ent.skinnum = 2;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
ex->start = cl.frame.servertime - 100.0f;
|
|
|
|
ex->light = 150;
|
|
|
|
|
|
|
|
if (type == TE_BLASTER2)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->lightcolor[1] = 1;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
else
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
/* flechette */
|
|
|
|
ex->lightcolor[0] = 0.19f;
|
|
|
|
ex->lightcolor[1] = 0.41f;
|
|
|
|
ex->lightcolor[2] = 0.75f;
|
|
|
|
}
|
|
|
|
|
|
|
|
ex->ent.model = cl_mod_explode;
|
|
|
|
ex->frames = 4;
|
2012-07-22 13:34:45 +00:00
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_LIGHTNING:
|
2012-07-22 13:34:45 +00:00
|
|
|
ent = CL_ParseLightning(cl_mod_lightning);
|
|
|
|
S_StartSound(NULL, ent, CHAN_WEAPON, cl_sfx_lightning,
|
|
|
|
1, ATTN_NORM, 0);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_DEBUGTRAIL:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadPos(&net_message, pos2);
|
|
|
|
CL_DebugTrail(pos, pos2);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_PLAIN_EXPLOSION:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
ex = CL_AllocExplosion();
|
|
|
|
VectorCopy(pos, ex->ent.origin);
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->type = ex_poly;
|
2012-07-22 13:34:45 +00:00
|
|
|
ex->ent.flags = RF_FULLBRIGHT | RF_NOSHADOW;
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->start = cl.frame.servertime - 100.0f;
|
|
|
|
ex->light = 350;
|
|
|
|
ex->lightcolor[0] = 1.0;
|
|
|
|
ex->lightcolor[1] = 0.5;
|
|
|
|
ex->lightcolor[2] = 0.5;
|
2012-06-02 09:55:12 +00:00
|
|
|
ex->ent.angles[1] = randk() % 360;
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->ent.model = cl_mod_explo4;
|
|
|
|
|
2012-06-02 09:55:12 +00:00
|
|
|
if (frandk() < 0.5)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->baseframe = 15;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
ex->frames = 15;
|
|
|
|
|
|
|
|
if (type == TE_ROCKET_EXPLOSION_WATER)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_watrexp, 1, ATTN_NORM, 0);
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_rockexp, 1, ATTN_NORM, 0);
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_FLASHLIGHT:
|
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
ent = MSG_ReadShort(&net_message);
|
|
|
|
CL_Flashlight(ent, pos);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_FORCEWALL:
|
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadPos(&net_message, pos2);
|
2012-07-22 13:34:45 +00:00
|
|
|
color = MSG_ReadByte(&net_message);
|
2010-06-18 14:51:25 +00:00
|
|
|
CL_ForceWall(pos, pos2, color);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_HEATBEAM:
|
2012-07-22 13:34:45 +00:00
|
|
|
CL_ParsePlayerBeam(cl_mod_heatbeam);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_MONSTER_HEATBEAM:
|
2012-07-22 13:34:45 +00:00
|
|
|
CL_ParsePlayerBeam(cl_mod_monster_heatbeam);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_HEATBEAM_SPARKS:
|
|
|
|
cnt = 50;
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
2010-06-18 14:51:25 +00:00
|
|
|
r = 8;
|
|
|
|
magnitude = 60;
|
|
|
|
color = r & 0xff;
|
2012-07-22 13:34:45 +00:00
|
|
|
CL_ParticleSteamEffect(pos, dir, color, cnt, magnitude);
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_HEATBEAM_STEAM:
|
|
|
|
cnt = 20;
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
2010-06-18 14:51:25 +00:00
|
|
|
color = 0xe0;
|
|
|
|
magnitude = 60;
|
2012-07-22 13:34:45 +00:00
|
|
|
CL_ParticleSteamEffect(pos, dir, color, cnt, magnitude);
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_STEAM:
|
|
|
|
CL_ParseSteam();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_BUBBLETRAIL2:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadPos(&net_message, pos2);
|
|
|
|
CL_BubbleTrail2(pos, pos2, 8);
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_MOREBLOOD:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
|
|
|
CL_ParticleEffect(pos, dir, 0xe8, 250);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_CHAINFIST_SMOKE:
|
2012-07-22 13:34:45 +00:00
|
|
|
dir[0] = 0;
|
|
|
|
dir[1] = 0;
|
|
|
|
dir[2] = 1;
|
2010-06-18 14:51:25 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
2012-07-22 13:34:45 +00:00
|
|
|
CL_ParticleSmokeEffect(pos, dir, 0, 20, 20);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_ELECTRIC_SPARKS:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
MSG_ReadDir(&net_message, dir);
|
|
|
|
CL_ParticleEffect(pos, dir, 0x75, 40);
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_TRACKER_EXPLOSION:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
CL_ColorFlash(pos, 0, 150, -1, -1, -1);
|
|
|
|
CL_ColorExplosionParticles(pos, 0, 1);
|
|
|
|
S_StartSound(pos, 0, 0, cl_sfx_disrexp, 1, ATTN_NORM, 0);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_TELEPORT_EFFECT:
|
|
|
|
case TE_DBALL_GOAL:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
CL_TeleportParticles(pos);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_WIDOWBEAMOUT:
|
2012-07-22 13:34:45 +00:00
|
|
|
CL_ParseWidow();
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_NUKEBLAST:
|
2012-07-22 13:34:45 +00:00
|
|
|
CL_ParseNuke();
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TE_WIDOWSPLASH:
|
2012-07-22 13:34:45 +00:00
|
|
|
MSG_ReadPos(&net_message, pos);
|
|
|
|
CL_WidowSplash(pos);
|
2010-06-18 14:51:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2012-07-22 13:34:45 +00:00
|
|
|
Com_Error(ERR_DROP, "CL_ParseTEnt: bad type");
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_AddBeams(void)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
beam_t *b;
|
|
|
|
vec3_t dist, org;
|
|
|
|
float d;
|
|
|
|
entity_t ent;
|
|
|
|
float yaw, pitch;
|
|
|
|
float forward;
|
|
|
|
float len, steps;
|
|
|
|
float model_length;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
/* update beams */
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++)
|
|
|
|
{
|
|
|
|
if (!b->model || (b->endtime < cl.time))
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
/* if coming from the player, update the start position */
|
2012-07-22 13:34:45 +00:00
|
|
|
if (b->entity == cl.playernum + 1) /* entity 0 is the world */
|
|
|
|
{
|
|
|
|
VectorCopy(cl.refdef.vieworg, b->start);
|
|
|
|
b->start[2] -= 22; /* adjust for view height */
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
VectorAdd(b->start, b->offset, org);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
/* calculate pitch and yaw */
|
2012-07-22 13:34:45 +00:00
|
|
|
VectorSubtract(b->end, org, dist);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if ((dist[1] == 0) && (dist[0] == 0))
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
yaw = 0;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (dist[2] > 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
pitch = 90;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
pitch = 270;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
if (dist[0])
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-03-02 21:39:50 +00:00
|
|
|
yaw = ((float)atan2(dist[1], dist[0]) * 180 / M_PI);
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else if (dist[1] > 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
yaw = 90;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
yaw = 270;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (yaw < 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
yaw += 360;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
forward = (float)sqrt(dist[0] * dist[0] + dist[1] * dist[1]);
|
2009-03-02 21:39:50 +00:00
|
|
|
pitch = ((float)atan2(dist[2], forward) * -180.0 / M_PI);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (pitch < 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
pitch += 360.0;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
/* add new entities for the beams */
|
2009-02-28 14:41:18 +00:00
|
|
|
d = VectorNormalize(dist);
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
memset(&ent, 0, sizeof(ent));
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (b->model == cl_mod_lightning)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
model_length = 35.0;
|
2012-07-22 13:34:45 +00:00
|
|
|
d -= 20.0; /* correction so it doesn't end in middle of tesla */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
model_length = 30.0;
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
steps = (float)ceil(d / model_length);
|
|
|
|
len = (d - model_length) / (steps - 1);
|
|
|
|
|
|
|
|
/* special case for lightning model .. if the real length
|
|
|
|
is shorter than the model, flip it around & draw it
|
|
|
|
from the end to the start. This prevents the model from
|
|
|
|
going through the tesla mine (instead it goes through
|
|
|
|
the target) */
|
|
|
|
if ((b->model == cl_mod_lightning) && (d <= model_length))
|
|
|
|
{
|
|
|
|
VectorCopy(b->end, ent.origin);
|
2009-02-28 14:41:18 +00:00
|
|
|
ent.model = b->model;
|
|
|
|
ent.flags = RF_FULLBRIGHT;
|
|
|
|
ent.angles[0] = pitch;
|
|
|
|
ent.angles[1] = yaw;
|
2012-07-22 13:34:45 +00:00
|
|
|
ent.angles[2] = (float)(randk() % 360);
|
|
|
|
V_AddEntity(&ent);
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
while (d > 0)
|
|
|
|
{
|
|
|
|
VectorCopy(org, ent.origin);
|
2009-02-28 14:41:18 +00:00
|
|
|
ent.model = b->model;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (b->model == cl_mod_lightning)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
ent.flags = RF_FULLBRIGHT;
|
|
|
|
ent.angles[0] = -pitch;
|
2009-03-02 21:39:50 +00:00
|
|
|
ent.angles[1] = yaw + 180.0f;
|
2012-07-22 13:34:45 +00:00
|
|
|
ent.angles[2] = (float)(randk() % 360);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
ent.angles[0] = pitch;
|
|
|
|
ent.angles[1] = yaw;
|
2012-07-22 13:34:45 +00:00
|
|
|
ent.angles[2] = (float)(randk() % 360);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
V_AddEntity(&ent);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (j = 0; j < 3; j++)
|
|
|
|
{
|
|
|
|
org[j] += dist[j] * len;
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
d -= model_length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extern cvar_t *hand;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_AddPlayerBeams(void)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
beam_t *b;
|
|
|
|
vec3_t dist, org;
|
|
|
|
float d;
|
|
|
|
entity_t ent;
|
|
|
|
float yaw, pitch;
|
|
|
|
float forward;
|
|
|
|
float len, steps;
|
|
|
|
int framenum;
|
|
|
|
float model_length;
|
|
|
|
|
|
|
|
float hand_multiplier;
|
|
|
|
frame_t *oldframe;
|
|
|
|
player_state_t *ps, *ops;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
framenum = 0;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (hand)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
if (hand->value == 2)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
hand_multiplier = 0;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else if (hand->value == 1)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
hand_multiplier = -1;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
hand_multiplier = 1;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
hand_multiplier = 1;
|
|
|
|
}
|
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
/* update beams */
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0, b = cl_playerbeams; i < MAX_BEAMS; i++, b++)
|
|
|
|
{
|
|
|
|
vec3_t f, r, u;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!b->model || (b->endtime < cl.time))
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (cl_mod_heatbeam && (b->model == cl_mod_heatbeam))
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
/* if coming from the player, update the start position */
|
2012-07-22 13:34:45 +00:00
|
|
|
if (b->entity == cl.playernum + 1)
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
/* set up gun position */
|
2009-02-28 14:41:18 +00:00
|
|
|
ps = &cl.frame.playerstate;
|
|
|
|
j = (cl.frame.serverframe - 1) & UPDATE_MASK;
|
|
|
|
oldframe = &cl.frames[j];
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if ((oldframe->serverframe != cl.frame.serverframe - 1) || !oldframe->valid)
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
oldframe = &cl.frame; /* previous frame was dropped or invalid */
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
ops = &oldframe->playerstate;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (j = 0; j < 3; j++)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
b->start[j] = cl.refdef.vieworg[j] + ops->gunoffset[j]
|
2012-07-22 13:34:45 +00:00
|
|
|
+ cl.lerpfrac * (ps->gunoffset[j] - ops->gunoffset[j]);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
VectorMA(b->start, (hand_multiplier * b->offset[0]),
|
|
|
|
cl.v_right, org);
|
|
|
|
VectorMA(org, b->offset[1], cl.v_forward, org);
|
|
|
|
VectorMA(org, b->offset[2], cl.v_up, org);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if ((hand) && (hand->value == 2))
|
|
|
|
{
|
|
|
|
VectorMA(org, -1, cl.v_up, org);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
VectorCopy(cl.v_right, r);
|
|
|
|
VectorCopy(cl.v_forward, f);
|
|
|
|
VectorCopy(cl.v_up, u);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
VectorCopy(b->start, org);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
/* if coming from the player, update the start position */
|
2012-07-22 13:34:45 +00:00
|
|
|
if (b->entity == cl.playernum + 1) /* entity 0 is the world */
|
|
|
|
{
|
|
|
|
VectorCopy(cl.refdef.vieworg, b->start);
|
|
|
|
b->start[2] -= 22; /* adjust for view height */
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
VectorAdd(b->start, b->offset, org);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
/* calculate pitch and yaw */
|
2012-07-22 13:34:45 +00:00
|
|
|
VectorSubtract(b->end, org, dist);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (cl_mod_heatbeam && (b->model == cl_mod_heatbeam) &&
|
|
|
|
(b->entity == cl.playernum + 1))
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
vec_t len;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
len = VectorLength(dist);
|
|
|
|
VectorScale(f, len, dist);
|
|
|
|
VectorMA(dist, (hand_multiplier * b->offset[0]), r, dist);
|
|
|
|
VectorMA(dist, b->offset[1], f, dist);
|
|
|
|
VectorMA(dist, b->offset[2], u, dist);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if ((hand) && (hand->value == 2))
|
|
|
|
{
|
|
|
|
VectorMA(org, -1, cl.v_up, org);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if ((dist[1] == 0) && (dist[0] == 0))
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
yaw = 0;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (dist[2] > 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
pitch = 90;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
pitch = 270;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
if (dist[0])
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-03-02 21:39:50 +00:00
|
|
|
yaw = ((float)atan2(dist[1], dist[0]) * 180 / M_PI);
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else if (dist[1] > 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
yaw = 90;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
yaw = 270;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (yaw < 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
yaw += 360;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
forward = sqrt(dist[0] * dist[0] + dist[1] * dist[1]);
|
2009-03-02 21:39:50 +00:00
|
|
|
pitch = ((float)atan2(dist[2], forward) * -180.0 / M_PI);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (pitch < 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
pitch += 360.0;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (cl_mod_heatbeam && (b->model == cl_mod_heatbeam))
|
|
|
|
{
|
|
|
|
if (b->entity != cl.playernum + 1)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
framenum = 2;
|
|
|
|
ent.angles[0] = -pitch;
|
2009-03-02 21:39:50 +00:00
|
|
|
ent.angles[1] = yaw + 180.0f;
|
2009-02-28 14:41:18 +00:00
|
|
|
ent.angles[2] = 0;
|
|
|
|
AngleVectors(ent.angles, f, r, u);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
/* if it's a non-origin offset, it's a player, so use the hardcoded player offset */
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!VectorCompare(b->offset, vec3_origin))
|
|
|
|
{
|
|
|
|
VectorMA(org, -(b->offset[0]) + 1, r, org);
|
|
|
|
VectorMA(org, -(b->offset[1]), f, org);
|
|
|
|
VectorMA(org, -(b->offset[2]) - 10, u, org);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
/* if it's a monster, do the particle effect */
|
2009-02-28 14:41:18 +00:00
|
|
|
CL_MonsterPlasma_Shell(b->start);
|
|
|
|
}
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
framenum = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
/* if it's the heatbeam, draw the particle effect */
|
2012-07-22 13:34:45 +00:00
|
|
|
if ((cl_mod_heatbeam && (b->model == cl_mod_heatbeam) &&
|
|
|
|
(b->entity == cl.playernum + 1)))
|
|
|
|
{
|
|
|
|
CL_Heatbeam(org, dist);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2010-06-18 14:51:25 +00:00
|
|
|
/* add new entities for the beams */
|
2009-02-28 14:41:18 +00:00
|
|
|
d = VectorNormalize(dist);
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
memset(&ent, 0, sizeof(ent));
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (b->model == cl_mod_heatbeam)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
model_length = 32.0;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
else if (b->model == cl_mod_lightning)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
model_length = 35.0;
|
2012-07-22 13:34:45 +00:00
|
|
|
d -= 20.0; /* correction so it doesn't end in middle of tesla */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
model_length = 30.0;
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
steps = ceil(d / model_length);
|
|
|
|
len = (d - model_length) / (steps - 1);
|
|
|
|
|
|
|
|
/* special case for lightning model .. if the real
|
|
|
|
length is shorter than the model, flip it around
|
|
|
|
& draw it from the end to the start. This prevents
|
|
|
|
the model from going through the tesla mine
|
|
|
|
(instead it goes through the target) */
|
|
|
|
if ((b->model == cl_mod_lightning) && (d <= model_length))
|
|
|
|
{
|
|
|
|
VectorCopy(b->end, ent.origin);
|
2009-02-28 14:41:18 +00:00
|
|
|
ent.model = b->model;
|
|
|
|
ent.flags = RF_FULLBRIGHT;
|
|
|
|
ent.angles[0] = pitch;
|
|
|
|
ent.angles[1] = yaw;
|
2012-07-22 13:34:45 +00:00
|
|
|
ent.angles[2] = (float)(randk() % 360);
|
|
|
|
V_AddEntity(&ent);
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
while (d > 0)
|
|
|
|
{
|
|
|
|
VectorCopy(org, ent.origin);
|
2009-02-28 14:41:18 +00:00
|
|
|
ent.model = b->model;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (cl_mod_heatbeam && (b->model == cl_mod_heatbeam))
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
ent.flags = RF_FULLBRIGHT;
|
|
|
|
ent.angles[0] = -pitch;
|
2009-03-02 21:39:50 +00:00
|
|
|
ent.angles[1] = yaw + 180.0f;
|
|
|
|
ent.angles[2] = (float)((cl.time) % 360);
|
2009-02-28 14:41:18 +00:00
|
|
|
ent.frame = framenum;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
else if (b->model == cl_mod_lightning)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
ent.flags = RF_FULLBRIGHT;
|
|
|
|
ent.angles[0] = -pitch;
|
2009-03-02 21:39:50 +00:00
|
|
|
ent.angles[1] = yaw + 180.0f;
|
2012-07-22 13:34:45 +00:00
|
|
|
ent.angles[2] = (float)(randk() % 360);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
ent.angles[0] = pitch;
|
|
|
|
ent.angles[1] = yaw;
|
2012-07-22 13:34:45 +00:00
|
|
|
ent.angles[2] = (float)(randk() % 360);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
V_AddEntity(&ent);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (j = 0; j < 3; j++)
|
|
|
|
{
|
|
|
|
org[j] += dist[j] * len;
|
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
d -= model_length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_AddExplosions(void)
|
|
|
|
{
|
|
|
|
entity_t *ent;
|
|
|
|
int i;
|
|
|
|
explosion_t *ex;
|
|
|
|
float frac;
|
|
|
|
int f;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
memset(&ent, 0, sizeof(ent));
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0, ex = cl_explosions; i < MAX_EXPLOSIONS; i++, ex++)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
if (ex->type == ex_free)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
frac = (cl.time - ex->start) / 100.0;
|
2009-03-02 21:39:50 +00:00
|
|
|
f = (int)floor(frac);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
ent = &ex->ent;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
switch (ex->type)
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
case ex_mflash:
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (f >= ex->frames - 1)
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->type = ex_free;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
break;
|
2010-06-18 14:51:25 +00:00
|
|
|
case ex_misc:
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (f >= ex->frames - 1)
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->type = ex_free;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
ent->alpha = 1.0f - frac / (ex->frames - 1);
|
2009-02-28 14:41:18 +00:00
|
|
|
break;
|
2010-06-18 14:51:25 +00:00
|
|
|
case ex_flash:
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (f >= 1)
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->type = ex_free;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ent->alpha = 1.0;
|
2009-02-28 14:41:18 +00:00
|
|
|
break;
|
2010-06-18 14:51:25 +00:00
|
|
|
case ex_poly:
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (f >= ex->frames - 1)
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->type = ex_free;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
ent->alpha = (16.0f - (float)f) / 16.0f;
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (f < 10)
|
|
|
|
{
|
|
|
|
ent->skinnum = (f >> 1);
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
if (ent->skinnum < 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ent->skinnum = 0;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ent->flags |= RF_TRANSLUCENT;
|
|
|
|
|
|
|
|
if (f < 13)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ent->skinnum = 5;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ent->skinnum = 6;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
break;
|
2010-06-18 14:51:25 +00:00
|
|
|
case ex_poly2:
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (f >= ex->frames - 1)
|
|
|
|
{
|
2010-06-18 14:51:25 +00:00
|
|
|
ex->type = ex_free;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
ent->alpha = (5.0 - (float)f) / 5.0;
|
2010-06-18 14:51:25 +00:00
|
|
|
ent->skinnum = 0;
|
|
|
|
ent->flags |= RF_TRANSLUCENT;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ex->type == ex_free)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (ex->light)
|
|
|
|
{
|
|
|
|
V_AddLight(ent->origin, ex->light * ent->alpha,
|
|
|
|
ex->lightcolor[0], ex->lightcolor[1], ex->lightcolor[2]);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
VectorCopy(ent->origin, ent->oldorigin);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (f < 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
f = 0;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:51:25 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
ent->frame = ex->baseframe + f + 1;
|
|
|
|
ent->oldframe = ex->baseframe + f;
|
2009-03-02 21:39:50 +00:00
|
|
|
ent->backlerp = 1.0f - cl.lerpfrac;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
V_AddEntity(ent);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_AddLasers(void)
|
|
|
|
{
|
|
|
|
laser_t *l;
|
|
|
|
int i;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0, l = cl_lasers; i < MAX_LASERS; i++, l++)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
if (l->endtime >= cl.time)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
V_AddEntity(&l->ent);
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_ProcessSustain()
|
|
|
|
{
|
|
|
|
cl_sustain_t *s;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0, s = cl_sustains; i < MAX_SUSTAINS; i++, s++)
|
|
|
|
{
|
|
|
|
if (s->id)
|
|
|
|
{
|
|
|
|
if ((s->endtime >= cl.time) && (cl.time >= s->nextthink))
|
|
|
|
{
|
|
|
|
s->think(s);
|
|
|
|
}
|
|
|
|
else if (s->endtime < cl.time)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
s->id = 0;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_AddTEnts(void)
|
|
|
|
{
|
|
|
|
CL_AddBeams();
|
|
|
|
CL_AddPlayerBeams();
|
|
|
|
CL_AddExplosions();
|
|
|
|
CL_AddLasers();
|
2009-02-28 14:41:18 +00:00
|
|
|
CL_ProcessSustain();
|
|
|
|
}
|
2012-07-22 13:34:45 +00:00
|
|
|
|