5 void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float alpha, float drawflag)
7 // I want to draw a quad...
8 // from and to are MIDPOINTS.
10 vector axis, thickdir, A, B, C, D;
13 axis = normalize(to - from);
14 length_tex = aspect * vlen(to - from) / thickness;
16 // direction is perpendicular to the view normal, and perpendicular to the axis
17 thickdir = normalize(cross(axis, view_origin - from));
19 A = from - thickdir * (thickness / 2);
20 B = from + thickdir * (thickness / 2);
21 C = to + thickdir * (thickness / 2);
22 D = to - thickdir * (thickness / 2);
24 R_BeginPolygon(texture, drawflag);
25 R_PolygonVertex(A, '0 0 0' + shift * '1 0 0', rgb, alpha);
26 R_PolygonVertex(B, '0 1 0' + shift * '1 0 0', rgb, alpha);
27 R_PolygonVertex(C, '0 1 0' + (shift + length_tex) * '1 0 0', rgb, alpha);
28 R_PolygonVertex(D, '0 0 0' + (shift + length_tex) * '1 0 0', rgb, alpha);
32 void Draw_GrapplingHook()
38 if(time >= self.HookKillTime)
40 if(self.sv_entnum == player_localentnum - 1)
41 a = view_origin + view_forward * 8 - view_right * 8 + view_up * -12;
45 if(self.team == COLOR_TEAM1)
47 tex = "particles/hook_red";
50 else if(self.team == COLOR_TEAM2)
52 tex = "particles/hook_blue";
55 else if(self.team == COLOR_TEAM3)
57 tex = "particles/hook_yellow";
60 else if(self.team == COLOR_TEAM4)
62 tex = "particles/hook_pink";
67 tex = "particles/hook_green";
70 if(csqc_flags & CSQC_FLAG_READPICTURE)
71 Draw_CylindricLine(b, a, 8, tex, 0.25, random(), '1 1 1', 1, DRAWFLAG_NORMAL);
73 Draw_CylindricLine(b, a, 1, "", 0.25, 0, rgb, 1, DRAWFLAG_NORMAL);
76 void Net_GrapplingHook()
86 start_x = ReadCoord();
87 start_y = ReadCoord();
88 start_z = ReadCoord();
90 if(i <= 0 || i >= 256) // not owned by a client
98 p.HookKillTime = time + 0.1;
101 p.draw = Draw_GrapplingHook;