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.
37 vector axis, thickdir, A, B, C, D;
43 axis = normalize(to - from);
44 length_tex = aspect * vlen(to - from) / thickness;
46 // direction is perpendicular to the view normal, and perpendicular to the axis
47 thickdir = normalize(cross(axis, org - from));
49 A = from - thickdir * (thickness / 2);
50 B = from + thickdir * (thickness / 2);
51 C = to + thickdir * (thickness / 2);
52 D = to - thickdir * (thickness / 2);
54 if(checkextension("DP_SV_WRITEPICTURE"))
55 R_BeginPolygon(texture, 0);
57 R_BeginPolygon("", 0);
58 R_PolygonVertex(A, '0 0 0' + t * '1 0 0', rgb, 1);
59 R_PolygonVertex(B, '0 1 0' + t * '1 0 0', rgb, 1);
60 R_PolygonVertex(C, '0 1 0' + (t + length_tex) * '1 0 0', rgb, 1);
61 R_PolygonVertex(D, '0 0 0' + (t + length_tex) * '1 0 0', rgb, 1);
65 void Draw_GrapplingHook()
72 o = pmove_org + '0 0 1' * getstati(STAT_VIEWHEIGHT);
73 makevectors(input_angles);
75 for(i = 0; i < 255; ++i)
80 if(time >= e.HookKillTime)
82 if(i == player_localentnum - 1)
83 a = o + v_forward * 8 - v_right * 8 + v_up * -12;
87 if(e.team == COLOR_TEAM1)
88 tex = "particles/hook_red";
89 else if(e.team == COLOR_TEAM2)
90 tex = "particles/hook_blue";
91 else if(e.team == COLOR_TEAM3)
92 tex = "particles/hook_yellow";
93 else if(e.team == COLOR_TEAM4)
94 tex = "particles/hook_pink";
96 tex = "particles/hook_green";
97 Draw_GrapplingHookLine(b, a, 8, o, v_forward, tex, 0.25, '1 1 1');