Ejemplo n.º 1
0
/**
 * @brief Counts visible enemies on the battlescape
 * @return The amount of visible enemies (from all the other teams)
 */
int CL_CountVisibleEnemies (void)
{
	le_t *le;
	int count;

	count = 0;
	le = NULL;
	while ((le = LE_GetNextInUse(le))) {
		if (LE_IsLivingAndVisibleActor(le) && le->team != cls.team && le->team != TEAM_CIVILIAN)
			count++;
	}

	return count;
}
Ejemplo n.º 2
0
/**
 * @brief Searches a local entity at the given position.
 * @param[in] pos The grid position to search a local entity at
 * @param[in] includingStunned Also search for stunned actors if @c true.
 * @param[in] actor The current selected actor
 */
le_t* CL_BattlescapeSearchAtGridPos (const pos3_t pos, bool includingStunned, const le_t *actor)
{
	le_t *le;
	le_t *nonActor = NULL;

	/* search for an actor on this field */
	le = NULL;
	while ((le = LE_GetNextInUse(le))) {
		if (actor != NULL && le == actor->clientAction) {
			/* if the actor has a client action assigned and we click onto the actor,
			 * we will trigger this client action */
			if (VectorCompare(actor->pos, pos))
				nonActor = le;
		} else if (le != actor && LE_IsLivingAndVisibleActor(le) && (includingStunned || !LE_IsStunned(le)))
			switch (le->fieldSize) {
			case ACTOR_SIZE_NORMAL:
				if (VectorCompare(le->pos, pos))
					return le;
				break;
			case ACTOR_SIZE_2x2: {
				pos3_t actor2x2[3];

				VectorSet(actor2x2[0], le->pos[0] + 1, le->pos[1],     le->pos[2]);
				VectorSet(actor2x2[1], le->pos[0],     le->pos[1] + 1, le->pos[2]);
				VectorSet(actor2x2[2], le->pos[0] + 1, le->pos[1] + 1, le->pos[2]);
				if (VectorCompare(le->pos, pos)
				|| VectorCompare(actor2x2[0], pos)
				|| VectorCompare(actor2x2[1], pos)
				|| VectorCompare(actor2x2[2], pos))
					return le;
				break;
			}
			default:
				Com_Error(ERR_DROP, "Grid_MoveCalc: unknown actor-size: %i!", le->fieldSize);
		}
	}

	return nonActor;
}
Ejemplo n.º 3
0
/**
 * @brief Plays step sounds and draw particles for different terrain types
 * @param[in] le The local entity to play the sound and draw the particle for
 * @param[in] textureName The name of the texture the actor is standing on
 * @sa LET_PathMove
 */
static void LE_PlaySoundFileAndParticleForSurface (le_t* le, const char* textureName)
{
	const terrainType_t* t = Com_GetTerrainType(textureName);
	if (!t)
		return;

	/* origin might not be up-to-date here - but pos should be */
	vec3_t origin;
	PosToVec(le->pos, origin);

	/** @todo use the Grid_Fall method (ACTOR_SIZE_NORMAL) to ensure, that the particle is
	 * drawn at the ground (if needed - maybe the origin is already ground aligned)*/
	if (t->particle) {
		/* check whether actor is visible */
		if (!LE_IsStunned(le) && LE_IsLivingAndVisibleActor(le))
			CL_ParticleSpawn(t->particle, 0, origin);
	}
	if (t->footstepSound) {
		Com_DPrintf(DEBUG_SOUND, "LE_PlaySoundFileAndParticleForSurface: volume %.2f\n", t->footstepVolume);
		S_LoadAndPlaySample(t->footstepSound, origin, SOUND_ATTN_STATIC, t->footstepVolume);
	}
}