]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Improve ladder prediction (not perfect, but not so glitchy)
authorMario <zacjardine@y7mail.com>
Mon, 5 Jan 2015 12:14:48 +0000 (23:14 +1100)
committerMario <zacjardine@y7mail.com>
Mon, 5 Jan 2015 12:14:48 +0000 (23:14 +1100)
qcsrc/server/t_halflife.qc

index 412c8e96ad36b7defde098054655df0d322cdefd..961ecdc0e84847a52b577286317d2287e8179830 100644 (file)
@@ -117,18 +117,27 @@ void func_ladder_draw()
 {
        float dt = time - self.move_time;
        self.move_time = time;
-       if(dt <= 0)
-               return;
-
-       tracebox(self.origin, self.mins, self.maxs, self.origin, MOVE_NORMAL, self);
-
-       //if(trace_fraction < 1)
-       if(trace_ent)
-       if(time >= trace_ent.ladder_time)
-       {
-               other = trace_ent;
-               func_ladder_touch();
-       }
+       if(dt <= 0) { return; }
+
+       entity e;
+
+               for(e = findradius((self.absmin + self.absmax) * 0.5, vlen(self.absmax - self.absmin) * 0.5 + 1); e; e = e.chain)
+                               if(e.isplayermodel)
+                               {
+                                       vector emin = e.absmin;
+                                       vector emax = e.absmax;
+                                       if(self.solid == SOLID_BSP)
+                                       {
+                                               emin -= '1 1 1';
+                                               emax += '1 1 1';
+                                       }
+                                       if(boxesoverlap(emin, emax, self.absmin, self.absmax)) // quick
+                                               if(WarpZoneLib_BoxTouchesBrush(emin, emax, self, e)) // accurate
+                                               {
+                                                       other = e;
+                                                       func_ladder_touch();
+                                               }
+                               }
 }
 
 void ent_func_ladder()