From 5b7ac1706712977bbc0297d2d53294e73574c7cd Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 4 Dec 2009 16:13:26 +0000 Subject: [PATCH] fixed a bug with sv_gameplayfix_nudgeoutofsolid where the player might 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 | 12 ++++++++++-- sv_main.c | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/collision.c b/collision.c index 89bc6f63..f17c9bfd 100644 --- a/collision.c +++ b/collision.c @@ -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 diff --git a/sv_main.c b/sv_main.c index 32d64e20..3a903751 100644 --- 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"}; -- 2.39.2