5 void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, vector rgb, float drawflag)
7 // I want to draw a quad...
8 // from and to are MIDPOINTS.
11 vector axis, thickdir, A, B, C, D;
17 axis = normalize(to - from);
18 length_tex = aspect * vlen(to - from) / thickness;
20 // direction is perpendicular to the view normal, and perpendicular to the axis
21 thickdir = normalize(cross(axis, view_origin - from));
23 A = from - thickdir * (thickness / 2);
24 B = from + thickdir * (thickness / 2);
25 C = to + thickdir * (thickness / 2);
26 D = to - thickdir * (thickness / 2);
28 R_BeginPolygon(texture, drawflag);
29 R_PolygonVertex(A, '0 0 0' + t * '1 0 0', rgb, 1);
30 R_PolygonVertex(B, '0 1 0' + t * '1 0 0', rgb, 1);
31 R_PolygonVertex(C, '0 1 0' + (t + length_tex) * '1 0 0', rgb, 1);
32 R_PolygonVertex(D, '0 0 0' + (t + length_tex) * '1 0 0', rgb, 1);
36 void Draw_GrapplingHook()
42 if(time >= self.HookKillTime)
44 if(self.sv_entnum == player_localentnum - 1)
45 a = view_origin + view_forward * 8 - view_right * 8 + view_up * -12;
49 if(self.team == COLOR_TEAM1)
51 tex = "particles/hook_red";
54 else if(self.team == COLOR_TEAM2)
56 tex = "particles/hook_blue";
59 else if(self.team == COLOR_TEAM3)
61 tex = "particles/hook_yellow";
64 else if(self.team == COLOR_TEAM4)
66 tex = "particles/hook_pink";
71 tex = "particles/hook_green";
74 if(checkextension("DP_SV_WRITEPICTURE"))
75 Draw_CylindricLine(b, a, 8, tex, 0.25, '1 1 1', DRAWFLAG_NORMAL);
77 Draw_CylindricLine(b, a, 1, "", 0.25, rgb, DRAWFLAG_NORMAL);
80 void Net_GrapplingHook()
90 start_x = ReadCoord();
91 start_y = ReadCoord();
92 start_z = ReadCoord();
94 if(i <= 0 || i >= 256) // not owned by a client
102 p.HookKillTime = time + 0.1;
105 p.draw = Draw_GrapplingHook;