コード例 #1
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : origin - 
//			ATTN_NORM - 
//-----------------------------------------------------------------------------
void CPASAttenuationFilter::Filter( const Vector& origin, float attenuation /*= ATTN_NORM*/ )
{
#ifdef TF_CLASSIC
	//SecobMod__Information: Try as we might, this was the only fix for getting breencasts.
	// Don't crop for attenuation 
	AddAllPlayers();
	return;
#else
	// Don't crop for attenuation in single player
	if ( gpGlobals->maxClients == 1 )
		return;
#endif
	// CPASFilter adds them by pure PVS in constructor
	if ( attenuation <= 0 )
		return;

	// Now remove recipients that are outside sound radius
	float distance, maxAudible;
	Vector vecRelative;

	int c = GetRecipientCount();
	
	for ( int i = c - 1; i >= 0; i-- )
	{
		int index = GetRecipientIndex( i );

		CBaseEntity *ent = CBaseEntity::Instance( index );
		if ( !ent || !ent->IsPlayer() )
		{
			Assert( 0 );
			continue;
		}

		CBasePlayer *player = ToBasePlayer( ent );
		if ( !player )
		{
			Assert( 0 );
			continue;
		}

#ifndef _XBOX
		// never remove the HLTV or Replay bot
		if ( player->IsHLTV() || player->IsReplay() )
			continue;
#endif

		VectorSubtract( player->EarPosition(), origin, vecRelative );
		distance = VectorLength( vecRelative );
		maxAudible = ( 2 * SOUND_NORMAL_CLIP_DIST ) / attenuation;
		if ( distance <= maxAudible )
			continue;

		RemoveRecipient( player );
	}
}
コード例 #2
0
void CRecipientFilter::AddRecipientsByPAS( const Vector& origin )
{
	if ( gpGlobals->maxClients == 1 )
	{
		AddAllPlayers();
	}
	else
	{
		CBitVec< ABSOLUTE_PLAYER_LIMIT > playerbits;
		engine->Message_DetermineMulticastRecipients( true, origin, playerbits );
		AddPlayersFromBitMask( playerbits );
	}
}
コード例 #3
0
void CEngineRecipientFilter::AddRecipientsByPAS( const Vector& origin )
{
	if ( svs.maxclients == 1 )
	{
		AddAllPlayers();
	}
	else
	{
		unsigned int playerbits = 0;
		SV_DetermineMulticastRecipients( true, origin, playerbits );
		AddPlayersFromBitMask( playerbits );
	}
}
コード例 #4
0
void CRecipientFilter::AddRecipientsByPVS( const Vector& origin )
{
	if ( gpGlobals->maxClients == 1 )
	{
		AddAllPlayers();
	}
	else
	{
		CPlayerBitVec playerbits;
		engine->Message_DetermineMulticastRecipients( false, origin, playerbits );
		AddPlayersFromBitMask( playerbits );
	}
}
コード例 #5
0
void CRecipientFilter::AddRecipientsByPAS( const Vector& origin )
{
	if ( gpGlobals->maxClients == 1 )
	{
		AddAllPlayers();
	}
	else
	{
		CPlayerBitVec playerbits;
		engine->Message_DetermineMulticastRecipients( true, origin, playerbits );
		AddPlayersFromBitMask( playerbits );
	}

#ifdef HL2WARS_DLL
	// Filter when in the fog of war
	for( int i = 0; i < GetRecipientCount(); i++ )
	{
		int iIdx = GetRecipientIndex( i );
		if( FogOfWarMgr()->PointInFOWByPlayerIndex( origin, iIdx ) )
			this->RemoveRecipientByPlayerIndex( iIdx );
	}
#endif // HL2WARS_DLL
}
コード例 #6
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : origin - 
//			ATTN_NORM - 
//-----------------------------------------------------------------------------
void CPASAttenuationFilter::Filter( const Vector& origin, float attenuation /*= ATTN_NORM*/ )
{
	// Don't crop for attenuation in single player
	if ( gpGlobals->maxClients == 1 )
		return;

	// CPASFilter adds them by pure PVS in constructor
	if ( attenuation <= 0 )
	{
		AddAllPlayers();
		return;
	}

	// Now remove recipients that are outside sound radius
	float maxAudible = ( 2 * SOUND_NORMAL_CLIP_DIST ) / attenuation;

	int c = GetRecipientCount();
	
	for ( int i = c - 1; i >= 0; i-- )
	{
		int index = GetRecipientIndex( i );

		CBaseEntity *ent = CBaseEntity::Instance( index );
		if ( !ent || !ent->IsPlayer() )
		{
			Assert( 0 );
			continue;
		}

		CBasePlayer *player = ToBasePlayer( ent );
		if ( !player )
		{
			Assert( 0 );
			continue;
		}

#ifndef _XBOX
		// never remove the HLTV or Replay bot
		if ( player->IsHLTV() || player->IsReplay() )
			continue;
#endif

		if ( player->EarPosition().DistTo(origin) <= maxAudible )
			continue;
		if ( player->GetSplitScreenPlayers().Count() )
		{
			CUtlVector< CHandle< CBasePlayer > > &list = player->GetSplitScreenPlayers();
			bool bSend = false;
			for ( int k = 0; k < list.Count(); k++ )
			{
				if ( list[k]->EarPosition().DistTo(origin) <= maxAudible )
				{
					bSend = true;
					break;
				}
			}
			if ( bSend )
				continue;
		}
		RemoveRecipient( player );
	}
}
コード例 #7
0
void C_RecipientFilter::AddRecipientsByPAS( const Vector& origin )
{
	AddAllPlayers();
}
コード例 #8
0
void C_RecipientFilter::AddRecipientsByTeam( C_Team *team )
{
	AddAllPlayers();
}
コード例 #9
0
void CMRecipientFilter::add_all_players()
{
	AddAllPlayers();
}