コード例 #1
0
ファイル: sv_world.c プロジェクト: ioid3-games/ioid3-rtcw
/*
=======================================================================================================================================
SV_AreaEntities_r
=======================================================================================================================================
*/
static void SV_AreaEntities_r(worldSector_t *node, areaParms_t *ap) {
	svEntity_t *check, *next;
	sharedEntity_t *gcheck;

	for (check = node->entities ; check; check = next) {
		next = check->nextEntityInWorldSector;

		gcheck = SV_GEntityForSvEntity(check);

		if (gcheck->r.absmin[0] > ap->maxs[0] || gcheck->r.absmin[1] > ap->maxs[1] || gcheck->r.absmin[2] > ap->maxs[2] || gcheck->r.absmax[0] < ap->mins[0] || gcheck->r.absmax[1] < ap->mins[1] || gcheck->r.absmax[2] < ap->mins[2]) {
			continue;
		}

		if (ap->count == ap->maxcount) {
			Com_DPrintf("SV_AreaEntities: MAXCOUNT\n");
			return;
		}

		ap->list[ap->count] = check - sv.svEntities;
		ap->count++;
	}

	if (node->axis == -1) {
		return;    // terminal node
	}
	// recurse down both sides
	if (ap->maxs[node->axis] > node->dist) {
		SV_AreaEntities_r(node->children[0], ap);
	}

	if (ap->mins[node->axis] < node->dist) {
		SV_AreaEntities_r(node->children[1], ap);
	}
}
コード例 #2
0
ファイル: sv_world.c プロジェクト: Razish/QtZ
static void SV_AreaEntities_r( worldSector_t *node, areaParms_t *ap ) {
	svEntity_t	*check, *next;
	sharedEntity_t *gcheck;

	for ( check = node->entities  ; check ; check = next ) {
		next = check->nextEntityInWorldSector;

		gcheck = SV_GEntityForSvEntity( check );

		if ( gcheck->r.absmin.x > ap->maxs->x ||
			 gcheck->r.absmin.y > ap->maxs->y ||
			 gcheck->r.absmin.z > ap->maxs->z ||
			 gcheck->r.absmax.x < ap->mins->x ||
			 gcheck->r.absmax.y < ap->mins->y ||
			 gcheck->r.absmax.z < ap->mins->z ) {
			continue;
		}

		if ( ap->count == ap->maxcount ) {
			Com_Printf ("SV_AreaEntities: MAXCOUNT\n");
			return;
		}

		ap->list[ap->count] = ARRAY_INDEX( sv.svEntities, check );
		ap->count++;
	}
	
	if (node->axis == -1) {
		return;		// terminal node
	}

	// recurse down both sides
	if ( ap->maxs->data[node->axis] > node->dist ) {
		SV_AreaEntities_r ( node->children[0], ap );
	}
	if ( ap->mins->data[node->axis] < node->dist ) {
		SV_AreaEntities_r ( node->children[1], ap );
	}
}
コード例 #3
0
ファイル: world.c プロジェクト: icanhas/yantar
/*
 * SV_AreaEntities_r
 *
 */
static void
SV_AreaEntities_r(worldSector_t *node, Areaparams *ap)
{
	Svent *check, *next;
	Sharedent *gcheck;

	for(check = node->entities; check; check = next){
		next = check->nextEntityInWorldSector;

		gcheck = SV_GEntityForSvEntity(check);

		if(gcheck->r.absmin[0] > ap->maxs[0]
		   || gcheck->r.absmin[1] > ap->maxs[1]
		   || gcheck->r.absmin[2] > ap->maxs[2]
		   || gcheck->r.absmax[0] < ap->mins[0]
		   || gcheck->r.absmax[1] < ap->mins[1]
		   || gcheck->r.absmax[2] < ap->mins[2])
			continue;

		if(ap->count == ap->maxcount){
			comprintf ("SV_AreaEntities: MAXCOUNT\n");
			return;
		}

		ap->list[ap->count] = check - sv.svEntities;
		ap->count++;
	}

	if(node->axis == -1)
		return;		/* terminal node */

	/* recurse down both sides */
	if(ap->maxs[node->axis] > node->dist)
		SV_AreaEntities_r (node->children[0], ap);
	if(ap->mins[node->axis] < node->dist)
		SV_AreaEntities_r (node->children[1], ap);
}