//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPropAPC::FireMachineGun( void ) { if ( m_flMachineGunTime > gpGlobals->curtime ) return; // If we're still firing the salvo, fire quickly m_iMachineGunBurstLeft--; if ( m_iMachineGunBurstLeft > 0 ) { m_flMachineGunTime = gpGlobals->curtime + MACHINE_GUN_BURST_TIME; } else { // Reload the salvo m_iMachineGunBurstLeft = MACHINE_GUN_BURST_SIZE; m_flMachineGunTime = gpGlobals->curtime + MACHINE_GUN_BURST_PAUSE_TIME; } Vector vecMachineGunShootPos; Vector vecMachineGunDir; GetAttachment( m_nMachineGunMuzzleAttachment, vecMachineGunShootPos, &vecMachineGunDir ); // Fire the round int bulletType = GetAmmoDef()->Index("AR2"); FireBullets( 1, vecMachineGunShootPos, vecMachineGunDir, VECTOR_CONE_8DEGREES, MAX_TRACE_LENGTH, bulletType, 1 ); DoMuzzleFlash(); EmitSound( "Weapon_AR2.Single" ); }
//==================================================================================== // WEAPON SPAWNING //==================================================================================== //----------------------------------------------------------------------------- // Purpose: Make a weapon visible and tangible //-----------------------------------------------------------------------------// void CBaseCombatWeapon::Materialize( void ) { if ( IsEffectActive( EF_NODRAW ) ) { // changing from invisible state to visible. #ifdef HL2MP EmitSound( "AlyxEmp.Charge" ); #else EmitSound( "BaseCombatWeapon.WeaponMaterialize" ); #endif RemoveEffects( EF_NODRAW ); DoMuzzleFlash(); } #ifdef HL2MP if ( HasSpawnFlags( SF_NORESPAWN ) == false ) { VPhysicsInitNormal( SOLID_BBOX, GetSolidFlags() | FSOLID_TRIGGER, false ); SetMoveType( MOVETYPE_VPHYSICS ); HL2MPRules()->AddLevelDesignerPlacedObject( this ); } #else SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_TRIGGER ); #endif SetPickupTouch(); SetThink (NULL); }
void CWeaponHL2MPBase::Materialize( void ) { if ( IsEffectActive( EF_NODRAW ) ) { // changing from invisible state to visible. EmitSound( "AlyxEmp.Charge" ); RemoveEffects( EF_NODRAW ); DoMuzzleFlash(); } if ( HasSpawnFlags( SF_NORESPAWN ) == false ) { VPhysicsInitNormal( SOLID_BBOX, GetSolidFlags() | FSOLID_TRIGGER, false ); SetMoveType( MOVETYPE_VPHYSICS ); HL2MPRules()->AddLevelDesignerPlacedObject( this ); } if ( HasSpawnFlags( SF_NORESPAWN ) == false ) { if ( GetOriginalSpawnOrigin() == vec3_origin ) { m_vOriginalSpawnOrigin = GetAbsOrigin(); m_vOriginalSpawnAngles = GetAbsAngles(); } } SetPickupTouch(); SetThink (NULL); }
void C_NEOPlayer::NEO_MuzzleFlash() { if ( m_iOldNMFlash != m_iNMFlash ) { m_iOldNMFlash = m_iNMFlash; DoMuzzleFlash(); } }
void CCeilingTurret::Shoot(const Vector &vecSrc, const Vector &vecDirToEnemy) { //NDebugOverlay::Line( vecSrc, vecSrc + vecDirToEnemy * 512, 0, 255, 255, false, 0.1 ); FireBullets( 1, vecSrc, vecDirToEnemy, TURRET_SPREAD, TURRET_RANGE, m_iAmmoType, 1 ); EmitSound( "CeilingTurret.Shoot" ); DoMuzzleFlash(); }
void CNPC_Sentry::Shoot(Vector &vecSrc, Vector &vecDirToEnemy) { FireBullets( 1, vecSrc, vecDirToEnemy, TURRET_SPREAD, TURRET_RANGE, m_iAmmoType, 1 ); CPASAttenuationFilter filter( this ); EmitSound( filter, entindex(), "Sentry.Shoot" ); DoMuzzleFlash(); }
//----------------------------------------------------------------------------- // Purpose: Fire! //----------------------------------------------------------------------------- void CNPC_CeilingTurret::Shoot( const Vector &vecSrc, const Vector &vecDirToEnemy ) { if ( m_spawnflags & SF_CEILING_TURRET_OUT_OF_AMMO ) { EmitSound( "NPC_FloorTurret.DryFire"); EmitSound( "NPC_CeilingTurret.Activate" ); if ( RandomFloat( 0, 1 ) > 0.7 ) { m_flShotTime = gpGlobals->curtime + random->RandomFloat( 0.5, 1.5 ); } else { m_flShotTime = gpGlobals->curtime; } return; } FireBulletsInfo_t info; if ( GetEnemy() != NULL ) { Vector vecDir = GetActualShootTrajectory( vecSrc ); info.m_vecSrc = vecSrc; info.m_vecDirShooting = vecDir; info.m_iTracerFreq = 1; info.m_iShots = 1; info.m_pAttacker = this; info.m_vecSpread = VECTOR_CONE_PRECALCULATED; info.m_flDistance = MAX_COORD_RANGE; info.m_iAmmoType = m_iAmmoType; } else { // Just shoot where you're facing! Vector vecMuzzle, vecMuzzleDir; QAngle vecMuzzleAng; info.m_vecSrc = vecSrc; info.m_vecDirShooting = vecDirToEnemy; info.m_iTracerFreq = 1; info.m_iShots = 1; info.m_pAttacker = this; info.m_vecSpread = GetAttackSpread( NULL, NULL ); info.m_flDistance = MAX_COORD_RANGE; info.m_iAmmoType = m_iAmmoType; } FireBullets( info ); EmitSound( "NPC_CeilingTurret.ShotSounds" ); DoMuzzleFlash(); }
//========================================================= // Materialize - make a CWeaponDODBase visible and tangible //========================================================= void CWeaponDODBase::Materialize() { if ( IsEffectActive( EF_NODRAW ) ) { RemoveEffects( EF_NODRAW ); DoMuzzleFlash(); } AddSolidFlags( FSOLID_TRIGGER ); SetThink (&CWeaponDODBase::SUB_Remove); SetNextThink( gpGlobals->curtime + 1 ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPropAPC2::FireMachineGun( void ) { if ( m_flMachineGunTime > gpGlobals->curtime ) return; // If we're still firing the salvo, fire quickly m_iMachineGunBurstLeft--; if ( m_iMachineGunBurstLeft > 0 ) { m_flMachineGunTime = gpGlobals->curtime + MACHINE_GUN_BURST_TIME; } else { // Reload the salvo m_iMachineGunBurstLeft = MACHINE_GUN_BURST_SIZE; m_flMachineGunTime = gpGlobals->curtime + MACHINE_GUN_BURST_PAUSE_TIME; } Vector vecMachineGunShootPos; QAngle vecMachineGunAngles; GetAttachment( m_nMachineGunMuzzleAttachment, vecMachineGunShootPos, vecMachineGunAngles ); Vector vecMachineGunDir; AngleVectors( vecMachineGunAngles, &vecMachineGunDir ); // Fire the round int bulletType = GetAmmoDef()->Index("StriderMiniGun"); FireBulletsInfo_t info; info.m_iShots = 1; info.m_vecSrc = vecMachineGunShootPos; info.m_vecDirShooting = vecMachineGunDir; info.m_vecSpread = VECTOR_CONE_8DEGREES; info.m_pAttacker = (CBaseEntity *) m_hPlayer; info.m_flDistance = MAX_TRACE_LENGTH; info.m_iAmmoType = bulletType; info.m_flDamage = 30; info.m_iPlayerDamage= 30; info.m_iTracerFreq = 1; FireBullets( info ); EntityMessageBegin( this, true ); WRITE_BYTE( APC_MSG_MACHINEGUN ); WRITE_VEC3COORD(vecMachineGunShootPos); WRITE_VEC3COORD(vecMachineGunDir); WRITE_VEC3COORD(VECTOR_CONE_8DEGREES); WRITE_BYTE( bulletType ); MessageEnd(); DoMuzzleFlash(); m_iAmmoCount--; EmitSound( "Weapon_AR2.Single" ); }
void CItem::Materialize( void ) { CreateItemVPhysicsObject(); if ( IsEffectActive( EF_NODRAW ) ) { // changing from invisible state to visible. EmitSound( "Item.Materialize" ); RemoveEffects( EF_NODRAW ); DoMuzzleFlash(); } SetTouch( &CItem::ItemTouch ); }
//==================================================================================== // WEAPON SPAWNING //==================================================================================== //----------------------------------------------------------------------------- // Purpose: Make a weapon visible and tangible //-----------------------------------------------------------------------------// void CBaseCombatWeapon::Materialize( void ) { if ( IsEffectActive( EF_NODRAW ) ) { // changing from invisible state to visible. EmitSound( "BaseCombatWeapon.WeaponMaterialize" ); RemoveEffects( EF_NODRAW ); DoMuzzleFlash(); } SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_TRIGGER ); SetPickupTouch(); SetThink (NULL); }
//========================================================= // Shoot //========================================================= void CNPC_HAssassin::Shoot ( void ) { Vector vForward, vRight, vUp; Vector vecShootOrigin; QAngle vAngles; if ( GetEnemy() == NULL) { return; } GetAttachment( "guntip", vecShootOrigin, vAngles ); Vector vecShootDir = GetShootEnemyDir( vecShootOrigin ); if (m_flLastShot + 2 < gpGlobals->curtime) { m_flDiviation = 0.10; } else { m_flDiviation -= 0.01; if (m_flDiviation < 0.02) m_flDiviation = 0.02; } m_flLastShot = gpGlobals->curtime; AngleVectors( GetAbsAngles(), &vForward, &vRight, &vUp ); Vector vecShellVelocity = vRight * random->RandomFloat(40,90) + vUp * random->RandomFloat(75,200) + vForward * random->RandomFloat(-40, 40); EjectShell( GetAbsOrigin() + vUp * 32 + vForward * 12, vecShellVelocity, GetAbsAngles().y, 0 ); FireBullets( 1, vecShootOrigin, vecShootDir, Vector( m_flDiviation, m_flDiviation, m_flDiviation ), 2048, m_iAmmoType ); // shoot +-8 degrees //NDebugOverlay::Line( vecShootOrigin, vecShootOrigin + vecShootDir * 2048, 255, 0, 0, true, 2.0 ); CPASAttenuationFilter filter( this ); EmitSound( filter, entindex(), "HAssassin.Shot" ); DoMuzzleFlash(); VectorAngles( vecShootDir, vAngles ); SetPoseParameter( "shoot", vecShootDir.x ); m_cAmmoLoaded--; }
void CItem::Materialize( void ) { CreateItemVPhysicsObject(); if ( IsEffectActive( EF_NODRAW ) ) { // changing from invisible state to visible. #ifdef HL2MP EmitSound( "AlyxEmp.Charge" ); #else EmitSound( "Item.Materialize" ); #endif RemoveEffects( EF_NODRAW ); DoMuzzleFlash(); } SetTouch( &CItem::ItemTouch ); }
//========================================================= // BarneyFirePistol - shoots one round from the pistol at // the enemy barney is facing. //========================================================= void CNPC_HL1Barney::BarneyFirePistol ( void ) { Vector vecShootOrigin; vecShootOrigin = GetAbsOrigin() + Vector( 0, 0, 55 ); Vector vecShootDir = GetShootEnemyDir( vecShootOrigin ); QAngle angDir; VectorAngles( vecShootDir, angDir ); // SetBlending( 0, angDir.x ); DoMuzzleFlash(); FireBullets(1, vecShootOrigin, vecShootDir, VECTOR_CONE_2DEGREES, 1024, m_iAmmoType ); int pitchShift = random->RandomInt( 0, 20 ); // Only shift about half the time if ( pitchShift > 10 ) pitchShift = 0; else pitchShift -= 5; CPASAttenuationFilter filter( this ); EmitSound_t params; params.m_pSoundName = "Barney.FirePistol"; params.m_flVolume = 1; params.m_nChannel= CHAN_WEAPON; params.m_SoundLevel = SNDLVL_NORM; params.m_nPitch = 100 + pitchShift; EmitSound( filter, entindex(), params ); CSoundEnt::InsertSound ( SOUND_COMBAT, GetAbsOrigin(), 384, 0.3 ); // UNDONE: Reload? m_cAmmoLoaded--;// take away a bullet! }
void QUA_helicopter::Dispara(void) { if (m_flWaitAttack<=gpGlobals->curtime) { Vector vecMachineGunShootPos; QAngle vecMachineGunAngles; GetAttachment( m_nMachineGunMuzzleAttachment, vecMachineGunShootPos, vecMachineGunAngles ); Vector vecMachineGunDir = DondeApuntaPlayer() - vecMachineGunShootPos; VectorNormalize(vecMachineGunDir); //AngleVectors( vecMachineGunAngles, &vecMachineGunDir ); // Fire the round FireBulletsInfo_t info; info.m_iShots = 1; info.m_vecSrc = vecMachineGunShootPos; info.m_vecDirShooting = vecMachineGunDir; info.m_vecSpread = VECTOR_CONE_PRECALCULATED; info.m_pAttacker = (CBaseEntity *) m_hPlayer; info.m_flDistance = MAX_TRACE_LENGTH; info.m_iAmmoType = m_iAmmoType; info.m_flDamage = 60; info.m_iPlayerDamage= 60; info.m_iTracerFreq = 1; FireBullets( info ); EntityMessageBegin( this, true ); WRITE_BYTE( HELICOPTER_MSG_MACHINEGUN ); WRITE_VEC3COORD(vecMachineGunShootPos); WRITE_VEC3COORD(vecMachineGunDir); WRITE_VEC3COORD(VECTOR_CONE_PRECALCULATED); WRITE_BYTE( m_iAmmoType ); MessageEnd(); DoMuzzleFlash(); m_iAmmoCount--; // Descontamos ametralladora. EmitSound( "Weapon_AR2.Single" ); } }
//----------------------------------------------------------------------------- // Purpose: Fire! //----------------------------------------------------------------------------- void CNPC_Portal_FloorTurret::Shoot( const Vector &vecSrc, const Vector &vecDirToEnemy, bool bStrict ) { FireBulletsInfo_t info; //if ( !bStrict && GetEnemy() == UTIL_PlayerByIndex( 1 ) ) CBaseEntity *pEnemy = GetEnemy(); if( !bStrict && (pEnemy && pEnemy->IsPlayer()) ) { Vector vecDir = GetActualShootTrajectory( vecSrc ); info.m_vecSrc = vecSrc; info.m_vecDirShooting = vecDir; info.m_iTracerFreq = 1; info.m_iShots = 1; info.m_pAttacker = this; info.m_vecSpread = GetAttackSpread( NULL, GetEnemy() ); info.m_flDistance = MAX_COORD_RANGE; info.m_iAmmoType = m_iAmmoType; } else { // Just shoot where you're facing! Vector vecMuzzle, vecMuzzleDir; GetAttachment( m_iMuzzleAttachment, vecMuzzle, &vecMuzzleDir ); info.m_vecSrc = vecSrc; info.m_vecDirShooting = vecMuzzleDir; info.m_iTracerFreq = 1; info.m_iShots = 1; info.m_pAttacker = this; info.m_vecSpread = GetAttackSpread( NULL, GetEnemy() ); info.m_flDistance = MAX_COORD_RANGE; info.m_iAmmoType = m_iAmmoType; } info.m_flDamageForceScale = ( ( !m_bDamageForce ) ? ( 0.0f ) : ( TURRET_FLOOR_BULLET_FORCE_MULTIPLIER ) ); int iBarrelIndex = ( m_bShootWithBottomBarrels ) ? ( 2 ) : ( 0 ); QAngle angBarrelDir; // Shoot out of the left barrel if there's nothing solid between the turret's center and the muzzle trace_t tr; GetAttachment( m_iBarrelAttachments[ iBarrelIndex ], info.m_vecSrc, angBarrelDir ); Vector vecCenter = GetAbsOrigin(); UTIL_TraceLine( vecCenter, info.m_vecSrc, MASK_SHOT, this, COLLISION_GROUP_NONE, &tr ); if ( !tr.m_pEnt || !tr.m_pEnt->IsWorld() ) { FireBullets( info ); } // Shoot out of the right barrel if there's nothing solid between the turret's center and the muzzle GetAttachment( m_iBarrelAttachments[ iBarrelIndex + 1 ], info.m_vecSrc, angBarrelDir ); vecCenter = GetAbsOrigin(); UTIL_TraceLine( vecCenter, info.m_vecSrc, MASK_SHOT, this, COLLISION_GROUP_NONE, &tr ); if ( !tr.m_pEnt || !tr.m_pEnt->IsWorld() ) { FireBullets( info ); } // Flip shooting from the top or bottom m_bShootWithBottomBarrels = !m_bShootWithBottomBarrels; EmitSound( "NPC_FloorTurret.ShotSounds" ); DoMuzzleFlash(); // Make ropes shake if they exist for ( int iRope = 0; iRope < PORTAL_FLOOR_TURRET_NUM_ROPES; ++iRope ) { if ( m_hRopes[ iRope ] ) { m_hRopes[ iRope ]->ShakeRopes( vecSrc, 32.0f, 5.0f ); } } // If a turret is partially tipped the recoil with each shot so that it can knock itself over Vector up; GetVectors( NULL, NULL, &up ); if ( up.z < 0.9f ) { m_pMotionController->Suspend( 2.0f ); IPhysicsObject *pTurretPhys = VPhysicsGetObject(); Vector vVelocityImpulse = info.m_vecDirShooting * -35.0f; pTurretPhys->AddVelocity( &vVelocityImpulse, &vVelocityImpulse ); } if ( m_iLastState == TURRET_ACTIVE && gpGlobals->curtime > m_fNextTalk ) { EmitSound( GetTurretTalkName( m_iLastState ) ); m_fNextTalk = gpGlobals->curtime + 2.5f; } }
//----------------------------------------------------------------------------- // Purpose: Plasma sentrygun's fire //----------------------------------------------------------------------------- void CObjectMannedPlasmagun::Fire( ) { if (m_flNextAttack > gpGlobals->curtime) return; // Because the plasma sentrygun always thinks it has ammo (see below) // we might not have ammo here, in which case we should just abort. if ( !m_nAmmoCount ) return; // Make sure we think soon enough in case of firing... float flNextRecharge = gpGlobals->curtime + (HasPowerup(POWERUP_EMP) ? MANNED_PLASMAGUN_RECHARGE_TIME * 1.5 : MANNED_PLASMAGUN_RECHARGE_TIME); SetNextThink( gpGlobals->curtime + flNextRecharge ); // We have to flush the bone cache because it's possible that only the bone controllers // have changed since the bonecache was generated, and bone controllers aren't checked. InvalidateBoneCache(); QAngle vecAng; Vector vecSrc, vecAim; // Alternate barrels when firing if ( m_bFiringLeft ) { // Aliens permanently fire left barrel because they have no right if ( GetTeamNumber() == TEAM_HUMANS ) { m_bFiringLeft = false; } GetAttachment( m_nBarrelAttachment, vecSrc, vecAng ); SetActivity( ACT_VM_PRIMARYATTACK ); } else { m_bFiringLeft = true; GetAttachment( m_nRightBarrelAttachment, vecSrc, vecAng ); SetActivity( ACT_VM_SECONDARYATTACK ); } // Get the distance to the target AngleVectors( vecAng, &vecAim, 0, 0 ); int damageType = GetAmmoDef()->DamageType( m_nAmmoType ); CBasePlasmaProjectile *pPlasma = CBasePlasmaProjectile::CreatePredicted( vecSrc, vecAim, Vector( 0, 0, 0 ), damageType, GetDriverPlayer() ); if ( pPlasma ) { pPlasma->SetDamage( obj_manned_plasmagun_damage.GetFloat() ); pPlasma->m_hOwner = GetDriverPlayer(); //pPlasma->SetOwnerEntity( this ); pPlasma->SetMaxRange( m_flMaxRange ); if ( obj_manned_plasmagun_radius.GetFloat() ) { pPlasma->SetExplosive( obj_manned_plasmagun_radius.GetFloat() ); } } CSoundParameters params; if ( GetParametersForSound( "ObjectMannedPlasmagun.Fire", params, NULL ) ) { CPASAttenuationFilter filter( this, params.soundlevel ); if ( IsPredicted() ) { filter.UsePredictionRules(); } EmitSound( filter, entindex(), "ObjectMannedPlasmagun.Fire" ); } // SetSentryAnim( TFTURRET_ANIM_FIRE ); DoMuzzleFlash(); --m_nAmmoCount; m_flNextIdleTime = gpGlobals->curtime + MANNED_PLASMAGUN_IDLE_TIME; // If I'm EMPed, slow the firing rate down m_flNextAttack = gpGlobals->curtime + ( HasPowerup(POWERUP_EMP) ? 0.3f : 0.1f ); }
//========================================================= // HandleAnimEvent - catches the monster-specific messages // that occur when tagged animation frames are played. // // Returns number of events handled, 0 if none. //========================================================= void CNPC_AlienGrunt::HandleAnimEvent( animevent_t *pEvent ) { switch( pEvent->event ) { case AGRUNT_AE_HORNET1: case AGRUNT_AE_HORNET2: case AGRUNT_AE_HORNET3: case AGRUNT_AE_HORNET4: case AGRUNT_AE_HORNET5: { // m_vecEnemyLKP should be center of enemy body Vector vecArmPos; QAngle angArmDir; Vector vecDirToEnemy; QAngle angDir; if (HasCondition( COND_SEE_ENEMY) && GetEnemy()) { Vector vecEnemyLKP = GetEnemy()->GetAbsOrigin(); vecDirToEnemy = ( ( vecEnemyLKP ) - GetAbsOrigin() ); VectorAngles( vecDirToEnemy, angDir ); VectorNormalize( vecDirToEnemy ); } else { angDir = GetAbsAngles(); angDir.x = -angDir.x; Vector vForward; AngleVectors( angDir, &vForward ); vecDirToEnemy = vForward; } DoMuzzleFlash(); // make angles +-180 if (angDir.x > 180) { angDir.x = angDir.x - 360; } // SetBlending( 0, angDir.x ); GetAttachment( "0", vecArmPos, angArmDir ); vecArmPos = vecArmPos + vecDirToEnemy * 32; CPVSFilter filter( GetAbsOrigin() ); te->Sprite( filter, 0.0, &vecArmPos, iAgruntMuzzleFlash, random->RandomFloat( 0.4, 0.8 ), 128 ); CBaseEntity *pHornet = CBaseEntity::Create( "hornet", vecArmPos, QAngle( 0, 0, 0 ), this ); Vector vForward; AngleVectors( angDir, &vForward ); pHornet->SetAbsVelocity( vForward * 300 ); pHornet->SetOwnerEntity( this ); EmitSound( "Weapon_Hornetgun.Single" ); CHL1BaseNPC *pHornetMonster = (CHL1BaseNPC *)pHornet->MyNPCPointer(); if ( pHornetMonster ) { pHornetMonster->SetEnemy( GetEnemy() ); } } break; case AGRUNT_AE_LEFT_FOOT: // left foot { CPASAttenuationFilter filter2( this ); EmitSound( filter2, entindex(), "AlienGrunt.LeftFoot" ); } break; case AGRUNT_AE_RIGHT_FOOT: // right foot { CPASAttenuationFilter filter3( this ); EmitSound( filter3, entindex(), "AlienGrunt.RightFoot" ); } break; case AGRUNT_AE_LEFT_PUNCH: { Vector vecMins = GetHullMins(); Vector vecMaxs = GetHullMaxs(); vecMins.z = vecMins.x; vecMaxs.z = vecMaxs.x; CBaseEntity *pHurt = CheckTraceHullAttack( AGRUNT_MELEE_DIST, vecMins, vecMaxs, sk_agrunt_dmg_punch.GetFloat(), DMG_CLUB ); CPASAttenuationFilter filter4( this ); if ( pHurt ) { if ( pHurt->GetFlags() & ( FL_NPC | FL_CLIENT ) ) pHurt->ViewPunch( QAngle( -25, 8, 0) ); Vector vRight; AngleVectors( GetAbsAngles(), NULL, &vRight, NULL ); // OK to use gpGlobals without calling MakeVectors, cause CheckTraceHullAttack called it above. if ( pHurt->IsPlayer() ) { // this is a player. Knock him around. pHurt->SetAbsVelocity( pHurt->GetAbsVelocity() + vRight * 250 ); } EmitSound(filter4, entindex(), "AlienGrunt.AttackHit" ); Vector vecArmPos; QAngle angArmAng; GetAttachment( 0, vecArmPos, angArmAng ); SpawnBlood(vecArmPos, g_vecAttackDir, pHurt->BloodColor(), 25);// a little surface blood. } else { // Play a random attack miss sound EmitSound(filter4, entindex(), "AlienGrunt.AttackMiss" ); } } break; case AGRUNT_AE_RIGHT_PUNCH: { Vector vecMins = GetHullMins(); Vector vecMaxs = GetHullMaxs(); vecMins.z = vecMins.x; vecMaxs.z = vecMaxs.x; CBaseEntity *pHurt = CheckTraceHullAttack( AGRUNT_MELEE_DIST, vecMins, vecMaxs, sk_agrunt_dmg_punch.GetFloat(), DMG_CLUB ); CPASAttenuationFilter filter5( this ); if ( pHurt ) { if ( pHurt->GetFlags() & ( FL_NPC | FL_CLIENT ) ) pHurt->ViewPunch( QAngle( 25, 8, 0) ); // OK to use gpGlobals without calling MakeVectors, cause CheckTraceHullAttack called it above. if ( pHurt->IsPlayer() ) { // this is a player. Knock him around. Vector vRight; AngleVectors( GetAbsAngles(), NULL, &vRight, NULL ); pHurt->SetAbsVelocity( pHurt->GetAbsVelocity() + vRight * -250 ); } EmitSound( filter5, entindex(), "AlienGrunt.AttackHit" ); Vector vecArmPos; QAngle angArmAng; GetAttachment( 0, vecArmPos, angArmAng ); SpawnBlood(vecArmPos, g_vecAttackDir, pHurt->BloodColor(), 25);// a little surface blood. } else { // Play a random attack miss sound EmitSound( filter5, entindex(), "AlienGrunt.AttackMiss" ); } } break; default: BaseClass::HandleAnimEvent( pEvent ); break; } }