4 void Net_GrapplingHook()
14 start_x = ReadCoord();
15 start_y = ReadCoord();
16 start_z = ReadCoord();
18 if(i <= 0 || i >= 256) // not owned by a client
26 p.HookKillTime = time + 0.1;
31 void Draw_GrapplingHookLine(vector from, vector to, float thickness, vector org, vector view_forward, string texture, float aspect, vector rgb)
33 // I want to draw a quad...
34 // from and to are MIDPOINTS.
36 vector axis, thickdir, A, B, C, D;
39 axis = normalize(to - from);
40 length_tex = aspect * vlen(to - from) / thickness;
42 // direction is perpendicular to the view normal, and perpendicular to the axis
43 thickdir = normalize(cross(axis, org - from));
45 A = from - thickdir * (thickness / 2);
46 B = from + thickdir * (thickness / 2);
47 C = to + thickdir * (thickness / 2);
48 D = to - thickdir * (thickness / 2);
50 if(checkextension("DP_SV_WRITEPICTURE"))
51 R_BeginPolygon(texture, 0);
53 R_BeginPolygon("", 0);
54 R_PolygonVertex(A, '0 0 0', rgb, 1);
55 R_PolygonVertex(B, '0 1 0', rgb, 1);
56 R_PolygonVertex(C, '0 1 0' + length_tex * '1 0 0', rgb, 1);
57 R_PolygonVertex(D, '0 0 0' + length_tex * '1 0 0', rgb, 1);
61 void Draw_GrapplingHook()
67 o = pmove_org + '0 0 1' * getstati(STAT_VIEWHEIGHT);
68 makevectors(input_angles);
70 for(i = 0; i < 255; ++i)
75 if(time >= e.HookKillTime)
77 if(i == player_localentnum - 1)
78 a = o + v_forward * 8 - v_right * 8 + v_up * -12;
82 Draw_GrapplingHookLine(b, a, 8, o, v_forward, "particles/hookbeam", 0.5, '1 1 1');