.vector HookStart;
.vector HookEnd;
.float HookKillTime;
+.vector LGBeamStart;
+.vector LGBeamEnd;
+.float LGBeamKillTime;
+.float LGBeamSound;
+.float LGBeamSilent;
void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float alpha, float drawflag)
{
// direction is perpendicular to the view normal, and perpendicular to the axis
thickdir = normalize(cross(axis, view_origin - from));
+/*
+ print("from ", vtos(from), "\n");
+ print("to ", vtos(to), "\n");
+ print("org ", vtos(view_origin), "\n");
+ print("dir ", vtos(thickdir), "\n");
+*/
+
A = from - thickdir * (thickness / 2);
B = from + thickdir * (thickness / 2);
C = to + thickdir * (thickness / 2);
string tex;
vector rgb;
float t;
+ float s;
+ vector vs;
- if(time >= self.HookKillTime)
- return;
- if(self.sv_entnum == player_localentnum - 1)
- a = view_origin + view_forward * hook_shotorigin_x + view_right * hook_shotorigin_y + view_up * hook_shotorigin_z;
- else
- a = self.HookStart;
- b = self.HookEnd;
-
- t = GetPlayerColorForce(self.sv_entnum);
-
- if(t == COLOR_TEAM1)
- {
- tex = "particles/hook_red";
- rgb = '1 .3 .3';
- }
- else if(t == COLOR_TEAM2)
+ if(time < self.HookKillTime)
{
- tex = "particles/hook_blue";
- rgb = '.3 .3 1';
+ s = cvar("cl_gunalign");
+ if(s != 1 && s != 2 && s != 4)
+ s = 3; // default value
+ --s;
+ vs = hook_shotorigin[s];
+
+ if(self.sv_entnum == player_localentnum - 1)
+ a = view_origin + view_forward * vs_x + view_right * -vs_y + view_up * vs_z;
+ else
+ a = self.HookStart;
+ b = self.HookEnd;
+
+ t = GetPlayerColorForce(self.sv_entnum);
+
+ if(t == COLOR_TEAM1)
+ {
+ tex = "particles/hook_red";
+ rgb = '1 .3 .3';
+ }
+ else if(t == COLOR_TEAM2)
+ {
+ tex = "particles/hook_blue";
+ rgb = '.3 .3 1';
+ }
+ else if(t == COLOR_TEAM3)
+ {
+ tex = "particles/hook_yellow";
+ rgb = '1 1 .3';
+ }
+ else if(t == COLOR_TEAM4)
+ {
+ tex = "particles/hook_pink";
+ rgb = '1 .3 1';
+ }
+ else
+ {
+ tex = "particles/hook_green";
+ rgb = '.3 1 .3';
+ }
+
+ Draw_GrapplingHook_trace_callback_tex = tex;
+ Draw_GrapplingHook_trace_callback_rnd = random();
+ WarpZone_TraceBox_ThroughZone(a, '0 0 0', '0 0 0', b, MOVE_NOMONSTERS, world, world, Draw_GrapplingHook_trace_callback);
+ Draw_GrapplingHook_trace_callback_tex = string_null;
}
- else if(t == COLOR_TEAM3)
+
+ if(time < self.LGBeamKillTime)
{
- tex = "particles/hook_yellow";
- rgb = '1 1 .3';
+ s = cvar("cl_gunalign");
+ if(s != 1 && s != 2 && s != 4)
+ s = 3; // default value
+ --s;
+ vs = electro_shotorigin[s];
+
+ if(self.sv_entnum == player_localentnum - 1)
+ {
+ b = view_origin + view_forward * MAX_SHOT_DISTANCE;
+ WarpZone_TraceLine(view_origin, b, MOVE_NORMAL, world);
+ a = view_origin + view_forward * vs_x + view_right * -vs_y + view_up * vs_z;
+ }
+ else
+ {
+ a = self.LGBeamStart;
+ b = self.LGBeamEnd;
+ }
+
+ tex = "particles/lgbeam";
+ rgb = '1 1 1';
+
+ Draw_GrapplingHook_trace_callback_tex = tex;
+ Draw_GrapplingHook_trace_callback_rnd = random();
+ WarpZone_TraceBox_ThroughZone(a, '0 0 0', '0 0 0', b, MOVE_NORMAL, world, world, Draw_GrapplingHook_trace_callback);
+ Draw_GrapplingHook_trace_callback_tex = string_null;
+
+ // helps the sound
+ setorigin(self, a);
}
- else if(t == COLOR_TEAM4)
+
+ if(time < self.LGBeamKillTime && !self.LGBeamSilent)
{
- tex = "particles/hook_pink";
- rgb = '1 .3 1';
+ if(!self.LGBeamSound)
+ {
+ sound (self, CHAN_PROJECTILE, "weapons/lgbeam_fly.wav", VOL_BASE, ATTN_NORM);
+ self.LGBeamSound = 1;
+ }
}
else
{
- tex = "particles/hook_green";
- rgb = '.3 1 .3';
+ if(self.LGBeamSound)
+ {
+ sound (self, CHAN_PROJECTILE, "misc/null.wav", VOL_BASE, ATTN_NORM);
+ self.LGBeamSound = 0;
+ }
}
-
- Draw_GrapplingHook_trace_callback_tex = tex;
- Draw_GrapplingHook_trace_callback_rnd = random();
- WarpZone_TraceBox_ThroughZone(a, '0 0 0', '0 0 0', b, MOVE_NOMONSTERS, world, world, Draw_GrapplingHook_trace_callback);
- Draw_GrapplingHook_trace_callback_tex = string_null;
}
void Net_GrapplingHook()
{
- float i;
+ float i, t;
vector start, end;
entity p;
- i = ReadShort();
+ i = ReadByte();
+ t = ReadByte();
end_x = ReadCoord();
end_y = ReadCoord();
end_z = ReadCoord();
if(!p)
return;
- p.HookKillTime = time + 0.1;
- p.HookStart = start;
- p.HookEnd = end;
- p.draw = Draw_GrapplingHook;
+ switch(t)
+ {
+ case 0: // hook beam
+ p.HookKillTime = time + 0.1;
+ p.HookStart = start;
+ p.HookEnd = end;
+ p.draw = Draw_GrapplingHook;
+ break;
+ case 1: // electro lgbeam
+ p.LGBeamKillTime = time + 0.1;
+ p.LGBeamStart = start;
+ p.LGBeamEnd = end;
+ p.LGBeamSilent = 0;
+ p.draw = Draw_GrapplingHook;
+ break;
+ case 2: // silent electro lgbeam
+ p.LGBeamKillTime = time + 0.1;
+ p.LGBeamStart = start;
+ p.LGBeamEnd = end;
+ p.LGBeamSilent = 1;
+ p.draw = Draw_GrapplingHook;
+ break;
+ }
+}
+
+void Hook_Precache()
+{
+ precache_sound("weapons/lgbeam_fly.wav");
}