//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CWeaponGrapple::Drop(const Vector &vecVelocity) { #ifndef CLIENT_DLL if (m_hHook) { m_hHook->SetTouch(NULL); m_hHook->SetThink(NULL); UTIL_Remove(m_hHook); m_hHook = NULL; NotifyHookDied(); m_bMustReload = true; } #endif if (m_bInZoom) { ToggleZoom(); } SetChargerState(CHARGER_STATE_OFF); BaseClass::Drop(vecVelocity); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFHunterRifle::ItemPostFrame( void ) { // If we're lowered, we're not allowed to fire if ( m_bLowered ) return; // Get the owning player. CTFPlayer *pPlayer = ToTFPlayer( GetOwner() ); if ( !pPlayer ) return; CheckReload(); if ( !CanAttack() ) { if ( IsZoomed() ) { ToggleZoom(); } return; } HandleZooms(); if ( m_flNextSecondaryAttack <= gpGlobals->curtime ) { // Don't start charging in the time just after a shot before we unzoom to play rack anim. if ( pPlayer->m_Shared.InCond( TF_COND_AIMING ) && !m_bRezoomAfterShot ) { m_flChargedSpread = max(m_flChargedSpread - gpGlobals->frametime * TF_WEAPON_HUNTERRIFLE_CHARGE_PER_SEC, TF_WEAPON_HUNTERRIFLE_SPREAD_MIN); } else { m_flChargedSpread = min(TF_WEAPON_HUNTERRIFLE_SPREAD_MAX, m_flChargedSpread + gpGlobals->frametime * TF_WEAPON_HUNTERRIFLE_UNCHARGE_PER_SEC); } } // Fire. if ( pPlayer->m_nButtons & IN_ATTACK ) { Fire( pPlayer ); } // Reload pressed / Clip Empty if ( ( pPlayer->m_nButtons & IN_RELOAD ) && !m_bInReload ) { // reload when reload is pressed, or if no buttons are down and weapon is empty. Reload(); } // Idle. if ( !( ( pPlayer->m_nButtons & IN_ATTACK) || ( pPlayer->m_nButtons & IN_ATTACK2 ) ) ) { // No fire buttons down or reloading if ( !ReloadOrSwitchWeapons() && ( m_bInReload == false ) ) { WeaponIdle(); } } }
//----------------------------------------------------------------------------- // Purpose: // Input : *pSwitchingTo - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CWeaponGrapple::Holster(CBaseCombatWeapon *pSwitchingTo) { #ifndef CLIENT_DLL if (m_hHook) { m_hHook->SetTouch(NULL); m_hHook->SetThink(NULL); UTIL_Remove(m_hHook); m_hHook = NULL; NotifyHookDied(); m_bMustReload = true; } #endif if (m_bInZoom) { ToggleZoom(); } SetChargerState(CHARGER_STATE_OFF); return BaseClass::Holster(pSwitchingTo); }
void CWeaponMosinNagant::Drop( const Vector &vecVelocity ) { if ( m_bInZoom ) ToggleZoom(); m_bWantsThirdPerson = false; BaseClass::Drop( vecVelocity ); }
//----------------------------------------------------------------------------- // Purpose: Toggle the zoom if the Sec attack button was pressed //----------------------------------------------------------------------------- void CWeaponMomentumGun::CheckZoomToggle(void) { CBasePlayer *pPlayer = ToBasePlayer(GetOwner()); if (pPlayer && (pPlayer->m_afButtonPressed & IN_ATTACK2)) { ToggleZoom(); } }
//----------------------------------------------------------------------------- // Purpose: Put away the gun and disable zoom if needed //----------------------------------------------------------------------------- bool CWeaponMomentumGun::Holster(CBaseCombatWeapon *pSwitchingTo /* = NULL */) { if (m_bInZoom) { ToggleZoom(); } return BaseClass::Holster(pSwitchingTo); }
bool CWeaponMosinNagant::Holster( CBaseCombatWeapon *pSwitchingTo ) { if ( m_bInZoom ) { ToggleZoom(); } return BaseClass::Holster( pSwitchingTo ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFHunterRifle::HandleZooms( void ) { // Get the owning player. CTFPlayer *pPlayer = ToTFPlayer( GetOwner() ); if ( !pPlayer ) return; // Handle the zoom when taunting. if ( pPlayer->m_Shared.InCond( TF_COND_TAUNTING ) ) { if ( pPlayer->m_Shared.InCond( TF_COND_AIMING ) ) { ToggleZoom(); } //Don't rezoom in the middle of a taunt. ResetTimers(); } if ( m_flUnzoomTime > 0 && gpGlobals->curtime > m_flUnzoomTime ) { if ( m_bRezoomAfterShot ) { ZoomOutIn(); m_bRezoomAfterShot = false; } else { ZoomOut(); } m_flUnzoomTime = -1; } if ( m_flRezoomTime > 0 ) { if ( gpGlobals->curtime > m_flRezoomTime ) { ZoomIn(); m_flRezoomTime = -1; } } if ( ( pPlayer->m_nButtons & IN_ATTACK2 ) && ( m_flNextSecondaryAttack <= gpGlobals->curtime ) ) { // If we're in the process of rezooming, just cancel it if ( m_flRezoomTime > 0 || m_flUnzoomTime > 0 ) { // Prevent them from rezooming in less time than they would have m_flNextSecondaryAttack = m_flRezoomTime + TF_WEAPON_HUNTERRIFLE_ZOOM_TIME; m_flRezoomTime = -1; } else { Zoom(); } } }
//----------------------------------------------------------------------------- // Purpose: Stop all zooming and special effects on the viewmodel //----------------------------------------------------------------------------- void CWeaponCrossbow::StopEffects() { // Stop zooming if ( m_bInZoom ) ToggleZoom(); // Turn off our sprites SetChargerState(CHARGER_STATE_OFF); }
void CWeaponTranquilizer::CheckZoomToggle( void ) { CBasePlayer *pPlayer = ToBasePlayer( GetOwner() ); if ( pPlayer == NULL ) return; if ( pPlayer->m_afButtonPressed & IN_ATTACK2 ) ToggleZoom(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CWeaponGrapple::CheckZoomToggle(void) { CBasePlayer *pPlayer = ToBasePlayer(GetOwner()); if (pPlayer->m_afButtonPressed & IN_ATTACK2) { ToggleZoom(); } }
//----------------------------------------------------------------------------- // Purpose: // Input : *pSwitchingTo - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CWeaponCrossbow::Holster( CBaseCombatWeapon *pSwitchingTo ) { if ( m_bInZoom ) { ToggleZoom(); } SetChargerState( CHARGER_STATE_OFF ); return BaseClass::Holster( pSwitchingTo ); }
bool CWeaponMosinNagant::Reload( void ) { bool fRet = DefaultReload( GetMaxClip1(), GetMaxClip2(), ACT_VM_RELOAD ); if ( fRet ) { WeaponSound( RELOAD ); if ( m_bInZoom ) { ToggleZoom(); //DHL: Leave zoom at reload } } return fRet; }
//----------------------------------------------------------------------------- // Purpose: Secondary attack. //----------------------------------------------------------------------------- void CTFHunterRifle::Zoom( void ) { // Don't allow the player to zoom in while jumping CTFPlayer *pPlayer = GetTFPlayerOwner(); if (!pPlayer) return; ToggleZoom(); // at least 0.1 seconds from now, but don't stomp a previous value m_flNextPrimaryAttack = max( m_flNextPrimaryAttack, gpGlobals->curtime + 0.1 ); m_flNextSecondaryAttack = gpGlobals->curtime + TF_WEAPON_HUNTERRIFLE_ZOOM_TIME; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- bool CTFHunterRifle::Lower( void ) { if ( BaseClass::Lower() ) { if ( IsZoomed() ) { ToggleZoom(); } return true; } return false; }
//----------------------------------------------------------------------------- // Purpose: Secondary attack. //----------------------------------------------------------------------------- void CTFSniperRifle::Zoom( void ) { // Don't allow the player to zoom in while jumping CTFPlayer *pPlayer = GetTFPlayerOwner(); if ( pPlayer && pPlayer->m_Shared.IsJumping() ) { if ( pPlayer->GetFOV() >= 75 ) return; } ToggleZoom(); // at least 0.1 seconds from now, but don't stomp a previous value m_flNextPrimaryAttack = max( m_flNextPrimaryAttack, gpGlobals->curtime + 0.1 ); m_flNextSecondaryAttack = gpGlobals->curtime + TF_WEAPON_SNIPERRIFLE_ZOOM_TIME; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFSniperRifle::ItemPostFrame( void ) { // If we're lowered, we're not allowed to fire if ( m_bLowered ) return; // Get the owning player. CTFPlayer *pPlayer = ToTFPlayer( GetOwner() ); if ( !pPlayer ) return; if ( !CanAttack() ) { if ( IsZoomed() ) { ToggleZoom(); } return; } HandleZooms(); #ifdef GAME_DLL // Update the sniper dot position if we have one if ( m_hSniperDot ) { UpdateSniperDot(); } #endif // Start charging when we're zoomed in, and allowed to fire if ( pPlayer->m_Shared.IsJumping() ) { // Unzoom if we're jumping if ( IsZoomed() ) { ToggleZoom(); } m_flChargedDamage = 0.0f; m_bRezoomAfterShot = false; } else if ( m_flNextSecondaryAttack <= gpGlobals->curtime ) { // Don't start charging in the time just after a shot before we unzoom to play rack anim. if ( pPlayer->m_Shared.InCond( TF_COND_AIMING ) && !m_bRezoomAfterShot ) { m_flChargedDamage = min( m_flChargedDamage + gpGlobals->frametime * TF_WEAPON_SNIPERRIFLE_CHARGE_PER_SEC, TF_WEAPON_SNIPERRIFLE_DAMAGE_MAX ); } else { m_flChargedDamage = max( 0, m_flChargedDamage - gpGlobals->frametime * TF_WEAPON_SNIPERRIFLE_UNCHARGE_PER_SEC ); } } // Fire. if ( pPlayer->m_nButtons & IN_ATTACK ) { Fire( pPlayer ); } // Idle. if ( !( ( pPlayer->m_nButtons & IN_ATTACK) || ( pPlayer->m_nButtons & IN_ATTACK2 ) ) ) { // No fire buttons down or reloading if ( !ReloadOrSwitchWeapons() && ( m_bInReload == false ) ) { WeaponIdle(); } } }
void CWeaponMosinNagant::SecondaryAttack( void ) { ToggleZoom(); m_flNextSecondaryAttack = gpGlobals->curtime + 0.5f; }
void BannerWindow::ToggleGameSettings() { ToggleZoom(); Brightness = (Brightness == 200 ? 0 : 200); }