removed spherical head detection

This commit is contained in:
Bryce Hutchings 2002-09-02 02:21:41 +00:00
parent 8b59c80291
commit 5ffd56fa2d
2 changed files with 6 additions and 72 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.125 2002/09/02 02:21:13 niceass
// removed spherical head detection
//
// Revision 1.124 2002/08/28 23:10:06 jbravo
// Added cg_RQ3_SuicideLikeARealMan, timestamping to server logs and
// fixed stats for non-TP modes.
@ -2332,83 +2335,12 @@ void G_Damage(gentity_t * targ, gentity_t * inflictor, gentity_t * attacker,
}
}
/*
===========
HitPlayer - By NiceAss
Will return qtrue or qfalse based on whether the shot will hit a player.
Created when spherical headshots were added which confused a lot of other
stuff. This function will assume a trace already hit a player.
===========
*/
qboolean G_HitPlayer(gentity_t * targ, vec3_t dir, vec3_t point)
{
vec3_t s_origin, s_forward, s_right, s_up, s_intersections[2];
float clientHeight, bulletHeight, clientFeetZ;
clientFeetZ = targ->r.currentOrigin[2] + targ->r.mins[2];
clientHeight = targ->r.maxs[2] - targ->r.mins[2];
bulletHeight = point[2] - clientFeetZ;
/* // NiceAss: Failed attempt to mimick AQ2's head hit detection. Anyone care to try and fixed?
// Comment the stuff below this if you do.
if ( bulletHeight > clientHeight - 8 && targ->client ) {
vec3_t new_point, normdir;
G_Printf("HEADSHOT\n");
VectorNormalize2(dir, normdir);
VectorMA(point, 12, normdir, new_point);
VectorSubtract( new_point, targ->r.currentOrigin, new_point );
G_Printf("Location: %d %d %d\n", (targ->r.maxs[2] - new_point[2]) < 8,
abs(new_point[1]),
abs(new_point[0]));
if ( (targ->r.maxs[2] - new_point[2]) < 8
&& (abs(new_point[1])) < 8*.8
&& (abs(new_point[0])) < 8*.8 )
{
G_Printf("HEADSHOT2\n");
// Above should and hit something.
return qtrue;
}
// Above shoulders and hit nothing.
return qfalse;
}
// Not above shoulders or not client. It's all good.
return qtrue;
*/
// Hal: targ->client isn't necessarily valid
if (!targ->client)
return qtrue;
// NiceAss: Added for better head hit-detection. Numbers derived by testing with Mr. T
VectorCopy(targ->r.currentOrigin, s_origin);
s_origin[2] = targ->r.currentOrigin[2] + targ->r.maxs[2] - 4; // Center in the face.
AngleVectors(targ->client->ps.viewangles, s_forward, s_right, s_up);
VectorMA(s_origin, 3.2, s_forward, s_origin); // Move origin of sphere foreward a little (better centerage of the head)
// JBravo: changed the head radius to 10. was 6
if (!RaySphereIntersections(s_origin, 8, point, dir, s_intersections) && bulletHeight > clientHeight - 8) {
// NiceAss: It didn't intersect the sphere and it's above the shoulders so it hit the air.
return qfalse;
}
// It must have hit...
return qtrue;
}
/*
============
CanDamage
Returns qtrue if the inflictor can directly damage the target. Used for
explosions and melee attacks.
NICEASS TODO: Impliment G_HitPlayer in this func for clients. Not a big deal though.
============
*/
qboolean CanDamage(gentity_t * targ, vec3_t origin)

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.122 2002/09/02 02:21:41 niceass
// removed spherical head detection
//
// Revision 1.121 2002/08/30 00:00:16 makro
// Sky portals
//
@ -993,7 +996,6 @@ const char *BuildShaderStateConfig();
//
// g_combat.c
//
qboolean G_HitPlayer(gentity_t * targ, vec3_t dir, vec3_t point); // Added by NiceAss for new head hit-detection
qboolean CanDamage(gentity_t * targ, vec3_t origin);
void G_Damage(gentity_t * targ, gentity_t * inflictor, gentity_t * attacker, vec3_t dir, vec3_t point, int damage,
int dflags, int mod);