Skip to content

Commit

Permalink
HL 25th anniversary update snark changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
nekonomicon committed Jan 27, 2024
1 parent 538e3a8 commit af7ecfa
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions dlls/squeakgrenade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ void CSqueakGrenade::SuperBounceTouch( CBaseEntity *pOther )
// higher pitch as squeeker gets closer to detonation time
flpitch = 155.0f - 60.0f * ( ( m_flDie - gpGlobals->time ) / SQUEEK_DETONATE_DELAY );

if( pOther->pev->takedamage && m_flNextAttack < gpGlobals->time )
if( !FBitSet( pOther->pev->flags, FL_WORLDBRUSH )
&& pOther->pev->takedamage && m_flNextAttack < gpGlobals->time )
{
// attack!

Expand Down Expand Up @@ -494,20 +495,34 @@ void CSqueak::PrimaryAttack()
{
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
{
UTIL_MakeVectors( m_pPlayer->pev->v_angle );
UTIL_MakeVectors( Vector( 0, m_pPlayer->pev->v_angle.y, m_pPlayer->pev->v_angle.z ));
TraceResult tr;
Vector trace_origin;
Vector trace_origin, forward, Forward;
float flVel;

UTIL_MakeVectorsPrivate( m_pPlayer->pev->v_angle, 0, forward, 0 );

if( m_pPlayer->pev->v_angle.x <= 0 )
{
flVel = 1;
}
else
{
flVel = m_pPlayer->pev->v_angle.x / 90.0f;
}

// HACK HACK: Ugly hacks to handle change in origin based on new physics code for players
// Move origin up if crouched and start trace a bit outside of body ( 20 units instead of 16 )
trace_origin = m_pPlayer->pev->origin;
if( m_pPlayer->pev->flags & FL_DUCKING )
{
trace_origin = trace_origin - ( VEC_HULL_MIN - VEC_DUCK_HULL_MIN );
trace_origin = trace_origin - Vector( 0, 0, 1 ) * ( flVel + 1.0f ) * -18;
}

Forward = gpGlobals->v_forward * flVel + forward * ( 1 - flVel );

// find place to toss monster
UTIL_TraceLine( trace_origin + gpGlobals->v_forward * 20.0f, trace_origin + gpGlobals->v_forward * 64.0f, dont_ignore_monsters, NULL, &tr );
UTIL_TraceLine( trace_origin + Forward * 24.0f, trace_origin + forward * 60.0f, dont_ignore_monsters, NULL, &tr );

int flags;
#if CLIENT_WEAPONS
Expand All @@ -517,13 +532,13 @@ void CSqueak::PrimaryAttack()
#endif
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usSnarkFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, 0, 0, 0, 0 );

if( tr.fAllSolid == 0 && tr.fStartSolid == 0 && tr.flFraction > 0.25f )
if( tr.fAllSolid == 0 && tr.fStartSolid == 0 && tr.flFraction > 0 )
{
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
#if !CLIENT_DLL
CBaseEntity *pSqueak = CBaseEntity::Create( "monster_snark", tr.vecEndPos, m_pPlayer->pev->v_angle, m_pPlayer->edict() );
pSqueak->pev->velocity = gpGlobals->v_forward * 200.0f + m_pPlayer->pev->velocity;
pSqueak->pev->velocity = Forward * 200.0f + m_pPlayer->pev->velocity;
#endif
// play hunt sound
float flRndSound = RANDOM_FLOAT( 0.0f, 1.0f );
Expand Down

0 comments on commit af7ecfa

Please sign in to comment.