if(IS_PLAYER(ent))
W_HitPlotAnalysis(ent, wep, forward, right, up);
+ // read shot origin offset, like g_shootfromcenter
+ // set in CL_WeaponEntity_SetModel (not a CSQC exclusive function...)
vector md = ent.(weaponentity).movedir;
- vector vecs = ((md.x > 0) ? md : '0 0 0');
+ //print(sprintf("offset of %s: %v\n", ent.(weaponentity).m_weapon.netname, md));
+ vector dv = right * -md.y + up * md.z;
- vector dv = right * -vecs.y + up * vecs.z;
w_shotorg = ent.origin + ent.view_ofs;
+
+ // move the shotorg sideways and vertically as much as requested if possible
if(antilag)
{
if(CS(ent).antilag_debug)
if(antilag)
{
if(CS(ent).antilag_debug)
- tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + forward * (vecs.x + nudge), MOVE_NORMAL, ent, CS(ent).antilag_debug);
+ tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + forward * (md.x + nudge), MOVE_NORMAL, ent, CS(ent).antilag_debug);
else
- tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + forward * (vecs.x + nudge), MOVE_NORMAL, ent, ANTILAG_LATENCY(ent));
+ tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + forward * (md.x + nudge), MOVE_NORMAL, ent, ANTILAG_LATENCY(ent));
}
else
- tracebox(w_shotorg, mi, ma, w_shotorg + forward * (vecs.x + nudge), MOVE_NORMAL, ent);
+ tracebox(w_shotorg, mi, ma, w_shotorg + forward * (md.x + nudge), MOVE_NORMAL, ent);
w_shotorg = trace_endpos - forward * nudge;
+
+ //print(sprintf("w_shotorg %v\n\n", w_shotorg - (ent.origin + ent.view_ofs)));
+
// calculate the shotdir from the chosen shotorg
if(W_DualWielding(ent))
w_shotdir = s_forward;