//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFCompoundBow::ItemPostFrame( void )
{
	BaseClass::ItemPostFrame();

	if ( m_flChargeBeginTime != 0.0f )
	{
		float flChargeTime = gpGlobals->curtime - m_flChargeBeginTime;
		if ( flChargeTime >= TF_BOW_CHARGE_TIRED_TIME )
		{
			// Play flinching animation if it was charged for too long.
			if ( GetActivity() == ACT_ITEM2_VM_IDLE_2 )
			{
				SendWeaponAnim( ACT_ITEM2_VM_CHARGE_IDLE_3 );
			}
			else if ( IsViewModelSequenceFinished() )
			{
				SendWeaponAnim( ACT_ITEM2_VM_IDLE_3 );
			}
		}
		else if ( IsViewModelSequenceFinished() )
		{
			SendWeaponAnim( ACT_ITEM2_VM_IDLE_2 );
		}
	}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponFrag::ItemPostFrame( void )
{
    if( m_fDrawbackFinished )
    {
        CBasePlayer *pOwner = ToBasePlayer( GetOwner() );

        if (pOwner)
        {
            switch( m_AttackPaused )
            {
            case GRENADE_PAUSED_PRIMARY:
                if( !(pOwner->m_nButtons & IN_ATTACK) )
                {
                    SendWeaponAnim( ACT_VM_THROW );
                    ToHL2MPPlayer(pOwner)->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY );

                    //Tony; fire the sequence
                    m_fDrawbackFinished = false;
                }
                break;

            case GRENADE_PAUSED_SECONDARY:
                if( !(pOwner->m_nButtons & IN_ATTACK2) )
                {
                    //See if we're ducking
                    if ( pOwner->m_nButtons & IN_DUCK )
                    {
                        //Send the weapon animation
                        SendWeaponAnim( ACT_VM_SECONDARYATTACK );
                    }
                    else
                    {
                        //Send the weapon animation
                        SendWeaponAnim( ACT_VM_HAULBACK );
                    }
                    //Tony; the grenade really should have a secondary anim. but it doesn't on the player.
                    ToHL2MPPlayer(pOwner)->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY );

                    m_fDrawbackFinished = false;
                }
                break;

            default:
                break;
            }
        }
    }

    BaseClass::ItemPostFrame();

    if ( m_bRedraw )
    {
        if ( IsViewModelSequenceFinished() )
        {
            Reload();
        }
    }
}
Ejemplo n.º 3
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWeaponFrag::ItemPostFrame( void )
{
	if( m_fDrawbackFinished )
	{
		CBasePlayer *pOwner = ToBasePlayer( GetOwner() );

		if (pOwner)
		{
			switch( m_AttackPaused )
			{
			case GRENADE_PAUSED_PRIMARY:
				if( !(pOwner->m_nButtons & IN_ATTACK) )
				{
					SendWeaponAnim( ACT_VM_THROW );
					m_fDrawbackFinished = false;
				}
				break;

			case GRENADE_PAUSED_SECONDARY:
				if( !(pOwner->m_nButtons & IN_ATTACK2) )
				{
					//See if we're ducking
					if ( pOwner->m_nButtons & IN_DUCK )
					{
						//Send the weapon animation
						SendWeaponAnim( ACT_VM_SECONDARYATTACK );
					}
					else
					{
						//Send the weapon animation
						SendWeaponAnim( ACT_VM_HAULBACK );
					}

					m_fDrawbackFinished = false;
				}
				break;

			default:
				break;
			}
		}
	}

	BaseClass::ItemPostFrame();

	if ( m_bRedraw )
	{
		if ( IsViewModelSequenceFinished() )
		{
			Reload();
		}
	}
}
Ejemplo n.º 4
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CTFMinigun::CanHolster( void ) const
{
	if ( m_iWeaponState > AC_STATE_IDLE )
		return false;

	if ( GetActivity() == ACT_MP_ATTACK_STAND_POSTFIRE )
	{
		if ( !IsViewModelSequenceFinished() )
			return false;
	}

	return BaseClass::CanHolster();
}
Ejemplo n.º 5
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWeaponBugBait::ItemPostFrame( void )
{
	CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
	
	if ( pOwner == NULL )
		return;

	// See if we're cocked and ready to throw
	if ( m_bDrawBackFinished )
	{
		DrawArc(); 

		if ( ( pOwner->m_nButtons & IN_ATTACK ) == false )
		{
			SendWeaponAnim( ACT_VM_THROW );
			m_flNextPrimaryAttack  = gpGlobals->curtime + SequenceDuration();
			HideArc();
			m_bDrawBackFinished = false;
		}
	}
	else
	{
		//See if we're attacking
		if ( ( pOwner->m_nButtons & IN_ATTACK ) && ( m_flNextPrimaryAttack < gpGlobals->curtime ) )
		{
			PrimaryAttack();
		}
		else if ( ( pOwner->m_nButtons & IN_ATTACK2 ) && ( m_flNextSecondaryAttack < gpGlobals->curtime ) )
		{
			SecondaryAttack();
		}
	}

	if ( m_bRedraw )
	{
		if ( IsViewModelSequenceFinished() )
		{
			Reload();
		}
	}

	WeaponIdle();
}
void CWeaponGrenade::ItemPostFrame( void )
{
    CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
    if (pOwner)
    {
        //Si on est pas en attente de lancer et que le nouton est appuyé
        if(!m_bAttackPaused && (pOwner->m_nButtons & IN_ATTACK) && HasPrimaryAmmo() && gpGlobals->curtime > m_flNextPrimaryAttack)
            PrimaryAttack();
        //Sinon si on est en attente de lancer et que le bouton n'est plus appuyé
        else if(m_bAttackPaused && !(pOwner->m_nButtons & IN_ATTACK))
            PrimaryAttackThrow();
    }

    BaseClass::ItemPostFrame();

    if ( m_bRedraw )
        if ( IsViewModelSequenceFinished() )
            Reload();
}
Ejemplo n.º 7
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponFrag::ItemPostFrame( void )
{
    if( m_fDrawbackFinished )
    {
        CBasePlayer *pOwner = ToBasePlayer( GetOwner() );

        if (pOwner)
        {
            switch( m_AttackPaused )
            {
            case GRENADE_PAUSED_PRIMARY:
                if( !(pOwner->m_nButtons & IN_ATTACK) )
                {
                    SendWeaponAnim( ACT_VM_THROW );
                    ToHL2MPPlayer(pOwner)->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY );

                    //Tony; fire the sequence
                    m_fDrawbackFinished = false;
                }
                //We are still holding attack...
                else
                {
                    if ( flExplodeTime <= gpGlobals->curtime )
                    {
                        //DHL: Skip the animations and go boom immediately if we've been holding it too long
                        ThrowGrenade( pOwner, true ); //Make it invisible as to maintain the illusion of going off in the player's hand
                        DecrementAmmo( pOwner );

                        //Make absolutely certain that if the grenade goes off in a player's hand, they die.
#ifndef CLIENT_DLL
                        CTakeDamageInfo GrenadeInfo( this, pOwner, 100.0f, DMG_BURN, 0 );
                        pOwner->TakeDamage( GrenadeInfo );
#endif

                    }
                }
                break;

            case GRENADE_PAUSED_SECONDARY:
                if( !(pOwner->m_nButtons & IN_ATTACK2) )
                {
                    //See if we're ducking
                    if ( pOwner->m_nButtons & IN_DUCK )
                    {
                        //Send the weapon animation
                        SendWeaponAnim( ACT_VM_SECONDARYATTACK );
                    }
                    else
                    {
                        //Send the weapon animation
                        SendWeaponAnim( ACT_VM_HAULBACK );
                    }
                    //Tony; the grenade really should have a secondary anim. but it doesn't on the player.
                    ToHL2MPPlayer(pOwner)->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY );

                    m_fDrawbackFinished = false;
                }
                break;

            default:
                break;
            }
        }
    }

    BaseClass::ItemPostFrame();

    if ( m_bRedraw )
    {
        if ( IsViewModelSequenceFinished() )
        {
            Reload();
        }
    }
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWeaponFrag::ItemPostFrame( void )
{
#ifdef MFS
	if (!HasPrimaryAmmo())
		weight = 0;
	else if (GetPrimaryAmmoCount() == 1 )
		weight = 0.5;
	else if (GetPrimaryAmmoCount() == 2)
		weight = 1;
	else if (GetPrimaryAmmoCount() == 3)
		weight = 1.5;
	else if (GetPrimaryAmmoCount() == 4)
		weight = 2;
	else if (GetPrimaryAmmoCount() == 5)
		weight = 2.5;
	else if (GetPrimaryAmmoCount() == 6)
		weight = 3;
#endif

	if( m_fDrawbackFinished )
	{
		CBasePlayer *pOwner = ToBasePlayer( GetOwner() );

		if (pOwner)
		{
			switch( m_AttackPaused )
			{
			case GRENADE_PAUSED_PRIMARY:
				if( !(pOwner->m_nButtons & IN_ATTACK) )
				{
					SendWeaponAnim( ACT_VM_THROW );
					m_fDrawbackFinished = false;
				}
				break;

			case GRENADE_PAUSED_SECONDARY:
				if( !(pOwner->m_nButtons & IN_ATTACK2) )
				{
					//See if we're ducking
					if ( pOwner->m_nButtons & IN_DUCK )
					{
						//Send the weapon animation
						SendWeaponAnim( ACT_VM_SECONDARYATTACK );
					}
					else
					{
						//Send the weapon animation
						SendWeaponAnim( ACT_VM_HAULBACK );
					}

					m_fDrawbackFinished = false;
				}
				break;

			default:
				break;
			}
		}
	}

	BaseClass::ItemPostFrame();

	if ( m_bRedraw )
	{
		if ( IsViewModelSequenceFinished() )
		{
			Reload();
		}
	}
}