Exemplo n.º 1
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CTFViewModel::GetAttachmentVelocity(int number, Vector &originVel, Quaternion &angleVel)
{
    if ( GetViewModelType() == VMTYPE_TF2 )
    {
        C_ViewmodelAttachmentModel *pEnt = m_viewmodelAddon.Get();
        if (pEnt)
            return pEnt->GetAttachmentVelocity(number, originVel, angleVel);
    }

    return BaseClass::GetAttachmentVelocity(number, originVel, angleVel);
}
Exemplo n.º 2
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CTFViewModel::GetAttachment(int number, Vector &origin, QAngle &angles)
{
    if ( GetViewModelType() == VMTYPE_TF2 )
    {
        C_ViewmodelAttachmentModel *pEnt = m_viewmodelAddon.Get();
        if (pEnt)
            return pEnt->GetAttachment(number, origin, angles);
    }

    return BaseClass::GetAttachment(number, origin, angles);
}
Exemplo n.º 3
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CTFViewModel::GetAttachment(int number, matrix3x4_t &matrix)
{
    if ( GetViewModelType() == VMTYPE_TF2 )
    {
        C_ViewmodelAttachmentModel *pEnt = m_viewmodelAddon.Get();
        if (pEnt)
            return pEnt->GetAttachment(number, matrix);
    }

    return BaseClass::GetAttachment(number, matrix);
}
Exemplo n.º 4
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
int	CTFViewModel::LookupAttachment(const char *pAttachmentName)
{
    if ( GetViewModelType() == VMTYPE_TF2 )
    {
        C_ViewmodelAttachmentModel *pEnt = m_viewmodelAddon.Get();
        if (pEnt)
            return pEnt->LookupAttachment(pAttachmentName);
    }

    return BaseClass::LookupAttachment(pAttachmentName);
}
Exemplo n.º 5
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFViewModel::UpdateViewmodelAddon( const char *pszModelname )
{
    C_ViewmodelAttachmentModel *pEnt = m_viewmodelAddon.Get();

    if ( pEnt && pEnt->GetModelIndex() == modelinfo->GetModelIndex(pszModelname) )
    {
        pEnt->m_nSkin = GetSkin();
        if ( C_BasePlayer::GetLocalPlayer() != GetOwner() ) // Spectator fix
        {
            pEnt->SetParent(this);
            pEnt->AddEffects(EF_BONEMERGE);
            pEnt->UpdateVisibility();
            pEnt->SetViewmodel(this);
        }
        return; // we already have the correct add-on
    }
    else if ( pEnt )
    {
        RemoveViewmodelAddon();
    }

    pEnt = new class C_ViewmodelAttachmentModel;
    if (!pEnt)
        return;

    if (pEnt->InitializeAsClientEntity(pszModelname, RENDER_GROUP_VIEW_MODEL_TRANSLUCENT) == false)
        return;

    m_viewmodelAddon = pEnt;
    V_strncpy(m_viewmodelAddonName, pszModelname, sizeof(m_viewmodelAddonName));
    pEnt->m_nSkin = GetSkin();
    pEnt->SetParent(this);
    pEnt->AddEffects(EF_BONEMERGE);
    pEnt->SetLocalOrigin(vec3_origin);
    pEnt->UpdatePartitionListEntry();
    pEnt->CollisionProp()->MarkPartitionHandleDirty();
    pEnt->UpdateVisibility();
    pEnt->SetViewmodel(this);
}
Exemplo n.º 6
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFViewModel::UpdateViewmodelAddon( const char *pszModelname )
{
	C_ViewmodelAttachmentModel *pAddon = m_hViewmodelAddon.Get();

	if ( pAddon )
	{
		if ( pAddon->GetModelIndex() == modelinfo->GetModelIndex( pszModelname ) )
		{
			pAddon->m_nSkin = GetSkin();

			if ( C_BasePlayer::GetLocalPlayer() != GetOwner() ) // Spectator fix
			{
				pAddon->FollowEntity( this );
				pAddon->m_nRenderFX = m_nRenderFX;
				pAddon->UpdateVisibility();
				pAddon->SetViewmodel( this );
			}
			return; // we already have the correct add-on
		}
		else
		{
			RemoveViewmodelAddon();
		}
	}

	pAddon = new C_ViewmodelAttachmentModel();

	if ( pAddon->InitializeAsClientEntity( pszModelname, RENDER_GROUP_VIEW_MODEL_TRANSLUCENT ) == false )
	{
		pAddon->Release();
		return;
	}

	m_hViewmodelAddon = pAddon;

	pAddon->m_nSkin = GetSkin();
	pAddon->SetOwner( GetOwner() );
	pAddon->FollowEntity( this );
	pAddon->UpdateVisibility();

	pAddon->SetViewmodel( this );
}