2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-25 19:29:13 +01:00

HL 25th anniversary update snark changes. (#430)

This commit is contained in:
Andrey Akhmichin 2024-01-28 09:16:06 +00:00 committed by GitHub
parent d020f6d474
commit 41ee8a8746
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -339,7 +339,8 @@ void CSqueakGrenade::SuperBounceTouch( CBaseEntity *pOther )
// higher pitch as squeeker gets closer to detonation time // higher pitch as squeeker gets closer to detonation time
flpitch = 155.0f - 60.0f * ( ( m_flDie - gpGlobals->time ) / SQUEEK_DETONATE_DELAY ); 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! // attack!
@ -494,20 +495,35 @@ void CSqueak::PrimaryAttack()
{ {
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] ) if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
{ {
UTIL_MakeVectors( m_pPlayer->pev->v_angle );
TraceResult tr; TraceResult tr;
Vector trace_origin; Vector trace_origin, forward;
float flVel;
UTIL_MakeVectors( Vector( 0, m_pPlayer->pev->v_angle.y, m_pPlayer->pev->v_angle.z ));
forward = gpGlobals->v_forward;
UTIL_MakeVectors( m_pPlayer->pev->v_angle );
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 // 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 ) // Move origin up if crouched and start trace a bit outside of body ( 20 units instead of 16 )
trace_origin = m_pPlayer->pev->origin; trace_origin = m_pPlayer->pev->origin;
if( m_pPlayer->pev->flags & FL_DUCKING ) 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 = forward * flVel + gpGlobals->v_forward * ( 1 - flVel );
// find place to toss monster // 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 + gpGlobals->v_forward * 60.0f, dont_ignore_monsters, NULL, &tr );
int flags; int flags;
#if CLIENT_WEAPONS #if CLIENT_WEAPONS
@ -517,13 +533,13 @@ void CSqueak::PrimaryAttack()
#endif #endif
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usSnarkFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, 0, 0, 0, 0 ); 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 // player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
#if !CLIENT_DLL #if !CLIENT_DLL
CBaseEntity *pSqueak = CBaseEntity::Create( "monster_snark", tr.vecEndPos, m_pPlayer->pev->v_angle, m_pPlayer->edict() ); 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 #endif
// play hunt sound // play hunt sound
float flRndSound = RANDOM_FLOAT( 0.0f, 1.0f ); float flRndSound = RANDOM_FLOAT( 0.0f, 1.0f );