]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
More changes to the dragging system, to make it usable outside of the cheats code
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 24 Oct 2011 21:52:28 +0000 (00:52 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 24 Oct 2011 21:52:28 +0000 (00:52 +0300)
qcsrc/server/cheats.qc
qcsrc/server/miscfunctions.qc

index 6bed7eb322ea8ed09fc7b04a676d9cdf9d7a39bb..ec2b661c313cdb7d779ff6eeb1d13fdc908ca72a 100644 (file)
@@ -664,8 +664,7 @@ float CheatCommand(float argc)
        END_CHEAT_FUNCTION();
 }
 
-void crosshair_trace_plusvisibletriggers(entity pl);
-float Drag();
+float Drag(entity e);
 void Drag_Begin(entity dragger, entity draggee, vector touchpoint);
 void Drag_Finish(entity dragger);
 float Drag_IsDraggable(entity draggee);
@@ -688,7 +687,8 @@ float CheatFrame()
                default:
                        if(self.BUTTON_DRAG)
                                IS_CHEAT(0, 0, CHRAME_DRAG);
-                       if(Drag())
+                       crosshair_trace_plusvisibletriggers(self);
+                       if(Drag(trace_ent))
                                DID_CHEAT();
                        break;
        }
@@ -702,23 +702,7 @@ float CheatFrame()
 
 // ENTITY DRAGGING
 
-void crosshair_trace_plusvisibletriggers(entity pl)
-{
-       entity first;
-       entity e;
-       first = findchainfloat(solid, SOLID_TRIGGER);
-
-       for (e = first; e; e = e.chain)
-               if (e.model != "")
-                       e.solid = SOLID_BSP;
-
-       crosshair_trace(pl);
-
-       for (e = first; e; e = e.chain)
-               e.solid = SOLID_TRIGGER;
-}
-
-float Drag()
+float Drag(entity e)
 {
        if(Drag_IsDragging(self))
        {
@@ -757,14 +741,14 @@ float Drag()
                        if(self.BUTTON_DRAG)
                        {
                                crosshair_trace_plusvisibletriggers(self);
-                               if(trace_ent)
-                                       if(Drag_IsDraggable(trace_ent))
+                               if(e)
+                                       if(Drag_IsDraggable(e))
                                        {
-                                                       if(trace_ent.draggedby)
-                                                               Drag_Finish(trace_ent.draggedby);
-                                                       if(trace_ent.tag_entity)
-                                                               detach_sameorigin(trace_ent);
-                                                       Drag_Begin(self, trace_ent, trace_endpos);
+                                                       if(e.draggedby)
+                                                               Drag_Finish(e.draggedby);
+                                                       if(e.tag_entity)
+                                                               detach_sameorigin(e);
+                                                       Drag_Begin(self, e, trace_endpos);
                                                        return TRUE;
                                        }
                        }
index 1cf28efff0bd0cf661f70e4bf3f1f88a376b7935..6db6454f6b904ddaf0a4b355c8d9d2111a1441e8 100644 (file)
@@ -8,6 +8,21 @@ 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));
 }
+void crosshair_trace_plusvisibletriggers(entity pl)
+{
+       entity first;
+       entity e;
+       first = findchainfloat(solid, SOLID_TRIGGER);
+
+       for (e = first; e; e = e.chain)
+               if (e.model != "")
+                       e.solid = SOLID_BSP;
+
+       crosshair_trace(pl);
+
+       for (e = first; e; e = e.chain)
+               e.solid = SOLID_TRIGGER;
+}
 void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
 void WarpZone_crosshair_trace(entity pl)
 {