Browse Source

Advanced trace when launching ar2grenade, prevent spawning in wall

hlzbot-dirty
mittorn 8 years ago
parent
commit
b9af0eb80a
  1. 19
      dlls/ar2.cpp

19
dlls/ar2.cpp

@ -131,7 +131,7 @@ void CAR2Ball::Spawn()
{ {
Precache(); Precache();
pev->movetype = MOVETYPE_BOUNCE; pev->movetype = MOVETYPE_BOUNCE;
pev->solid = SOLID_SLIDEBOX; pev->solid = SOLID_BBOX;
UTIL_SetOrigin(pev, pev->origin); UTIL_SetOrigin(pev, pev->origin);
SetTouch(&CAR2Ball::AR2Touch); // Bounce if touched SetTouch(&CAR2Ball::AR2Touch); // Bounce if touched
@ -152,7 +152,8 @@ void CAR2Ball::Spawn()
SET_MODEL(ENT(pev), "models/ar2grenade.mdl"); SET_MODEL(ENT(pev), "models/ar2grenade.mdl");
pev->dmg = 60; pev->dmg = 60;
m_fRegisteredSound = FALSE; m_fRegisteredSound = FALSE;
UTIL_SetSize(pev, Vector(-8, -8, -8), Vector(8, 8, 8)); //UTIL_SetSize(pev, Vector(-8, -8, -8), Vector(8, 8, 8));
UTIL_SetSize( pev, Vector( -4, -4, -4 ), Vector( 4, 4, 4 ) );
UTIL_SetOrigin(pev, pev->origin); UTIL_SetOrigin(pev, pev->origin);
pev->avelocity.x = RANDOM_LONG(-1000, 1000); pev->avelocity.x = RANDOM_LONG(-1000, 1000);
pev->avelocity.y = RANDOM_LONG(-1000, 1000); pev->avelocity.y = RANDOM_LONG(-1000, 1000);
@ -605,10 +606,16 @@ void CAR2::SecondaryAttack(void)
m_pPlayer->SetAnimation(PLAYER_ATTACK1); m_pPlayer->SetAnimation(PLAYER_ATTACK1);
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle); UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
Vector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs;
CAR2Ball::AR2Shoot(m_pPlayer->pev, TraceResult tr;
m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16, Vector forward = gpGlobals->v_forward;
gpGlobals->v_forward * 1600,5); UTIL_TraceLine( vecSrc, vecSrc + gpGlobals->v_forward * 16, ignore_monsters, ENT( m_pPlayer->pev ), &tr );
if( tr.flFraction != 1.0 )
{
vecSrc = tr.vecEndPos + ( tr.vecPlaneNormal * 15 );
}
CAR2Ball::AR2Shoot(m_pPlayer->pev,vecSrc,
forward * 1600,5);
// reload sound // reload sound
if( m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] ) if( m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] )

Loading…
Cancel
Save