@ -51,21 +51,13 @@ extern "C"
@@ -51,21 +51,13 @@ extern "C"
{
// HLDM
void EV_FireGlock1 ( struct event_args_s * args ) ;
void EV_FireGlock2 ( struct event_args_s * args ) ;
void EV_FireShotGunSingle ( struct event_args_s * args ) ;
void EV_FireShotGunDouble ( struct event_args_s * args ) ;
void EV_FireMP5 ( struct event_args_s * args ) ;
void EV_FireMP52 ( struct event_args_s * args ) ;
void EV_FirePython ( struct event_args_s * args ) ;
void EV_FireGauss ( struct event_args_s * args ) ;
void EV_SpinGauss ( struct event_args_s * args ) ;
void EV_Crowbar ( struct event_args_s * args ) ;
void EV_FireCrossbow ( struct event_args_s * args ) ;
void EV_FireCrossbow2 ( struct event_args_s * args ) ;
void EV_FireRpg ( struct event_args_s * args ) ;
void EV_EgonFire ( struct event_args_s * args ) ;
void EV_EgonStop ( struct event_args_s * args ) ;
void EV_HornetGunFire ( struct event_args_s * args ) ;
void EV_TripmineFire ( struct event_args_s * args ) ;
void EV_SnarkFire ( struct event_args_s * args ) ;
@ -540,7 +532,8 @@ void EV_FireGlock1( event_args_t *args )
@@ -540,7 +532,8 @@ void EV_FireGlock1( event_args_t *args )
EV_MuzzleFlash ( ) ;
gEngfuncs . pEventAPI - > EV_WeaponAnimation ( empty ? GLOCK_SHOOT_EMPTY : GLOCK_SHOOT , 2 ) ;
V_PunchAxis ( 0 , - 2.0 ) ;
V_PunchAxis ( 0 , - 2.6 ) ;
V_PunchAxis ( 1 , gEngfuncs . pfnRandomFloat ( - 0.7 , 0.7 ) ) ;
}
EV_GetDefaultShellInfo ( args , origin , velocity , ShellVelocity , ShellOrigin , forward , right , up , 20 , - 12 , 4 ) ;
@ -555,52 +548,6 @@ void EV_FireGlock1( event_args_t *args )
@@ -555,52 +548,6 @@ void EV_FireGlock1( event_args_t *args )
EV_HLDM_FireBullets ( idx , forward , right , up , 1 , vecSrc , vecAiming , 8192 , BULLET_PLAYER_9MM , 0 , 0 , args - > fparam1 , args - > fparam2 ) ;
}
void EV_FireGlock2 ( event_args_t * args )
{
int idx ;
vec3_t origin ;
vec3_t angles ;
vec3_t velocity ;
vec3_t ShellVelocity ;
vec3_t ShellOrigin ;
int shell ;
vec3_t vecSrc , vecAiming ;
vec3_t vecSpread ;
vec3_t up , right , forward ;
idx = args - > entindex ;
VectorCopy ( args - > origin , origin ) ;
VectorCopy ( args - > angles , angles ) ;
VectorCopy ( args - > velocity , velocity ) ;
int empty = args - > bparam1 ;
AngleVectors ( angles , forward , right , up ) ;
shell = gEngfuncs . pEventAPI - > EV_FindModelIndex ( " models/shell.mdl " ) ; // brass shell
if ( EV_IsLocal ( idx ) )
{
// Add muzzle flash to current weapon model
EV_MuzzleFlash ( ) ;
gEngfuncs . pEventAPI - > EV_WeaponAnimation ( empty ? GLOCK_SHOOT_EMPTY : GLOCK_SHOOT , 2 ) ;
V_PunchAxis ( 0 , - 2.0 ) ;
}
EV_GetDefaultShellInfo ( args , origin , velocity , ShellVelocity , ShellOrigin , forward , right , up , 20 , - 12 , 4 ) ;
EV_EjectBrass ( ShellOrigin , ShellVelocity , angles [ YAW ] , shell , TE_BOUNCE_SHELL ) ;
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_WEAPON , " weapons/pl_gun3.wav " , gEngfuncs . pfnRandomFloat ( 0.92 , 1.0 ) , ATTN_NORM , 0 , 98 + gEngfuncs . pfnRandomLong ( 0 , 3 ) ) ;
EV_GetGunPosition ( args , vecSrc , origin ) ;
VectorCopy ( forward , vecAiming ) ;
EV_HLDM_FireBullets ( idx , forward , right , up , 1 , vecSrc , vecAiming , 8192 , BULLET_PLAYER_9MM , 0 , & g_tracerCount [ idx - 1 ] , args - > fparam1 , args - > fparam2 ) ;
}
//======================
// GLOCK END
//======================
@ -608,61 +555,6 @@ void EV_FireGlock2( event_args_t *args )
@@ -608,61 +555,6 @@ void EV_FireGlock2( event_args_t *args )
//======================
// SHOTGUN START
//======================
void EV_FireShotGunDouble ( event_args_t * args )
{
int idx ;
vec3_t origin ;
vec3_t angles ;
vec3_t velocity ;
int j ;
vec3_t ShellVelocity ;
vec3_t ShellOrigin ;
int shell ;
vec3_t vecSrc , vecAiming ;
vec3_t vecSpread ;
vec3_t up , right , forward ;
//float flSpread = 0.01;
idx = args - > entindex ;
VectorCopy ( args - > origin , origin ) ;
VectorCopy ( args - > angles , angles ) ;
VectorCopy ( args - > velocity , velocity ) ;
AngleVectors ( angles , forward , right , up ) ;
shell = gEngfuncs . pEventAPI - > EV_FindModelIndex ( " models/shotgunshell.mdl " ) ; // brass shell
if ( EV_IsLocal ( idx ) )
{
// Add muzzle flash to current weapon model
EV_MuzzleFlash ( ) ;
gEngfuncs . pEventAPI - > EV_WeaponAnimation ( SHOTGUN_FIRE2 , 2 ) ;
V_PunchAxis ( 0 , - 10.0 ) ;
}
for ( j = 0 ; j < 2 ; j + + )
{
EV_GetDefaultShellInfo ( args , origin , velocity , ShellVelocity , ShellOrigin , forward , right , up , 32 , - 12 , 6 ) ;
EV_EjectBrass ( ShellOrigin , ShellVelocity , angles [ YAW ] , shell , TE_BOUNCE_SHOTSHELL ) ;
}
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_WEAPON , " weapons/dbarrel1.wav " , gEngfuncs . pfnRandomFloat ( 0.98 , 1.0 ) , ATTN_NORM , 0 , 85 + gEngfuncs . pfnRandomLong ( 0 , 0x1f ) ) ;
EV_GetGunPosition ( args , vecSrc , origin ) ;
VectorCopy ( forward , vecAiming ) ;
if ( gEngfuncs . GetMaxClients ( ) > 1 )
{
EV_HLDM_FireBullets ( idx , forward , right , up , 8 , vecSrc , vecAiming , 2048 , BULLET_PLAYER_BUCKSHOT , 0 , & g_tracerCount [ idx - 1 ] , 0.17365 , 0.04362 ) ;
}
else
{
EV_HLDM_FireBullets ( idx , forward , right , up , 12 , vecSrc , vecAiming , 2048 , BULLET_PLAYER_BUCKSHOT , 0 , & g_tracerCount [ idx - 1 ] , 0.08716 , 0.08716 ) ;
}
}
void EV_FireShotGunSingle ( event_args_t * args )
{
int idx ;
@ -693,26 +585,20 @@ void EV_FireShotGunSingle( event_args_t *args )
@@ -693,26 +585,20 @@ void EV_FireShotGunSingle( event_args_t *args )
EV_MuzzleFlash ( ) ;
gEngfuncs . pEventAPI - > EV_WeaponAnimation ( SHOTGUN_FIRE , 2 ) ;
V_PunchAxis ( 0 , - 5.0 ) ;
V_PunchAxis ( 0 , - 6.0 ) ;
V_PunchAxis ( 1 , gEngfuncs . pfnRandomFloat ( - 2 , 2 ) ) ;
}
EV_GetDefaultShellInfo ( args , origin , velocity , ShellVelocity , ShellOrigin , forward , right , up , 32 , - 12 , 6 ) ;
EV_EjectBrass ( ShellOrigin , ShellVelocity , angles [ YAW ] , shell , TE_BOUNCE_SHOTSHELL ) ;
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_WEAPON , " weapons/sbarrel1.wav " , gEngfuncs . pfnRandomFloat ( 0.95 , 1.0 ) , ATTN_NORM , 0 , 93 + gEngfuncs . pfnRandomLong ( 0 , 0x1f ) ) ;
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_WEAPON , " weapons/sbarrel1.wav " , gEngfuncs . pfnRandomFloat ( 0.95 , 1.0 ) , ATTN_NORM , 0 , 85 + gEngfuncs . pfnRandomLong ( 0 , 31 ) ) ;
EV_GetGunPosition ( args , vecSrc , origin ) ;
VectorCopy ( forward , vecAiming ) ;
if ( gEngfuncs . GetMaxClients ( ) > 1 )
{
EV_HLDM_FireBullets ( idx , forward , right , up , 4 , vecSrc , vecAiming , 2048 , BULLET_PLAYER_BUCKSHOT , 0 , & g_tracerCount [ idx - 1 ] , 0.08716 , 0.04362 ) ;
}
else
{
EV_HLDM_FireBullets ( idx , forward , right , up , 6 , vecSrc , vecAiming , 2048 , BULLET_PLAYER_BUCKSHOT , 0 , & g_tracerCount [ idx - 1 ] , 0.08716 , 0.08716 ) ;
}
EV_HLDM_FireBullets ( idx , forward , right , up , 16 , vecSrc , vecAiming , 2048 , BULLET_PLAYER_BUCKSHOT , 0 , & g_tracerCount [ idx - 1 ] , 0.08716 , 0.04362 ) ;
}
//======================
// SHOTGUN END
@ -750,7 +636,8 @@ void EV_FireMP5( event_args_t *args )
@@ -750,7 +636,8 @@ void EV_FireMP5( event_args_t *args )
EV_MuzzleFlash ( ) ;
gEngfuncs . pEventAPI - > EV_WeaponAnimation ( MP5_FIRE1 + gEngfuncs . pfnRandomLong ( 0 , 2 ) , 2 ) ;
V_PunchAxis ( 0 , gEngfuncs . pfnRandomFloat ( - 2 , 2 ) ) ;
V_PunchAxis ( 0 , gEngfuncs . pfnRandomFloat ( - 1.7 , - 2.3 ) ) ;
V_PunchAxis ( 1 , gEngfuncs . pfnRandomFloat ( - 1 , 1 ) ) ;
}
EV_GetDefaultShellInfo ( args , origin , velocity , ShellVelocity , ShellOrigin , forward , right , up , 20 , - 12 , 4 ) ;
@ -770,14 +657,7 @@ void EV_FireMP5( event_args_t *args )
@@ -770,14 +657,7 @@ void EV_FireMP5( event_args_t *args )
EV_GetGunPosition ( args , vecSrc , origin ) ;
VectorCopy ( forward , vecAiming ) ;
if ( gEngfuncs . GetMaxClients ( ) > 1 )
{
EV_HLDM_FireBullets ( idx , forward , right , up , 1 , vecSrc , vecAiming , 8192 , BULLET_PLAYER_MP5 , 2 , & g_tracerCount [ idx - 1 ] , args - > fparam1 , args - > fparam2 ) ;
}
else
{
EV_HLDM_FireBullets ( idx , forward , right , up , 1 , vecSrc , vecAiming , 8192 , BULLET_PLAYER_MP5 , 2 , & g_tracerCount [ idx - 1 ] , args - > fparam1 , args - > fparam2 ) ;
}
EV_HLDM_FireBullets ( idx , forward , right , up , 1 , vecSrc , vecAiming , 8192 , BULLET_PLAYER_MP5 , 0 , & g_tracerCount [ idx - 1 ] , args - > fparam1 , args - > fparam2 ) ;
}
// We only predict the animation and sound
@ -793,7 +673,7 @@ void EV_FireMP52( event_args_t *args )
@@ -793,7 +673,7 @@ void EV_FireMP52( event_args_t *args )
if ( EV_IsLocal ( idx ) )
{
gEngfuncs . pEventAPI - > EV_WeaponAnimation ( MP5_LAUNCH , 2 ) ;
V_PunchAxis ( 0 , - 10 ) ;
V_PunchAxis ( 0 , - 8 ) ;
}
switch ( gEngfuncs . pfnRandomLong ( 0 , 1 ) )
@ -810,374 +690,6 @@ void EV_FireMP52( event_args_t *args )
@@ -810,374 +690,6 @@ void EV_FireMP52( event_args_t *args )
// MP5 END
//======================
//======================
// PHYTON START
// ( .357 )
//======================
void EV_FirePython ( event_args_t * args )
{
int idx ;
vec3_t origin ;
vec3_t angles ;
vec3_t velocity ;
vec3_t vecSrc , vecAiming ;
vec3_t up , right , forward ;
//float flSpread = 0.01;
idx = args - > entindex ;
VectorCopy ( args - > origin , origin ) ;
VectorCopy ( args - > angles , angles ) ;
VectorCopy ( args - > velocity , velocity ) ;
AngleVectors ( angles , forward , right , up ) ;
if ( EV_IsLocal ( idx ) )
{
// Python uses different body in multiplayer versus single player
int multiplayer = gEngfuncs . GetMaxClients ( ) = = 1 ? 0 : 1 ;
// Add muzzle flash to current weapon model
EV_MuzzleFlash ( ) ;
gEngfuncs . pEventAPI - > EV_WeaponAnimation ( PYTHON_FIRE1 , multiplayer ? 1 : 0 ) ;
V_PunchAxis ( 0 , - 10.0 ) ;
}
switch ( gEngfuncs . pfnRandomLong ( 0 , 1 ) )
{
case 0 :
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_WEAPON , " weapons/357_shot1.wav " , gEngfuncs . pfnRandomFloat ( 0.8 , 0.9 ) , ATTN_NORM , 0 , PITCH_NORM ) ;
break ;
case 1 :
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_WEAPON , " weapons/357_shot2.wav " , gEngfuncs . pfnRandomFloat ( 0.8 , 0.9 ) , ATTN_NORM , 0 , PITCH_NORM ) ;
break ;
}
EV_GetGunPosition ( args , vecSrc , origin ) ;
VectorCopy ( forward , vecAiming ) ;
EV_HLDM_FireBullets ( idx , forward , right , up , 1 , vecSrc , vecAiming , 8192 , BULLET_PLAYER_357 , 0 , 0 , args - > fparam1 , args - > fparam2 ) ;
}
//======================
// PHYTON END
// ( .357 )
//======================
//======================
// GAUSS START
//======================
# define SND_CHANGE_PITCH (1 << 7) // duplicated in protocol.h change sound pitch
void EV_SpinGauss ( event_args_t * args )
{
int idx ;
vec3_t origin ;
vec3_t angles ;
vec3_t velocity ;
int iSoundState = 0 ;
int pitch ;
idx = args - > entindex ;
VectorCopy ( args - > origin , origin ) ;
VectorCopy ( args - > angles , angles ) ;
VectorCopy ( args - > velocity , velocity ) ;
pitch = args - > iparam1 ;
iSoundState = args - > bparam1 ? SND_CHANGE_PITCH : 0 ;
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_WEAPON , " ambience/pulsemachine.wav " , 1.0 , ATTN_NORM , iSoundState , pitch ) ;
}
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
EV_StopPreviousGauss
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
void EV_StopPreviousGauss ( int idx )
{
// Make sure we don't have a gauss spin event in the queue for this guy
gEngfuncs . pEventAPI - > EV_KillEvents ( idx , " events/gaussspin.sc " ) ;
gEngfuncs . pEventAPI - > EV_StopSound ( idx , CHAN_WEAPON , " ambience/pulsemachine.wav " ) ;
}
extern float g_flApplyVel ;
void EV_FireGauss ( event_args_t * args )
{
int idx ;
vec3_t origin ;
vec3_t angles ;
vec3_t velocity ;
float flDamage = args - > fparam1 ;
//int primaryfire = args->bparam1;
int m_fPrimaryFire = args - > bparam1 ;
//int m_iWeaponVolume = GAUSS_PRIMARY_FIRE_VOLUME;
vec3_t vecSrc ;
vec3_t vecDest ;
//edict_t *pentIgnore;
pmtrace_t tr , beam_tr ;
float flMaxFrac = 1.0 ;
//int nTotal = 0;
int fHasPunched = 0 ;
int fFirstBeam = 1 ;
int nMaxHits = 10 ;
physent_t * pEntity ;
int m_iBeam , m_iGlow , m_iBalls ;
vec3_t up , right , forward ;
idx = args - > entindex ;
VectorCopy ( args - > origin , origin ) ;
VectorCopy ( args - > angles , angles ) ;
VectorCopy ( args - > velocity , velocity ) ;
if ( args - > bparam2 )
{
EV_StopPreviousGauss ( idx ) ;
return ;
}
//Con_Printf( "Firing gauss with %f\n", flDamage );
EV_GetGunPosition ( args , vecSrc , origin ) ;
m_iBeam = gEngfuncs . pEventAPI - > EV_FindModelIndex ( " sprites/smoke.spr " ) ;
m_iBalls = m_iGlow = gEngfuncs . pEventAPI - > EV_FindModelIndex ( " sprites/hotglow.spr " ) ;
AngleVectors ( angles , forward , right , up ) ;
VectorMA ( vecSrc , 8192 , forward , vecDest ) ;
if ( EV_IsLocal ( idx ) )
{
V_PunchAxis ( 0 , - 2.0 ) ;
gEngfuncs . pEventAPI - > EV_WeaponAnimation ( GAUSS_FIRE2 , 2 ) ;
if ( m_fPrimaryFire = = false )
g_flApplyVel = flDamage ;
}
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_WEAPON , " weapons/gauss2.wav " , 0.5 + flDamage * ( 1.0 / 400.0 ) , ATTN_NORM , 0 , 85 + gEngfuncs . pfnRandomLong ( 0 , 0x1f ) ) ;
while ( flDamage > 10 & & nMaxHits > 0 )
{
nMaxHits - - ;
gEngfuncs . pEventAPI - > EV_SetUpPlayerPrediction ( false , true ) ;
// Store off the old count
gEngfuncs . pEventAPI - > EV_PushPMStates ( ) ;
// Now add in all of the players.
gEngfuncs . pEventAPI - > EV_SetSolidPlayers ( idx - 1 ) ;
gEngfuncs . pEventAPI - > EV_SetTraceHull ( 2 ) ;
gEngfuncs . pEventAPI - > EV_PlayerTrace ( vecSrc , vecDest , PM_STUDIO_BOX , - 1 , & tr ) ;
gEngfuncs . pEventAPI - > EV_PopPMStates ( ) ;
if ( tr . allsolid )
break ;
if ( fFirstBeam )
{
if ( EV_IsLocal ( idx ) )
{
// Add muzzle flash to current weapon model
EV_MuzzleFlash ( ) ;
}
fFirstBeam = 0 ;
gEngfuncs . pEfxAPI - > R_BeamEntPoint (
idx | 0x1000 ,
tr . endpos ,
m_iBeam ,
0.1 ,
m_fPrimaryFire ? 1.0 : 2.5 ,
0.0 ,
m_fPrimaryFire ? 128.0 : flDamage ,
0 ,
0 ,
0 ,
m_fPrimaryFire ? 255 : 255 ,
m_fPrimaryFire ? 128 : 255 ,
m_fPrimaryFire ? 0 : 255
) ;
}
else
{
gEngfuncs . pEfxAPI - > R_BeamPoints ( vecSrc ,
tr . endpos ,
m_iBeam ,
0.1 ,
m_fPrimaryFire ? 1.0 : 2.5 ,
0.0 ,
m_fPrimaryFire ? 128.0 : flDamage ,
0 ,
0 ,
0 ,
m_fPrimaryFire ? 255 : 255 ,
m_fPrimaryFire ? 128 : 255 ,
m_fPrimaryFire ? 0 : 255
) ;
}
pEntity = gEngfuncs . pEventAPI - > EV_GetPhysent ( tr . ent ) ;
if ( pEntity = = NULL )
break ;
if ( pEntity - > solid = = SOLID_BSP )
{
float n ;
//pentIgnore = NULL;
n = - DotProduct ( tr . plane . normal , forward ) ;
if ( n < 0.5 ) // 60 degrees
{
// ALERT( at_console, "reflect %f\n", n );
// reflect
vec3_t r ;
VectorMA ( forward , 2.0 * n , tr . plane . normal , r ) ;
flMaxFrac = flMaxFrac - tr . fraction ;
VectorCopy ( r , forward ) ;
VectorMA ( tr . endpos , 8.0 , forward , vecSrc ) ;
VectorMA ( vecSrc , 8192.0 , forward , vecDest ) ;
gEngfuncs . pEfxAPI - > R_TempSprite ( tr . endpos , vec3_origin , 0.2 , m_iGlow , kRenderGlow , kRenderFxNoDissipation , flDamage * n / 255.0 , flDamage * n * 0.5 * 0.1 , FTENT_FADEOUT ) ;
vec3_t fwd ;
VectorAdd ( tr . endpos , tr . plane . normal , fwd ) ;
gEngfuncs . pEfxAPI - > R_Sprite_Trail ( TE_SPRITETRAIL , tr . endpos , fwd , m_iBalls , 3 , 0.1 , gEngfuncs . pfnRandomFloat ( 10 , 20 ) / 100.0 , 100 ,
255 , 100 ) ;
// lose energy
if ( n = = 0 )
{
n = 0.1 ;
}
flDamage = flDamage * ( 1 - n ) ;
}
else
{
// tunnel
EV_HLDM_DecalGunshot ( & tr , BULLET_MONSTER_12MM ) ;
gEngfuncs . pEfxAPI - > R_TempSprite ( tr . endpos , vec3_origin , 1.0 , m_iGlow , kRenderGlow , kRenderFxNoDissipation , flDamage / 255.0 , 6.0 , FTENT_FADEOUT ) ;
// limit it to one hole punch
if ( fHasPunched )
{
break ;
}
fHasPunched = 1 ;
// try punching through wall if secondary attack (primary is incapable of breaking through)
if ( ! m_fPrimaryFire )
{
vec3_t start ;
VectorMA ( tr . endpos , 8.0 , forward , start ) ;
// Store off the old count
gEngfuncs . pEventAPI - > EV_PushPMStates ( ) ;
// Now add in all of the players.
gEngfuncs . pEventAPI - > EV_SetSolidPlayers ( idx - 1 ) ;
gEngfuncs . pEventAPI - > EV_SetTraceHull ( 2 ) ;
gEngfuncs . pEventAPI - > EV_PlayerTrace ( start , vecDest , PM_STUDIO_BOX , - 1 , & beam_tr ) ;
if ( ! beam_tr . allsolid )
{
vec3_t delta ;
// trace backwards to find exit point
gEngfuncs . pEventAPI - > EV_PlayerTrace ( beam_tr . endpos , tr . endpos , PM_STUDIO_BOX , - 1 , & beam_tr ) ;
VectorSubtract ( beam_tr . endpos , tr . endpos , delta ) ;
n = Length ( delta ) ;
if ( n < flDamage )
{
if ( n = = 0 )
n = 1 ;
flDamage - = n ;
// absorption balls
{
vec3_t fwd ;
VectorSubtract ( tr . endpos , forward , fwd ) ;
gEngfuncs . pEfxAPI - > R_Sprite_Trail ( TE_SPRITETRAIL , tr . endpos , fwd , m_iBalls , 3 , 0.1 , gEngfuncs . pfnRandomFloat ( 10 , 20 ) / 100.0 , 100 ,
255 , 100 ) ;
}
//////////////////////////////////// WHAT TO DO HERE
// CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3.0 );
EV_HLDM_DecalGunshot ( & beam_tr , BULLET_MONSTER_12MM ) ;
gEngfuncs . pEfxAPI - > R_TempSprite ( beam_tr . endpos , vec3_origin , 0.1 , m_iGlow , kRenderGlow , kRenderFxNoDissipation , flDamage / 255.0 , 6.0 , FTENT_FADEOUT ) ;
// balls
{
vec3_t fwd ;
VectorSubtract ( beam_tr . endpos , forward , fwd ) ;
gEngfuncs . pEfxAPI - > R_Sprite_Trail ( TE_SPRITETRAIL , beam_tr . endpos , fwd , m_iBalls , ( int ) ( flDamage * 0.3 ) , 0.1 , gEngfuncs . pfnRandomFloat ( 10 , 20 ) / 100.0 , 200 ,
255 , 40 ) ;
}
VectorAdd ( beam_tr . endpos , forward , vecSrc ) ;
}
}
else
{
flDamage = 0 ;
}
gEngfuncs . pEventAPI - > EV_PopPMStates ( ) ;
}
else
{
if ( m_fPrimaryFire )
{
// slug doesn't punch through ever with primary
// fire, so leave a little glowy bit and make some balls
gEngfuncs . pEfxAPI - > R_TempSprite ( tr . endpos , vec3_origin , 0.2 , m_iGlow , kRenderGlow , kRenderFxNoDissipation , 200.0 / 255.0 , 0.3 , FTENT_FADEOUT ) ;
{
vec3_t fwd ;
VectorAdd ( tr . endpos , tr . plane . normal , fwd ) ;
gEngfuncs . pEfxAPI - > R_Sprite_Trail ( TE_SPRITETRAIL , tr . endpos , fwd , m_iBalls , 8 , 0.6 , gEngfuncs . pfnRandomFloat ( 10 , 20 ) / 100.0 , 100 ,
255 , 200 ) ;
}
}
flDamage = 0 ;
}
}
}
else
{
VectorAdd ( tr . endpos , forward , vecSrc ) ;
}
}
}
//======================
// GAUSS END
//======================
//======================
// CROWBAR START
//======================
@ -1439,218 +951,6 @@ void EV_FireRpg( event_args_t *args )
@@ -1439,218 +951,6 @@ void EV_FireRpg( event_args_t *args )
// RPG END
//======================
//======================
// EGON END
//======================
enum egon_e
{
EGON_IDLE1 = 0 ,
EGON_FIDGET1 ,
EGON_ALTFIREON ,
EGON_ALTFIRECYCLE ,
EGON_ALTFIREOFF ,
EGON_FIRE1 ,
EGON_FIRE2 ,
EGON_FIRE3 ,
EGON_FIRE4 ,
EGON_DRAW ,
EGON_HOLSTER
} ;
int g_fireAnims1 [ ] = { EGON_FIRE1 , EGON_FIRE2 , EGON_FIRE3 , EGON_FIRE4 } ;
int g_fireAnims2 [ ] = { EGON_ALTFIRECYCLE } ;
enum EGON_FIRESTATE
{
FIRE_OFF ,
FIRE_CHARGE
} ;
enum EGON_FIREMODE
{
FIRE_NARROW ,
FIRE_WIDE
} ;
# define EGON_PRIMARY_VOLUME 450
# define EGON_BEAM_SPRITE "sprites / xbeam1.spr"
# define EGON_FLARE_SPRITE "sprites / XSpark1.spr"
# define EGON_SOUND_OFF "weapons / egon_off1.wav"
# define EGON_SOUND_RUN "weapons / egon_run3.wav"
# define EGON_SOUND_STARTUP "weapons / egon_windup2.wav"
# define ARRAYSIZE(p) ( sizeof(p) / sizeof(p[0]) )
BEAM * pBeam ;
BEAM * pBeam2 ;
void EV_EgonFire ( event_args_t * args )
{
int idx , /*iFireState,*/ iFireMode ;
vec3_t origin ;
idx = args - > entindex ;
VectorCopy ( args - > origin , origin ) ;
//iFireState = args->iparam1;
iFireMode = args - > iparam2 ;
int iStartup = args - > bparam1 ;
if ( iStartup )
{
if ( iFireMode = = FIRE_WIDE )
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_WEAPON , EGON_SOUND_STARTUP , 0.98 , ATTN_NORM , 0 , 125 ) ;
else
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_WEAPON , EGON_SOUND_STARTUP , 0.9 , ATTN_NORM , 0 , 100 ) ;
}
else
{
// If there is any sound playing already, kill it. - Solokiller
// This is necessary because multiple sounds can play on the same channel at the same time.
// In some cases, more than 1 run sound plays when the egon stops firing, in which case only the earliest entry in the list is stopped.
// This ensures no more than 1 of those is ever active at the same time.
gEngfuncs . pEventAPI - > EV_StopSound ( idx , CHAN_STATIC , EGON_SOUND_RUN ) ;
if ( iFireMode = = FIRE_WIDE )
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_STATIC , EGON_SOUND_RUN , 0.98 , ATTN_NORM , 0 , 125 ) ;
else
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_STATIC , EGON_SOUND_RUN , 0.9 , ATTN_NORM , 0 , 100 ) ;
}
//Only play the weapon anims if I shot it.
if ( EV_IsLocal ( idx ) )
gEngfuncs . pEventAPI - > EV_WeaponAnimation ( g_fireAnims1 [ gEngfuncs . pfnRandomLong ( 0 , 3 ) ] , 1 ) ;
if ( iStartup = = 1 & & EV_IsLocal ( idx ) & & ! pBeam & & ! pBeam2 & & cl_lw - > value ) //Adrian: Added the cl_lw check for those lital people that hate weapon prediction.
{
vec3_t vecSrc , vecEnd , angles , forward , right , up ;
pmtrace_t tr ;
cl_entity_t * pl = gEngfuncs . GetEntityByIndex ( idx ) ;
if ( pl )
{
VectorCopy ( gHUD . m_vecAngles , angles ) ;
AngleVectors ( angles , forward , right , up ) ;
EV_GetGunPosition ( args , vecSrc , pl - > origin ) ;
VectorMA ( vecSrc , 2048 , forward , vecEnd ) ;
gEngfuncs . pEventAPI - > EV_SetUpPlayerPrediction ( false , true ) ;
// Store off the old count
gEngfuncs . pEventAPI - > EV_PushPMStates ( ) ;
// Now add in all of the players.
gEngfuncs . pEventAPI - > EV_SetSolidPlayers ( idx - 1 ) ;
gEngfuncs . pEventAPI - > EV_SetTraceHull ( 2 ) ;
gEngfuncs . pEventAPI - > EV_PlayerTrace ( vecSrc , vecEnd , PM_STUDIO_BOX , - 1 , & tr ) ;
gEngfuncs . pEventAPI - > EV_PopPMStates ( ) ;
int iBeamModelIndex = gEngfuncs . pEventAPI - > EV_FindModelIndex ( EGON_BEAM_SPRITE ) ;
float r = 50.0f ;
float g = 50.0f ;
float b = 125.0f ;
if ( IEngineStudio . IsHardware ( ) )
{
r / = 100.0f ;
g / = 100.0f ;
}
pBeam = gEngfuncs . pEfxAPI - > R_BeamEntPoint ( idx | 0x1000 , tr . endpos , iBeamModelIndex , 99999 , 3.5 , 0.2 , 0.7 , 55 , 0 , 0 , r , g , b ) ;
if ( pBeam )
pBeam - > flags | = ( FBEAM_SINENOISE ) ;
pBeam2 = gEngfuncs . pEfxAPI - > R_BeamEntPoint ( idx | 0x1000 , tr . endpos , iBeamModelIndex , 99999 , 5.0 , 0.08 , 0.7 , 25 , 0 , 0 , r , g , b ) ;
}
}
}
void EV_EgonStop ( event_args_t * args )
{
int idx ;
vec3_t origin ;
idx = args - > entindex ;
VectorCopy ( args - > origin , origin ) ;
gEngfuncs . pEventAPI - > EV_StopSound ( idx , CHAN_STATIC , EGON_SOUND_RUN ) ;
if ( args - > iparam1 )
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_WEAPON , EGON_SOUND_OFF , 0.98 , ATTN_NORM , 0 , 100 ) ;
if ( EV_IsLocal ( idx ) )
{
if ( pBeam )
{
pBeam - > die = 0.0 ;
pBeam = NULL ;
}
if ( pBeam2 )
{
pBeam2 - > die = 0.0 ;
pBeam2 = NULL ;
}
}
}
//======================
// EGON END
//======================
//======================
// HORNET START
//======================
enum hgun_e
{
HGUN_IDLE1 = 0 ,
HGUN_FIDGETSWAY ,
HGUN_FIDGETSHAKE ,
HGUN_DOWN ,
HGUN_UP ,
HGUN_SHOOT
} ;
void EV_HornetGunFire ( event_args_t * args )
{
int idx ; //, iFireMode;
vec3_t origin , angles , vecSrc , forward , right , up ;
idx = args - > entindex ;
VectorCopy ( args - > origin , origin ) ;
VectorCopy ( args - > angles , angles ) ;
//iFireMode = args->iparam1;
//Only play the weapon anims if I shot it.
if ( EV_IsLocal ( idx ) )
{
V_PunchAxis ( 0 , gEngfuncs . pfnRandomLong ( 0 , 2 ) ) ;
gEngfuncs . pEventAPI - > EV_WeaponAnimation ( HGUN_SHOOT , 1 ) ;
}
switch ( gEngfuncs . pfnRandomLong ( 0 , 2 ) )
{
case 0 :
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_WEAPON , " agrunt/ag_fire1.wav " , 1 , ATTN_NORM , 0 , 100 ) ;
break ;
case 1 :
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_WEAPON , " agrunt/ag_fire2.wav " , 1 , ATTN_NORM , 0 , 100 ) ;
break ;
case 2 :
gEngfuncs . pEventAPI - > EV_PlaySound ( idx , origin , CHAN_WEAPON , " agrunt/ag_fire3.wav " , 1 , ATTN_NORM , 0 , 100 ) ;
break ;
}
}
//======================
// HORNET END
//======================
//======================
// TRIPMINE START
//======================
@ -1758,7 +1058,7 @@ void EV_SnarkFire( event_args_t *args )
@@ -1758,7 +1058,7 @@ void EV_SnarkFire( event_args_t *args )
//======================
// SQUEAK END
//======================
# define SND_CHANGE_PITCH (1 << 7) // duplicated in protocol.h change sound pitch
void EV_TrainPitchAdjust ( event_args_t * args )
{
int idx ;
@ -1867,7 +1167,8 @@ void EV_FireAK47( struct event_args_s *args )
@@ -1867,7 +1167,8 @@ void EV_FireAK47( struct event_args_s *args )
EV_MuzzleFlash ( ) ;
gEngfuncs . pEventAPI - > EV_WeaponAnimation ( AK47_FIRE1 + gEngfuncs . pfnRandomLong ( 0 , 2 ) , 2 ) ;
V_PunchAxis ( 0 , gEngfuncs . pfnRandomFloat ( - 2 , 2 ) ) ;
V_PunchAxis ( 0 , gEngfuncs . pfnRandomFloat ( - 2.5 , - 3.2 ) ) ;
V_PunchAxis ( 1 , gEngfuncs . pfnRandomFloat ( - 1.5 , 1.5 ) ) ;
}
EV_GetDefaultShellInfo ( args , origin , velocity , ShellVelocity , ShellOrigin , forward , right , up , 20 , - 12 , 4 ) ;
@ -1890,14 +1191,7 @@ void EV_FireAK47( struct event_args_s *args )
@@ -1890,14 +1191,7 @@ void EV_FireAK47( struct event_args_s *args )
EV_GetGunPosition ( args , vecSrc , origin ) ;
VectorCopy ( forward , vecAiming ) ;
if ( gEngfuncs . GetMaxClients ( ) > 1 )
{
EV_HLDM_FireBullets ( idx , forward , right , up , 1 , vecSrc , vecAiming , 8192 , BULLET_PLAYER_AK47 , 2 , & g_tracerCount [ idx - 1 ] , args - > fparam1 , args - > fparam2 ) ;
}
else
{
EV_HLDM_FireBullets ( idx , forward , right , up , 1 , vecSrc , vecAiming , 8192 , BULLET_PLAYER_AK47 , 2 , & g_tracerCount [ idx - 1 ] , args - > fparam1 , args - > fparam2 ) ;
}
EV_HLDM_FireBullets ( idx , forward , right , up , 1 , vecSrc , vecAiming , 8192 , BULLET_PLAYER_AK47 , 0 , & g_tracerCount [ idx - 1 ] , args - > fparam1 , args - > fparam2 ) ;
}
//======================
// AK47 END
@ -1947,7 +1241,8 @@ void EV_FireMac10( struct event_args_s *args )
@@ -1947,7 +1241,8 @@ void EV_FireMac10( struct event_args_s *args )
EV_MuzzleFlash ( ) ;
gEngfuncs . pEventAPI - > EV_WeaponAnimation ( MAC10_FIRE1 + gEngfuncs . pfnRandomLong ( 0 , 2 ) , 2 ) ;
V_PunchAxis ( 0 , gEngfuncs . pfnRandomFloat ( - 2 , 2 ) ) ;
V_PunchAxis ( 0 , gEngfuncs . pfnRandomFloat ( - 1.4 , - 2 ) ) ;
V_PunchAxis ( 1 , gEngfuncs . pfnRandomFloat ( - 1.6 , 1.6 ) ) ;
}
EV_GetDefaultShellInfo ( args , origin , velocity , ShellVelocity , ShellOrigin , forward , right , up , 20 , - 12 , 4 ) ;
@ -1970,14 +1265,7 @@ void EV_FireMac10( struct event_args_s *args )
@@ -1970,14 +1265,7 @@ void EV_FireMac10( struct event_args_s *args )
EV_GetGunPosition ( args , vecSrc , origin ) ;
VectorCopy ( forward , vecAiming ) ;
if ( gEngfuncs . GetMaxClients ( ) > 1 )
{
EV_HLDM_FireBullets ( idx , forward , right , up , 1 , vecSrc , vecAiming , 8192 , BULLET_PLAYER_MAC10 , 2 , & g_tracerCount [ idx - 1 ] , args - > fparam1 , args - > fparam2 ) ;
}
else
{
EV_HLDM_FireBullets ( idx , forward , right , up , 1 , vecSrc , vecAiming , 8192 , BULLET_PLAYER_MAC10 , 2 , & g_tracerCount [ idx - 1 ] , args - > fparam1 , args - > fparam2 ) ;
}
EV_HLDM_FireBullets ( idx , forward , right , up , 1 , vecSrc , vecAiming , 8192 , BULLET_PLAYER_MAC10 , 0 , & g_tracerCount [ idx - 1 ] , args - > fparam1 , args - > fparam2 ) ;
}
//======================
// MAC10 END