Ejemplo n.º 1
0
//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
qboolean AAS_AreaEntityCollision( int areanum, vec3_t start, vec3_t end,
								  int presencetype, int passent, aas_trace_t *trace ) {
	int collision;
	vec3_t boxmins, boxmaxs;
	aas_link_t *link;
	bsp_trace_t bsptrace;

	AAS_PresenceTypeBoundingBox( presencetype, boxmins, boxmaxs );

	memset( &bsptrace, 0, sizeof( bsp_trace_t ) ); //make compiler happy
	//assume no collision
	bsptrace.fraction = 1;
	collision = qfalse;
	for ( link = ( *aasworld ).arealinkedentities[areanum]; link; link = link->next_ent )
	{
		//ignore the pass entity
		if ( link->entnum == passent ) {
			continue;
		}
		//
		if ( AAS_EntityCollision( link->entnum, start, boxmins, boxmaxs, end,
								  CONTENTS_SOLID | CONTENTS_PLAYERCLIP, &bsptrace ) ) {
			collision = qtrue;
		} //end if
	} //end for
	if ( collision ) {
		trace->startsolid = bsptrace.startsolid;
		trace->ent = bsptrace.ent;
		VectorCopy( bsptrace.endpos, trace->endpos );
		trace->area = 0;
		trace->planenum = 0;
		return qtrue;
	} //end if
	return qfalse;
} //end of the function AAS_AreaEntityCollision
Ejemplo n.º 2
0
//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
qboolean AAS_AreaEntityCollision(int areanum, vec3_t start, vec3_t end,
										int presencetype, int passent, int contentmask, aas_trace_t *trace)
{
	int collision;
	vec3_t boxmins, boxmaxs;
	aas_link_t *link;
	bsp_trace_t bsptrace;

	AAS_PresenceTypeBoundingBox(presencetype, boxmins, boxmaxs);

	Com_Memset(&bsptrace, 0, sizeof(bsp_trace_t)); //make compiler happy
	//assume no collision
	bsptrace.fraction = 1;
	collision = qfalse;
	for (link = aasworld.arealinkedentities[areanum]; link; link = link->next_ent)
	{
		//ignore the pass entity
		if (link->entnum == passent) continue;
		//
		if (AAS_EntityCollision(link->entnum, start, boxmins, boxmaxs, end,
												contentmask, &bsptrace))
		{
			collision = qtrue;
		} //end if
	} //end for
	if (collision)
	{
		trace->startsolid = bsptrace.startsolid;
		trace->ent = bsptrace.entityNum;
		VectorCopy(bsptrace.endpos, trace->endpos);
		trace->area = 0;
		trace->planenum = 0;
		VectorCopy(bsptrace.plane.normal, trace->plane.normal);
		trace->plane.dist = bsptrace.plane.dist;
		// ZTM: FIXME: Are AAS plane type and BSP plane type the same values?
		trace->plane.type = bsptrace.plane.type;
		return qtrue;
	} //end if
	return qfalse;
} //end of the function AAS_AreaEntityCollision