Exemplo n.º 1
0
// Find an entity that I'm interested in and precache the sounds he'll need in the sequence.
void CCineMonster::Activate(void)
{
	edict_t *     pentTarget;
	CBaseMonster *pTarget;

	// The entity name could be a target name or a classname
	// Check the targetname
	pentTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(m_iszEntity));
	pTarget    = NULL;

	while(!pTarget && !FNullEnt(pentTarget))
	{
		if(FBitSet(VARS(pentTarget)->flags, FL_MONSTER))
		{
			pTarget = GetMonsterPointer(pentTarget);
		}
		pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(m_iszEntity));
	}

	// If no entity with that targetname, check the classname
	if(!pTarget)
	{
		pentTarget = FIND_ENTITY_BY_CLASSNAME(NULL, STRING(m_iszEntity));
		while(!pTarget && !FNullEnt(pentTarget))
		{
			pTarget    = GetMonsterPointer(pentTarget);
			pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(m_iszEntity));
		}
	}
	// Found a compatible entity
	if(pTarget)
	{
		void *pmodel;
		pmodel = GET_MODEL_PTR(pTarget->edict());
		if(pmodel)
		{
			// Look through the event list for stuff to precache
			SequencePrecache(pmodel, STRING(m_iszIdle));
			SequencePrecache(pmodel, STRING(m_iszPlay));
		}
	}
}
Exemplo n.º 2
0
// Find an entity that I'm interested in and precache the sounds he'll need in the sequence.
void CCineMonster::Activate( void )
{
	CBaseMonster* pTarget = nullptr;

	CBaseEntity* pNextTarget = nullptr;

	// The entity name could be a target name or a classname
	// Check the targetname
	while( !pTarget && ( pNextTarget = UTIL_FindEntityByTargetname( pNextTarget, STRING( m_iszEntity ) ) ) != nullptr )
	{
		if( pNextTarget->GetFlags().Any( FL_MONSTER ) )
		{
			pTarget = pNextTarget->MyMonsterPointer();
		}
	}

	// If no entity with that targetname, check the classname
	if( !pTarget )
	{
		pNextTarget = nullptr;
		while( !pTarget && ( pNextTarget = UTIL_FindEntityByClassname( pNextTarget, STRING( m_iszEntity ) ) ) != nullptr )
		{
			pTarget = pNextTarget->MyMonsterPointer();
		}
	}

	// Found a compatible entity
	if( pTarget )
	{
		void *pmodel;
		pmodel = GET_MODEL_PTR( pTarget->edict() );
		if( pmodel )
		{
			// Look through the event list for stuff to precache
			SequencePrecache( pmodel, STRING( m_iszIdle ) );
			SequencePrecache( pmodel, STRING( m_iszPlay ) );
		}
	}
}