void CShotgun::PrimaryAttack() { // don't fire underwater if (m_pPlayer->pev->waterlevel == 3) { PlayEmptySound( ); m_flNextPrimaryAttack = gpGlobals->time + 0.15; return; } if (m_iClip <= 0) { Reload( ); if (m_iClip == 0) PlayEmptySound( ); return; } PLAYBACK_EVENT( 0, m_pPlayer->edict(), m_usSingleFire ); m_pPlayer->m_iWeaponVolume = LOUD_GUN_VOLUME; m_pPlayer->Gunflash (); m_iClip--; // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); Vector vecSrc = m_pPlayer->GetGunPosition( ); Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES ); if ( g_pGameRules->IsDeathmatch() ) { // altered deathmatch spread m_pPlayer->FireBullets( 4, vecSrc, vecAiming, VECTOR_CONE_DM_SHOTGUN, 2048, BULLET_PLAYER_BUCKSHOT, 0 ); } else { // regular old, untouched spread. m_pPlayer->FireBullets( 6, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 2048, BULLET_PLAYER_BUCKSHOT, 0 ); } if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) // HEV suit - indicate out of ammo condition m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); if (m_iClip != 0) m_flPumpTime = gpGlobals->time + 0.5; m_flNextPrimaryAttack = gpGlobals->time + 0.75; m_flNextSecondaryAttack = gpGlobals->time + 0.75; if (m_iClip != 0) m_flTimeWeaponIdle = gpGlobals->time + 5.0; else m_flTimeWeaponIdle = 0.75; m_fInReload = 0; }
void CShotgun::SecondaryAttack( void ) { // don't fire underwater if (m_pPlayer->pev->waterlevel == 3) { PlayEmptySound( ); m_flNextPrimaryAttack = gpGlobals->time + 0.15; return; } if (m_iClip <= 1) { Reload( ); PlayEmptySound( ); return; } PLAYBACK_EVENT( 0, m_pPlayer->edict(), m_usDoubleFire ); m_pPlayer->m_iWeaponVolume = LOUD_GUN_VOLUME; m_pPlayer->Gunflash (); m_iClip -= 2; // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); Vector vecSrc = m_pPlayer->GetGunPosition( ); Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES ); if ( g_pGameRules->IsDeathmatch() ) { // tuned for deathmatch m_pPlayer->FireBullets( 8, vecSrc, vecAiming, VECTOR_CONE_DM_DOUBLESHOTGUN, 2048, BULLET_PLAYER_BUCKSHOT_DOUBLE, 0 ); } else { // untouched default single player m_pPlayer->FireBullets( 12, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 2048, BULLET_PLAYER_BUCKSHOT_DOUBLE, 0 ); } if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) // HEV suit - indicate out of ammo condition m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); if (m_iClip != 0) m_flPumpTime = gpGlobals->time + 0.95; m_flNextPrimaryAttack = gpGlobals->time + 1.5; m_flNextSecondaryAttack = gpGlobals->time + 1.5; if (m_iClip != 0) m_flTimeWeaponIdle = gpGlobals->time + 6.0; else m_flTimeWeaponIdle = 1.5; m_fInReload = 0; }
void CMP5::SecondaryAttack( void ) { // don't fire underwater if (m_pPlayer->pev->waterlevel == 3) { PlayEmptySound( ); m_flNextPrimaryAttack = 0.15; return; } if (m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] == 0) { PlayEmptySound( ); return; } m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH; m_pPlayer->m_iExtraSoundTypes = bits_SOUND_DANGER; m_pPlayer->m_flStopExtraSoundTime = UTIL_WeaponTimeBase() + 0.2; m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType]--; // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); UTIL_MakeVectors( m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle ); // we don't add in player velocity anymore. CGrenade::ShootContact( m_pPlayer->pev, m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16, gpGlobals->v_forward * 800 ); int flags; #if defined( CLIENT_WEAPONS ) flags = FEV_NOTHOST; #else flags = 0; #endif PLAYBACK_EVENT( flags, m_pPlayer->edict(), m_usMP52 ); m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1; m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5;// idle pretty soon after shooting. if (!m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType]) // HEV suit - indicate out of ammo condition m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); }
void CTEST::PrimaryAttack() { // don''t fire underwater if (m_pPlayer->pev->waterlevel == 3) { PlayEmptySound( ); m_flNextPrimaryAttack = gpGlobals->time + 0.15; return; } if (m_iClip <= 0) { PlayEmptySound(); m_flNextPrimaryAttack = gpGlobals->time + 0.15; return; } PLAYBACK_EVENT( 0, m_pPlayer->edict(), m_usTEST ); m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH; m_iClip--; // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); Vector vecSrc = m_pPlayer->GetGunPosition( ); Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES ); if ( g_pGameRules->IsDeathmatch() ) { // optimized multiplayer. Widened to make it easier to hit a moving player m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_6DEGREES, 8192, BULLET_PLAYER_MP5, 2 ); } else { m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_3DEGREES, 8192, BULLET_PLAYER_MP5, 2 ); } m_flNextPrimaryAttack = m_flNextPrimaryAttack + 0.1; if (m_flNextPrimaryAttack < gpGlobals->time) m_flNextPrimaryAttack = gpGlobals->time + 0.1; m_flTimeWeaponIdle = gpGlobals->time + RANDOM_FLOAT ( 10, 15 ); UpdateSpot( ); }
void CFSniper::PrimaryAttack() { // don't fire underwater if (m_pPlayer->pev->waterlevel == 3) { PlayEmptySound( ); m_flNextPrimaryAttack = gpGlobals->time + 0.15; return; } if (m_iClip <= 0) { PlayEmptySound(); m_flNextPrimaryAttack = gpGlobals->time + 0.15; return; } PLAYBACK_EVENT( 0, m_pPlayer->edict(), m_usFSniper ); //avec un délai pour l ejection de la cartouche PLAYBACK_EVENT_FULL ( 0, m_pPlayer->edict(), m_usFSniper, 27 / 25.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, 0, 0, 1, 0 ); m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; m_pPlayer->Gunflash (); m_iClip--; // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); Vector vecSrc = m_pPlayer->GetGunPosition( ); Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_8DEGREES ); m_pPlayer->FireBullets( 1, vecSrc, vecAiming, Vector ( 0, 0, 0 )/*VECTOR_CONE_1DEGREES*/, 8192, BULLET_PLAYER_SNIPER, 1 ); if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) // HEV suit - indicate out of ammo condition m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); m_flNextPrimaryAttack = gpGlobals->time + 52 / 25.0; m_flTimeWeaponIdle = gpGlobals->time + RANDOM_FLOAT ( 10, 15 ); }
void CRpg::PrimaryAttack() { if ( m_iClip ) { m_pPlayer->m_iWeaponVolume = LOUD_GUN_VOLUME; m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH; #ifndef CLIENT_DLL // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); UTIL_MakeVectors( m_pPlayer->pev->v_angle ); Vector vecSrc = m_pPlayer->GetGunPosition( ) + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -8; CRpgRocket *pRocket = CRpgRocket::CreateRpgRocket( vecSrc, m_pPlayer->pev->v_angle, m_pPlayer, this ); UTIL_MakeVectors( m_pPlayer->pev->v_angle );// RpgRocket::Create stomps on globals, so remake. pRocket->pev->velocity = pRocket->pev->velocity + gpGlobals->v_forward * DotProduct( m_pPlayer->pev->velocity, gpGlobals->v_forward ); #endif // firing RPG no longer turns on the designator. ALT fire is a toggle switch for the LTD. // Ken signed up for this as a global change (sjb) int flags; #if defined( CLIENT_WEAPONS ) flags = FEV_NOTHOST; #else flags = 0; #endif PLAYBACK_EVENT( flags, m_pPlayer->edict(), m_usRpg ); // Fograin92 EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/rocketfire1.wav", 0.80, ATTN_NORM); m_iClip--; m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.5; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5; } else { PlayEmptySound( ); m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2; } UpdateSpot( ); }
void CM16::PrimaryAttack() { // don't fire underwater if (m_pPlayer->pev->waterlevel == 3) { PlayEmptySound( ); m_flNextPrimaryAttack = gpGlobals->time + 0.15; return; } if (m_iClip <= 0) { PlayEmptySound(); m_flNextPrimaryAttack = gpGlobals->time + 0.15; return; } PLAYBACK_EVENT( 0, m_pPlayer->edict(), m_usM16 ); m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; m_pPlayer->Gunflash (); m_iClip--; // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); Vector vecSrc = m_pPlayer->GetGunPosition( ); Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES ); // single player spread m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_4DEGREES, 8192, BULLET_PLAYER_M16, 2 ); if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) // HEV suit - indicate out of ammo condition m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); m_flNextPrimaryAttack = m_flNextPrimaryAttack + 0.1; if (m_flNextPrimaryAttack < gpGlobals->time) m_flNextPrimaryAttack = gpGlobals->time + 0.1; m_flTimeWeaponIdle = gpGlobals->time + RANDOM_FLOAT ( 10, 15 ); }