thirtyflightsofloving/client/cl_lights.c

1021 lines
32 KiB
C

/*
===========================================================================
Copyright (C) 1997-2001 Id Software, Inc.
This file is part of Quake 2 source code.
Quake 2 source code 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.
Quake 2 source code 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 Quake 2 source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// cl_lights.c -- light style, dynamic light, and muzzle flash parsing and management
// moved from cl_fx.c
#include "client.h"
void CL_LogoutEffect (vec3_t org, int type);
void CL_GunSmokeEffect (vec3_t org, vec3_t dir);
/*
==============================================================
LIGHT STYLE MANAGEMENT
==============================================================
*/
typedef struct
{
int length;
float value[3];
float map[MAX_QPATH];
} clightstyle_t;
clightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
int lastofs;
/*
================
CL_ClearLightStyles
================
*/
void CL_ClearLightStyles (void)
{
memset (cl_lightstyle, 0, sizeof(cl_lightstyle));
lastofs = -1;
}
/*
================
CL_RunLightStyles
================
*/
void CL_RunLightStyles (void)
{
int ofs;
int i;
clightstyle_t *ls;
ofs = cl.time / 100;
if (ofs == lastofs)
return;
lastofs = ofs;
for (i=0,ls=cl_lightstyle ; i<MAX_LIGHTSTYLES ; i++, ls++)
{
if (!ls->length)
{
ls->value[0] = ls->value[1] = ls->value[2] = 1.0;
continue;
}
if (ls->length == 1)
ls->value[0] = ls->value[1] = ls->value[2] = ls->map[0];
else
ls->value[0] = ls->value[1] = ls->value[2] = ls->map[ofs%ls->length];
}
}
void CL_SetLightstyle (int i)
{
char *s;
int j, k;
// Knightmare- BIG UGLY HACK for old connected to server using old protocol
// Changed config strings require different parsing
if ( LegacyProtocol() )
s = cl.configstrings[i+OLD_CS_LIGHTS];
else
s = cl.configstrings[i+CS_LIGHTS];
j = (int)strlen (s);
if (j >= MAX_QPATH)
Com_Error (ERR_DROP, "svc_lightstyle length=%i", j);
cl_lightstyle[i].length = j;
for (k=0 ; k<j ; k++)
cl_lightstyle[i].map[k] = (float)(s[k]-'a')/(float)('m'-'a');
}
/*
================
CL_AddLightStyles
================
*/
void CL_AddLightStyles (void)
{
int i;
clightstyle_t *ls;
for (i=0,ls=cl_lightstyle ; i<MAX_LIGHTSTYLES ; i++, ls++)
V_AddLightStyle (i, ls->value[0], ls->value[1], ls->value[2]);
}
/*
==============================================================
DLIGHT MANAGEMENT
==============================================================
*/
cdlight_t cl_dlights[MAX_DLIGHTS];
/*
================
CL_ClearDlights
================
*/
void CL_ClearDlights (void)
{
memset (cl_dlights, 0, sizeof(cl_dlights));
}
/*
===============
CL_AllocDlight
===============
*/
cdlight_t *CL_AllocDlight (int key)
{
int i;
cdlight_t *dl;
// first look for an exact key match
if (key)
{
dl = cl_dlights;
for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
{
if (dl->key == key)
{
memset (dl, 0, sizeof(*dl));
dl->key = key;
return dl;
}
}
}
// then look for anything else
dl = cl_dlights;
for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
{
if (dl->die < cl.time)
{
memset (dl, 0, sizeof(*dl));
dl->key = key;
return dl;
}
}
dl = &cl_dlights[0];
memset (dl, 0, sizeof(*dl));
dl->key = key;
return dl;
}
/*
===============
CL_NewDlight
===============
*/
void CL_NewDlight (int key, float x, float y, float z, float radius, float time)
{
cdlight_t *dl;
dl = CL_AllocDlight (key);
dl->origin[0] = x;
dl->origin[1] = y;
dl->origin[2] = z;
dl->radius = radius;
dl->die = cl.time + time;
}
/*
===============
CL_RunDLights
===============
*/
void CL_RunDLights (void)
{
int i;
cdlight_t *dl;
dl = cl_dlights;
for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
{
if (!dl->radius)
continue;
if (dl->die < cl.time)
{
dl->radius = 0;
// return;
continue; // MH bugfix
}
dl->radius -= cls.renderFrameTime*dl->decay;
if (dl->radius < 0)
dl->radius = 0;
}
}
/*
===============
CL_AddDLights
===============
*/
void CL_AddDLights (void)
{
int i;
cdlight_t *dl;
dl = cl_dlights;
for (i=0; i<MAX_DLIGHTS; i++, dl++)
{
if (!dl->radius)
continue;
V_AddLight (dl->origin, dl->radius,
dl->color[0], dl->color[1], dl->color[2]);
}
}
/*
==============
CL_ParseMuzzleFlash
==============
*/
void CL_ParseMuzzleFlash (void)
{
vec3_t fv, rv;
cdlight_t *dl;
int i, weapon;
centity_t *pl;
int silenced;
float volume;
char soundname[64];
i = (unsigned short)MSG_ReadShort (&net_message); // Knightmare- make sure this doesn't turn negative!
if (i < 1 || i >= MAX_EDICTS)
Com_Error (ERR_DROP, "CL_ParseMuzzleFlash: bad entity");
weapon = MSG_ReadByte (&net_message);
// TODO: Use index 127 as a flag to read a short for the extended index
/* if ( !LegacyProtocol() && ((weapon & MZ_SEND_SHORT) == MZ_SEND_SHORT) ) {
weapon = (unsigned short)MSG_ReadShort (&net_message);
silenced = weapon & MZ_SILENCED_HI;
weapon &= ~MZ_SILENCED_HI;
}
else { */
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);
if (silenced)
dl->radius = 100 + (rand()&31);
else
dl->radius = 200 + (rand()&31);
dl->minlight = 32;
dl->die = cl.time; // + 0.1;
if (silenced)
volume = 0.2;
else
volume = 1;
switch (weapon)
{
case MZ_BLASTER:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0.15;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/blastf1a.wav"), volume, ATTN_NORM, 0);
break;
case MZ_BLUEHYPERBLASTER:
dl->color[0] = 0.15;dl->color[1] = 0.15;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.15;
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;
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
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.1);
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:
dl->radius = 200 + (rand()&31);
dl->color[0] = 1;dl->color[1] = 0.25;dl->color[2] = 0;
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
break;
case MZ_CHAINGUN2:
dl->radius = 225 + (rand()&31);
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0;
dl->die = cl.time + 0.1; // long delay
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.05);
break;
case MZ_CHAINGUN3:
dl->radius = 250 + (rand()&31);
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
dl->die = cl.time + 0.1; // long delay
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.033);
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.066);
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.1);
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.1);
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.0;
//Knightmare changed
// S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0);
// S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("misc/tele1.wav"), 1, ATTN_NORM, 0);
S_StartSound (NULL, i, CHAN_WEAPON, clMedia.sfx_player_teleport, 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.0;
//Knightmare changed
// S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0);
// S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("misc/tele1.wav"), 1, ATTN_NORM, 0);
S_StartSound (NULL, i, CHAN_WEAPON, clMedia.sfx_player_teleport, 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;
// RAFAEL
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;
// RAFAEL
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;
// ======================
// PGM
case MZ_ETF_RIFLE:
dl->color[0] = 0.9;dl->color[1] = 0.7;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;
// S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/bfg__l1a.wav"), volume, ATTN_NORM, 0);
break;
case MZ_BLASTER2:
dl->color[0] = 0.15;dl->color[1] = 1;dl->color[2] = 0.15;
// FIXME - different sound for blaster2 ??
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;
// PGM
// ======================
// Knightmare 1/3/2002- blue blaster and green hyperblaster and red blaster and hyperblaster
case MZ_BLUEBLASTER:
dl->color[0] = 0.15;dl->color[1] = 0.15;dl->color[2] = 1;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/blastf1a.wav"), volume, ATTN_NORM, 0);
break;
case MZ_GREENHYPERBLASTER:
dl->color[0] = 0.15;dl->color[1] = 1;dl->color[2] = 0.15;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/hyprbf1a.wav"), volume, ATTN_NORM, 0);
break;
case MZ_REDBLASTER:
dl->color[0] = 1;dl->color[1] = 0.15;dl->color[2] = 0.15;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/blastf1a.wav"), volume, ATTN_NORM, 0);
break;
case MZ_REDHYPERBLASTER:
dl->color[0] = 1;dl->color[1] = 0.15;dl->color[2] = 0.15;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/hyprbf1a.wav"), volume, ATTN_NORM, 0);
break;
case MZ_PLASMA_RIFLE_BOUNCE:
dl->color[0] = 0.15;dl->color[1] = 0.15;dl->color[2] = 1;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/plasma/fire1.wav"), volume, ATTN_NORM, 0);
break;
case MZ_PLASMA_RIFLE_SPREAD:
dl->color[0] = 0.15;dl->color[1] = 0.15;dl->color[2] = 1;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/plasma/fire2.wav"), volume, ATTN_NORM, 0);
break;
// end Knightmare
}
}
/*
==============
CL_ParseMuzzleFlash2
==============
*/
void CL_ParseMuzzleFlash2 (void)
{
int ent;
vec3_t origin;
int flash_number, modifier = -1;
cdlight_t *dl;
vec3_t forward, right;
char soundname[64];
ent = (unsigned short)MSG_ReadShort (&net_message); // Knightmare- make sure this doesn't turn negative!
if (ent < 1 || ent >= MAX_EDICTS)
Com_Error (ERR_DROP, "CL_ParseMuzzleFlash2: bad entity");
flash_number = MSG_ReadByte (&net_message);
// Use index 255 as a flag to read a short for the real extended index
if ( !LegacyProtocol() && (flash_number == MZ2_SEND_SHORT) ) {
flash_number = (unsigned short)MSG_ReadShort (&net_message);
modifier = MSG_ReadByte (&net_message);
}
// locate the origin
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);
dl->radius = 200 + (rand()&31);
dl->minlight = 32;
dl->die = cl.time; // + 0.1;
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_GunSmokeEffect (origin, vec3_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_GunSmokeEffect (origin, vec3_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_GunSmokeEffect (origin, vec3_origin);
#ifdef NOTTHIRTYFLIGHTS
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("gunner/gunatck2.wav"), 1, ATTN_NORM, 0);
#endif
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: // PGM
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
CL_GunSmokeEffect (origin, vec3_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: // PMM
case MZ2_CARRIER_MACHINEGUN_L2: // PMM
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
CL_GunSmokeEffect (origin, vec3_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: // PGM
// dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
if (modifier < 0) // default
{ dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; }
else if (modifier == 1) // green
{ dl->color[0] = 0.15;dl->color[1] = 1;dl->color[2] = 0.15; }
else if (modifier == 2) // blue
{ dl->color[0] = 0.15;dl->color[1] = 0.15;dl->color[2] = 1; }
else if (modifier == 3) // red
{ dl->color[0] = 1;dl->color[1] = 0.15;dl->color[2] = 0.15; }
else // orange
{ 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;
if (modifier < 0) // default
{ dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; }
else if (modifier == 1) // green
{ dl->color[0] = 0.15;dl->color[1] = 1;dl->color[2] = 0.15; }
else if (modifier == 2) // blue
{ dl->color[0] = 0.15;dl->color[1] = 0.15;dl->color[2] = 1; }
else if (modifier == 3) // red
{ dl->color[0] = 1;dl->color[1] = 0.15;dl->color[2] = 0.15; }
else // orange
{ 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;
if (modifier < 0) // default
{ dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; }
else if (modifier == 1) // green
{ dl->color[0] = 0.15;dl->color[1] = 1;dl->color[2] = 0.15; }
else if (modifier == 2) // blue
{ dl->color[0] = 0.15;dl->color[1] = 0.15;dl->color[2] = 1; }
else if (modifier == 3) // red
{ dl->color[0] = 1;dl->color[1] = 0.15;dl->color[2] = 0.15; }
else // orange
{ 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;
if (modifier < 0) // default
{ dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; }
else if (modifier == 1) // green
{ dl->color[0] = 0.15;dl->color[1] = 1;dl->color[2] = 0.15; }
else if (modifier == 2) // blue
{ dl->color[0] = 0.15;dl->color[1] = 0.15;dl->color[2] = 1; }
else if (modifier == 3) // red
{ dl->color[0] = 1;dl->color[1] = 0.15;dl->color[2] = 0.15; }
else // orange
{ 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;
if (modifier < 0) // default
{ dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; }
else if (modifier == 1) // green
{ dl->color[0] = 0.15;dl->color[1] = 1;dl->color[2] = 0.15; }
else if (modifier == 2) // blue
{ dl->color[0] = 0.15;dl->color[1] = 0.15;dl->color[2] = 1; }
else if (modifier == 3) // red
{ dl->color[0] = 1;dl->color[1] = 0.15;dl->color[2] = 0.15; }
else // orange
{ 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_GunSmokeEffect (origin, vec3_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;
if (modifier < 0) // default
{ dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; }
else if (modifier == 1) // green
{ dl->color[0] = 0.15;dl->color[1] = 1;dl->color[2] = 0.15; }
else if (modifier == 2) // blue
{ dl->color[0] = 0.15;dl->color[1] = 0.15;dl->color[2] = 1; }
else if (modifier == 3) // red
{ dl->color[0] = 1;dl->color[1] = 0.15;dl->color[2] = 0.15; }
else // orange
{ 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_GunSmokeEffect (origin, vec3_origin);
Com_sprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav", 'a' + rand() % 5);
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound(soundname), 1, ATTN_NORM, 0);
break;
case MZ2_CHICK_ROCKET_1:
case MZ2_TURRET_ROCKET: // PGM
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0.2;
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.5;dl->color[2] = 0.2;
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:
// case MZ2_CARRIER_ROCKET_2:
// case MZ2_CARRIER_ROCKET_3:
// case MZ2_CARRIER_ROCKET_4:
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0.2;
#ifdef NOTTHIRTYFLIGHTS
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/rocket.wav"), 1, ATTN_NORM, 0);
#endif
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;
#ifdef NOTTHIRTYFLIGHTS
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("gunner/gunatck3.wav"), 1, ATTN_NORM, 0);
#endif
break;
case MZ2_GLADIATOR_RAILGUN_1:
// PMM
case MZ2_CARRIER_RAILGUN:
case MZ2_WIDOW_RAIL:
// pmm
dl->color[0] = 0.5;dl->color[1] = 0.5;dl->color[2] = 1.0;
break;
// --- Xian's shit starts ---
case MZ2_MAKRON_BFG:
dl->color[0] = 0.5;dl->color[1] = 1 ;dl->color[2] = 0.5;
//S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("makron/bfg_fire.wav"), 1, ATTN_NORM, 0);
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;
if (modifier < 0) // default
{ dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; }
else if (modifier == 1) // green
{ dl->color[0] = 0.15;dl->color[1] = 1;dl->color[2] = 0.15; }
else if (modifier == 2) // blue
{ dl->color[0] = 0.15;dl->color[1] = 0.15;dl->color[2] = 1; }
else if (modifier == 3) // red
{ dl->color[0] = 1;dl->color[1] = 0.15;dl->color[2] = 0.15; }
else // orange
{ 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_GunSmokeEffect (origin, vec3_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_GunSmokeEffect (origin, vec3_origin);
break;
case MZ2_JORG_BFG_1:
dl->color[0] = 0.5;dl->color[1] = 1;dl->color[2] = 0.5;
break;
// --- Xian's shit ends ---
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: // PMM
case MZ2_CARRIER_MACHINEGUN_R2: // PMM
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
CL_GunSmokeEffect (origin, vec3_origin);
break;
// ======
// ROGUE
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.15;dl->color[1] = 1;dl->color[2] = 0.15;
if (modifier < 0) // default
{ dl->color[0] = 0.15;dl->color[1] = 1;dl->color[2] = 0.15; }
else if (modifier == 1) // green
{ dl->color[0] = 0.15;dl->color[1] = 1;dl->color[2] = 0.15; }
else if (modifier == 2) // blue
{ dl->color[0] = 0.15;dl->color[1] = 0.15;dl->color[2] = 1; }
else if (modifier == 3) // red
{ dl->color[0] = 1;dl->color[1] = 0.15;dl->color[2] = 0.15; }
else // orange
{ 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_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:
dl->radius = 300 + (rand()&100);
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
dl->die = cl.time + 200;
break;
// ROGUE
// ======
// Knightmare added
case MZ2_SOLDIER_IONRIPPER_1:
case MZ2_SOLDIER_IONRIPPER_2:
case MZ2_SOLDIER_IONRIPPER_3:
case MZ2_SOLDIER_IONRIPPER_4:
case MZ2_SOLDIER_IONRIPPER_5:
case MZ2_SOLDIER_IONRIPPER_6:
case MZ2_SOLDIER_IONRIPPER_7:
case MZ2_SOLDIER_IONRIPPER_8:
dl->color[0] = 1;dl->color[1] = 0.5; dl->color[2] = 0.5;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("weapons/rippfire.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_SOLDIER_HYPERBLASTER_1:
case MZ2_SOLDIER_HYPERBLASTER_2:
case MZ2_SOLDIER_HYPERBLASTER_3:
case MZ2_SOLDIER_HYPERBLASTER_4:
case MZ2_SOLDIER_HYPERBLASTER_5:
case MZ2_SOLDIER_HYPERBLASTER_6:
case MZ2_SOLDIER_HYPERBLASTER_7:
case MZ2_SOLDIER_HYPERBLASTER_8:
if (modifier < 0) // default
{ dl->color[0] = 0.15;dl->color[1] = 0.15;dl->color[2] = 1; }
else if (modifier == 1) // green
{ dl->color[0] = 0.15;dl->color[1] = 1;dl->color[2] = 0.15; }
else if (modifier == 2) // blue
{ dl->color[0] = 0.15;dl->color[1] = 0.15;dl->color[2] = 1; }
else if (modifier == 3) // red
{ dl->color[0] = 1;dl->color[1] = 0.15;dl->color[2] = 0.15; }
else // orange
{ dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; }
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("weapons/hyprbf1a.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_GLADBETA_PHALANX_1:
dl->color[0] = 1;dl->color[1] = 0.5; dl->color[2] = 0.5;
break;
case MZ2_TURRET_RAILGUN_1:
dl->color[0] = 0.5;dl->color[1] = 0.5;dl->color[2] = 1.0;
break;
case MZ2_GUNNER_ETF_RIFLE_1:
case MZ2_GUNNER_ETF_RIFLE_2:
case MZ2_GUNNER_ETF_RIFLE_3:
case MZ2_GUNNER_ETF_RIFLE_4:
case MZ2_GUNNER_ETF_RIFLE_5:
case MZ2_GUNNER_ETF_RIFLE_6:
case MZ2_GUNNER_ETF_RIFLE_7:
case MZ2_GUNNER_ETF_RIFLE_8:
dl->color[0] = 0.9;dl->color[1] = 0.7;dl->color[2] = 0;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("weapons/nail1.wav"), 1, ATTN_NORM, 0);
break;
case MZ2_SOLDIER_PLASMA_RIFLE_1:
case MZ2_SOLDIER_PLASMA_RIFLE_2:
case MZ2_SOLDIER_PLASMA_RIFLE_3:
case MZ2_SOLDIER_PLASMA_RIFLE_4:
case MZ2_SOLDIER_PLASMA_RIFLE_5:
case MZ2_SOLDIER_PLASMA_RIFLE_6:
case MZ2_SOLDIER_PLASMA_RIFLE_7:
case MZ2_SOLDIER_PLASMA_RIFLE_8:
dl->color[0] = 0.15;dl->color[1] = 0.15;dl->color[2] = 1;
if (modifier == 1)
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("weapons/plasma/fire2.wav"), 1, ATTN_NORM, 0);
else
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("weapons/plasma/fire1.wav"), 1, ATTN_NORM, 0);
break;
// end Knightmare
}
}