mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +00:00
Fix hit accuracy stats for lightning gun and shotgun kills
If a lightning bolt killed a player or the first shotgun pellet that hit a player killed them, the shot was not counted as accurate. Check if shot player is alive for hit accuracy before dealing damage.
This commit is contained in:
parent
eeaade70bd
commit
51e9aa2df0
1 changed files with 10 additions and 22 deletions
|
@ -275,6 +275,7 @@ qboolean ShotgunPellet( vec3_t start, vec3_t end, gentity_t *ent ) {
|
|||
vec3_t impactpoint, bouncedir;
|
||||
#endif
|
||||
vec3_t tr_start, tr_end;
|
||||
qboolean hitClient = qfalse;
|
||||
|
||||
passent = ent->s.number;
|
||||
VectorCopy( start, tr_start );
|
||||
|
@ -304,19 +305,12 @@ qboolean ShotgunPellet( vec3_t start, vec3_t end, gentity_t *ent ) {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
G_Damage( traceEnt, ent, ent, forward, tr.endpos,
|
||||
damage, 0, MOD_SHOTGUN);
|
||||
if( LogAccuracyHit( traceEnt, ent ) ) {
|
||||
return qtrue;
|
||||
}
|
||||
}
|
||||
#else
|
||||
G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, 0, MOD_SHOTGUN);
|
||||
if( LogAccuracyHit( traceEnt, ent ) ) {
|
||||
return qtrue;
|
||||
}
|
||||
#endif
|
||||
if( LogAccuracyHit( traceEnt, ent ) ) {
|
||||
hitClient = qtrue;
|
||||
}
|
||||
G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, 0, MOD_SHOTGUN);
|
||||
return hitClient;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
@ -663,14 +657,11 @@ void Weapon_LightningFire( gentity_t *ent ) {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
G_Damage( traceEnt, ent, ent, forward, tr.endpos,
|
||||
damage, 0, MOD_LIGHTNING);
|
||||
}
|
||||
#else
|
||||
G_Damage( traceEnt, ent, ent, forward, tr.endpos,
|
||||
damage, 0, MOD_LIGHTNING);
|
||||
#endif
|
||||
if( LogAccuracyHit( traceEnt, ent ) ) {
|
||||
ent->client->accuracy_hits++;
|
||||
}
|
||||
G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, 0, MOD_LIGHTNING);
|
||||
}
|
||||
|
||||
if ( traceEnt->takedamage && traceEnt->client ) {
|
||||
|
@ -678,9 +669,6 @@ void Weapon_LightningFire( gentity_t *ent ) {
|
|||
tent->s.otherEntityNum = traceEnt->s.number;
|
||||
tent->s.eventParm = DirToByte( tr.plane.normal );
|
||||
tent->s.weapon = ent->s.weapon;
|
||||
if( LogAccuracyHit( traceEnt, ent ) ) {
|
||||
ent->client->accuracy_hits++;
|
||||
}
|
||||
} else if ( !( tr.surfaceFlags & SURF_NOIMPACT ) ) {
|
||||
tent = G_TempEntity( tr.endpos, EV_MISSILE_MISS );
|
||||
tent->s.eventParm = DirToByte( tr.plane.normal );
|
||||
|
|
Loading…
Reference in a new issue