//------------------------------------------------------------------------------ // Purpose : Given an .mdl file with gibs and the number of gibs in the file // spawns them in pVictim's bounding box // Input : // Output : //------------------------------------------------------------------------------ void CGib::SpawnSpecificGibs( CBaseEntity* pVictim, int nNumGibs, float vMinVelocity, float vMaxVelocity, const char* cModelName, float flLifetime) { for ( int i = 0; i < nNumGibs; i++ ) { CGib *pGib = CREATE_ENTITY( CGib, "gib" ); pGib->Spawn( cModelName, flLifetime ); pGib->m_nBody = i; pGib->InitGib( pVictim, vMinVelocity, vMaxVelocity ); pGib->m_lifeTime = flLifetime; if ( pVictim != NULL ) { pGib->SetOwnerEntity( pVictim ); } //If pVictim is on fire, ignite pVictim's gibs as well. if ( pVictim->GetFlags() & FL_ONFIRE ) { pGib->Ignite( ( flLifetime - 1 ), false ); } } }