All pastes #352202 Raw Edit

Untitled

public cpp v1 · immutable
·published 2007-02-12 17:31 UTC
rendered paste body
int NearestCHTarget( ){	FLOAT	CHDist		= 0;	FLOAT   lastCHDist   	= 9999;	int	iBestTargetCH	= -1;	FLOAT	AngleX, AngleY;	for( int i=0; i < MAX_CLIENTS; i++ ) 	{		myEntities_t *ent = &entities[i];		if( ( !ent->isValid ) || ( cg_entities[i].currentState.eType != ET_PLAYER ) || ( cg_entities[i].currentState.eFlags & EF_DEAD ) || ( cg_entities[i].currentState.eFlags & EF_NODRAW ) || ( ent->isInvicible ) )		{			continue;		}		if( ent->isValid )		{			if( ent->isEnemy )			{				if( ent->isVisible )				{					if( CheckFov( ent->aimvec ) )					{						GetAngleToOrigin( ent->aimvec, AngleX, AngleY ); 												CHDist   = sqrt( AngleX*AngleX + AngleY*AngleY );												if ( (CHDist < lastCHDist)  )						{							lastCHDist	= CHDist;							iBestTargetCH	= i;						}					}				}			}		}			}	return iBestTargetCH;}