From: Mario Date: Sat, 15 Jul 2017 18:04:19 +0000 (+1000) Subject: Port the other cursor_trace_* fields to ClientState X-Git-Tag: xonotic-v0.8.5~2626 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5630cfd011468afa0a78c4d53dc0cf09bea25d57;p=xonotic%2Fxonotic-data.pk3dir.git Port the other cursor_trace_* fields to ClientState --- diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 24f16c487..578445e81 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -33,7 +33,7 @@ void crosshair_trace(entity pl) { - traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl)); + traceline_antilag(pl, CS(pl).cursor_trace_start, CS(pl).cursor_trace_start + normalize(CS(pl).cursor_trace_endpos - CS(pl).cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl)); } .bool ctrace_solidchanged; void crosshair_trace_plusvisibletriggers(entity pl) @@ -60,7 +60,7 @@ void crosshair_trace_plusvisibletriggers(entity pl) } void WarpZone_crosshair_trace(entity pl) { - WarpZone_traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl)); + WarpZone_traceline_antilag(pl, CS(pl).cursor_trace_start, CS(pl).cursor_trace_start + normalize(CS(pl).cursor_trace_endpos - CS(pl).cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl)); } diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index 8e4f88b8c..2173f0bfa 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -25,9 +25,9 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect { TC(Sound, snd); float nudge = 1; // added to traceline target and subtracted from result TOOD(divVerent): do we still need this? Doesn't the engine do this now for us? - float oldsolid; - vector vecs, dv; - oldsolid = ent.dphitcontentsmask; + float oldsolid = ent.dphitcontentsmask; + if(!IS_CLIENT(ent)) + antilag = false; // no antilag for non-clients! if (IS_PLAYER(ent) && ent.(weaponentity).m_weapon == WEP_RIFLE) ent.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_CORPSE; else @@ -60,12 +60,9 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect W_HitPlotAnalysis(ent, weaponentity, v_forward, v_right, v_up); vector md = ent.(weaponentity).movedir; - if(md.x > 0) - vecs = md; - else - vecs = '0 0 0'; + vector vecs = ((md.x > 0) ? md : '0 0 0'); - dv = v_right * -vecs.y + v_up * vecs.z; + vector dv = v_right * -vecs.y + v_up * vecs.z; w_shotorg = ent.origin + ent.view_ofs + dv; // now move the shotorg forward as much as requested if possible @@ -108,10 +105,10 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect else if(autocvar_g_antilag == 3) // client side hitscan { // this part MUST use prydon cursor - if (ent.cursor_trace_ent) // client was aiming at someone - if (ent.cursor_trace_ent != ent) // just to make sure - if (ent.cursor_trace_ent.takedamage) // and that person is killable - if (IS_PLAYER(ent.cursor_trace_ent)) // and actually a player + if (CS(ent).cursor_trace_ent) // client was aiming at someone + if (CS(ent).cursor_trace_ent != ent) // just to make sure + if (CS(ent).cursor_trace_ent.takedamage) // and that person is killable + if (IS_PLAYER(CS(ent).cursor_trace_ent)) // and actually a player { // verify that the shot would miss without antilag // (avoids an issue where guns would always shoot at their origin) @@ -119,9 +116,9 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect if (!trace_ent.takedamage) { // verify that the shot would hit if altered - traceline(w_shotorg, ent.cursor_trace_ent.origin, MOVE_NORMAL, ent); - if (trace_ent == ent.cursor_trace_ent) - w_shotdir = normalize(ent.cursor_trace_ent.origin - w_shotorg); + traceline(w_shotorg, CS(ent).cursor_trace_ent.origin, MOVE_NORMAL, ent); + if (trace_ent == CS(ent).cursor_trace_ent) + w_shotdir = normalize(CS(ent).cursor_trace_ent.origin - w_shotorg); else LOG_INFO("antilag fail\n"); }