From: Rudolf Polzer Date: Mon, 18 Nov 2013 18:56:50 +0000 (+0100) Subject: work on restructuring fireBallisticBullet X-Git-Tag: xonotic-v0.8.0~190^2~4^2~11 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b62d5345eba99bc31d9a5ac2493a54a77d6ef97d;p=xonotic%2Fxonotic-data.pk3dir.git work on restructuring fireBallisticBullet --- diff --git a/qcsrc/server/w_common.qc b/qcsrc/server/w_common.qc index 72cac7985..c1a1093fd 100644 --- a/qcsrc/server/w_common.qc +++ b/qcsrc/server/w_common.qc @@ -527,6 +527,61 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f return; } +void fireBallisticBullet_simple(vector start, vector dir, float spread, float pSpeed, float lifetime, float damage, float force, float dtype, float tracereffects, float bulletconstant) +{ + vector end; + + dir = normalize(dir + randomvec() * spread); + end = start + dir * MAX_SHOT_DISTANCE; + + for (;;) + { + // TODO also show effect + if(self.antilag_debug) + WarpZone_traceline_antilag (self, start, end, FALSE, self, self.antilag_debug); + else + WarpZone_traceline_antilag (self, start, end, FALSE, self, ANTILAG_LATENCY(self)); + + if (pointcontents (trace_endpos) != CONTENT_SKY) + { + trace_endpos = end; + return; + } + + // Avoid self-damage + if (!trace_ent || (trace_ent == self)) + { + if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) + return; + + W_BallisticBullet_Hit(); // FIXME + } + + // if we hit "weapclip", bail out + // + // rationale of this check: + // + // any shader that is solid, nodraw AND trans is meant to clip weapon + // shots and players, but has no other effect! + // + // if it is not trans, it is caulk and should not have this side effect + // + // matching shaders: + // common/weapclip (intended) + // common/noimpact (is supposed to eat projectiles, but is erased farther above) + if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW) + if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID)) + if (!(trace_dphitcontents & DPCONTENTS_OPAQUE)) + return; + + // go through solid! + if(!W_BallisticBullet_LeaveSolid((trace_ent && (trace_ent.solid != SOLID_BSP)) ? eff : -1)) // FIXME + return; + + W_BallisticBullet_LeaveSolid_think(); // FIXME + } +} + void fireBullet (vector start, vector dir, float spread, float damage, float force, float dtype, float tracer) { vector end;