fix endless loops in Nex shots through recursive warpzones
authorRudolf Polzer <divverent@alientrap.org>
Fri, 25 Jun 2010 11:00:57 +0000 (13:00 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 25 Jun 2010 11:00:57 +0000 (13:00 +0200)
qcsrc/server/w_common.qc
qcsrc/warpzonelib/common.qc

index 8f2de4e8ce27b777624ea583860d081df599e830..4427320586988352ab039c04810e2fbeeced5fdf 100644 (file)
@@ -270,7 +270,7 @@ float W_BallisticBullet_LeaveSolid(entity e, vector vel, float constant)
 
        self.W_BallisticBullet_LeaveSolid_origin = trace_endpos;
 
-       dst = vlen(trace_endpos - self.origin);
+       dst = max(cvar("g_ballistics_mindistance"), vlen(trace_endpos - self.origin));
        // E(s) = E0 - constant * s, constant = area of bullet circle * material constant / mass
        Es_m = E0_m - constant * dst;
        if(Es_m <= 0)
index e4acfb1693a2d86586cd3fb53cda548547b83f7b..5cf155642bd6019d1d4587f0881093a7466171ca 100644 (file)
@@ -200,6 +200,7 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end,
                if(--i < 1)
                {
                        dprint("Too many warpzones in sequence, aborting trace.\n");
+                       trace_ent = world;
                        break;
                }
                tracebox(org, mi, ma, end, nomonsters, forent);
@@ -216,6 +217,7 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end,
                if(trace_ent == wz)
                {
                        dprint("I transformed into the same zone again, wtf, aborting the trace\n");
+                       trace_ent = world;
                        break;
                }
                wz = trace_ent;
@@ -281,6 +283,7 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo
                if(--i < 1)
                {
                        dprint("Too many warpzones in sequence, aborting trace.\n");
+                       trace_ent = world;
                        break;
                }
                tracetoss(e, forent);
@@ -297,6 +300,7 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo
                if(trace_ent == wz)
                {
                        dprint("I transformed into the same zone again, wtf, aborting the trace\n");
+                       trace_ent = world;
                        break;
                }
                wz = trace_ent;