lots of simplifaction of the trace function of warpzones
authordiv0 <div0@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Sun, 28 Feb 2010 19:45:41 +0000 (19:45 +0000)
committerdiv0 <div0@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Sun, 28 Feb 2010 19:45:41 +0000 (19:45 +0000)
Conflicts:

data/qcsrc/server/w_crylink.qc

git-svn-id: svn://svn.icculus.org/nexuiz/trunk@8720 f962a42d-fe04-0410-a3ab-8c8b0445ebaa

data/qcsrc/client/hook.qc
data/qcsrc/server/cl_weaponsystem.qc
data/qcsrc/server/w_common.qc
data/qcsrc/server/w_minstanex.qc
data/qcsrc/server/w_nex.qc
data/qcsrc/warpzonelib/common.qc
data/qcsrc/warpzonelib/common.qh
data/qcsrc/warpzonelib/server.qc

index 49949e5..101ab9f 100644 (file)
@@ -80,11 +80,9 @@ void Draw_GrapplingHook()
                rgb = '.3 1 .3';
        }
 
-       WarpZone_trace_callback = Draw_GrapplingHook_trace_callback;
        Draw_GrapplingHook_trace_callback_tex = tex;
        Draw_GrapplingHook_trace_callback_rnd = random();
-       WarpZone_TraceLine(a, b, MOVE_NOMONSTERS, world);
-       WarpZone_trace_callback = func_null;
+       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;
 }
 
index 8c1b836..97cbaab 100644 (file)
@@ -145,7 +145,7 @@ void W_SetupShot_Dir_ProjectileSize(entity ent, vector s_forward, vector mi, vec
        else
                WarpZone_TraceLine(ent.origin + ent.view_ofs, ent.origin + ent.view_ofs + s_forward * MAX_SHOT_DISTANCE, MOVE_NOMONSTERS, ent);
        ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
-       trueaimpoint = WarpZone_trace_endpos; // warpzone support
+       trueaimpoint = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); // warpzone support
 
        // track max damage
        if not(inWarmupStage) {
index f79d02f..0f738ba 100644 (file)
@@ -64,7 +64,7 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
                trace_ent.railgunhit = TRUE;
                trace_ent.railgunhitloc = end;
                trace_ent.railgunhitsolidbackup = trace_ent.solid;
-               trace_ent.railgundistance = vlen(WarpZone_trace_endpos - start);
+               trace_ent.railgundistance = vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos) - start);
 
                // stop if this is a wall
                if (trace_ent.solid == SOLID_BSP)
@@ -414,9 +414,7 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f
                        trace_fraction = 0;
                        fireBallisticBullet_trace_callback_ent = self;
                        fireBallisticBullet_trace_callback_eff = eff;
-                       WarpZone_trace_callback = fireBallisticBullet_trace_callback;
-                       WarpZone_TraceToss(self, oldself);
-                       WarpZone_trace_callback = func_null;
+                       WarpZone_TraceToss_ThroughZone(self, oldself, world, fireBallisticBullet_trace_callback);
                        self.velocity = v0;
                        self.gravity = g0;
 
index 9240a11..27bc8bd 100644 (file)
@@ -41,38 +41,40 @@ void W_MinstaNex_Attack (void)
        pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
        // teamcolor / hit beam effect
+       vector v;
+       v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
        if(teamplay)
        {
            switch(self.team)
            {
             case COLOR_TEAM1:   // Red
                 if(damage_goodhits)
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, WarpZone_trace_endpos);
+                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
                 else
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, WarpZone_trace_endpos);
+                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
                 break;
             case COLOR_TEAM2:   // Blue
                 if(damage_goodhits)
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, WarpZone_trace_endpos);
+                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
                 else
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, WarpZone_trace_endpos);
+                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
                 break;
             case COLOR_TEAM3:   // Yellow
                 if(damage_goodhits)
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, WarpZone_trace_endpos);
+                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
                 else
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, WarpZone_trace_endpos);
+                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
                 break;
             case COLOR_TEAM4:   // Pink
                 if(damage_goodhits)
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, WarpZone_trace_endpos);
+                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
                 else
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, WarpZone_trace_endpos);
+                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
                 break;
            }
        }
        else
-        WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, WarpZone_trace_endpos);
+        WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
 
        // flash and burn the wall
        if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
index abb4b2b..f9196a8 100644 (file)
@@ -2,15 +2,17 @@
 REGISTER_WEAPON(NEX, w_nex, IT_CELLS, 7, WEP_FLAG_NORMAL | WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_HIGH, "nex", "nex", "Nex");
 #else
 void SendCSQCNexBeamParticle() {
+       vector v;
+       v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
        WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
        WriteByte(MSG_BROADCAST, TE_CSQC_NEXGUNBEAMPARTICLE);
        
        WriteCoord(MSG_BROADCAST, w_shotorg_x);
        WriteCoord(MSG_BROADCAST, w_shotorg_y);
        WriteCoord(MSG_BROADCAST, w_shotorg_z);
-       WriteCoord(MSG_BROADCAST, WarpZone_trace_endpos_x);
-       WriteCoord(MSG_BROADCAST, WarpZone_trace_endpos_y);
-       WriteCoord(MSG_BROADCAST, WarpZone_trace_endpos_z);
+       WriteCoord(MSG_BROADCAST, v_x);
+       WriteCoord(MSG_BROADCAST, v_y);
+       WriteCoord(MSG_BROADCAST, v_z);
 }
 
 void W_Nex_Attack (void)
index d657a37..5535c80 100644 (file)
@@ -1,3 +1,25 @@
+void WarpZone_Accumulator_Clear(entity acc)
+{
+       acc.warpzone_transform = '0 0 0';
+       acc.warpzone_shift = '0 0 0';
+}
+void WarpZone_Accumulator_AddTransform(entity acc, vector t, vector s)
+{
+       vector tr, st;
+       tr = AnglesTransform_Multiply(t, acc.warpzone_transform);
+       st = AnglesTransform_Multiply_GetPostShift(t, s, acc.warpzone_transform, acc.warpzone_shift);
+       acc.warpzone_transform = tr;
+       acc.warpzone_shift = st;
+}
+void WarpZone_Accumulator_Add(entity acc, entity wz)
+{
+       vector t, st;
+       t = AnglesTransform_Multiply(wz.warpzone_transform, acc.warpzone_transform);
+       st = AnglesTransform_Multiply_GetPostShift(wz.warpzone_transform, wz.warpzone_shift, acc.warpzone_transform, acc.warpzone_shift);
+       acc.warpzone_transform = t;
+       acc.warpzone_shift = st;
+}
+
 void WarpZone_SetUp(entity e, vector my_org, vector my_ang, vector other_org, vector other_ang)
 {
        e.warpzone_transform = AnglesTransform_Divide(other_ang, AnglesTransform_TurnDirectionFR(my_ang));
@@ -89,64 +111,21 @@ void WarpZone_MakeAllOther()
                e.solid = SOLID_TRIGGER;
 }
 
-void WarpZone_TraceBox(vector org, vector mi, vector ma, vector end, float nomonsters, entity forent)
+void WarpZone_Trace_InitTransform()
 {
-       float frac, sol;
-       vector o0, e0;
-       entity wz;
-       vector vf, vr, vu;
-       vf = v_forward;
-       vr = v_right;
-       vu = v_up;
-       o0 = org;
-       e0 = end;
-       // if starting in warpzone, first transform
-       wz = WarpZone_Find(org + mi, org + ma);
-       if(wz)
+       if(!WarpZone_trace_transform)
        {
-               org = WarpZone_TransformOrigin(wz, trace_endpos);
-               end = WarpZone_TransformOrigin(wz, end);
-               WarpZone_trace_velocity = WarpZone_TransformVelocity(wz, WarpZone_trace_velocity);
-               WarpZone_trace_angles = WarpZone_TransformAngles(wz, WarpZone_trace_angles);
-               WarpZone_trace_v_angle = WarpZone_TransformVAngles(wz, WarpZone_trace_v_angle);
+               WarpZone_trace_transform = spawn();
+               WarpZone_trace_transform.classname = "warpzone_trace_transform";
        }
-       WarpZone_MakeAllSolid();
-       sol = -1;
-       frac = 0;
-       for(;;)
-       {
-               tracebox(org, mi, ma, end, nomonsters, forent);
-               if(WarpZone_trace_callback)
-                       WarpZone_trace_callback(org, trace_endpos, end);
-               if(sol < 0)
-                       sol = trace_startsolid;
-               if(trace_fraction >= 1)
-                       break;
-               frac = trace_fraction = frac + (1 - frac) * trace_fraction;
-               if(trace_ent.classname != "trigger_warpzone")
-                       break;
-               if(trace_ent == wz)
-               {
-                       dprint("I transformed into the same zone again, wtf, aborting the trace\n");
-                       break;
-               }
-               wz = trace_ent;
-               // we hit a warpzone... so, let's perform the trace after the warp again
-               org = WarpZone_TransformOrigin(wz, trace_endpos);
-               end = WarpZone_TransformOrigin(wz, end);
-               WarpZone_trace_velocity = WarpZone_TransformVelocity(wz, WarpZone_trace_velocity);
-               WarpZone_trace_angles = WarpZone_TransformAngles(wz, WarpZone_trace_angles);
-               WarpZone_trace_v_angle = WarpZone_TransformVAngles(wz, WarpZone_trace_v_angle);
-       }
-       WarpZone_MakeAllOther();
-       trace_startsolid = sol;
-       WarpZone_trace_endpos = o0 + (e0 - o0) * trace_fraction;
-       v_forward = vf;
-       v_right = vr;
-       v_up = vu;
+       WarpZone_Accumulator_Clear(WarpZone_trace_transform);
+}
+void WarpZone_Trace_AddTransform(entity wz)
+{
+       WarpZone_Accumulator_Add(WarpZone_trace_transform, wz);
 }
 
-void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end, float nomonsters, entity forent, entity zone)
+void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end, float nomonsters, entity forent, entity zone, WarpZone_trace_callback_t cb)
 {
        float frac, sol;
        vector o0, e0;
@@ -157,11 +136,12 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end,
        vu = v_up;
        o0 = org;
        e0 = end;
+       WarpZone_Trace_InitTransform();
        // if starting in warpzone, first transform
        wz = WarpZone_Find(org + mi, org + ma);
        if(wz)
        {
-               if(wz != zone)
+               if(zone && wz != zone)
                {
                        // we are in ANOTHER warpzone. This is bad. Make a zero length trace and return.
                        sol = 1;
@@ -169,11 +149,9 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end,
                        trace_endpos = org;
                        goto fail;
                }
+               WarpZone_Trace_AddTransform(wz);
                org = WarpZone_TransformOrigin(wz, trace_endpos);
                end = WarpZone_TransformOrigin(wz, end);
-               WarpZone_trace_velocity = WarpZone_TransformVelocity(wz, WarpZone_trace_velocity);
-               WarpZone_trace_angles = WarpZone_TransformAngles(wz, WarpZone_trace_angles);
-               WarpZone_trace_v_angle = WarpZone_TransformVAngles(wz, WarpZone_trace_v_angle);
        }
        WarpZone_MakeAllSolid();
        sol = -1;
@@ -181,58 +159,72 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end,
        for(;;)
        {
                tracebox(org, mi, ma, end, nomonsters, forent);
-               if(WarpZone_trace_callback)
-                       WarpZone_trace_callback(org, trace_endpos, end);
+               if(cb)
+                       cb(org, trace_endpos, end);
                if(sol < 0)
                        sol = trace_startsolid;
+
+               frac = trace_fraction = frac + (1 - frac) * trace_fraction;
                if(trace_fraction >= 1)
                        break;
-               frac = trace_fraction = frac + (1 - frac) * trace_fraction;
                if(trace_ent.classname != "trigger_warpzone")
                        break;
-               if(trace_ent != zone)
-                       break;
                if(trace_ent == wz)
                {
                        dprint("I transformed into the same zone again, wtf, aborting the trace\n");
                        break;
                }
                wz = trace_ent;
+               if(zone && wz != zone)
+                       break;
+               WarpZone_Trace_AddTransform(wz);
                // we hit a warpzone... so, let's perform the trace after the warp again
                org = WarpZone_TransformOrigin(wz, trace_endpos);
                end = WarpZone_TransformOrigin(wz, end);
-               WarpZone_trace_velocity = WarpZone_TransformVelocity(wz, WarpZone_trace_velocity);
-               WarpZone_trace_angles = WarpZone_TransformAngles(wz, WarpZone_trace_angles);
-               WarpZone_trace_v_angle = WarpZone_TransformVAngles(wz, WarpZone_trace_v_angle);
        }
        WarpZone_MakeAllOther();
 :fail
        trace_startsolid = sol;
-       WarpZone_trace_endpos = o0 + (e0 - o0) * trace_fraction;
        v_forward = vf;
        v_right = vr;
        v_up = vu;
 }
 
+void WarpZone_TraceBox(vector org, vector mi, vector ma, vector end, float nomonsters, entity forent)
+{
+       WarpZone_TraceBox_ThroughZone(org, mi, ma, end, nomonsters, forent, world, WarpZone_trace_callback_t_null);
+}
+
 void WarpZone_TraceLine(vector org, vector end, float nomonsters, entity forent)
 {
        WarpZone_TraceBox(org, '0 0 0', '0 0 0', end, nomonsters, forent);
 }
 
-void WarpZone_TraceToss(entity e, entity forent)
+void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZone_trace_callback_t cb)
 {
        float g, dt;
        vector vf, vr, vu, v0, o0;
        entity wz;
+
        vf = v_forward;
        vr = v_right;
        vu = v_up;
-       v0 = e.velocity;
        o0 = e.origin;
+       v0 = e.velocity;
+       WarpZone_Trace_InitTransform();
        // if starting in warpzone, first transform
        wz = WarpZone_Find(e.origin + e.mins, e.origin + e.maxs);
        if(wz)
        {
+               if(zone && wz != zone)
+               {
+                       // we are in ANOTHER warpzone. This is bad. Make a zero length trace and return.
+
+                       WarpZone_tracetoss_time = 0;
+                       trace_endpos = o0;
+                       goto fail;
+               }
+               WarpZone_Trace_AddTransform(wz);
                setorigin(e, WarpZone_TransformOrigin(wz, e.origin));
                e.velocity = WarpZone_TransformVelocity(wz, e.velocity);
        }
@@ -242,12 +234,12 @@ void WarpZone_TraceToss(entity e, entity forent)
        for(;;)
        {
                tracetoss(e, forent);
-               if(WarpZone_trace_callback)
-                       WarpZone_trace_callback(e.origin, trace_endpos, trace_endpos);
+               if(cb)
+                       cb(e.origin, trace_endpos, trace_endpos);
                e.origin = trace_endpos;
+               e.velocity_z -= WarpZone_tracetoss_time * g;
                dt = vlen(e.origin - o0) / vlen(e.velocity);
                WarpZone_tracetoss_time += dt;
-               e.velocity_z -= WarpZone_tracetoss_time * g;
                if(trace_fraction >= 1)
                        break;
                if(trace_ent.classname != "trigger_warpzone")
@@ -258,53 +250,41 @@ void WarpZone_TraceToss(entity e, entity forent)
                        break;
                }
                wz = trace_ent;
+               if(zone && wz != zone)
+                       break;
+               WarpZone_Trace_AddTransform(wz);
                // we hit a warpzone... so, let's perform the trace after the warp again
                e.origin = WarpZone_TransformOrigin(wz, e.origin);
                e.velocity = WarpZone_TransformVelocity(wz, e.velocity);
        }
        WarpZone_MakeAllOther();
+:fail
+       WarpZone_tracetoss_velocity = e.velocity;
        v_forward = vf;
        v_right = vr;
        v_up = vu;
-       WarpZone_tracetoss_velocity = e.velocity;
+       // restore old entity data (caller just uses trace_endpos, WarpZone_tracetoss_velocity and the transform)
        e.velocity = v0;
        e.origin = o0;
-       WarpZone_trace_endpos = e.origin + e.velocity * WarpZone_tracetoss_time;
-       WarpZone_trace_endpos_z -= 0.5 * g * WarpZone_tracetoss_time * WarpZone_tracetoss_time;
+}
+
+void WarpZone_TraceToss(entity e, entity forent)
+{
+       WarpZone_TraceToss_ThroughZone(e, forent, world, WarpZone_trace_callback_t_null);
+}
+
+entity WarpZone_TrailParticles_trace_callback_own;
+float WarpZone_TrailParticles_trace_callback_eff;
+void WarpZone_TrailParticles_trace_callback(vector from, vector endpos, vector to)
+{
+       trailparticles(WarpZone_TrailParticles_trace_callback_own, WarpZone_TrailParticles_trace_callback_eff, from, endpos);
 }
 
 void WarpZone_TrailParticles(entity own, float eff, vector org, vector end)
 {
-       vector vf, vr, vu;
-       entity e;
-       vf = v_forward;
-       vr = v_right;
-       vu = v_up;
-       WarpZone_MakeAllSolid();
-       e = world;
-       for(;;)
-       {
-               traceline(org, end, MOVE_NOMONSTERS, world);
-               //print(vtos(org), " to ", vtos(trace_endpos), "\n");
-               trailparticles(own, eff, org, trace_endpos);
-               if(trace_fraction >= 1)
-                       break;
-               if(trace_ent.classname != "trigger_warpzone")
-                       break;
-               // we hit a warpzone... so, let's perform the trace after the warp again
-               org = WarpZone_TransformOrigin(trace_ent, trace_endpos);
-               end = WarpZone_TransformOrigin(trace_ent, end);
-               if(trace_ent == e)
-               {
-                       dprint("I transformed into the same zone again, wtf, aborting the trace\n");
-                       break;
-               }
-               e = trace_ent;
-       }
-       WarpZone_MakeAllOther();
-       v_forward = vf;
-       v_right = vr;
-       v_up = vu;
+       WarpZone_TrailParticles_trace_callback_own = own;
+       WarpZone_TrailParticles_trace_callback_eff = eff;
+       WarpZone_TraceBox_ThroughZone(org, '0 0 0', '0 0 0', end, MOVE_NOMONSTERS, world, world, WarpZone_TrailParticles_trace_callback);
 }
 
 float WarpZone_PlaneDist(entity wz, vector v)
@@ -465,28 +445,6 @@ entity WarpZone_FindRadius(vector org, float rad, float needlineofsight)
        return e0;
 }
 
-void WarpZone_Accumulator_Clear(entity acc)
-{
-       acc.warpzone_transform = '0 0 0';
-       acc.warpzone_shift = '0 0 0';
-}
-void WarpZone_Accumulator_AddTransform(entity acc, vector t, vector s)
-{
-       vector tr, st;
-       tr = AnglesTransform_Multiply(t, acc.warpzone_transform);
-       st = AnglesTransform_Multiply_GetPostShift(t, s, acc.warpzone_transform, acc.warpzone_shift);
-       acc.warpzone_transform = tr;
-       acc.warpzone_shift = st;
-}
-void WarpZone_Accumulator_Add(entity acc, entity wz)
-{
-       vector t, st;
-       t = AnglesTransform_Multiply(wz.warpzone_transform, acc.warpzone_transform);
-       st = AnglesTransform_Multiply_GetPostShift(wz.warpzone_transform, wz.warpzone_shift, acc.warpzone_transform, acc.warpzone_shift);
-       acc.warpzone_transform = t;
-       acc.warpzone_shift = st;
-}
-
 .entity WarpZone_refsys;
 void WarpZone_RefSys_GC()
 {
index 4806b1e..c3a1e38 100644 (file)
@@ -1,3 +1,5 @@
+const void func_null(void); // never assign to this one please
+
 .vector warpzone_shift;
 .vector warpzone_origin;
 .vector warpzone_angles;
@@ -17,17 +19,16 @@ entity WarpZone_Find(vector mi, vector ma);
 void WarpZone_MakeAllSolid();
 void WarpZone_MakeAllOther();
 
-var void(vector start, vector hit, vector end) WarpZone_trace_callback; // called after every trace
-vector WarpZone_trace_angles; // total angles accumulator
-vector WarpZone_trace_v_angle; // total v_angle accumulator
-vector WarpZone_trace_velocity; // total velocity
-vector WarpZone_trace_endpos; // UNtransformed endpos
+typedef void(vector start, vector hit, vector end) WarpZone_trace_callback_t; // called on every elementary trace
+const var WarpZone_trace_callback_t WarpZone_trace_callback_t_null;
+entity WarpZone_trace_transform; // transform accumulator during a trace
 vector WarpZone_tracetoss_velocity; // ending velocity of a tracetoss (post-transform)
 float WarpZone_tracetoss_time; // duration of toss (approximate)
 void WarpZone_TraceBox(vector org, vector min, vector max, vector end, float nomonsters, entity forent);
-void WarpZone_TraceBox_ThroughZone(vector org, vector min, vector max, vector end, float nomonsters, entity forent, entity zone);
+void WarpZone_TraceBox_ThroughZone(vector org, vector min, vector max, vector end, float nomonsters, entity forent, entity zone, WarpZone_trace_callback_t cb);
 void WarpZone_TraceLine(vector org, vector end, float nomonsters, entity forent);
 void WarpZone_TraceToss(entity e, entity forent);
+void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZone_trace_callback_t cb);
 void WarpZone_TrailParticles(entity own, float eff, vector org, vector end);
 
 .vector WarpZone_findradius_dist;
index d5b9892..f8e7661 100644 (file)
@@ -242,12 +242,10 @@ float WarpZone_CheckProjectileImpact()
        // not properly retain the projectile trail (but we can't retain it
        // easily anyway without delaying the projectile by two frames, so who
        // cares)
-       WarpZone_trace_angles = self.angles;
-       WarpZone_trace_velocity = self.velocity;
-       WarpZone_TraceBox_ThroughZone(self.warpzone_oldorigin, self.mins, self.maxs, self.warpzone_oldorigin + self.warpzone_oldvelocity * frametime, MOVE_NORMAL, self, wz); // this will get us through the warpzone
+       WarpZone_TraceBox_ThroughZone(self.warpzone_oldorigin, self.mins, self.maxs, self.warpzone_oldorigin + self.warpzone_oldvelocity * frametime, MOVE_NORMAL, self, wz, WarpZone_trace_callback_t_null); // this will get us through the warpzone
        setorigin(self, trace_endpos);
-       self.angles = WarpZone_trace_angles;
-       self.velocity = WarpZone_trace_velocity;
+       self.angles = WarpZone_TransformAngles(WarpZone_trace_transform, self.angles);
+       self.velocity = WarpZone_TransformVelocity(WarpZone_trace_transform, self.velocity);
        
        // in case we are in our warp zone post-teleport, shift the projectile forward a bit
        mpd = max(vlen(self.mins), vlen(self.maxs));