Code:
struct trace_t {
float Fraction;
Vector normal;
int surfaceFlags;
int contents;
const char *material;
int hitType;
unsigned __int16 hitId;
unsigned __int16 modelIndex;
unsigned __int16 partName;
unsigned __int16 partGroup;
bool allsolid;
bool startsolid;
bool walkable;
};
bool IsVisible(Entity_T* currentEntity, float* vPoint) //vPoint is the position of the enemy you wish to aim at, Entity is the entity struct of the atim target
{
trace_t trace; //Create a new trace
CG_Trace( &trace, RefDef->ViewOrigin, currentEntity, CG->LocalClientNumber, 0x803003 ); //Engine does the trace here
if( trace->Fraction >= 0.97f ) return true; //If fraction is >=0.97, enemy is visible
else return false; //Else they're not
}