From 81b4e80a3a74aae7360854ff587be59360d46450 Mon Sep 17 00:00:00 2001 From: havoc Date: Sat, 22 May 2004 02:59:36 +0000 Subject: [PATCH] added sv_gameplayfix_grenadebouncedownsteps, sv_gameplayfix_noairborncorpse, sv_gameplayfix_stepwhilejumping, sv_gameplayfix_swiminbmodels cvars to be able to disable DP's physics enhancements git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4233 d7cf8633-e32d-0410-b094-e92efae38249 --- server.h | 5 +++++ sv_main.c | 9 +++++++++ sv_phys.c | 33 +++++++++++++++++++++++++-------- world.c | 2 +- 4 files changed, 40 insertions(+), 9 deletions(-) diff --git a/server.h b/server.h index 5ae03a23..d7cfd727 100644 --- a/server.h +++ b/server.h @@ -257,6 +257,11 @@ extern cvar_t sv_aim; extern cvar_t sv_stepheight; extern cvar_t sv_jumpstep; +extern cvar_t sv_gameplayfix_grenadebouncedownslopes; +extern cvar_t sv_gameplayfix_noairborncorpse; +extern cvar_t sv_gameplayfix_stepwhilejumping; +extern cvar_t sv_gameplayfix_swiminbmodels; + extern mempool_t *sv_clients_mempool; extern mempool_t *sv_edicts_mempool; diff --git a/sv_main.c b/sv_main.c index 051a8ec2..4b4ac374 100644 --- a/sv_main.c +++ b/sv_main.c @@ -26,6 +26,11 @@ static cvar_t sv_cullentities_trace = {0, "sv_cullentities_trace", "0"}; // tend static cvar_t sv_cullentities_stats = {0, "sv_cullentities_stats", "0"}; static cvar_t sv_entpatch = {0, "sv_entpatch", "1"}; +cvar_t sv_gameplayfix_grenadebouncedownslopes = {0, "sv_gameplayfix_grenadebouncedownslopes", "1"}; +cvar_t sv_gameplayfix_noairborncorpse = {0, "sv_gameplayfix_noairborncorpse", "1"}; +cvar_t sv_gameplayfix_stepwhilejumping = {0, "sv_gameplayfix_stepwhilejumping", "1"}; +cvar_t sv_gameplayfix_swiminbmodels = {0, "sv_gameplayfix_swiminbmodels", "1"}; + server_t sv; server_static_t svs; @@ -64,6 +69,10 @@ void SV_Init (void) Cvar_RegisterVariable (&sv_cullentities_trace); Cvar_RegisterVariable (&sv_cullentities_stats); Cvar_RegisterVariable (&sv_entpatch); + Cvar_RegisterVariable (&sv_gameplayfix_grenadebouncedownslopes); + Cvar_RegisterVariable (&sv_gameplayfix_noairborncorpse); + Cvar_RegisterVariable (&sv_gameplayfix_stepwhilejumping); + Cvar_RegisterVariable (&sv_gameplayfix_swiminbmodels); SV_Phys_Init(); SV_World_Init(); diff --git a/sv_phys.c b/sv_phys.c index 74b254b8..909dbb4c 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -1014,7 +1014,7 @@ void SV_WalkMove (edict_t *ent) if (ent->v->movetype != MOVETYPE_FLY) { - if (!oldonground && ent->v->waterlevel == 0 && !sv_jumpstep.integer) + if (!oldonground && ent->v->waterlevel == 0 && (!sv_jumpstep.integer || !sv_gameplayfix_stepwhilejumping.integer)) // don't stair up while jumping return; @@ -1205,6 +1205,8 @@ void SV_Physics_Toss (edict_t *ent) // if onground, return without moving if ((int)ent->v->flags & FL_ONGROUND) { + if (!sv_gameplayfix_noairborncorpse.integer) + return; if (ent->v->groundentity == 0) return; // if ent was supported by a brush model on previous frame, @@ -1252,16 +1254,31 @@ void SV_Physics_Toss (edict_t *ent) float d; ClipVelocity (ent->v->velocity, trace.plane.normal, ent->v->velocity, 1.5); // LordHavoc: fixed grenades not bouncing when fired down a slope - d = DotProduct(trace.plane.normal, ent->v->velocity); - if (trace.plane.normal[2] > 0.7 && fabs(d) < 60) + if (sv_gameplayfix_grenadebouncedownslopes.integer) { - ent->v->flags = (int)ent->v->flags | FL_ONGROUND; - ent->v->groundentity = EDICT_TO_PROG(trace.ent); - VectorClear (ent->v->velocity); - VectorClear (ent->v->avelocity); + d = DotProduct(trace.plane.normal, ent->v->velocity); + if (trace.plane.normal[2] > 0.7 && fabs(d) < 60) + { + ent->v->flags = (int)ent->v->flags | FL_ONGROUND; + ent->v->groundentity = EDICT_TO_PROG(trace.ent); + VectorClear (ent->v->velocity); + VectorClear (ent->v->avelocity); + } + else + ent->v->flags = (int)ent->v->flags & ~FL_ONGROUND; } else - ent->v->flags = (int)ent->v->flags & ~FL_ONGROUND; + { + if (trace.plane.normal[2] > 0.7 && ent->v->velocity[2] < 60) + { + ent->v->flags = (int)ent->v->flags | FL_ONGROUND; + ent->v->groundentity = EDICT_TO_PROG(trace.ent); + VectorClear (ent->v->velocity); + VectorClear (ent->v->avelocity); + } + else + ent->v->flags = (int)ent->v->flags & ~FL_ONGROUND; + } } else { diff --git a/world.c b/world.c index 1d6763d9..1945d906 100644 --- a/world.c +++ b/world.c @@ -727,7 +727,7 @@ trace_t SV_Move(const vec3_t start, const vec3_t mins, const vec3_t maxs, const int SV_PointSuperContents(const vec3_t point) { - return SV_Move(point, vec3_origin, vec3_origin, point, MOVE_NOMONSTERS, NULL).startsupercontents; + return SV_Move(point, vec3_origin, vec3_origin, point, sv_gameplayfix_swiminbmodels.integer ? MOVE_NOMONSTERS : MOVE_WORLDONLY, NULL).startsupercontents; } int SV_PointQ1Contents(const vec3_t point) -- 2.39.2