3 float HookKillTime[255];
4 void Net_GrapplingHook()
13 start_x = ReadCoord();
14 start_y = ReadCoord();
15 start_z = ReadCoord();
17 if(i <= 0 || i >= 256) // not owned by a client
21 HookKillTime[i] = time + 0.1;
26 void Draw_GrapplingHookLine(vector from, vector to, float thickness, vector org, vector view_forward)
28 // I want to draw a quad...
29 // from and to are MIDPOINTS.
31 vector axis, thickdir, A, B, C, D;
34 axis = normalize(to - from);
35 length_tex = vlen(to - from) / thickness;
37 // direction is perpendicular to the view normal, and perpendicular to the axis
38 thickdir = normalize(cross(axis, org - from));
40 A = from - thickdir * (thickness / 2);
41 B = from + thickdir * (thickness / 2);
42 C = to + thickdir * (thickness / 2);
43 D = to - thickdir * (thickness / 2);
45 R_BeginPolygon("particles/nexbeam", DRAWFLAG_ADDITIVE);
46 R_PolygonVertex(A, '0 0 0', '.5 1 0', 1);
47 R_PolygonVertex(B, '1 0 0', '.5 1 0', 1);
48 R_PolygonVertex(C, '1 0 0' + length_tex * '0 1 0', '.5 1 0', 1);
49 R_PolygonVertex(D, '0 0 0' + length_tex * '0 1 0', '.5 1 0', 1);
53 void Draw_GrapplingHook()
58 o = pmove_org + '0 0 1' * getstati(STAT_VIEWHEIGHT);
59 makevectors(input_angles);
61 for(i = 0; i < 255; ++i)
63 if(time >= HookKillTime[i])
65 if(i == player_localentnum - 1)
66 a = o + v_forward * 8 - v_right * 8 + v_up * -12;
70 Draw_GrapplingHookLine(a, b, 8, o, v_forward);