Merge branch 'master' into mirceakitsune/hud_postprocessing
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hook.qc
index b22dba8..7ff5ade 100644 (file)
@@ -1,7 +1,6 @@
 .float HookType; // ENT_CLIENT_*
 .vector origin;
 .vector velocity;
 .float HookType; // ENT_CLIENT_*
 .vector origin;
 .vector velocity;
-.float HookSound;
 .float HookSilent;
 .float HookRange;
 
 .float HookSilent;
 .float HookRange;
 
@@ -19,13 +18,6 @@ void Draw_CylindricLine(vector from, vector to, float thickness, string texture,
        // direction is perpendicular to the view normal, and perpendicular to the axis
        thickdir = normalize(cross(axis, vieworg - from));
 
        // direction is perpendicular to the view normal, and perpendicular to the axis
        thickdir = normalize(cross(axis, vieworg - from));
 
-/*
-       print("from ", vtos(from), "\n");
-       print("to ", vtos(to), "\n");
-       print("org ", vtos(view_origin), "\n");
-       print("dir ", vtos(thickdir), "\n");
-*/
-
        A = from - thickdir * (thickness / 2);
        B = from + thickdir * (thickness / 2);
        C = to + thickdir * (thickness / 2);
        A = from - thickdir * (thickness / 2);
        B = from + thickdir * (thickness / 2);
        C = to + thickdir * (thickness / 2);
@@ -53,10 +45,11 @@ void Draw_GrapplingHook_trace_callback(vector start, vector hit, vector end)
        Draw_GrapplingHook_trace_callback_rnd += 0.25 * vlen(hit - start) / 8;
 }
 
        Draw_GrapplingHook_trace_callback_rnd += 0.25 * vlen(hit - start) / 8;
 }
 
+.float teleport_time;
 void Draw_GrapplingHook()
 {
        vector a, b, atrans;
 void Draw_GrapplingHook()
 {
        vector a, b, atrans;
-       string tex, snd;
+       string tex;
        vector rgb;
        float t;
        float s;
        vector rgb;
        float t;
        float s;
@@ -72,7 +65,7 @@ void Draw_GrapplingHook()
 
        InterpolateOrigin_Do();
 
 
        InterpolateOrigin_Do();
 
-       s = cvar("cl_gunalign");
+       s = autocvar_cl_gunalign;
        if(s != 1 && s != 2 && s != 4)
                s = 3; // default value
        --s;
        if(s != 1 && s != 2 && s != 4)
                s = 3; // default value
        --s;
@@ -189,8 +182,16 @@ void Draw_GrapplingHook()
        {
                default:
                case ENT_CLIENT_HOOK:
        {
                default:
                case ENT_CLIENT_HOOK:
-                       setorigin(self, trace_endpos); // hook endpoint!
-                       self.angles = vectoangles(trace_endpos - atrans);
+                       if(vlen(trace_endpos - atrans) > 0.5)
+                       {
+                               setorigin(self, trace_endpos); // hook endpoint!
+                               self.angles = vectoangles(trace_endpos - atrans);
+                               self.drawmask = MASK_NORMAL;
+                       }
+                       else
+                       {
+                               self.drawmask = 0;
+                       }
                        break;
                case ENT_CLIENT_LGBEAM:
                case ENT_CLIENT_GAUNTLET:
                        break;
                case ENT_CLIENT_LGBEAM:
                case ENT_CLIENT_GAUNTLET:
@@ -260,7 +261,7 @@ void Ent_ReadHook(float bIsNew, float type)
 
        InterpolateOrigin_Note();
 
 
        InterpolateOrigin_Note();
 
-       if(bIsNew)
+       if(bIsNew || !self.teleport_time)
        {
                self.draw = Draw_GrapplingHook;
                self.entremove = Remove_GrapplingHook;
        {
                self.draw = Draw_GrapplingHook;
                self.entremove = Remove_GrapplingHook;