本文整理汇总了C++中CChoreoEvent类的典型用法代码示例。如果您正苦于以下问题:C++ CChoreoEvent类的具体用法?C++ CChoreoEvent怎么用?C++ CChoreoEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CChoreoEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetEvent
void CChoreoGlobalEventWidget::DrawLabel( CChoreoWidgetDrawHelper& drawHelper, COLORREF clr, int x, int y, bool right )
{
CChoreoEvent *event = GetEvent();
if ( !event )
return;
int len = drawHelper.CalcTextWidth( "Arial", 9, FW_NORMAL, va( "%s", event->GetName() ) );
RECT rcText;
rcText.top = y;
rcText.bottom = y + 10;
rcText.left = x - len / 2;
rcText.right = rcText.left + len;
if ( !right )
{
drawHelper.DrawColoredTextCharset( "Marlett", 9, FW_NORMAL, SYMBOL_CHARSET, clr, rcText, "3" );
OffsetRect( &rcText, 8, 0 );
drawHelper.DrawColoredText( "Arial", 9, FW_NORMAL, clr, rcText, va( "%s", event->GetName() ) );
}
else
{
drawHelper.DrawColoredText( "Arial", 9, FW_NORMAL, clr, rcText, va( "%s", event->GetName() ) );
OffsetRect( &rcText, len, 0 );
drawHelper.DrawColoredTextCharset( "Marlett", 9, FW_NORMAL, SYMBOL_CHARSET, clr, rcText, "4" );
}
}
示例2: SetMarkedForSave
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CChoreoChannel::MarkForSaveAll( bool mark )
{
SetMarkedForSave( mark );
int c = GetNumEvents();
for ( int i = 0; i < c; i++ )
{
CChoreoEvent *e = GetEvent( i );
e->SetMarkedForSave( mark );
}
}
示例3: EventCollidesWithRows
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;
}
示例4: Q_strncpy
//-----------------------------------------------------------------------------
// Purpose:
// Assignment
// Input : src -
//-----------------------------------------------------------------------------
CChoreoChannel& CChoreoChannel::operator=( const CChoreoChannel& src )
{
m_bActive = src.m_bActive;
Q_strncpy( m_szName, src.m_szName, sizeof( m_szName ) );
for ( int i = 0; i < src.m_Events.Count(); i++ )
{
CChoreoEvent *e = src.m_Events[ i ];
CChoreoEvent *newEvent = new CChoreoEvent( e->GetScene() );
*newEvent = *e;
AddEvent( newEvent );
newEvent->SetChannel( this );
newEvent->SetActor( m_pActor );
}
return *this;
}
示例5: GetControl
void CBaseEventPropertiesDialog::PopulateTagList( CEventParams *params )
{
CChoreoScene *scene = params->m_pScene;
if ( !scene )
return;
HWND control = GetControl( IDC_TAGS );
if ( control )
{
SendMessage( control, CB_RESETCONTENT, 0, 0 );
SendMessage( control, WM_SETTEXT , 0, (LPARAM)va( "\"%s\" \"%s\"", params->m_szTagName, params->m_szTagWav ) );
for ( int i = 0; i < scene->GetNumActors(); i++ )
{
CChoreoActor *a = scene->GetActor( i );
if ( !a )
continue;
for ( int j = 0; j < a->GetNumChannels(); j++ )
{
CChoreoChannel *c = a->GetChannel( j );
if ( !c )
continue;
for ( int k = 0 ; k < c->GetNumEvents(); k++ )
{
CChoreoEvent *e = c->GetEvent( k );
if ( !e )
continue;
if ( e->GetNumRelativeTags() <= 0 )
continue;
// add each tag to combo box
for ( int t = 0; t < e->GetNumRelativeTags(); t++ )
{
CEventRelativeTag *tag = e->GetRelativeTag( t );
if ( !tag )
continue;
SendMessage( control, CB_ADDSTRING, 0, (LPARAM)va( "\"%s\" \"%s\"", tag->GetName(), e->GetParameters() ) );
}
}
}
}
}
}
示例6: GetName
void CChoreoChannel::SaveToBuffer( CUtlBuffer& buf, CChoreoScene *pScene, IChoreoStringPool *pStringPool )
{
buf.PutShort( pStringPool->FindOrAddString( GetName() ) );
int c = GetNumEvents();
Assert( c <= 255 );
buf.PutUnsignedChar( c );
for ( int i = 0; i < c; i++ )
{
CChoreoEvent *e = GetEvent( i );
Assert( e );
e->SaveToBuffer( buf, pScene, pStringPool );
}
buf.PutChar( GetActive() ? 1 : 0 );
}
示例7: AddFlexSequence
//-----------------------------------------------------------------------------
// Purpose:
// Input : *actor -
// *parameters -
//-----------------------------------------------------------------------------
void CBaseFlex::AddFlexSequence( CExpressionInfo *info )
{
if ( !info )
return;
CChoreoEvent *event = info->m_pEvent;
if ( !event )
return;
CChoreoScene *scene = info->m_pScene;
if ( !scene )
return;
if (info->m_iLayer >= 0)
{
SetLayerWeight( info->m_iLayer, event->GetIntensity( scene->GetTime() ) );
}
}
示例8: AddFlexGesture
//-----------------------------------------------------------------------------
// Purpose:
// Input : *actor -
// *parameters -
//-----------------------------------------------------------------------------
void CBaseFlex::AddFlexGesture( CExpressionInfo *info )
{
if ( !info )
return;
CChoreoEvent *event = info->m_pEvent;
if ( !event )
return;
CChoreoScene *scene = info->m_pScene;
if ( !scene )
return;
if (info->m_iLayer >= 0)
{
// this happens after StudioFrameAdvance()
float duration = event->GetDuration( );
float orig_duration = SequenceDuration( info->m_nSequence );
// when we come by again after StudioFrameAdvance() has moved forward 0.1 seconds, what frame should we be on?
float flCycle = GetLayerCycle( info->m_iLayer );
float flNextCycle = event->GetShiftedTimeFromReferenceTime( (m_flAnimTime - info->m_flStartAnim + 0.1) / duration );
// FIXME: what time should this use?
SetLayerWeight( info->m_iLayer, event->GetIntensity( scene->GetTime() ) );
float rate = (flNextCycle - flCycle) * orig_duration / 0.1;
/*
Msg( "%d : %.2f (%.2f) : %.3f %.3f : %.3f\n",
info->m_iLayer,
scene->GetTime(),
(scene->GetTime() - event->GetStartTime()) / duration,
flCycle,
flNextCycle,
rate );
*/
SetLayerPlaybackRate( info->m_iLayer, rate );
}
}
示例9: LoadSoundsFromScene
void CVCDFile::LoadSoundsFromScene( CChoreoScene *scene )
{
if ( !scene )
return;
CChoreoEvent *e;
int c = scene->GetNumEvents();
for ( int i = 0; i < c; i++ )
{
e = scene->GetEvent( i );
if ( !e )
continue;
if ( e->GetType() != CChoreoEvent::SPEAK )
continue;
CSoundEntry *se = new CSoundEntry( this, e->GetParameters() );
m_Sounds.AddToTail( se );
}
}
示例10: GetFirstSoundInScene
bool GetFirstSoundInScene( const char *pSceneFilename, char *pSoundName, int soundNameLen )
{
CChoreoScene *pScene = HammerLoadScene( pSceneFilename );
if ( !pScene )
return false;
for ( int i = 0; i < pScene->GetNumEvents(); i++ )
{
CChoreoEvent *e = pScene->GetEvent( i );
if ( !e || e->GetType() != CChoreoEvent::SPEAK )
continue;
const char *pParameters = e->GetParameters();
V_strncpy( pSoundName, pParameters, soundNameLen );
delete pScene;
return true;
}
delete pScene;
return false;
}
示例11: GetNumEvents
bool CChoreoChannel::GetSortedCombinedEventList( char const *cctoken, CUtlRBTree< CChoreoEvent * >& events )
{
events.RemoveAll();
int i;
// Sort items
int c = GetNumEvents();
for ( i = 0; i < c; i++ )
{
CChoreoEvent *e = GetEvent( i );
Assert( e );
if ( e->GetType() != CChoreoEvent::SPEAK )
continue;
if ( e->GetCloseCaptionType() == CChoreoEvent::CC_DISABLED )
continue;
// A master with no slaves is not a combined event
if ( e->GetCloseCaptionType() == CChoreoEvent::CC_MASTER &&
e->GetNumSlaves() == 0 )
continue;
char const *token = e->GetCloseCaptionToken();
if ( Q_stricmp( token, cctoken ) )
continue;
events.Insert( e );
}
return ( events.Count() > 0 ) ? true : false;
}
示例12: sizeof
bool CChoreoChannel::RestoreFromBuffer( CUtlBuffer& buf, CChoreoScene *pScene, CChoreoActor *pActor, IChoreoStringPool *pStringPool )
{
char sz[ 256 ];
pStringPool->GetString( buf.GetShort(), sz, sizeof( sz ) );
SetName( sz );
int numEvents = (int)buf.GetUnsignedChar();
for ( int i = 0 ; i < numEvents; ++i )
{
CChoreoEvent *e = pScene->AllocEvent();
if ( e->RestoreFromBuffer( buf, pScene, pStringPool ) )
{
AddEvent( e );
e->SetChannel( this );
e->SetActor( pActor );
continue;
}
return false;
}
SetActive( buf.GetChar() == 1 ? true : false );
return true;
}
示例13: GetEvent
//-----------------------------------------------------------------------------
// Purpose: FIXME: This should either be embedded or we should draw the caption
// here
//-----------------------------------------------------------------------------
void CChoreoEventWidget::redraw( CChoreoWidgetDrawHelper& drawHelper )
{
if ( !getVisible() )
return;
CChoreoEvent *event = GetEvent();
if ( !event )
return;
int deflateborder = 1;
int fontsize = 9;
HDC dc = drawHelper.GrabDC();
RECT rcClient = getBounds();
RECT rcDC;
drawHelper.GetClientRect( rcDC );
RECT dummy;
if ( !IntersectRect( &dummy, &rcDC, &rcClient ) )
return;
bool ramponly = m_pView->IsRampOnly();
if ( IsSelected() && !ramponly )
{
InflateRect( &rcClient, 3, 1 );
//rcClient.bottom -= 1;
rcClient.right += 1;
RECT rcFrame = rcClient;
RECT rcBorder = rcClient;
rcFrame.bottom = rcFrame.top + 17;
rcBorder.bottom = rcFrame.top + 17;
COLORREF clrSelection = RGB( 0, 63, 63 );
COLORREF clrBorder = RGB( 100, 200, 255 );
HBRUSH brBorder = CreateSolidBrush( clrBorder );
HBRUSH brSelected = CreateHatchBrush( HS_FDIAGONAL, clrSelection );
for ( int i = 0; i < 2; i++ )
{
FrameRect( dc, &rcFrame, brSelected );
InflateRect( &rcFrame, -1, -1 );
}
FrameRect( dc, &rcBorder, brBorder );
FrameRect( dc, &rcFrame, brBorder );
DeleteObject( brSelected );
DeleteObject( brBorder );
rcClient.right -= 1;
//rcClient.bottom += 1;
InflateRect( &rcClient, -3, -1 );
}
RECT rcEvent;
rcEvent = rcClient;
InflateRect( &rcEvent, 0, -deflateborder );
rcEvent.bottom = rcEvent.top + 10;
if ( event->GetType() == CChoreoEvent::SPEAK && m_pWaveFile && !event->HasEndTime() )
{
event->SetEndTime( event->GetStartTime() + m_pWaveFile->GetRunningLength() );
rcEvent.right = ( int )( m_pWaveFile->GetRunningLength() * m_pView->GetPixelsPerSecond() );
}
if ( event->HasEndTime() )
{
rcEvent.right = rcEvent.left + m_nDurationRightEdge;
RECT rcEventLine = rcEvent;
OffsetRect( &rcEventLine, 0, 1 );
if ( event->GetType() == CChoreoEvent::SPEAK )
{
if ( m_pWaveFile )
{
HBRUSH brEvent = CreateSolidBrush( COLOR_CHOREO_EVENT );
HBRUSH brBackground = CreateSolidBrush( COLOR_CHOREO_DARKBACKGROUND );
if ( !ramponly )
{
FillRect( dc, &rcEventLine, brBackground );
}
// Only draw wav form here if selected
if ( IsSelected() )
{
sound->RenderWavToDC( dc, rcEventLine, IsSelected() ? COLOR_CHOREO_EVENT_SELECTED : COLOR_CHOREO_EVENT, 0.0, m_pWaveFile->GetRunningLength(), m_pWaveFile );
}
//FrameRect( dc, &rcEventLine, brEvent );
drawHelper.DrawColoredLine( COLOR_CHOREO_EVENT, PS_SOLID, 3,
//.........这里部分代码省略.........
示例14: ProcessVCD
void ProcessVCD( CUtlDict< VCDList, int >& database, CUtlSymbol& vcdname )
{
// vprint( 0, "Processing '%s'\n", g_Analysis.symbols.String( vcdname ) );
// Load the .vcd
char fullname[ 512 ];
Q_snprintf( fullname, sizeof( fullname ), "%s", g_Analysis.symbols.String( vcdname ) );
LoadScriptFile( fullname );
CChoreoScene *scene = ChoreoLoadScene( fullname, NULL, &g_TokenProcessor, Con_Printf );
if ( scene )
{
bool first = true;
// Now iterate the events looking for speak events
int c = scene->GetNumEvents();
for ( int i = 0; i < c; i++ )
{
CChoreoEvent *e = scene->GetEvent( i );
if ( e->GetType() == CChoreoEvent::MOVETO )
{
SpewMoveto( first, fullname, e );
first = false;
}
if ( e->GetType() != CChoreoEvent::SPEAK )
continue;
// Look up sound in sound emitter system
char const *wavename = soundemitter->GetWavFileForSound( e->GetParameters(), NULL );
if ( !wavename || !wavename[ 0 ] )
{
continue;
}
char fullwavename[ 512 ];
Q_snprintf( fullwavename, sizeof( fullwavename ), "%ssound\\%s",
gamedir, wavename );
Q_FixSlashes( fullwavename );
// Now add to proper slot
VCDList *entry = NULL;
// Add vcd to database
int slot = database.Find( fullwavename );
if ( slot == database.InvalidIndex() )
{
VCDList nullEntry;
slot = database.Insert( fullwavename, nullEntry );
}
entry = &database[ slot ];
if ( entry->vcds.Find( vcdname ) == entry->vcds.InvalidIndex() )
{
entry->vcds.AddToTail( vcdname );
}
}
if ( vcdonly )
{
CheckForOverlappingFlexTracks( scene );
}
}
delete scene;
}
示例15: CheckForOverlappingFlexTracks
void CheckForOverlappingFlexTracks( CChoreoScene *scene )
{
for ( int a = 0; a < scene->GetNumActors(); ++a )
{
CChoreoActor *actor = scene->GetActor( a );
CUtlRBTree< CChoreoEvent * > actorFlexEvents( 0, 0, ChoreEventStartTimeLessFunc );
for ( int c = 0; c < actor->GetNumChannels(); ++c )
{
CChoreoChannel *channel = actor->GetChannel( c );
for ( int e = 0 ; e < channel->GetNumEvents(); ++e )
{
CChoreoEvent *event = channel->GetEvent( e );
if ( event->GetType() != CChoreoEvent::FLEXANIMATION )
continue;
actorFlexEvents.Insert( event );
}
}
CUtlVector< CUtlLinkedList< CChoreoEvent*, int > > rows;
bool done = false;
int i;
// Now check for overlaps
for ( i = actorFlexEvents.FirstInorder(); i != actorFlexEvents.InvalidIndex() && !done; i = actorFlexEvents.NextInorder( i ) )
{
CChoreoEvent *e = actorFlexEvents[ i ];
if ( !rows.Count() )
{
rows.AddToTail();
CUtlLinkedList< CChoreoEvent*, int >& list = rows[ 0 ];
list.AddToHead( e );
continue;
}
// Does it come totally after what's in rows[0]?
int rowCount = rows.Count();
bool addrow = true;
for ( int j = 0; j < rowCount; j++ )
{
CUtlLinkedList< CChoreoEvent*, int >& list = rows[ j ];
char offender[ 256 ];
if ( !EventCollidesWithRows( list, e, offender, sizeof( offender ) ) )
{
// Update row event list
list.AddToHead( e );
addrow = false;
break;
}
else
{
Msg( "[%s] has overlapping events for actor [%s] [%s] [flex: %s]\n",
scene->GetFilename(), actor->GetName(), e->GetName(), offender );
done = true;
}
}
if ( addrow )
{
// Add a new row
int idx = rows.AddToTail();
CUtlLinkedList< CChoreoEvent *, int >& list = rows[ idx ];
list.AddToHead( e );
}
}
// Assert( rows.Count() <= 1 );
}
}