Esempio n. 1
0
/*
 * Sv_PointContents
 *
 * Returns the contents mask for the specified point.  This includes world
 * contents as well as contents for any entities this point intersects.
 */
int Sv_PointContents(vec3_t point) {
	g_edict_t *touched[MAX_EDICTS];
	int i, contents, num;

	// get base contents from world
	contents = Cm_PointContents(point, sv.models[1]->head_node);

	// as well as contents from all intersected entities
	num = Sv_AreaEdicts(point, point, touched, MAX_EDICTS, AREA_SOLID);

	for (i = 0; i < num; i++) {

		const g_edict_t *touch = touched[i];
		const vec_t *angles;

		// might intersect, so do an exact clip
		const int head_node = Sv_HullForEntity(touch);

		if (touch->solid == SOLID_BSP) // bsp models can rotate
			angles = touch->s.angles;
		else
			angles = vec3_origin;

		contents |= Cm_TransformedPointContents(point, head_node,
				touch->s.origin, angles);
	}

	return contents;
}
Esempio n. 2
0
/**
 * @brief Yields the contents mask (bitwise OR) for the specified point. The
 * world model and all solids are checked.
 */
int32_t Cl_PointContents(const vec3_t point) {

	int32_t contents = Cm_PointContents(point, 0);

	for (uint16_t i = 0; i < cl.frame.num_entities; i++) {

		const uint32_t snum = (cl.frame.entity_state + i) & ENTITY_STATE_MASK;
		const entity_state_t *s = &cl.entity_states[snum];

		if (s->solid < SOLID_BOX) {
			continue;
		}

		const cl_entity_t *ent = &cl.entities[s->number];

		if (ent == cl.entity) {
			continue;
		}

		const int32_t head_node = Cl_HullForEntity(s);

		contents |= Cm_TransformedPointContents(point, head_node, &ent->inverse_matrix);
	}

	return contents;
}
Esempio n. 3
0
/**
 * @brief Returns the contents mask for the specified point. This includes world
 * contents as well as contents for any solid entities this point intersects.
 */
int32_t Sv_PointContents(const vec3_t point) {
	g_entity_t *entities[MAX_ENTITIES];

	// get base contents from world
	int32_t contents = Cm_PointContents(point, 0);

	// as well as contents from all intersected entities
	const size_t len = Sv_BoxEntities(point, point, entities, lengthof(entities), BOX_COLLIDE);

	// iterate the area entities, checking each one for an intersection
	for (size_t i = 0; i < len; i++) {
		const g_entity_t *ent = entities[i];

		const int32_t head_node = Sv_HullForEntity(ent);
		if (head_node != -1) {

			const sv_entity_t *sent = &sv.entities[NUM_FOR_ENTITY(ent)];
			contents |= Cm_TransformedPointContents(point, head_node, &sent->inverse_matrix);
		}
	}

	return contents;
}
Esempio n. 4
0
/*
 * Cl_Pointcontents
 */
static int Cl_Pointcontents(vec3_t point) {
	int i;
	c_model_t *model;
	int contents;

	contents = Cm_PointContents(point, r_world_model->first_node);

	for (i = 0; i < cl.frame.num_entities; i++) {
		const int num = (cl.frame.entity_state + i) & ENTITY_STATE_MASK;
		const entity_state_t *ent = &cl.entity_states[num];

		if (ent->solid != 31) // special value for bsp models
			continue;

		model = cl.model_clip[ent->model1];
		if (!model)
			continue;

		contents |= Cm_TransformedPointContents(point, model->head_node,
				ent->origin, ent->angles);
	}

	return contents;
}