From 31e7715cffcebfd400b8473f3b2d3dc80937fc5a Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 1 Nov 2009 23:07:12 +0000 Subject: [PATCH] add a little bias to prevent constant contact cases with sv_gameplayfix_nudgeoutofsolid git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9408 d7cf8633-e32d-0410-b094-e92efae38249 --- server.h | 1 + sv_main.c | 2 ++ sv_phys.c | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/server.h b/server.h index 6a19f1b7..06543a55 100644 --- a/server.h +++ b/server.h @@ -429,6 +429,7 @@ extern cvar_t sv_gameplayfix_multiplethinksperframe; extern cvar_t sv_gameplayfix_noairborncorpse; extern cvar_t sv_gameplayfix_noairborncorpse_allowsuspendeditems; extern cvar_t sv_gameplayfix_nudgeoutofsolid; +extern cvar_t sv_gameplayfix_nudgeoutofsolid_bias; extern cvar_t sv_gameplayfix_setmodelrealbox; extern cvar_t sv_gameplayfix_slidemoveprojectiles; extern cvar_t sv_gameplayfix_stepdown; diff --git a/sv_main.c b/sv_main.c index e3f5f45b..8096d558 100644 --- a/sv_main.c +++ b/sv_main.c @@ -98,6 +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_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"}; @@ -408,6 +409,7 @@ void SV_Init (void) Cvar_RegisterVariable (&sv_gameplayfix_noairborncorpse); Cvar_RegisterVariable (&sv_gameplayfix_noairborncorpse_allowsuspendeditems); Cvar_RegisterVariable (&sv_gameplayfix_nudgeoutofsolid); + Cvar_RegisterVariable (&sv_gameplayfix_nudgeoutofsolid_bias); Cvar_RegisterVariable (&sv_gameplayfix_q2airaccelerate); Cvar_RegisterVariable (&sv_gameplayfix_setmodelrealbox); Cvar_RegisterVariable (&sv_gameplayfix_slidemoveprojectiles); diff --git a/sv_phys.c b/sv_phys.c index 71ba23ee..5c239777 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -1500,7 +1500,8 @@ static qboolean SV_PushEntity (trace_t *trace, prvm_edict_t *ent, vec3_t push, q bump = 0; while (trace->startsolid && sv_gameplayfix_nudgeoutofsolid.integer) { - VectorMA(ent->fields.server->origin, -trace->startdepth, trace->startdepthnormal, ent->fields.server->origin); + vec_t nudge = -trace->startdepth + sv_gameplayfix_nudgeoutofsolid_bias.value; + VectorMA(ent->fields.server->origin, nudge, trace->startdepthnormal, ent->fields.server->origin); *trace = SV_TraceBox(ent->fields.server->origin, ent->fields.server->mins, ent->fields.server->maxs, end, type, ent, SV_GenericHitSuperContentsMask(ent)); bump++; if (bump > 10) -- 2.39.2