X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fhook.qc;h=a995970b45fbbc4499afc306c512e6970d619913;hb=e0c1470ac5fcae5caeea336e35909475880357df;hp=b769947eeb9439e02e6618ef20dbdc4338e0b168;hpb=b42a2b0a6c12ccbb208bd8cafb0a8405adbc3ae0;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/hook.qc b/qcsrc/client/hook.qc index b769947ee..a995970b4 100644 --- a/qcsrc/client/hook.qc +++ b/qcsrc/client/hook.qc @@ -1,11 +1,10 @@ .float HookType; // ENT_CLIENT_* .vector origin; .vector velocity; -.float HookSound; .float HookSilent; .float HookRange; -void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float alpha, float drawflag) +void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float alpha, float drawflag, vector vieworg) { // I want to draw a quad... // from and to are MIDPOINTS. @@ -17,7 +16,7 @@ void Draw_CylindricLine(vector from, vector to, float thickness, string texture, length_tex = aspect * vlen(to - from) / thickness; // direction is perpendicular to the view normal, and perpendicular to the axis - thickdir = normalize(cross(axis, view_origin - from)); + thickdir = normalize(cross(axis, vieworg - from)); /* print("from ", vtos(from), "\n"); @@ -46,21 +45,31 @@ float Draw_GrapplingHook_trace_callback_a; void Draw_GrapplingHook_trace_callback(vector start, vector hit, vector end) { float i; + vector vorg; + vorg = WarpZone_TransformOrigin(WarpZone_trace_transform, view_origin); for(i = 0; i < Draw_GrapplingHook_trace_callback_a; ++i) - Draw_CylindricLine(hit, start, 8, Draw_GrapplingHook_trace_callback_tex, 0.25, Draw_GrapplingHook_trace_callback_rnd, Draw_GrapplingHook_trace_callback_rgb, min(1, Draw_GrapplingHook_trace_callback_a - i), DRAWFLAG_NORMAL); + Draw_CylindricLine(hit, start, 8, Draw_GrapplingHook_trace_callback_tex, 0.25, Draw_GrapplingHook_trace_callback_rnd, Draw_GrapplingHook_trace_callback_rgb, min(1, Draw_GrapplingHook_trace_callback_a - i), DRAWFLAG_NORMAL, vorg); Draw_GrapplingHook_trace_callback_rnd += 0.25 * vlen(hit - start) / 8; } +.float teleport_time; void Draw_GrapplingHook() { vector a, b, atrans; - string tex, snd; + string tex; vector rgb; float t; float s; vector vs; float intensity, offset; + if(self.teleport_time) + if(time > self.teleport_time) + { + sound (self, CHAN_PROJECTILE, "misc/null.wav", VOL_BASE, ATTN_NORM); // safeguard + self.teleport_time = 0; + } + InterpolateOrigin_Do(); s = cvar("cl_gunalign"); @@ -180,8 +189,16 @@ void Draw_GrapplingHook() { default: case ENT_CLIENT_HOOK: - setorigin(self, trace_endpos); // hook endpoint! - self.angles = vectoangles(trace_endpos - atrans); + if(vlen(trace_endpos - atrans) > 0.5) + { + setorigin(self, trace_endpos); // hook endpoint! + self.angles = vectoangles(trace_endpos - atrans); + self.drawmask = MASK_NORMAL; + } + else + { + self.drawmask = 0; + } break; case ENT_CLIENT_LGBEAM: case ENT_CLIENT_GAUNTLET: @@ -251,7 +268,7 @@ void Ent_ReadHook(float bIsNew, float type) InterpolateOrigin_Note(); - if(bIsNew) + if(bIsNew || !self.teleport_time) { self.draw = Draw_GrapplingHook; self.entremove = Remove_GrapplingHook; @@ -272,6 +289,8 @@ void Ent_ReadHook(float bIsNew, float type) break; } } + + self.teleport_time = time + 10; } void Hook_Precache()