本文整理汇总了C++中CChoreoScene::GetEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ CChoreoScene::GetEvent方法的具体用法?C++ CChoreoScene::GetEvent怎么用?C++ CChoreoScene::GetEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChoreoScene
的用法示例。
在下文中一共展示了CChoreoScene::GetEvent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateTargetFile_VCD
//-----------------------------------------------------------------------------
// Create binary compiled version of VCD. Stores to a dictionary for later
// post processing
//-----------------------------------------------------------------------------
bool CreateTargetFile_VCD( const char *pSourceName, const char *pTargetName, bool bWriteToZip, bool bLittleEndian )
{
CUtlBuffer sourceBuf;
if ( !scriptlib->ReadFileToBuffer( pSourceName, sourceBuf ) )
{
return false;
}
CRC32_t crcSource;
CRC32_Init( &crcSource );
CRC32_ProcessBuffer( &crcSource, sourceBuf.Base(), sourceBuf.TellMaxPut() );
CRC32_Final( &crcSource );
ParseFromMemory( (char *)sourceBuf.Base(), sourceBuf.TellMaxPut() );
CChoreoScene *pChoreoScene = ChoreoLoadScene( pSourceName, NULL, &g_SceneTokenProcessor, Msg );
if ( !pChoreoScene )
{
return false;
}
int iScene = g_SceneFiles.AddToTail();
g_SceneFiles[iScene].fileName.Set( pSourceName );
// Walk all events looking for SPEAK events
CChoreoEvent *pEvent;
for ( int i = 0; i < pChoreoScene->GetNumEvents(); ++i )
{
pEvent = pChoreoScene->GetEvent( i );
FindSoundsInEvent( pEvent, g_SceneFiles[iScene].soundList );
}
// calc duration
g_SceneFiles[iScene].msecs = (unsigned int)( pChoreoScene->FindStopTime() * 1000.0f + 0.5f );
// compile to binary buffer
g_SceneFiles[iScene].compiledBuffer.SetBigEndian( !bLittleEndian );
pChoreoScene->SaveToBinaryBuffer( g_SceneFiles[iScene].compiledBuffer, crcSource, &g_ChoreoStringPool );
unsigned int compressedSize;
unsigned char *pCompressedBuffer = LZMA_Compress( (unsigned char *)g_SceneFiles[iScene].compiledBuffer.Base(), g_SceneFiles[iScene].compiledBuffer.TellMaxPut(), &compressedSize );
if ( pCompressedBuffer )
{
// replace the compiled buffer with the compressed version
g_SceneFiles[iScene].compiledBuffer.Purge();
g_SceneFiles[iScene].compiledBuffer.EnsureCapacity( compressedSize );
g_SceneFiles[iScene].compiledBuffer.Put( pCompressedBuffer, compressedSize );
free( pCompressedBuffer );
}
delete pChoreoScene;
return true;
}
示例2: 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;
}
示例3: Rebuild
void CSceneCache::Rebuild( char const *filename )
{
msecs = 0;
sounds.RemoveAll();
CChoreoScene *scene = BlockingLoadScene( filename );
if ( scene )
{
// Walk all events looking for SPEAK events
CChoreoEvent *event;
int c = scene->GetNumEvents();
for ( int i = 0; i < c; ++i )
{
event = scene->GetEvent( i );
PrecacheSceneEvent( event, sounds );
}
// Update scene duration, too
msecs = (int)( scene->FindStopTime() * 1000.0f + 0.5f );
delete scene;
}
}
示例4: 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;
}