//----------------------------------------------------------------------------- // 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: // 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); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CWeaponGrapple::ItemPostFrame( void ) { //Enforces being able to use PrimaryAttack and Secondary Attack CBasePlayer *pOwner = ToBasePlayer( GetOwner() ); if ( ( pOwner->m_nButtons & IN_ATTACK ) ) { if ( m_flNextPrimaryAttack < gpGlobals->curtime ) { PrimaryAttack(); } } else if ( m_bMustReload ) //&& HasWeaponIdleTimeElapsed() ) { Reload(); } if ( ( pOwner->m_afButtonPressed & IN_ATTACK2 ) ) { if ( m_flNextPrimaryAttack < gpGlobals->curtime ) { SecondaryAttack(); } } else if ( m_bMustReload ) //&& HasWeaponIdleTimeElapsed() ) { Reload(); } //Allow a refire as fast as the player can click if ( ( ( pOwner->m_nButtons & IN_ATTACK ) == false ) ) { m_flNextPrimaryAttack = gpGlobals->curtime - 0.1f; } #ifndef CLIENT_DLL if ( m_hHook ) { if ( !(pOwner->m_nButtons & IN_ATTACK) && !(pOwner->m_nButtons & IN_ATTACK2)) { m_hHook->SetTouch( NULL ); m_hHook->SetThink( NULL ); UTIL_Remove( m_hHook ); m_hHook = NULL; NotifyHookDied(); m_bMustReload = true; } } #endif // BaseClass::ItemPostFrame(); }
//----------------------------------------------------------------------------- // 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 BaseClass::Drop(vecVelocity); }
//----------------------------------------------------------------------------- // 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 return BaseClass::Holster(pSwitchingTo); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CWeaponGrapple::ItemPostFrame(void) { // Allow zoom toggling CheckZoomToggle(); CBasePlayer *pOwner = ToBasePlayer(GetOwner()); if ((pOwner->m_nButtons & IN_ATTACK)) { if (m_flNextPrimaryAttack < gpGlobals->curtime) { PrimaryAttack(); } } else if (m_bMustReload) //&& HasWeaponIdleTimeElapsed() ) { Reload(); } #ifndef CLIENT_DLL if (m_hHook) { if (m_hRope) m_hRope->RecalculateLength(); if (!(pOwner->m_nButtons & IN_ATTACK)) { m_hHook->SetTouch(NULL); m_hHook->SetThink(NULL); UTIL_Remove(m_hHook); m_hHook = NULL; NotifyHookDied(); m_bMustReload = true; } } #endif // BaseClass::ItemPostFrame(); }