MCPcopy Create free account
hub / github.com/carbonengine/trinity / PlayLayerAnimationByName

Method PlayLayerAnimationByName

trinity/Tr2GrannyAnimation.cpp:1451–1489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1449}
1450
1451bool Tr2GrannyAnimation::PlayLayerAnimationByName( const char* layerName, const char* animName, bool replace, int loopCount, float delay, float speed, bool clearWhenDone )
1452{
1453 Tr2GrannyAnimationLayer* layer = GetAnimationLayer( layerName );
1454 if( !layer )
1455 {
1456 return false;
1457 }
1458
1459 bool secondaryGrannyResPrepared = true;
1460 for( auto it = m_secondaryGrannyRes.begin(); it != m_secondaryGrannyRes.end(); it++ )
1461 {
1462 secondaryGrannyResPrepared = secondaryGrannyResPrepared && it->second->IsPrepared();
1463 }
1464
1465 if( ( !m_grannyRes && !m_geometryRes ) ||
1466 ( m_grannyRes && !m_grannyRes->IsPrepared() ) ||
1467 ( m_geometryRes && !m_geometryRes->IsPrepared() ) ||
1468 !secondaryGrannyResPrepared )
1469 {
1470 layer->QueueAnimation( animName, replace, loopCount, delay, speed, clearWhenDone );
1471 return true;
1472 }
1473
1474 bool secondaryGrannyResGood = true;
1475 for( auto it = m_secondaryGrannyRes.begin(); it != m_secondaryGrannyRes.end(); it++ )
1476 {
1477 secondaryGrannyResGood = secondaryGrannyResGood && it->second->IsGood();
1478 }
1479
1480 if( ( ( m_grannyRes && !m_grannyRes->IsGood() ) ||
1481 ( m_geometryRes && !m_geometryRes->IsGood() ) ||
1482 !secondaryGrannyResGood ) )
1483 {
1484 CCP_LOGERR( "Animation resource failed to load!" );
1485 return false;
1486 }
1487
1488 return layer->PlayAnimation( this, animName, replace, loopCount, delay, speed, clearWhenDone );
1489}
1490
1491void Tr2GrannyAnimation::EndAnimation()
1492{

Callers 1

StartMethod · 0.80

Calls 5

QueueAnimationMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
IsGoodMethod · 0.45
PlayAnimationMethod · 0.45

Tested by

no test coverage detected