本文整理汇总了C++中C_BaseCombatWeapon::IsCarriedByLocalPlayer方法的典型用法代码示例。如果您正苦于以下问题:C++ C_BaseCombatWeapon::IsCarriedByLocalPlayer方法的具体用法?C++ C_BaseCombatWeapon::IsCarriedByLocalPlayer怎么用?C++ C_BaseCombatWeapon::IsCarriedByLocalPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C_BaseCombatWeapon
的用法示例。
在下文中一共展示了C_BaseCombatWeapon::IsCarriedByLocalPlayer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDataChanged
void CBeam::OnDataChanged( DataUpdateType_t updateType )
{
MarkMessageReceived();
// Make sure that the correct model is referenced for this entity
SetModelPointer( modelinfo->GetModel( GetModelIndex() ) );
// Convert weapon world models to viewmodels if they're weapons being carried by the local player
for (int i=0;i<MAX_BEAM_ENTS;i++)
{
C_BaseEntity *pEnt = m_hAttachEntity[i].Get();
if ( pEnt )
{
C_BaseCombatWeapon *pWpn = dynamic_cast<C_BaseCombatWeapon *>(pEnt);
if ( pWpn && pWpn->IsCarriedByLocalPlayer() )
{
C_BasePlayer *player = ToBasePlayer( pWpn->GetOwner() );
C_BaseViewModel *pViewModel = player ? player->GetViewModel( 0 ) : NULL;
if ( pViewModel )
{
// Get the viewmodel and use it instead
m_hAttachEntity.Set( i, pViewModel );
}
}
}
}
// Compute the bounds here...
Vector mins, maxs;
ComputeBounds( mins, maxs );
SetCollisionBounds( mins, maxs );
}
示例2: GetTracerOrigin
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Vector GetTracerOrigin( const CEffectData &data )
{
Vector vecStart = data.m_vStart;
QAngle vecAngles;
int iAttachment = data.m_nAttachmentIndex;;
// Attachment?
if ( data.m_fFlags & TRACER_FLAG_USEATTACHMENT )
{
C_BaseViewModel *pViewModel = NULL;
// If the entity specified is a weapon being carried by this player, use the viewmodel instead
IClientRenderable *pRenderable = data.GetRenderable();
if ( !pRenderable )
return vecStart;
C_BaseEntity *pEnt = data.GetEntity();
FOR_EACH_VALID_SPLITSCREEN_PLAYER( hh )
{
ACTIVE_SPLITSCREEN_PLAYER_GUARD( hh );
C_BaseCombatWeapon *pWpn = ToBaseCombatWeapon( pEnt );
if ( pWpn && pWpn->IsCarriedByLocalPlayer() )
{
C_BasePlayer *player = ToBasePlayer( pWpn->GetOwner() );
if( !player && pWpn->GetOwner() && pWpn->GetOwner()->IsUnit() )
{
player = pWpn->GetOwner()->MyUnitPointer()->GetCommander();
}
pViewModel = player ? player->GetViewModel( 0 ) : NULL;
if ( pViewModel )
{
// Get the viewmodel and use it instead
pRenderable = pViewModel;
break;
}
}
}
// Get the attachment origin
if ( !pRenderable->GetAttachment( iAttachment, vecStart, vecAngles ) )
{
DevMsg( "GetTracerOrigin: Couldn't find attachment %d on model %s\n", iAttachment,
modelinfo->GetModelName( pRenderable->GetModel() ) );
}
}
示例3: GetTracerOrigin
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Vector GetTracerOrigin( const CEffectData &data )
{
Vector vecStart = data.m_vStart;
QAngle vecAngles;
int iAttachment = data.m_nAttachmentIndex;;
// Attachment?
if ( data.m_fFlags & TRACER_FLAG_USEATTACHMENT )
{
C_BaseViewModel *pViewModel = NULL;
// If the entity specified is a weapon being carried by this player, use the viewmodel instead
IClientRenderable *pRenderable = data.GetRenderable();
if ( !pRenderable )
return vecStart;
C_BaseEntity *pEnt = data.GetEntity();
// This check should probably be for all multiplayer games, investigate later
#if defined( HL2MP ) || defined( TF_CLIENT_DLL )
if ( pEnt && pEnt->IsDormant() )
return vecStart;
#endif
C_BaseCombatWeapon *pWpn = dynamic_cast<C_BaseCombatWeapon *>( pEnt );
if ( pWpn && pWpn->IsCarriedByLocalPlayer() )
{
C_BasePlayer *player = ToBasePlayer( pWpn->GetOwner() );
pViewModel = player ? player->GetViewModel( 0 ) : NULL;
if ( pViewModel )
{
// Get the viewmodel and use it instead
pRenderable = pViewModel;
}
}
// Get the attachment origin
if ( !pRenderable->GetAttachment( iAttachment, vecStart, vecAngles ) )
{
DevMsg( "GetTracerOrigin: Couldn't find attachment %d on model %s\n", iAttachment,
modelinfo->GetModelName( pRenderable->GetModel() ) );
}
}
return vecStart;
}
示例4: GetTracerOrigin
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Vector GetTracerOrigin( const CEffectData &data )
{
Vector vecStart = data.m_vStart;
QAngle vecAngles;
int iEntIndex = data.m_nEntIndex;
// Attachment?
if ( data.m_fFlags & TRACER_FLAG_USEATTACHMENT )
{
int iAttachment = data.m_vStart[0];
C_BaseViewModel *pViewModel = NULL;
// If the entity specified is a weapon being carried by this player, use the viewmodel instead
C_BaseEntity *pEnt = ClientEntityList().GetEnt( iEntIndex );
if ( !pEnt )
return vecStart;
C_BaseCombatWeapon *pWpn = dynamic_cast<C_BaseCombatWeapon *>(pEnt);
if ( pWpn && pWpn->IsCarriedByLocalPlayer() )
{
C_BasePlayer *player = ToBasePlayer( pWpn->GetOwner() );
pViewModel = player ? player->GetViewModel( 0 ) : NULL;
if ( pViewModel )
{
// Get the viewmodel and use it instead
pEnt = pViewModel;
}
}
// Get the attachment origin
if ( !pEnt->GetAttachment( iAttachment, vecStart, vecAngles ) )
{
Msg( "GetTracerOrigin: Couldn't find attachment %d on model %s\n", iAttachment, pEnt->GetModelName() );
}
}
return vecStart;
}