Esempio n. 1
0
//-----------------------------------------------------------------------------
// Purpose: Is a given point contained within a respawn room?
//-----------------------------------------------------------------------------
bool PointInRespawnRoom( CBaseEntity *pTarget, const Vector &vecOrigin )
{
	// Find out whether we're in a respawn room or not
	CBaseEntity *pEntity = NULL;
	while ((pEntity = gEntList.FindEntityByClassname( pEntity, "func_respawnroom" )) != NULL)
	{
		CFuncRespawnRoom *pRespawnRoom = (CFuncRespawnRoom *)pEntity;

		// Are we within this respawn room?
		if ( pRespawnRoom->GetActive() )
		{
			if ( pRespawnRoom->PointIsWithin( vecOrigin ) )
			{
				if ( !pTarget || pRespawnRoom->GetTeamNumber() == TEAM_UNASSIGNED || pRespawnRoom->InSameTeam( pTarget ) )
					return true;
			}
			else 
			{
				if ( pTarget && pRespawnRoom->IsTouching(pTarget) )
					return true;
			}
		}
	}

	return false;
}