Exemple #1
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_PropVehicleDriveable::OnDataChanged( DataUpdateType_t updateType )
{
    BaseClass::OnDataChanged( updateType );

    ConVar* thirdpers_cvar = cvar->FindVar("cl_thirdperson");
    ConVar* cam_dist = cvar->FindVar("cam_idealdist");
    ConVar* cam_pos = cvar->FindVar("cam_idealdistright");

    if (m_hPlayer && !m_hPrevPlayer)
    {
        OnEnteredVehicle(m_hPlayer);
        SetNextClientThink(CLIENT_THINK_ALWAYS);
        g_ClientVirtualReality.AlignTorsoAndViewToWeapon();

        if (!DidEnter)
        {
            DidEnter = true;
            cam_dist->SetValue(155);
            cam_pos->SetValue(0);
            thirdpers_cvar->SetValue(1);
        }
    }
    else if ( !m_hPlayer && m_hPrevPlayer )
    {
        // NVNT notify haptics system of navigation exit
        OnExitedVehicle( m_hPrevPlayer );
        // They have just exited the vehicle.
        // Sometimes we never reach the end of our exit anim, such as if the
        // animation doesn't have fadeout 0 specified in the QC, so we fail to
        // catch it in VehicleViewSmoothing. Catch it here instead.
        m_ViewSmoothingData.bWasRunningAnim = false;
        SetNextClientThink(CLIENT_THINK_NEVER);

        if (DidEnter)
        {
            DidEnter = false;
            thirdpers_cvar->SetValue(0);
            SetViewOffset(VEC_VIEW_SCALED(this));
        }
    }
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void C_PropVehicleDriveable::OnDataChanged( DataUpdateType_t updateType )
{
	BaseClass::OnDataChanged( updateType );

	if ( m_hPlayer && !m_hPrevPlayer )
	{
		OnEnteredVehicle( m_hPlayer );
		SetNextClientThink( CLIENT_THINK_ALWAYS );
		g_ClientVirtualReality.AlignTorsoAndViewToWeapon();
	}
	else if ( !m_hPlayer && m_hPrevPlayer )
	{
		// NVNT notify haptics system of navigation exit
		OnExitedVehicle( m_hPrevPlayer );
		// They have just exited the vehicle.
		// Sometimes we never reach the end of our exit anim, such as if the
		// animation doesn't have fadeout 0 specified in the QC, so we fail to
		// catch it in VehicleViewSmoothing. Catch it here instead.
		m_ViewSmoothingData.bWasRunningAnim = false;
		SetNextClientThink( CLIENT_THINK_NEVER );
	}
}