コード例 #1
0
static bool IsFlexTrackBeingUsed( CChoreoEvent *event, char const *trackName )
{
    int tc = event->GetNumFlexAnimationTracks();
    for ( int track = 0; track < tc; ++track )
    {
        CFlexAnimationTrack *t = event->GetFlexAnimationTrack( track );
        if ( !t->IsTrackActive() )
        {
            continue;
        }

        int sampleCountNormal = t->GetNumSamples( 0 );
        int sampleCountBalance = 0;
        if ( t->IsComboType() )
        {
            sampleCountBalance = t->GetNumSamples( 1 );
        }

        if ( !sampleCountNormal && !sampleCountBalance )
            continue;

        // Otherwise, see if the test track has this as an active track
        if ( !Q_stricmp( t->GetFlexControllerName(), trackName ) )
        {
            return true;
        }
    }
    return false;
}
コード例 #2
0
static bool EventCollidesWithRows( CUtlLinkedList< CChoreoEvent*, int >& list, CChoreoEvent *event, char *trackName, size_t trackNameLength )
{
    float st = event->GetStartTime();
    float ed = event->GetEndTime();

    for ( int i = list.Head(); i != list.InvalidIndex(); i = list.Next( i ) )
    {
        CChoreoEvent *test = list[ i ];

        float teststart = test->GetStartTime();
        float testend = test->GetEndTime();

        // See if spans overlap
        if ( teststart >= ed )
            continue;
        if ( testend <= st )
            continue;

        // Now see if they deal with the same flex controller
        int tc = event->GetNumFlexAnimationTracks();
        for ( int track = 0; track < tc; ++track )
        {
            CFlexAnimationTrack *t = event->GetFlexAnimationTrack( track );
            if ( !t->IsTrackActive() )
            {
                continue;
            }

            int sampleCountNormal = t->GetNumSamples( 0 );
            int sampleCountBalance = 0;
            if ( t->IsComboType() )
            {
                sampleCountBalance = t->GetNumSamples( 1 );
            }

            if ( !sampleCountNormal && !sampleCountBalance )
                continue;

            // Otherwise, see if the test track has this as an active track
            if ( IsFlexTrackBeingUsed( test, t->GetFlexControllerName() ) )
            {
                Q_strncpy( trackName, t->GetFlexControllerName(), trackNameLength );
                return true;
            }
        }
        return false;
    }

    return false;
}