summaryrefslogtreecommitdiff
path: root/src/cgame/cg_ents.c
diff options
context:
space:
mode:
authorTony J. White <tjw@tjw.org>2006-12-09 05:12:31 +0000
committerTony J. White <tjw@tjw.org>2006-12-09 05:12:31 +0000
commit74db521aeb93d7e706d9e3745dd3462e8d5f90eb (patch)
treefa6d52f0722bb48fa57612f9bf91aee5c81c0721 /src/cgame/cg_ents.c
parent3b9e1e27a21cef8b3b1fa0a14c47299622e29609 (diff)
* (bug 2937) adds cg_projectileNudge. This is originally from Neil Toronto's
unlagged project. kevlarman added automatic latency detection so the nudge time doesn't have to be set manually. Defaults to 1 (on).
Diffstat (limited to 'src/cgame/cg_ents.c')
-rw-r--r--src/cgame/cg_ents.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c
index 02972a51..2d2e8089 100644
--- a/src/cgame/cg_ents.c
+++ b/src/cgame/cg_ents.c
@@ -918,6 +918,9 @@ CG_CalcEntityLerpPositions
*/
static void CG_CalcEntityLerpPositions( centity_t *cent )
{
+ // this will be set to how far forward projectiles will be extrapolated
+ int timeshift = 0;
+
// if this player does not want to see extrapolated players
if( !cg_smoothClients.integer )
{
@@ -944,9 +947,33 @@ static void CG_CalcEntityLerpPositions( centity_t *cent )
return;
}
+ if( cg_projectileNudge.integer > 0 &&
+ cent->currentState.eType == ET_MISSILE &&
+ !( cg.snap->ps.pm_flags & PMF_FOLLOW ) )
+ {
+ timeshift = cg.ping;
+ }
+
// just use the current frame and evaluate as best we can
- BG_EvaluateTrajectory( &cent->currentState.pos, cg.time, cent->lerpOrigin );
- BG_EvaluateTrajectory( &cent->currentState.apos, cg.time, cent->lerpAngles );
+ BG_EvaluateTrajectory( &cent->currentState.pos,
+ ( cg.time + timeshift ), cent->lerpOrigin );
+ BG_EvaluateTrajectory( &cent->currentState.apos,
+ ( cg.time + timeshift ), cent->lerpAngles );
+
+ if( timeshift )
+ {
+ trace_t tr;
+ vec3_t lastOrigin;
+
+ BG_EvaluateTrajectory( &cent->currentState.pos, cg.time, lastOrigin );
+
+ CG_Trace( &tr, lastOrigin, vec3_origin, vec3_origin, cent->lerpOrigin,
+ cent->currentState.number, MASK_SHOT );
+
+ // don't let the projectile go through the floor
+ if( tr.fraction < 1.0f )
+ VectorLerp( tr.fraction, lastOrigin, cent->lerpOrigin, cent->lerpOrigin );
+ }
// adjust for riding a mover if it wasn't rolled into the predicted
// player state