X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fhook.qc;h=9f690d5bc884dc3692b1ebb172cdd6089e74775f;hb=24c2148c1ceb17186cc4e77279d7810d9f398f36;hp=dbd8ab2ad89fd7429a8b8349ccd54634e8aacd16;hpb=21cd0bef7a9329d0201610bccedf8a29048b0291;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/hook.qc b/qcsrc/client/hook.qc index dbd8ab2ad..9f690d5bc 100644 --- a/qcsrc/client/hook.qc +++ b/qcsrc/client/hook.qc @@ -1,6 +1,17 @@ .vector HookStart; .vector HookEnd; .float HookKillTime; +.vector LGBeamStart; +.vector LGBeamEnd; +.float LGBeamKillTime; +.float LGBeamSound; +.float LGBeamSilent; +.vector GauntletBeamStart; +.vector GauntletBeamEnd; +.float GauntletBeamKillTime; +.float GauntletBeamSound; +.float GauntletBeamSilent; + void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float alpha, float drawflag) { @@ -50,56 +61,164 @@ void Draw_GrapplingHook() 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; + if(time < self.HookKillTime) + { + s = cvar("cl_gunalign"); + if(s != 1 && s != 2 && s != 4) + s = 3; // default value + --s; + vs = hook_shotorigin[s]; - t = GetPlayerColorForce(self.sv_entnum); + 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; - if(t == COLOR_TEAM1) - { - tex = "particles/hook_red"; - rgb = '1 .3 .3'; + 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_TEAM2) + + if(time < self.LGBeamKillTime) { - 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 = 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_TEAM3) + + if(time < self.GauntletBeamKillTime) { - 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 = gauntlet_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.GauntletBeamStart; + b = self.GauntletBeamEnd; + } + + tex = "particles/gauntletbeam"; + 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; + if(time < self.GauntletBeamKillTime && !self.GauntletBeamSilent) + { + if(!self.GauntletBeamSound) + { + sound (self, CHAN_PROJECTILE, "weapons/gauntletbeam_fly.wav", VOL_BASE, ATTN_NORM); + self.GauntletBeamSound = 1; + } + } + else + { + if(self.GauntletBeamSound) + { + sound (self, CHAN_PROJECTILE, "misc/null.wav", VOL_BASE, ATTN_NORM); + self.GauntletBeamSound = 0; + } + } } 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(); @@ -115,8 +234,40 @@ void Net_GrapplingHook() 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; + case 3: // gauntlet beam + p.GauntletBeamKillTime = time + 0.1; + p.GauntletBeamStart = start; + p.GauntletBeamEnd = end; + p.GauntletBeamSilent = 0; + p.draw = Draw_GrapplingHook; + break; + } +} + +void Hook_Precache() +{ + precache_sound("weapons/lgbeam_fly.wav"); + precache_sound("weapons/gauntletbeam_fly.wav"); }