[nexuiz-commits] r6858 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Jun 3 15:37:39 EDT 2009
Author: div0
Date: 2009-06-03 15:37:39 -0400 (Wed, 03 Jun 2009)
New Revision: 6858
Modified:
trunk/data/qcsrc/server/cl_weaponsystem.qc
trunk/data/qcsrc/server/g_subs.qc
Log:
fix antilag bug with point blank shots going through target
Modified: trunk/data/qcsrc/server/cl_weaponsystem.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weaponsystem.qc 2009-06-03 16:10:09 UTC (rev 6857)
+++ trunk/data/qcsrc/server/cl_weaponsystem.qc 2009-06-03 19:37:39 UTC (rev 6858)
@@ -134,7 +134,7 @@
vector vecs, dv;
oldsolid = ent.dphitcontentsmask;
ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
- traceline(ent.origin + ent.view_ofs, ent.origin + ent.view_ofs + v_forward * MAX_SHOT_DISTANCE, MOVE_NOMONSTERS, ent);
+ traceline(ent.origin + ent.view_ofs, ent.origin + ent.view_ofs + v_forward * MAX_SHOT_DISTANCE, MOVE_NOMONSTERS, ent); // no antilag needed
trueaimpoint = trace_endpos;
W_HitPlotAnalysis(ent, v_forward, v_right, v_up);
@@ -154,7 +154,15 @@
w_shotorg = ent.origin + ent.view_ofs + dv;
// now move the shotorg forward as much as requested if possible
- tracebox(w_shotorg, mi, ma, w_shotorg + v_forward * (vecs_x + nudge), MOVE_NORMAL, ent);
+ if(antilag)
+ {
+ if(ent.antilag_debug)
+ tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + v_forward * (vecs_x + nudge), MOVE_NORMAL, ent, ent.antilag_debug);
+ else
+ tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + v_forward * (vecs_x + nudge), MOVE_NORMAL, ent, ANTILAG_LATENCY(ent));
+ }
+ else
+ tracebox(w_shotorg, mi, ma, w_shotorg + v_forward * (vecs_x + nudge), MOVE_NORMAL, ent);
w_shotorg = trace_endpos - v_forward * nudge;
// calculate the shotdir from the chosen shotorg
w_shotdir = normalize(trueaimpoint - w_shotorg);
Modified: trunk/data/qcsrc/server/g_subs.qc
===================================================================
--- trunk/data/qcsrc/server/g_subs.qc 2009-06-03 16:10:09 UTC (rev 6857)
+++ trunk/data/qcsrc/server/g_subs.qc 2009-06-03 19:37:39 UTC (rev 6858)
@@ -297,7 +297,7 @@
Additionally it moves players back into the past before the trace and restores them afterward.
==================
*/
-void traceline_antilag_force (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
+void tracebox_antilag_force (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag)
{
local entity player;
local float oldsolid;
@@ -309,8 +309,11 @@
lag = 0; // only antilag for clients
// change shooter to SOLID_BBOX so the shot can hit corpses
- oldsolid = source.dphitcontentsmask;
- source.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+ if(source)
+ {
+ oldsolid = source.dphitcontentsmask;
+ source.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+ }
if (lag)
{
@@ -324,7 +327,7 @@
}
// do the trace
- traceline (v1, v2, nomonst, forent);
+ tracebox (v1, mi, ma, v2, nomonst, forent);
// restore players to current positions
if (lag)
@@ -338,14 +341,25 @@
}
// restore shooter solid type
- source.dphitcontentsmask = oldsolid;
+ if(source)
+ source.dphitcontentsmask = oldsolid;
}
+void traceline_antilag_force (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
+{
+ tracebox_antilag_force(source, v1, '0 0 0', '0 0 0', v2, nomonst, forent, lag);
+}
void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
{
if (cvar("g_antilag") != 2)
lag = 0;
traceline_antilag_force(source, v1, v2, nomonst, forent, lag);
}
+void tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag)
+{
+ if (cvar("g_antilag") != 2)
+ lag = 0;
+ tracebox_antilag_force(source, v1, mi, ma, v2, nomonst, forent, lag);
+}
float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomonsters, entity forent) // returns the number of traces done, for benchmarking
{
More information about the nexuiz-commits
mailing list