本文整理汇总了C++中CBaseAnimating::GetAttachment方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseAnimating::GetAttachment方法的具体用法?C++ CBaseAnimating::GetAttachment怎么用?C++ CBaseAnimating::GetAttachment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseAnimating
的用法示例。
在下文中一共展示了CBaseAnimating::GetAttachment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool CRopeKeyframe::GetEndPointPos2( CBaseEntity *pAttached, int iAttachment, Vector &vPos )
{
if( !pAttached )
return false;
if ( iAttachment > 0 )
{
CBaseAnimating *pAnim = pAttached->GetBaseAnimating();
if ( pAnim )
{
if( !pAnim->GetAttachment( iAttachment, vPos ) )
return false;
}
else
{
return false;
}
}
else
{
vPos = pAttached->GetAbsOrigin();
}
return true;
}
示例2: GetExitAnimToUse
//-----------------------------------------------------------------------------
// Purpose:
// Input : &vecEyeExitEndpoint -
// Output : int
//-----------------------------------------------------------------------------
int CJeepFourWheelServerVehicle::GetExitAnimToUse( Vector &vecEyeExitEndpoint, bool &bAllPointsBlocked )
{
bAllPointsBlocked = false;
if ( !m_bParsedAnimations )
{
// Load the entry/exit animations from the vehicle
ParseEntryExitAnims();
m_bParsedAnimations = true;
}
CBaseAnimating *pAnimating = dynamic_cast<CBaseAnimating *>(m_pVehicle);
// If we don't have the gun anymore, we want to get out using the "gun-less" animation
if ( pAnimating )
{
// HACK: We know the tau-cannon removed exit anim uses the first upright anim's exit details
trace_t tr;
Vector vehicleExitOrigin;
QAngle vehicleExitAngles;
// Ensure the endpoint is clear by dropping a point down from above
pAnimating->GetAttachment( m_ExitAnimations[0].iAttachment, vehicleExitOrigin, vehicleExitAngles );
vehicleExitOrigin -= VEC_VIEW;
Vector vecMove = Vector(0,0,64);
Vector vecStart = vehicleExitOrigin + vecMove;
Vector vecEnd = vehicleExitOrigin - vecMove;
UTIL_TraceHull( vecStart, vecEnd, VEC_HULL_MIN, VEC_HULL_MAX, MASK_SOLID, NULL, COLLISION_GROUP_NONE, &tr );
Assert( !tr.startsolid && tr.fraction < 1.0 );
m_vecCurrentExitEndPoint = vecStart + ((vecEnd - vecStart) * tr.fraction);
vecEyeExitEndpoint = m_vecCurrentExitEndPoint + VEC_VIEW;
m_iCurrentExitAnim = 0;
return pAnimating->LookupSequence( "exit_tauremoved" );
}
return BaseClass::GetExitAnimToUse( vecEyeExitEndpoint, bAllPointsBlocked );
}
示例3: PropBreakableCreateAll
void PropBreakableCreateAll( int modelindex, IPhysicsObject *pPhysics, const breakablepropparams_t ¶ms, CBaseEntity *pEntity, int iPrecomputedBreakableCount, bool bIgnoreGibLimit, bool defaultLocation )
{
// Check for prop breakable count reset.
int nPropCount = props_break_max_pieces_perframe.GetInt();
if ( nPropCount != -1 )
{
if ( nFrameNumber != gpGlobals->framecount )
{
nPropBreakablesPerFrameCount = 0;
nFrameNumber = gpGlobals->framecount;
}
// Check for max breakable count for the frame.
if ( nPropBreakablesPerFrameCount >= nPropCount )
return;
}
int iMaxBreakCount = bIgnoreGibLimit ? -1 : props_break_max_pieces.GetInt();
if ( iMaxBreakCount != -1 )
{
if ( iPrecomputedBreakableCount != -1 )
{
iPrecomputedBreakableCount = MIN( iMaxBreakCount, iPrecomputedBreakableCount );
}
else
{
iPrecomputedBreakableCount = iMaxBreakCount;
}
}
#ifdef GAME_DLL
// On server limit break model creation
if ( !PropBreakableCapEdictsOnCreateAll(modelindex, pPhysics, params, pEntity, iPrecomputedBreakableCount ) )
{
DevMsg( "Failed to create PropBreakable: would exceed MAX_EDICTS\n" );
return;
}
#endif
vcollide_t *pCollide = modelinfo->GetVCollide( modelindex );
if ( !pCollide )
return;
int nSkin = 0;
CBaseEntity *pOwnerEntity = pEntity;
CBaseAnimating *pOwnerAnim = NULL;
if ( pPhysics )
{
pOwnerEntity = static_cast<CBaseEntity *>(pPhysics->GetGameData());
}
if ( pOwnerEntity )
{
pOwnerAnim = pOwnerEntity->GetBaseAnimating();
if ( pOwnerAnim )
{
nSkin = pOwnerAnim->m_nSkin;
}
}
matrix3x4_t localToWorld;
CStudioHdr studioHdr;
const model_t *model = modelinfo->GetModel( modelindex );
if ( model )
{
studioHdr.Init( modelinfo->GetStudiomodel( model ) );
}
Vector parentOrigin = vec3_origin;
int parentAttachment = Studio_FindAttachment( &studioHdr, "placementOrigin" ) + 1;
if ( parentAttachment > 0 )
{
GetAttachmentLocalSpace( &studioHdr, parentAttachment-1, localToWorld );
MatrixGetColumn( localToWorld, 3, parentOrigin );
}
else
{
AngleMatrix( vec3_angle, localToWorld );
}
CUtlVector<breakmodel_t> list;
BreakModelList( list, modelindex, params.defBurstScale, params.defCollisionGroup );
if ( list.Count() )
{
for ( int i = 0; i < list.Count(); i++ )
{
int modelIndex = modelinfo->GetModelIndex( list[i].modelName );
if ( modelIndex <= 0 )
continue;
// Skip multiplayer pieces that should be spawning on the other dll
#ifdef GAME_DLL
if ( gpGlobals->maxClients > 1 && breakable_multiplayer.GetBool() )
#else
if ( gpGlobals->maxClients > 1 )
#endif
{
#ifdef GAME_DLL
if ( list[i].mpBreakMode == MULTIPLAYER_BREAK_CLIENTSIDE )
//.........这里部分代码省略.........
示例4: SpawnControlPanels
//-----------------------------------------------------------------------------
// This is called by the base object when it's time to spawn the control panels
//-----------------------------------------------------------------------------
void CBaseViewModel::SpawnControlPanels()
{
#if defined( VGUI_CONTROL_PANELS )
char buf[64];
// Destroy existing panels
DestroyControlPanels();
CBaseCombatWeapon *weapon = m_hWeapon.Get();
if ( weapon == NULL )
{
return;
}
MDLCACHE_CRITICAL_SECTION();
// FIXME: Deal with dynamically resizing control panels?
// If we're attached to an entity, spawn control panels on it instead of use
CBaseAnimating *pEntityToSpawnOn = this;
char *pOrgLL = "controlpanel%d_ll";
char *pOrgUR = "controlpanel%d_ur";
char *pAttachmentNameLL = pOrgLL;
char *pAttachmentNameUR = pOrgUR;
/*
if ( IsBuiltOnAttachment() )
{
pEntityToSpawnOn = dynamic_cast<CBaseAnimating*>((CBaseEntity*)m_hBuiltOnEntity.Get());
if ( pEntityToSpawnOn )
{
char sBuildPointLL[64];
char sBuildPointUR[64];
Q_snprintf( sBuildPointLL, sizeof( sBuildPointLL ), "bp%d_controlpanel%%d_ll", m_iBuiltOnPoint );
Q_snprintf( sBuildPointUR, sizeof( sBuildPointUR ), "bp%d_controlpanel%%d_ur", m_iBuiltOnPoint );
pAttachmentNameLL = sBuildPointLL;
pAttachmentNameUR = sBuildPointUR;
}
else
{
pEntityToSpawnOn = this;
}
}
*/
Assert( pEntityToSpawnOn );
// Lookup the attachment point...
int nPanel;
for ( nPanel = 0; true; ++nPanel )
{
Q_snprintf( buf, sizeof( buf ), pAttachmentNameLL, nPanel );
int nLLAttachmentIndex = pEntityToSpawnOn->LookupAttachment(buf);
if (nLLAttachmentIndex <= 0)
{
// Try and use my panels then
pEntityToSpawnOn = this;
Q_snprintf( buf, sizeof( buf ), pOrgLL, nPanel );
nLLAttachmentIndex = pEntityToSpawnOn->LookupAttachment(buf);
if (nLLAttachmentIndex <= 0)
return;
}
Q_snprintf( buf, sizeof( buf ), pAttachmentNameUR, nPanel );
int nURAttachmentIndex = pEntityToSpawnOn->LookupAttachment(buf);
if (nURAttachmentIndex <= 0)
{
// Try and use my panels then
Q_snprintf( buf, sizeof( buf ), pOrgUR, nPanel );
nURAttachmentIndex = pEntityToSpawnOn->LookupAttachment(buf);
if (nURAttachmentIndex <= 0)
return;
}
const char *pScreenName;
weapon->GetControlPanelInfo( nPanel, pScreenName );
if (!pScreenName)
continue;
const char *pScreenClassname;
weapon->GetControlPanelClassName( nPanel, pScreenClassname );
if ( !pScreenClassname )
continue;
// Compute the screen size from the attachment points...
matrix3x4_t panelToWorld;
pEntityToSpawnOn->GetAttachment( nLLAttachmentIndex, panelToWorld );
matrix3x4_t worldToPanel;
MatrixInvert( panelToWorld, worldToPanel );
// Now get the lower right position + transform into panel space
Vector lr, lrlocal;
pEntityToSpawnOn->GetAttachment( nURAttachmentIndex, panelToWorld );
MatrixGetColumn( panelToWorld, 3, lr );
VectorTransform( lr, worldToPanel, lrlocal );
//.........这里部分代码省略.........
示例5: sizeof
//-----------------------------------------------------------------------------
// This is called by the base object when it's time to spawn the control panels
//-----------------------------------------------------------------------------
void CPlantedC4::SpawnControlPanels()
{
char buf[64];
// FIXME: Deal with dynamically resizing control panels?
// If we're attached to an entity, spawn control panels on it instead of use
CBaseAnimating *pEntityToSpawnOn = this;
char *pOrgLL = "controlpanel%d_ll";
char *pOrgUR = "controlpanel%d_ur";
char *pAttachmentNameLL = pOrgLL;
char *pAttachmentNameUR = pOrgUR;
Assert( pEntityToSpawnOn );
// Lookup the attachment point...
int nPanel;
for ( nPanel = 0; true; ++nPanel )
{
Q_snprintf( buf, sizeof( buf ), pAttachmentNameLL, nPanel );
int nLLAttachmentIndex = pEntityToSpawnOn->LookupAttachment(buf);
if (nLLAttachmentIndex <= 0)
{
// Try and use my panels then
pEntityToSpawnOn = this;
Q_snprintf( buf, sizeof( buf ), pOrgLL, nPanel );
nLLAttachmentIndex = pEntityToSpawnOn->LookupAttachment(buf);
if (nLLAttachmentIndex <= 0)
return;
}
Q_snprintf( buf, sizeof( buf ), pAttachmentNameUR, nPanel );
int nURAttachmentIndex = pEntityToSpawnOn->LookupAttachment(buf);
if (nURAttachmentIndex <= 0)
{
// Try and use my panels then
Q_snprintf( buf, sizeof( buf ), pOrgUR, nPanel );
nURAttachmentIndex = pEntityToSpawnOn->LookupAttachment(buf);
if (nURAttachmentIndex <= 0)
return;
}
const char *pScreenName;
GetControlPanelInfo( nPanel, pScreenName );
if (!pScreenName)
continue;
const char *pScreenClassname;
GetControlPanelClassName( nPanel, pScreenClassname );
if ( !pScreenClassname )
continue;
// Compute the screen size from the attachment points...
matrix3x4_t panelToWorld;
pEntityToSpawnOn->GetAttachment( nLLAttachmentIndex, panelToWorld );
matrix3x4_t worldToPanel;
MatrixInvert( panelToWorld, worldToPanel );
// Now get the lower right position + transform into panel space
Vector lr, lrlocal;
pEntityToSpawnOn->GetAttachment( nURAttachmentIndex, panelToWorld );
MatrixGetColumn( panelToWorld, 3, lr );
VectorTransform( lr, worldToPanel, lrlocal );
float flWidth = lrlocal.x;
float flHeight = lrlocal.y;
CVGuiScreen *pScreen = CreateVGuiScreen( pScreenClassname, pScreenName, pEntityToSpawnOn, this, nLLAttachmentIndex );
pScreen->ChangeTeam( GetTeamNumber() );
pScreen->SetActualSize( flWidth, flHeight );
pScreen->SetActive( true );
pScreen->MakeVisibleOnlyToTeammates( false );
int nScreen = m_hScreens.AddToTail( );
m_hScreens[nScreen].Set( pScreen );
}
}