Beispiel #1
0
/**
 * @brief Prepares the collision model to clip to the specified entity. For
 * mesh models, the box hull must be set to reflect the bounds of the entity.
 */
static int32_t Sv_HullForEntity(const g_entity_t *ent) {

	if (ent->solid == SOLID_BSP) {
		const cm_bsp_model_t *mod = sv.cm_models[ent->s.model1];

		if (!mod) {
			Com_Error(ERROR_DROP, "SOLID_BSP with no model\n");
		}

		return mod->head_node;
	}

	if (ent->solid == SOLID_BOX) {

		if (ent->client) {
			return Cm_SetBoxHull(ent->mins, ent->maxs, CONTENTS_MONSTER);
		}

		return Cm_SetBoxHull(ent->mins, ent->maxs, CONTENTS_SOLID);
	}

	if (ent->solid == SOLID_DEAD) {
		return Cm_SetBoxHull(ent->mins, ent->maxs, CONTENTS_DEAD_MONSTER);
	}

	return -1;
}
Beispiel #2
0
/*
 * @brief Prepares the collision model to clip to the specified entity. For
 * mesh models, the box hull must be set to reflect the bounds of the entity.
 *
 * @remark The server only informs us of `SOLID_BSP` and `SOLID_BOX`. Everything
 * else is `SOLID_NOT` to the client.
 */
static int32_t Cl_HullForEntity(const entity_state_t *ent) {

	if (ent->solid == SOLID_BSP) {
		const cm_bsp_model_t *mod = cl.cm_models[ent->model1];

		if (!mod)
			Com_Error(ERR_DROP, "SOLID_BSP with no model\n");

		return mod->head_node;
	}

	vec3_t emins, emaxs;
	UnpackBounds(ent->solid, emins, emaxs);

	if (ent->client)
		return Cm_SetBoxHull(emins, emaxs, CONTENTS_MONSTER);
	else
		return Cm_SetBoxHull(emins, emaxs, CONTENTS_SOLID);
}
Beispiel #3
0
/**
 * @brief Prepares the collision model to clip to the specified entity. For
 * mesh models, the box hull must be set to reflect the bounds of the entity.
 */
static int32_t Cl_HullForEntity(const entity_state_t *s) {

	if (s->solid == SOLID_BSP) {
		const cm_bsp_model_t *mod = cl.cm_models[s->model1];

		if (!mod) {
			Com_Error(ERROR_DROP, "SOLID_BSP with no model\n");
		}

		return mod->head_node;
	}

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

	if (s->client) {
		return Cm_SetBoxHull(ent->mins, ent->maxs, CONTENTS_MONSTER);
	} else {
		return Cm_SetBoxHull(ent->mins, ent->maxs, CONTENTS_SOLID);
	}
}