Пример #1
0
void UTIL_PrecacheOther( const char *szClassname )
{
#if PRECACHE_OTHER_ONCE
	// already done this one?, if not, mark as done
	if ( !g_PrecacheOtherList.AddOrMarkPrecached( szClassname ) )
		return;
#endif

	// Client should only do this once entities are coming down from server!!!
	// Assert( engine->IsConnected() );

	C_BaseEntity	*pEntity = CreateEntityByName( szClassname );
	if ( !pEntity )
	{
		Warning( "NULL Ent in UTIL_PrecacheOther\n" );
		return;
	}
	
	if (pEntity)
	{
		pEntity->Precache( );
	}

	// Bye bye
	pEntity->Release();
}
Пример #2
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *szClassname - 
//			*modelName - 
//-----------------------------------------------------------------------------
void UTIL_PrecacheOther( const char *szClassname, const char *modelName )
{
#if defined( PRECACHE_OTHER_ONCE )
    // already done this one?, if not, mark as done
    if ( !g_PrecacheOtherList.AddOrMarkPrecached( szClassname ) )
        return;
#endif

    CBaseEntity	*pEntity = CreateEntityByName( szClassname );
    if ( !pEntity )
    {
        Warning( "NULL Ent in UTIL_PrecacheOther for %s\n", szClassname );
        return;
    }

    // If we have a specified model, set it before calling precache
    if ( modelName && modelName[0] )
    {
        VFuncs::SetModelName(pEntity, AllocPooledString( modelName ) );
    }
    
    if (pEntity)
        VFuncs::Precache( pEntity );

    UTIL_RemoveImmediate( pEntity );
}