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()
39 if(time >= self.HookKillTime)
41 if(self.sv_entnum == player_localentnum - 1)
42 a = view_origin + view_forward * hook_shotorigin_x + view_right * hook_shotorigin_y + view_up * hook_shotorigin_z;
47 t = GetPlayerColorForce(self.sv_entnum);
51 tex = "particles/hook_red";
54 else if(t == COLOR_TEAM2)
56 tex = "particles/hook_blue";
59 else if(t == COLOR_TEAM3)
61 tex = "particles/hook_yellow";
64 else if(t == COLOR_TEAM4)
66 tex = "particles/hook_pink";
71 tex = "particles/hook_green";
74 Draw_CylindricLine(b, a, 8, tex, 0.25, random(), '1 1 1', 1, DRAWFLAG_NORMAL);
77 void Net_GrapplingHook()
87 start_x = ReadCoord();
88 start_y = ReadCoord();
89 start_z = ReadCoord();
91 if(i <= 0 || i >= 256) // not owned by a client
99 p.HookKillTime = time + 0.1;
102 p.draw = Draw_GrapplingHook;