From: Rudolf Polzer Date: Wed, 18 Aug 2010 18:44:31 +0000 (+0200) Subject: fix electro beam drawing through warpzone X-Git-Tag: xonotic-v0.1.0preview~343 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=02bf8667ee9686ba129b305a263fcd704bb1d8c1 fix electro beam drawing through warpzone --- diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index a45b360e94..2059527cdb 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -79,11 +79,11 @@ void Porto_Draw() p = p - view_up * 16; if(idx-1 >= portal1_idx) { - Draw_CylindricLine(p, q, 4, "", 1, 0, '0 0 1', 0.5, DRAWFLAG_NORMAL); + Draw_CylindricLine(p, q, 4, "", 1, 0, '0 0 1', 0.5, DRAWFLAG_NORMAL, view_origin); } else { - Draw_CylindricLine(p, q, 4, "", 1, 0, '1 0 0', 0.5, DRAWFLAG_NORMAL); + Draw_CylindricLine(p, q, 4, "", 1, 0, '1 0 0', 0.5, DRAWFLAG_NORMAL, view_origin); } --idx; } diff --git a/qcsrc/client/effects.qc b/qcsrc/client/effects.qc index bbee658009..2e946fc830 100644 --- a/qcsrc/client/effects.qc +++ b/qcsrc/client/effects.qc @@ -10,8 +10,8 @@ void SUB_Remove() void b_draw() { - //Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, 0, time * 3, '1 1 1', 0.7, DRAWFLAG_ADDITIVE); - Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, (self.fx_with/256), 0, '1 1 1', 1, DRAWFLAG_ADDITIVE); + //Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, 0, time * 3, '1 1 1', 0.7, DRAWFLAG_ADDITIVE, view_origin); + Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, (self.fx_with/256), 0, '1 1 1', 1, DRAWFLAG_ADDITIVE, view_origin); } void b_make(vector s,vector e, string t,float l,float z) diff --git a/qcsrc/client/hook.qc b/qcsrc/client/hook.qc index b769947eeb..06858d597a 100644 --- a/qcsrc/client/hook.qc +++ b/qcsrc/client/hook.qc @@ -5,7 +5,7 @@ .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 +17,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,8 +46,10 @@ 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; } diff --git a/qcsrc/client/laser.qc b/qcsrc/client/laser.qc index 23ced4b64a..6703b1b11f 100644 --- a/qcsrc/client/laser.qc +++ b/qcsrc/client/laser.qc @@ -35,11 +35,11 @@ void Draw_Laser() { if(self.alpha) { - Draw_CylindricLine(self.origin, trace_endpos, self.scale, "particles/laserbeam", 0, time * 3, self.colormod, self.alpha, DRAWFLAG_NORMAL); // TODO make a texture to make the laser look smoother + Draw_CylindricLine(self.origin, trace_endpos, self.scale, "particles/laserbeam", 0, time * 3, self.colormod, self.alpha, DRAWFLAG_NORMAL, view_origin); } else { - Draw_CylindricLine(self.origin, trace_endpos, self.scale, "particles/laserbeam", 0, time * 3, self.colormod, 0.5, DRAWFLAG_ADDITIVE); // TODO make a texture to make the laser look smoother + Draw_CylindricLine(self.origin, trace_endpos, self.scale, "particles/laserbeam", 0, time * 3, self.colormod, 0.5, DRAWFLAG_ADDITIVE, view_origin); } } if not(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT))