]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/physics/movetypes/toss.qc
Save global trace values when performing touch operations as touches may perform...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / physics / movetypes / toss.qc
index 772eb1b070c59a2be0df4aa72df5bc904e115838..67405a636498d0f0aef004f2b5236750e42dda4d 100644 (file)
@@ -56,9 +56,17 @@ void _Movetype_Physics_Toss(entity this, float dt)  // SV_Physics_Toss
                if (wasfreed(this))
                        return;
 
-               if (trace_startsolid)
+               // NOTE: this is bmodelstartsolid in the engine
+               if (trace_startsolid && trace_ent.solid == SOLID_BSP)
                {
+                       // QC lacks pointers so we must save the old trace values
+                       float oldtrace_fraction = trace_fraction;
+                       vector oldtrace_plane_normal = trace_plane_normal;
+                       entity oldtrace_ent = trace_ent;
                        _Movetype_UnstickEntity(this);
+                       trace_fraction = oldtrace_fraction;
+                       trace_plane_normal = oldtrace_plane_normal;
+                       trace_ent = oldtrace_ent;
                        if(!_Movetype_PushEntity(this, move, true, true))
                                return;
                        if (wasfreed(this))