示例#1
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFViewModel::SetWeaponModel( const char *modelname, CBaseCombatWeapon *weapon )
{
    BaseClass::SetWeaponModel( modelname, weapon );

#ifdef CLIENT_DLL
    RemoveViewmodelAddon();
#endif
}
示例#2
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CTFViewModel::~CTFViewModel()
{
    SetViewModelType( VMTYPE_NONE );
#ifdef CLIENT_DLL
    RemoveViewmodelAddon();
#endif

}
示例#3
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 class C_ViewmodelAttachmentModel;
	if ( !pAddon )
		return;

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

	m_hViewmodelAddon = pAddon;
	pAddon->m_nSkin = GetSkin();
	pAddon->FollowEntity( this );
	pAddon->UpdatePartitionListEntry();
	pAddon->CollisionProp()->MarkPartitionHandleDirty();
	pAddon->UpdateVisibility();
	pAddon->SetViewmodel( this );
}
示例#4
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);
}