本文整理汇总了C++中CStudioHdr::iRelativeAnim方法的典型用法代码示例。如果您正苦于以下问题:C++ CStudioHdr::iRelativeAnim方法的具体用法?C++ CStudioHdr::iRelativeAnim怎么用?C++ CStudioHdr::iRelativeAnim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStudioHdr
的用法示例。
在下文中一共展示了CStudioHdr::iRelativeAnim方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrefetchAnimBlocks
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_SceneEntity::PrefetchAnimBlocks( CChoreoScene *pScene )
{
if (!CommandLine()->FindParm("-hushasserts"))
{
Assert( pScene && m_bMultiplayer );
}
if ( !pScene || !m_bMultiplayer )
return;
// Build a fast lookup, too
CUtlMap<CChoreoActor*,CBaseFlex*> actorMap( 0, 0, DefLessFunc( CChoreoActor* ) );
int nSpew = 0;
int nResident = 0;
int nChecked = 0;
// Iterate events and precache necessary resources
for ( int i = 0; i < pScene->GetNumEvents(); i++ )
{
CChoreoEvent *pEvent = pScene->GetEvent( i );
if ( !pEvent )
continue;
// load any necessary data
switch ( pEvent->GetType() )
{
default:
break;
case CChoreoEvent::SEQUENCE:
case CChoreoEvent::GESTURE:
{
CChoreoActor *pActor = pEvent->GetActor();
if ( pActor )
{
CBaseFlex *pFlex = NULL;
int idx = actorMap.Find( pActor );
if ( idx == actorMap.InvalidIndex() )
{
pFlex = FindNamedActor( pActor );
idx = actorMap.Insert( pActor, pFlex );
}
else
{
pFlex = actorMap[ idx ];
}
if ( pFlex )
{
int iSequence = pFlex->LookupSequence( pEvent->GetParameters() );
if ( iSequence >= 0 )
{
CStudioHdr *pStudioHdr = pFlex->GetModelPtr();
if ( pStudioHdr )
{
// Now look up the animblock
mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( iSequence );
for ( int i = 0 ; i < seqdesc.groupsize[ 0 ] ; ++i )
{
for ( int j = 0; j < seqdesc.groupsize[ 1 ]; ++j )
{
int iAnimation = seqdesc.anim( i, j );
int iBaseAnimation = pStudioHdr->iRelativeAnim( iSequence, iAnimation );
mstudioanimdesc_t &animdesc = pStudioHdr->pAnimdesc( iBaseAnimation );
++nChecked;
if ( nSpew != 0 )
{
Msg( "%s checking block %d\n", pStudioHdr->pszName(), animdesc.animblock );
}
// Async load the animation
int iFrame = 0;
const mstudioanim_t *panim = animdesc.pAnim( &iFrame );
if ( panim )
{
++nResident;
if ( nSpew > 1 )
{
Msg( "%s:%s[%i:%i] was resident\n", pStudioHdr->pszName(), animdesc.pszName(), i, j );
}
}
else
{
if ( nSpew != 0 )
{
Msg( "%s:%s[%i:%i] async load\n", pStudioHdr->pszName(), animdesc.pszName(), i, j );
}
}
}
}
}
}
}
}
break;
}
//.........这里部分代码省略.........