//----------------------------------------------------------------------------- // Purpose: only called for local player //----------------------------------------------------------------------------- void C_TFWeaponBuilder::Redraw() { if ( m_iValidBuildPoseParam >= 0 ) { CTFPlayer *pOwner = ToTFPlayer( GetOwner() ); if ( !pOwner ) return; // Assuming here that our model is the same as our viewmodel's model! CBaseViewModel *pViewModel = pOwner->GetViewModel(0); if ( pViewModel ) { float flPoseParamValue = pViewModel->GetPoseParameter( m_iValidBuildPoseParam ); C_BaseObject *pObj = m_hObjectBeingBuilt.Get(); if ( pObj && pObj->WasLastPlacementPosValid() ) { // pose param approach 1.0 flPoseParamValue = Approach( 1.0, flPoseParamValue, 3.0 * gpGlobals->frametime ); } else { // pose param approach 0.0 flPoseParamValue = Approach( 0.0, flPoseParamValue, 1.5 * gpGlobals->frametime ); } pViewModel->SetPoseParameter( m_iValidBuildPoseParam, flPoseParamValue ); } } BaseClass::Redraw(); }
void CTFBonesaw::UpdateChargePoseParam( void ) { CTFPlayer *pOwner = GetTFPlayerOwner(); if ( !pOwner ) return; CWeaponMedigun *pMedigun = pOwner->GetMedigun(); if ( pMedigun ) { SetPoseParameter( "syringe_charge_level", pMedigun->GetChargeLevel() ); CBaseViewModel *vm = pOwner->GetViewModel( m_nViewModelIndex ); if ( vm ) vm->SetPoseParameter( "syringe_charge_level", pMedigun->GetChargeLevel() ); } }