예제 #1
0
/*
=================
CG_Bleed

This is the spurt of blood when a character gets hit
=================
*/
void CG_Bleed(vec3_t origin, int entityNum)
{
	if (!cg_blood.integer)
	{
		return;
	}

	// blood spurts
	if (entityNum != cg.snap->ps.clientNum)
	{
		vec3_t vhead, vbody, bOrigin, dir, vec, pvec, ndir;
		int    i, j;

		CG_GetBleedOrigin(vhead, vbody, entityNum);

		// project the impact point onto the vector defined by torso -> head
		ProjectPointOntoVector(origin, vbody, vhead, bOrigin);

		// if it's below the waste, or above the head, clamp
		VectorSubtract(vhead, vbody, vec);
		VectorSubtract(bOrigin, vbody, pvec);
		if (DotProduct(pvec, vec) < 0)
		{
			VectorCopy(vbody, bOrigin);
		}
		else
		{
			VectorSubtract(bOrigin, vhead, pvec);
			if (DotProduct(pvec, vec) > 0)
			{
				VectorCopy(vhead, bOrigin);
			}
		}

		// spawn some blood trails, heading out towards the impact point
		VectorSubtract(origin, bOrigin, dir);
		VectorNormalize(dir);

		{
			float  len;
			vec3_t vec;

			VectorSubtract(bOrigin, vhead, vec);
			len = VectorLength(vec);

			if (len > 8)
			{
				VectorMA(bOrigin, 8, dir, bOrigin);
			}
		}

		for (i = 0; i < BLOOD_SPURT_COUNT; i++)
		{
			VectorCopy(dir, ndir);
			for (j = 0; j < 3; j++)
			{
				ndir[j] += crandom() * 0.3;
			}
			VectorNormalize(ndir);
			CG_AddBloodTrails(bOrigin, ndir,
			                  100,  // speed
			                  450 + (int)(crandom() * 50),       // duration
			                  2 + rand() % 2,     // count
			                  0.1);     // rand scale
		}
	}
}
예제 #2
0
/*
=================
CG_Bleed

This is the spurt of blood when a character gets hit
=================
*/
void CG_Bleed(vec3_t origin, int entityNum)
{
#define BLOOD_SPURT_COUNT   4
	int       i, j;
	centity_t *cent;

	if (!cg_blood.integer)
	{
		return;
	}

#ifdef SAVEGAME_SUPPORT
	if (cg_reloading.integer)
	{
		// to dangerous, since we call playerangles() in here, which calls the animation system, which might not be setup yet
		return;
	}
#endif // SAVEGAME_SUPPORT

	cent = &cg_entities[entityNum];

	// Ridah, blood spurts
	if (entityNum != cg.snap->ps.clientNum)
	{
		vec3_t vhead, vbody, bOrigin, dir, vec, pvec, ndir;

		CG_GetBleedOrigin(vhead, vbody, entityNum);

		// project the impact point onto the vector defined by torso -> head
		ProjectPointOntoVector(origin, vbody, vhead, bOrigin);

		// if it's below the waste, or above the head, clamp
		VectorSubtract(vhead, vbody, vec);
		VectorSubtract(bOrigin, vbody, pvec);
		if (DotProduct(pvec, vec) < 0)
		{
			VectorCopy(vbody, bOrigin);
		}
		else
		{
			VectorSubtract(bOrigin, vhead, pvec);
			if (DotProduct(pvec, vec) > 0)
			{
				VectorCopy(vhead, bOrigin);
			}
		}

		// spawn some blood trails, heading out towards the impact point
		VectorSubtract(origin, bOrigin, dir);
		VectorNormalize(dir);

		{
			float  len;
			vec3_t vec;

			VectorSubtract(bOrigin, vhead, vec);
			len = VectorLength(vec);

			if (len > 8)
			{
				VectorMA(bOrigin, 8, dir, bOrigin);
			}
		}

		// DHM - Nerve :: Made minor adjustments
		for (i = 0; i < BLOOD_SPURT_COUNT; i++)
		{
			VectorCopy(dir, ndir);
			for (j = 0; j < 3; j++)
				ndir[j] += crandom() * 0.3;
			VectorNormalize(ndir);
			CG_AddBloodTrails(bOrigin, ndir,
			                  100,  // speed
			                  450 + (int)(crandom() * 50),       // duration
			                  2 + rand() % 2,     // count
			                  0.1);     // rand scale
		}
	}
}
예제 #3
0
/*
=================
CG_Bleed

This is the spurt of blood when a character gets hit
=================
*/
void CG_Bleed( vec3_t origin, int entityNum ) {
#define BLOOD_SPURT_COUNT   4
	int i,j;
//	localEntity_t *ex;
	centity_t *cent;
//	vec3_t	dir;

	if ( !cg_blood.integer ) {
		return;
	}

	cent = &cg_entities[entityNum];

	if ( cent->currentState.aiChar == AICHAR_ZOMBIE ) {
		CG_ParticleBloodCloudZombie( cent, origin, vec3_origin );
		return;
	}

	// Ridah, blood spurts
	if ( entityNum != cg.snap->ps.clientNum ) {
		vec3_t vhead, vlegs, vtorso, bOrigin, dir, vec, pvec, ndir;

		CG_GetBleedOrigin( vhead, vtorso, vlegs, entityNum );

		// project the impact point onto the vector defined by torso -> head
		ProjectPointOntoVector( origin, vtorso, vhead, bOrigin );

		// if it's below the waste, or above the head, clamp
		VectorSubtract( vhead, vtorso, vec );
		VectorSubtract( bOrigin, vtorso, pvec );
		if ( DotProduct( pvec, vec ) < 0 ) {
			VectorCopy( vtorso, bOrigin );
		} else {
			VectorSubtract( bOrigin, vhead, pvec );
			if ( DotProduct( pvec, vec ) > 0 ) {
				VectorCopy( vhead, bOrigin );
			}
		}

		// spawn some blood trails, heading out towards the impact point
		VectorSubtract( origin, bOrigin, dir );
		VectorNormalize( dir );

		{
			float len;
			vec3_t vec;

			VectorSubtract( bOrigin, vhead, vec );
			len = VectorLength( vec );

			if ( len > 8 ) {
				VectorMA( bOrigin, 8, dir, bOrigin );
			}
		}

		// DHM - Nerve :: Made minor adjustments
		for ( i = 0; i < BLOOD_SPURT_COUNT; i++ ) {
			VectorCopy( dir, ndir );
			for ( j = 0; j < 3; j++ ) ndir[j] += crandom() * 0.3;
			VectorNormalize( ndir );
			CG_AddBloodTrails( bOrigin, ndir,
							   100,     // speed
							   450 + (int)( crandom() * 50 ),   // duration
							   2 + rand() % 2,  // count
							   0.1 );   // rand scale
		}

	}
	// done.
}