本文整理汇总了C++中CBaseViewModel类的典型用法代码示例。如果您正苦于以下问题:C++ CBaseViewModel类的具体用法?C++ CBaseViewModel怎么用?C++ CBaseViewModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBaseViewModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToTFPlayer
//-----------------------------------------------------------------------------
// 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();
}
示例2: IsWeaponVisible
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CWarsWeapon::IsWeaponVisible( void )
{
CBaseViewModel *vm = NULL;
CUnitBase *pUnit;
CBasePlayer *pOwner = NULL;
if( GetOwner() )
{
pUnit = GetOwner()->MyUnitPointer();
if( pUnit && pUnit->GetCommander() )
{
pOwner = ToBasePlayer( pUnit->GetCommander() );
}
}
if ( pOwner )
{
vm = pOwner->GetViewModel( m_nViewModelIndex );
if ( vm )
return ( !vm->IsEffectActive(EF_NODRAW) );
}
return BaseClass::IsWeaponVisible();
}
示例3: DelayedAttack
//-----------------------------------------------------------------------------
// Purpose: Handle grenade detonate in-air (even when no ammo is left)
//-----------------------------------------------------------------------------
void CWeaponAR2::ItemPostFrame( void )
{
// See if we need to fire off our secondary round
if ( m_bShotDelayed && gpGlobals->curtime > m_flDelayedFire )
{
DelayedAttack();
}
// Update our pose parameter for the vents
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if ( pOwner )
{
CBaseViewModel *pVM = pOwner->GetViewModel();
if ( pVM )
{
if ( m_nVentPose == -1 )
{
m_nVentPose = pVM->LookupPoseParameter( "VentPoses" );
}
float flVentPose = RemapValClamped( m_nShotsFired, 0, 5, 0.0f, 1.0f );
pVM->SetPoseParameter( m_nVentPose, flVentPose );
}
}
BaseClass::ItemPostFrame();
}
示例4: SetWeaponVisible
//-----------------------------------------------------------------------------
// Purpose: Show/hide weapon and corresponding view model if any
// Input : visible -
//-----------------------------------------------------------------------------
void CWarsWeapon::SetWeaponVisible( bool visible )
{
CBaseViewModel *vm = NULL;
CUnitBase *pUnit;
if( GetOwner() )
{
pUnit = GetOwner()->MyUnitPointer();
if( pUnit && pUnit->GetCommander() )
{
CBasePlayer *pOwner = ToBasePlayer( pUnit->GetCommander() );
if ( pOwner )
{
vm = pOwner->GetViewModel( m_nViewModelIndex );
}
}
}
if ( vm )
{
if ( visible )
{
vm->RemoveEffects( EF_NODRAW );
}
else
{
vm->AddEffects( EF_NODRAW );
}
}
BaseClass::SetWeaponVisible( visible );
}
示例5: SetWeaponVisible
//-----------------------------------------------------------------------------
// Purpose: Show/hide weapon and corresponding view model if any
// Input : visible -
//-----------------------------------------------------------------------------
void CTFWeaponInvis::SetWeaponVisible( bool visible )
{
CBaseViewModel *vm = NULL;
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if ( pOwner )
{
vm = pOwner->GetViewModel( m_nViewModelIndex );
}
if ( visible )
{
RemoveEffects( EF_NODRAW );
if ( vm )
{
vm->RemoveEffects( EF_NODRAW );
}
}
else
{
AddEffects( EF_NODRAW );
if ( vm )
{
vm->AddEffects( EF_NODRAW );
}
}
}
示例6: SetSkin
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponCrossbow::DoLoadEffect( void )
{
SetSkin( BOLT_SKIN_GLOW );
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if ( pOwner == NULL )
return;
CBaseViewModel *pViewModel = pOwner->GetViewModel();
if ( pViewModel == NULL )
return;
CEffectData data;
data.m_nEntIndex = pViewModel->entindex();
data.m_nAttachmentIndex = 1;
DispatchEffect( "CrossbowLoad", data );
CSprite *pBlast = CSprite::SpriteCreate( CROSSBOW_GLOW_SPRITE2, GetAbsOrigin(), false );
if ( pBlast )
{
pBlast->SetAttachment( pOwner->GetViewModel(), 1 );
pBlast->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNone );
pBlast->SetBrightness( 128 );
pBlast->SetScale( 0.2f );
pBlast->FadeOutFromSpawn();
}
}
示例7: defined
//-----------------------------------------------------------------------------
// Purpose:
// Input : iActivity -
//-----------------------------------------------------------------------------
void CWarsWeapon::SendViewModelAnim( int nSequence )
{
#if defined( CLIENT_DLL )
if ( !IsPredicted() )
{
return;
}
#endif
if ( nSequence < 0 )
return;
CBasePlayer *pOwner = ToBasePlayer( GetCommander() );
if ( pOwner == NULL ) {
BaseClass::SendViewModelAnim( nSequence );
return;
}
CBaseViewModel *vm = pOwner->GetViewModel( m_nViewModelIndex );
if ( vm == NULL )
{
return;
}
SetViewModel();
Assert( vm->ViewModelIndex() == m_nViewModelIndex );
vm->SendViewModelMatchingSequence( nSequence );
}
示例8: SetCollisionBounds
void CHL2MP_Player::PostThink( void )
{
BaseClass::PostThink();
if ( GetFlags() & FL_DUCKING )
{
SetCollisionBounds( VEC_CROUCH_TRACE_MIN, VEC_CROUCH_TRACE_MAX );
}
m_PlayerAnimState.Update();
// Store the eye angles pitch so the client can compute its animation state correctly.
m_angEyeAngles = EyeAngles();
QAngle angles = GetLocalAngles();
angles[PITCH] = 0;
SetLocalAngles( angles );
if (!IsDead())
{
if (m_afButtonReleased & IN_KICK && m_flNextKickAttack < gpGlobals->curtime /* && m_flNextKickAttack < gpGlobals->curtime && !m_bIsKicking*/)
{
KickAttack();
m_bIsKicking = true;
}
}
CBaseCombatWeapon *pWeapon = this->GetActiveWeapon();
if (pWeapon != NULL)
{
if (m_afButtonPressed & IN_IRONSIGHT)
{
pWeapon->EnableIronsights();
}
else if (m_afButtonReleased & IN_IRONSIGHT)
{
pWeapon->DisableIronsights();
}
}
if (!IsDead())
{
if (m_flNextKickAttack < gpGlobals->curtime)
{
m_bIsKicking = false;
CBaseViewModel *vm = GetViewModel(1);
if (vm)
{
int idealSequence = vm->SelectWeightedSequence(ACT_VM_IDLE);
if (idealSequence >= 0)
{
vm->SendViewModelMatchingSequence(idealSequence);
}
}
}
}
}
示例9: IsViewModelMoveParent
int CCitadelEnergyCore::ShouldTransmit( const CCheckTransmitInfo *pInfo )
{
CBaseViewModel *pViewModel = IsViewModelMoveParent( this );
if ( pViewModel )
{
return pViewModel->ShouldTransmit( pInfo );
}
return BaseClass::ShouldTransmit( pInfo );
}
示例10: GetViewModel
void CBasePlayer::CalcViewModelView( const Vector& eyeOrigin, const QAngle& eyeAngles)
{
for ( int i = 0; i < MAX_VIEWMODELS; i++ )
{
CBaseViewModel *vm = GetViewModel( i );
if ( !vm )
continue;
vm->CalcViewModelView( this, eyeOrigin, eyeAngles );
}
}
示例11: RecvProxy_SequenceNum
void RecvProxy_SequenceNum( const CRecvProxyData *pData, void *pStruct, void *pOut )
{
CBaseViewModel *model = (CBaseViewModel *)pStruct;
if (pData->m_Value.m_Int != model->GetSequence())
{
MDLCACHE_CRITICAL_SECTION();
model->SetSequence(pData->m_Value.m_Int);
model->m_flAnimTime = gpGlobals->curtime;
model->SetCycle(0);
}
}
示例12: StudioFrameAdvance
void CBaseCombatWeapon::Operator_FrameUpdate( CBaseCombatCharacter *pOperator )
{
StudioFrameAdvance( ); // animate
if ( IsSequenceFinished() )
{
if ( SequenceLoops() )
{
// animation does loop, which means we're playing subtle idle. Might need to fidget.
int iSequence = SelectWeightedSequence( GetActivity() );
if ( iSequence != ACTIVITY_NOT_AVAILABLE )
{
ResetSequence( iSequence ); // Set to new anim (if it's there)
}
}
#if 0
else
{
// animation that just ended doesn't loop! That means we just finished a fidget
// and should return to our heaviest weighted idle (the subtle one)
SelectHeaviestSequence( GetActivity() );
}
#endif
}
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if ( pOwner == NULL )
return;
CBaseViewModel *vm = pOwner->GetViewModel( m_nViewModelIndex );
if ( vm == NULL )
return;
// HACK: Player weapon and view model often use the same mdl, which results
// in duplicate anim events. For now, let the view model handle the events
// if they're the same, which is the preferred behavior in general.
CStudioHdr *w_hdr = GetModelPtr();
CStudioHdr *v_hdr = vm->GetModelPtr();
if ( w_hdr->GetRenderHdr() != v_hdr->GetRenderHdr() )
{
// Animation events are passed back to the weapon's owner/operator
DispatchAnimEvents( pOperator );
}
// Update and dispatch the viewmodel events
if ( vm != NULL )
{
vm->StudioFrameAdvance();
vm->DispatchAnimEvents( this );
}
}
示例13: PickDefaultSpawnTeam
//-----------------------------------------------------------------------------
// Purpose: Sets HL2 specific defaults.
//-----------------------------------------------------------------------------
void CHL2MP_Player::Spawn(void)
{
m_flNextModelChangeTime = 0.0f;
m_flNextTeamChangeTime = 0.0f;
PickDefaultSpawnTeam();
BaseClass::Spawn();
if ( !IsObserver() )
{
pl.deadflag = false;
RemoveSolidFlags( FSOLID_NOT_SOLID );
RemoveEffects( EF_NODRAW );
GiveDefaultItems();
}
SetNumAnimOverlays( 3 );
ResetAnimation();
m_nRenderFX = kRenderNormal;
m_Local.m_iHideHUD = 0;
AddFlag(FL_ONGROUND); // set the player on the ground at the start of the round.
m_impactEnergyScale = HL2MPPLAYER_PHYSDAMAGE_SCALE;
if ( HL2MPRules()->IsIntermission() )
{
AddFlag( FL_FROZEN );
}
else
{
RemoveFlag( FL_FROZEN );
}
m_iSpawnInterpCounter = (m_iSpawnInterpCounter + 1) % 8;
m_Local.m_bDucked = false;
SetPlayerUnderwater(false);
m_bReady = false;
m_flNextKickAttack = gpGlobals->curtime;
CBaseViewModel *Leg = GetViewModel(1);
Leg->SetWeaponModel("models/weapons/v_kick.mdl", NULL);
}
示例14: GetActiveSDKWeapon
void CSDKPlayer::DoMuzzleFlash()
{
#ifdef CLIENT_DLL
if (prediction->InPrediction() && !prediction->IsFirstTimePredicted())
return;
C_SDKPlayer* pLocalPlayer = C_SDKPlayer::GetLocalSDKPlayer();
C_WeaponSDKBase* pActiveWeapon = GetActiveSDKWeapon();
if (pLocalPlayer)
{
if (pLocalPlayer == this && !::input->CAM_IsThirdPerson() || pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE && pLocalPlayer->GetObserverTarget() == this)
{
for ( int i = 0; i < MAX_VIEWMODELS; i++ )
{
CBaseViewModel *vm = GetViewModel( i );
if ( !vm )
continue;
vm->DoMuzzleFlash();
}
}
else if (pActiveWeapon)
{
// Force world model so the attachments work.
pActiveWeapon->SetModelIndex( pActiveWeapon->GetWorldModelIndex() );
switch (pActiveWeapon->GetWeaponType())
{
case WT_PISTOL:
default:
pActiveWeapon->ParticleProp()->Create( "muzzleflash_pistol", PATTACH_POINT_FOLLOW, "muzzle" );
break;
case WT_SMG:
pActiveWeapon->ParticleProp()->Create( "muzzleflash_smg", PATTACH_POINT_FOLLOW, "muzzle" );
break;
case WT_RIFLE:
pActiveWeapon->ParticleProp()->Create( "muzzleflash_rifle", PATTACH_POINT_FOLLOW, "muzzle" );
break;
case WT_SHOTGUN:
pActiveWeapon->ParticleProp()->Create( "muzzleflash_shotgun", PATTACH_POINT_FOLLOW, "muzzle" );
break;
}
}
}
#endif
}
示例15: SetSkin
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponCrossbow::DoLoadEffect()
{
SetSkin(BOLT_SKIN_GLOW);
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if ( !pOwner )
return;
CEffectData data;
data.m_nAttachmentIndex = 1;
#ifdef GAME_DLL
data.m_nEntIndex = entindex();
CPASFilter filter(data.m_vOrigin);
filter.RemoveRecipient(pOwner);
te->DispatchEffect(filter, 0.0, data.m_vOrigin, "CrossbowLoad", data);
#else
CBaseViewModel *pViewModel = pOwner->GetViewModel();
if ( pViewModel != NULL )
{
if ( ::input->CAM_IsThirdPerson() )
data.m_hEntity = pViewModel->GetRefEHandle();
else
data.m_hEntity = GetRefEHandle();
DispatchEffect("CrossbowLoad", data);
}
#endif
//Tony; switched this up, always attach it to the weapon, not the view model!!
#ifndef CLIENT_DLL
CSprite *pBlast = CSprite::SpriteCreate( CROSSBOW_GLOW_SPRITE2, GetAbsOrigin(), false );
if ( pBlast )
{
pBlast->SetAttachment(this, 1);
pBlast->SetTransparency(kRenderTransAdd, 255, 255, 255, 255, kRenderFxNone );
pBlast->SetBrightness(128);
pBlast->SetScale(0.2f);
pBlast->FadeOutFromSpawn();
}
#endif
}