void CRecipientFilter::UsePredictionRules( void ) { if ( m_bUsingPredictionRules ) return; m_bUsingPredictionRules = true; // Cull list now, if needed if ( GetRecipientCount() == 0 ) return; CBasePlayer *pPlayer = ToBasePlayer( (CBaseEntity*)g_RecipientFilterPredictionSystem.GetSuppressHost() ); if ( pPlayer) { RemoveRecipient( pPlayer ); if ( pPlayer->IsSplitScreenPlayer() ) { RemoveRecipient( pPlayer->GetSplitScreenPlayerOwner() ); } else { CUtlVector< CHandle< CBasePlayer > > &players = pPlayer->GetSplitScreenPlayers(); for ( int i = 0; i < players.Count(); ++i ) { RemoveRecipient( players[ i ].Get() ); } } } }
int CRecipientFilter::GetRecipientIndex( int slot ) const { if ( slot < 0 || slot >= GetRecipientCount() ) return -1; return m_Recipients[ slot ]; }
void C_RecipientFilter::UsePredictionRules( void ) { if ( m_bUsingPredictionRules ) return; if ( !prediction->InPrediction() ) { Assert( 0 ); return; } C_BasePlayer *local = C_BasePlayer::GetLocalPlayer(); if ( !local ) { Assert( 0 ); return; } m_bUsingPredictionRules = true; // Cull list now, if needed int c = GetRecipientCount(); if ( c == 0 ) return; if ( !g_RecipientFilterPredictionSystem.CanPredict() ) { RemoveRecipient( local ); } }
//----------------------------------------------------------------------------- // 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 ); } }
void CRecipientFilter::RemoveSplitScreenPlayers() { for ( int i = GetRecipientCount() - 1; i >= 0; --i ) { int idx = m_Recipients[ i ]; CBasePlayer *pPlayer = UTIL_PlayerByIndex( idx ); if ( !pPlayer || !pPlayer->IsSplitScreenPlayer() ) continue; m_Recipients.Remove( i ); } }
void CRecipientFilter::UsePredictionRules( void ) { if ( m_bUsingPredictionRules ) return; m_bUsingPredictionRules = true; // Cull list now, if needed if ( GetRecipientCount() == 0 ) return; CBasePlayer *pPlayer = ToBasePlayer( (CBaseEntity*)g_RecipientFilterPredictionSystem.GetSuppressHost() ); if ( pPlayer) { RemoveRecipient( pPlayer ); } }
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 }
//----------------------------------------------------------------------------- // 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 ); } }
int CMRecipientFilter::get_recipient_count( void ) const { return GetRecipientCount(); }