1 .vector GrabberStart;
\r
3 .float GrabberKillTime;
\r
5 void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float alpha, float drawflag)
\r
7 // I want to draw a quad...
\r
8 // from and to are MIDPOINTS.
\r
10 vector axis, thickdir, A, B, C, D;
\r
13 axis = normalize(to - from);
\r
14 length_tex = aspect * vlen(to - from) / thickness;
\r
16 // direction is perpendicular to the view normal, and perpendicular to the axis
\r
17 thickdir = normalize(cross(axis, view_origin - from));
\r
19 A = from - thickdir * (thickness / 2);
\r
20 B = from + thickdir * (thickness / 2);
\r
21 C = to + thickdir * (thickness / 2);
\r
22 D = to - thickdir * (thickness / 2);
\r
24 R_BeginPolygon(texture, drawflag);
\r
25 R_PolygonVertex(A, '0 0 0' + shift * '1 0 0', rgb, alpha);
\r
26 R_PolygonVertex(B, '0 1 0' + shift * '1 0 0', rgb, alpha);
\r
27 R_PolygonVertex(C, '0 1 0' + (shift + length_tex) * '1 0 0', rgb, alpha);
\r
28 R_PolygonVertex(D, '0 0 0' + (shift + length_tex) * '1 0 0', rgb, alpha);
\r
32 string Draw_Grabber_trace_callback_tex;
\r
33 float Draw_Grabber_trace_callback_rnd;
\r
34 void Draw_Grabber_trace_callback(vector start, vector hit, vector end)
\r
36 Draw_CylindricLine(hit, start, 8, Draw_Grabber_trace_callback_tex, 0.25, Draw_Grabber_trace_callback_rnd, '1 1 1', 1, DRAWFLAG_NORMAL);
\r
37 Draw_Grabber_trace_callback_rnd += 0.25 * vlen(hit - start) / 8;
\r
47 if(time >= self.GrabberKillTime)
\r
49 if(self.sv_entnum == player_localentnum - 1)
\r
50 a = view_origin + view_forward * grabber_shotorigin_x + view_right * grabber_shotorigin_y + view_up * grabber_shotorigin_z;
\r
52 a = self.GrabberStart;
\r
53 b = self.GrabberEnd;
\r
55 t = GetPlayerColorForce(self.sv_entnum);
\r
57 if(t == COLOR_TEAM1)
\r
59 tex = "particles/grabber_red";
\r
62 else if(t == COLOR_TEAM2)
\r
64 tex = "particles/grabber_blue";
\r
67 else if(t == COLOR_TEAM3)
\r
69 tex = "particles/grabber_yellow";
\r
72 else if(t == COLOR_TEAM4)
\r
74 tex = "particles/grabber_pink";
\r
79 tex = "particles/grabber_white";
\r
83 Draw_Grabber_trace_callback_tex = tex;
\r
84 Draw_Grabber_trace_callback_rnd = random();
\r
85 WarpZone_TraceBox_ThroughZone(a, '0 0 0', '0 0 0', b, MOVE_NOMONSTERS, world, world, Draw_Grabber_trace_callback);
\r
86 Draw_Grabber_trace_callback_tex = string_null;
\r
96 end_x = ReadCoord();
\r
97 end_y = ReadCoord();
\r
98 end_z = ReadCoord();
\r
99 start_x = ReadCoord();
\r
100 start_y = ReadCoord();
\r
101 start_z = ReadCoord();
\r
103 if(i <= 0 || i >= 256) // not owned by a client
\r
107 p = playerslots[i];
\r
111 p.GrabberKillTime = time + 0.1;
\r
112 p.GrabberStart = start;
\r
113 p.GrabberEnd = end;
\r
114 p.draw = Draw_Grabber;
\r