]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fixed a bug with sv_gameplayfix_nudgeoutofsolid where the player might
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 4 Dec 2009 16:13:26 +0000 (16:13 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 4 Dec 2009 16:13:26 +0000 (16:13 +0000)
get put on the opposite side of a brush because of being very near the
plane that should be used for nudging, which caused it not to be
considered as a nudging plane
added some checks to ensure more consistency on trace direction (should
be able to swap start and end without startsolid trouble, at least less)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9537 d7cf8633-e32d-0410-b094-e92efae38249

collision.c
sv_main.c

index 89bc6f636b08f5557ea6f5ced3ec64d3c0b57a83..f17c9bfdf7d5449ed3d848535cd69c4a8bb519a1 100644 (file)
@@ -717,12 +717,16 @@ void Collision_TraceBrushBrushFloat(trace_t *trace, const colbrushf_t *trace_sta
                //Con_Printf("%c%i: startdist = %f, enddist = %f, startdist / (startdist - enddist) = %f\n", nplane2 != nplane ? 'b' : 'a', nplane2, startdist, enddist, startdist / (startdist - enddist));
 
                // aside from collisions, this is also used for error correction
-               if (startdist < 0 && (startdepth < startdist || startdepth == 1))
+               if (startdist < collision_impactnudge.value && nplane < numplanes1 && (startdepth < startdist || startdepth == 1))
                {
                        startdepth = startdist;
                        VectorCopy(startplane, startdepthnormal);
                }
 
+               if (startdist >= -collision_impactnudge.value && enddist >= startdist)
+                       return;
+               if (startdist <= 0 && enddist <= 0)
+                       continue;
                if (startdist > enddist)
                {
                        // moving into brush
@@ -880,12 +884,16 @@ void Collision_TraceLineBrushFloat(trace_t *trace, const vec3_t linestart, const
                //Con_Printf("%c%i: startdist = %f, enddist = %f, startdist / (startdist - enddist) = %f\n", nplane2 != nplane ? 'b' : 'a', nplane2, startdist, enddist, startdist / (startdist - enddist));
 
                // aside from collisions, this is also used for error correction
-               if (startdist < 0 && (startdepth < startdist || startdepth == 1))
+               if (startdist < collision_impactnudge.value && (startdepth < startdist || startdepth == 1))
                {
                        startdepth = startdist;
                        VectorCopy(startplane, startdepthnormal);
                }
 
+               if (startdist >= -collision_impactnudge.value && enddist >= startdist)
+                       return;
+               if (startdist <= 0 && enddist <= 0)
+                       continue;
                if (startdist > enddist)
                {
                        // moving into brush
index 32d64e20e0b9eef4c94c51efd0c5a67b17198219..3a9037518e89de7d1d48ea44dda7116aaf1a5ce6 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -98,7 +98,7 @@ cvar_t sv_gameplayfix_multiplethinksperframe = {0, "sv_gameplayfix_multiplethink
 cvar_t sv_gameplayfix_noairborncorpse = {0, "sv_gameplayfix_noairborncorpse", "1", "causes entities (corpses, items, etc) sitting ontop of moving entities (players) to fall when the moving entity (player) is no longer supporting them"};
 cvar_t sv_gameplayfix_noairborncorpse_allowsuspendeditems = {0, "sv_gameplayfix_noairborncorpse_allowsuspendeditems", "1", "causes entities sitting ontop of objects that are instantaneously remove to float in midair (special hack to allow a common level design trick for floating items)"};
 cvar_t sv_gameplayfix_nudgeoutofsolid = {0, "sv_gameplayfix_nudgeoutofsolid", "1", "attempts to fix physics errors (where an object ended up in solid for some reason)"};
-cvar_t sv_gameplayfix_nudgeoutofsolid_bias = {0, "sv_gameplayfix_nudgeoutofsolid_bias", "0.03125", "over-correction on nudgeoutofsolid logic, to prevent constant contact"};
+cvar_t sv_gameplayfix_nudgeoutofsolid_bias = {0, "sv_gameplayfix_nudgeoutofsolid_bias", "0", "over-correction on nudgeoutofsolid logic, to prevent constant contact"};
 cvar_t sv_gameplayfix_q2airaccelerate = {0, "sv_gameplayfix_q2airaccelerate", "0", "Quake2-style air acceleration"};
 cvar_t sv_gameplayfix_setmodelrealbox = {0, "sv_gameplayfix_setmodelrealbox", "1", "fixes a bug in Quake that made setmodel always set the entity box to ('-16 -16 -16', '16 16 16') rather than properly checking the model box, breaks some poorly coded mods"};
 cvar_t sv_gameplayfix_slidemoveprojectiles = {0, "sv_gameplayfix_slidemoveprojectiles", "1", "allows MOVETYPE_FLY/FLYMISSILE/TOSS/BOUNCE/BOUNCEMISSILE entities to finish their move in a frame even if they hit something, fixes 'gravity accumulation' bug for grenades on steep slopes"};