dlls/sendproxy.cpp
103104105106107108
}
REGISTER_SEND_PROXY_NON_MODIFIED_POINTER( SendProxy_OnlyToTeam );
#define TIME_BITS 24
// This table encodes edict data.
103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
}
REGISTER_SEND_PROXY_NON_MODIFIED_POINTER( SendProxy_OnlyToTeam );
//-----------------------------------------------------------------------------
// Purpose: Proxy that only sends data to observers of the entity
// Input : *pStruct -
// *pData -
// *pOut -
// objectID -
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
void* SendProxy_OnlyToObservers( const SendProp *pProp, const void *pStruct, const void *pVarData, CSendProxyRecipients *pRecipients, int objectID )
{
CBaseEntity *pEntity = (CBaseEntity*)pStruct;
if ( pEntity )
{
pRecipients->ClearAllRecipients();
CBasePlayer *pRecipient = NULL;
if (pEntity->IsPlayer())
pRecipient = ToBasePlayer(pEntity);
else if (pEntity->GetOwnerEntity())
{
CBaseEntity *pOwner = pEntity->GetOwnerEntity();
if (pOwner->IsPlayer())
pRecipient = ToBasePlayer(pOwner);
}
// send to the ent if its a player
if (pRecipient)
pRecipients->SetRecipient( pRecipient->GetClientIndex() );
else
return NULL;
for ( int i=1; i <= gpGlobals->maxClients; i++ )
{
CBasePlayer *pPlayer = UTIL_PlayerByIndex( i );
if (pPlayer)
{
if (pPlayer->IsObserver() && pPlayer->GetObserverTarget() == pRecipient)
pRecipients->SetRecipient( pPlayer->GetClientIndex() );
}
}
return (void*)pVarData;
}
return NULL;
}
REGISTER_SEND_PROXY_NON_MODIFIED_POINTER( SendProxy_OnlyToObservers );
#define TIME_BITS 24
// This table encodes edict data.