@ -56,7 +56,6 @@ void CDisplacerBall::Spawn(void)
pev - > frame = 0 ;
pev - > frame = 0 ;
pev - > scale = 0.75 ;
pev - > scale = 0.75 ;
SetTouch ( & CDisplacerBall : : Touch ) ;
SetThink ( & CDisplacerBall : : FlyThink ) ;
SetThink ( & CDisplacerBall : : FlyThink ) ;
pev - > nextthink = gpGlobals - > time + 0.2 ;
pev - > nextthink = gpGlobals - > time + 0.2 ;
UTIL_SetSize ( pev , Vector ( 0 , 0 , 0 ) , Vector ( 0 , 0 , 0 ) ) ;
UTIL_SetSize ( pev , Vector ( 0 , 0 , 0 ) , Vector ( 0 , 0 , 0 ) ) ;
@ -154,9 +153,7 @@ void CDisplacerBall::SelfCreate(entvars_t *pevOwner,Vector vecStart)
void CDisplacerBall : : Touch ( CBaseEntity * pOther )
void CDisplacerBall : : Touch ( CBaseEntity * pOther )
{
{
// Do not collide with the owner.
pev - > velocity = g_vecZero ;
if ( ENT ( pOther - > pev ) = = pev - > owner | | ( ENT ( pOther - > pev ) = = VARS ( pev - > owner ) - > owner ) )
return ;
TraceResult tr ;
TraceResult tr ;
Vector vecSpot ;
Vector vecSpot ;
@ -164,11 +161,7 @@ void CDisplacerBall::Touch(CBaseEntity *pOther)
pev - > enemy = pOther - > edict ( ) ;
pev - > enemy = pOther - > edict ( ) ;
CBaseEntity * pTarget = NULL ;
CBaseEntity * pTarget = NULL ;
if ( ! pOther - > pev - > takedamage )
EMIT_SOUND ( ENT ( pev ) , CHAN_WEAPON , " weapons/displacer_impact.wav " , 0.9f , ATTN_NORM ) ;
{
EMIT_SOUND_DYN ( ENT ( pev ) , CHAN_WEAPON , " weapons/displacer_impact.wav " , 1 , ATTN_NORM , 0 , 100 ) ;
UTIL_MuzzleLight ( pOther - > pev - > origin , 160.0f , 255 , 180 , 96 , 1.0f , 100.0f ) ;
}
if ( ( g_pGameRules - > IsMultiplayer ( ) & & ! g_pGameRules - > IsCoOp ( ) ) & & pOther - > IsPlayer ( ) )
if ( ( g_pGameRules - > IsMultiplayer ( ) & & ! g_pGameRules - > IsCoOp ( ) ) & & pOther - > IsPlayer ( ) )
{
{
@ -219,7 +212,7 @@ void CDisplacerBall::Circle( void )
WRITE_COORD ( pev - > origin . z ) ;
WRITE_COORD ( pev - > origin . z ) ;
WRITE_COORD ( pev - > origin . x ) ;
WRITE_COORD ( pev - > origin . x ) ;
WRITE_COORD ( pev - > origin . y ) ;
WRITE_COORD ( pev - > origin . y ) ;
WRITE_COORD ( pev - > origin . z + 800 ) ; // reach damage radius over .2 seconds
WRITE_COORD ( pev - > origin . z + 800.0f ) ; // reach damage radius over .2 seconds
WRITE_SHORT ( iRingSprite ) ;
WRITE_SHORT ( iRingSprite ) ;
WRITE_BYTE ( 0 ) ; // startframe
WRITE_BYTE ( 0 ) ; // startframe
WRITE_BYTE ( 0 ) ; // framerate
WRITE_BYTE ( 0 ) ; // framerate
@ -237,8 +230,6 @@ void CDisplacerBall::Circle( void )
void CDisplacerBall : : KillThink ( void )
void CDisplacerBall : : KillThink ( void )
{
{
if ( pRemoveEnt )
UTIL_Remove ( pRemoveEnt ) ;
SetThink ( & CDisplacerBall : : ExplodeThink ) ;
SetThink ( & CDisplacerBall : : ExplodeThink ) ;
pev - > nextthink = gpGlobals - > time + 0.2f ;
pev - > nextthink = gpGlobals - > time + 0.2f ;
}
}
@ -335,7 +326,7 @@ BOOL CDisplacer::PlayEmptySound(void)
{
{
if ( m_iPlayEmptySound )
if ( m_iPlayEmptySound )
{
{
EMIT_SOUND ( ENT ( m_pPlayer - > pev ) , CHAN_WEAPON , " buttons/button11.wav " , 1 , ATTN_NORM ) ;
EMIT_SOUND ( m_pPlayer - > edict ( ) , CHAN_WEAPON , " buttons/button11.wav " , 0.9f , ATTN_NORM ) ;
m_iPlayEmptySound = 0 ;
m_iPlayEmptySound = 0 ;
return 0 ;
return 0 ;
}
}
@ -395,7 +386,7 @@ void CDisplacer::Precache(void)
//=========================================================
//=========================================================
BOOL CDisplacer : : Deploy ( )
BOOL CDisplacer : : Deploy ( )
{
{
return DefaultDeploy ( " models/v_displacer.mdl " , " models/p_displacer.mdl " , DISPLACER_DRAW , " displacer " , UseDecrement ( ) ) ;
return DefaultDeploy ( " models/v_displacer.mdl " , " models/p_displacer.mdl " , DISPLACER_DRAW , " egon " , UseDecrement ( ) ) ;
}
}
//=========================================================
//=========================================================
@ -421,7 +412,7 @@ void CDisplacer::SecondaryAttack(void)
if ( m_fFireOnEmpty | | ! CanFireDisplacer ( DISPLACER_SECONDARY_USAGE ) )
if ( m_fFireOnEmpty | | ! CanFireDisplacer ( DISPLACER_SECONDARY_USAGE ) )
{
{
PlayEmptySound ( ) ;
PlayEmptySound ( ) ;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase ( ) + 0.3 f ;
m_flNextPrimaryAttack = m_flNext SecondaryAttack = UTIL_WeaponTimeBase ( ) + 0.5 f ;
return ;
return ;
}
}
@ -443,7 +434,7 @@ void CDisplacer::PrimaryAttack()
if ( m_fFireOnEmpty | | ! CanFireDisplacer ( DISPLACER_PRIMARY_USAGE ) )
if ( m_fFireOnEmpty | | ! CanFireDisplacer ( DISPLACER_PRIMARY_USAGE ) )
{
{
PlayEmptySound ( ) ;
PlayEmptySound ( ) ;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase ( ) + 0.3 f ;
m_flNextPrimaryAttack = m_flNext SecondaryAttack = UTIL_WeaponTimeBase ( ) + 0.5 f ;
return ;
return ;
}
}
m_iFireMode = FIREMODE_FORWARD ;
m_iFireMode = FIREMODE_FORWARD ;
@ -490,10 +481,10 @@ void CDisplacer::ClearSpin( void )
switch ( m_iFireMode )
switch ( m_iFireMode )
{
{
case FIREMODE_FORWARD :
case FIREMODE_FORWARD :
STOP_SOUND ( ENT ( pev ) , CHAN_WEAPON , " weapons/displacer_spin.wav " ) ;
STOP_SOUND ( m_pPlayer - > edict ( ) , CHAN_WEAPON , " weapons/displacer_spin.wav " ) ;
break ;
break ;
case FIREMODE_BACKWARD :
case FIREMODE_BACKWARD :
STOP_SOUND ( ENT ( pev ) , CHAN_WEAPON , " weapons/displacer_spin2.wav " ) ;
STOP_SOUND ( m_pPlayer - > edict ( ) , CHAN_WEAPON , " weapons/displacer_spin2.wav " ) ;
break ;
break ;
}
}
}
}
@ -509,12 +500,12 @@ void CDisplacer::SpinUp( void )
if ( m_iFireMode = = FIREMODE_FORWARD )
if ( m_iFireMode = = FIREMODE_FORWARD )
{
{
EMIT_SOUND ( edict ( ) , CHAN_WEAPON , " weapons/displacer_spin.wav " , 1 , ATTN_NORM ) ;
EMIT_SOUND ( m_pPlayer - > edict ( ) , CHAN_WEAPON , " weapons/displacer_spin.wav " , 1 , ATTN_NORM ) ;
SetThink ( & CDisplacer : : Displace ) ;
SetThink ( & CDisplacer : : Displace ) ;
}
}
else
else
{
{
EMIT_SOUND ( edict ( ) , CHAN_WEAPON , " weapons/displacer_spin2.wav " , 1 , ATTN_NORM ) ;
EMIT_SOUND ( m_pPlayer - > edict ( ) , CHAN_WEAPON , " weapons/displacer_spin2.wav " , 1 , ATTN_NORM ) ;
SetThink ( & CDisplacer : : Teleport ) ;
SetThink ( & CDisplacer : : Teleport ) ;
}
}
pev - > nextthink = gpGlobals - > time + 0.9 ;
pev - > nextthink = gpGlobals - > time + 0.9 ;
@ -583,6 +574,9 @@ void CDisplacer::Teleport( void )
if ( pTarget & & /*HACK*/ ( tmp ! = Vector ( 0 , 0 , 0 ) /*HACK*/ ) )
if ( pTarget & & /*HACK*/ ( tmp ! = Vector ( 0 , 0 , 0 ) /*HACK*/ ) )
{
{
if ( ( m_pPlayer - > m_afPhysicsFlags & PFLAG_ONROPE ) )
m_pPlayer - > LetGoRope ( ) ;
// UTIL_ScreenFade( m_pPlayer, Vector( 0, 200, 0 ), 0.5, 0.5, 255, FFADE_IN );
// UTIL_ScreenFade( m_pPlayer, Vector( 0, 200, 0 ), 0.5, 0.5, 255, FFADE_IN );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase ( ) ;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase ( ) ;
@ -619,7 +613,7 @@ void CDisplacer::Teleport( void )
}
}
else
else
{
{
EMIT_SOUND ( edict ( ) , CHAN_BODY , " buttons/button11.wav " , 1 , ATTN_NORM ) ;
EMIT_SOUND ( m_pPlayer - > edict ( ) , CHAN_WEAPON , " buttons/button11.wav " , 0.9f , ATTN_NORM ) ;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase ( ) + 3.0 ;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase ( ) + 3.0 ;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase ( ) + 0.9 ;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase ( ) + 0.9 ;
}
}