From: havoc Date: Thu, 12 Mar 2009 08:17:02 +0000 (+0000) Subject: added sv_gameplayfix_slidemoveprojectiles which avoids a sticking bug X-Git-Tag: xonotic-v0.1.0preview~1800 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6910784f904116cde2496bc0f116998ae8c390b8;p=xonotic%2Fdarkplaces.git added sv_gameplayfix_slidemoveprojectiles which avoids a sticking bug with grenades where they kept accumulating gravity git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8802 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/server.h b/server.h index 0d7b239f..835c9f86 100644 --- a/server.h +++ b/server.h @@ -403,6 +403,7 @@ extern cvar_t sv_gameplayfix_easierwaterjump; extern cvar_t sv_gameplayfix_findradiusdistancetobox; extern cvar_t sv_gameplayfix_grenadebouncedownslopes; extern cvar_t sv_gameplayfix_multiplethinksperframe; +extern cvar_t sv_gameplayfix_slidemoveprojectiles; extern cvar_t sv_gameplayfix_noairborncorpse; extern cvar_t sv_gameplayfix_setmodelrealbox; extern cvar_t sv_gameplayfix_stepdown; diff --git a/sv_main.c b/sv_main.c index 74737a83..67198160 100644 --- a/sv_main.c +++ b/sv_main.c @@ -87,6 +87,7 @@ cvar_t sv_gameplayfix_easierwaterjump = {0, "sv_gameplayfix_easierwaterjump", "1 cvar_t sv_gameplayfix_findradiusdistancetobox = {0, "sv_gameplayfix_findradiusdistancetobox", "1", "causes findradius to check the distance to the corner of a box rather than the center of the box, makes findradius detect bmodels such as very large doors that would otherwise be unaffected by splash damage"}; cvar_t sv_gameplayfix_grenadebouncedownslopes = {0, "sv_gameplayfix_grenadebouncedownslopes", "1", "prevents MOVETYPE_BOUNCE (grenades) from getting stuck when fired down a downward sloping surface"}; cvar_t sv_gameplayfix_multiplethinksperframe = {0, "sv_gameplayfix_multiplethinksperframe", "1", "allows entities to think more often than the server framerate, primarily useful for very high fire rate weapons"}; +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"}; cvar_t sv_gameplayfix_noairborncorpse = {0, "sv_gameplayfix_noairborncorpse", "1", "causes entities (corpses) sitting ontop of moving entities (players) to fall when the moving entity (player) is no longer supporting them"}; 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_stepdown = {0, "sv_gameplayfix_stepdown", "0", "attempts to step down stairs, not just up them (prevents the familiar thud..thud..thud.. when running down stairs and slopes)"}; @@ -363,6 +364,7 @@ void SV_Init (void) Cvar_RegisterVariable (&sv_gameplayfix_findradiusdistancetobox); Cvar_RegisterVariable (&sv_gameplayfix_grenadebouncedownslopes); Cvar_RegisterVariable (&sv_gameplayfix_multiplethinksperframe); + Cvar_RegisterVariable (&sv_gameplayfix_slidemoveprojectiles); Cvar_RegisterVariable (&sv_gameplayfix_noairborncorpse); Cvar_RegisterVariable (&sv_gameplayfix_setmodelrealbox); Cvar_RegisterVariable (&sv_gameplayfix_stepdown); diff --git a/sv_phys.c b/sv_phys.c index b05dee17..91db8052 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -1896,6 +1896,8 @@ void SV_Physics_Toss (prvm_edict_t *ent) { trace_t trace; vec3_t move; + vec_t movetime; + int bump; // if onground, return without moving if ((int)ent->fields.server->flags & FL_ONGROUND) @@ -1930,22 +1932,25 @@ void SV_Physics_Toss (prvm_edict_t *ent) // move angles VectorMA (ent->fields.server->angles, sv.frametime, ent->fields.server->avelocity, ent->fields.server->angles); -// move origin - VectorScale (ent->fields.server->velocity, sv.frametime, move); - trace = SV_PushEntity (ent, move, true); - if (ent->priv.server->free) - return; - if (trace.bmodelstartsolid) + movetime = sv.frametime; + for (bump = 0;bump < MAX_CLIP_PLANES && movetime > 0;bump++) { - // try to unstick the entity - SV_UnstickEntity(ent); - trace = SV_PushEntity (ent, move, false); + // move origin + VectorScale (ent->fields.server->velocity, movetime, move); + trace = SV_PushEntity (ent, move, true); if (ent->priv.server->free) return; - } - - if (trace.fraction < 1) - { + if (trace.bmodelstartsolid) + { + // try to unstick the entity + SV_UnstickEntity(ent); + trace = SV_PushEntity (ent, move, false); + if (ent->priv.server->free) + return; + } + if (trace.fraction == 1) + break; + movetime *= 1 - min(1, trace.fraction); if (ent->fields.server->movetype == MOVETYPE_BOUNCEMISSILE) { ClipVelocity (ent->fields.server->velocity, trace.plane.normal, ent->fields.server->velocity, 2.0); @@ -1959,7 +1964,7 @@ void SV_Physics_Toss (prvm_edict_t *ent) if (sv_gameplayfix_grenadebouncedownslopes.integer) { d = DotProduct(trace.plane.normal, ent->fields.server->velocity); - if (trace.plane.normal[2] > 0.7 && fabs(d) < 60) + if (trace.plane.normal[2] > 0.7 && fabs(d) < sv_gravity.value * (60.0 / 800.0)) { ent->fields.server->flags = (int)ent->fields.server->flags | FL_ONGROUND; ent->fields.server->groundentity = PRVM_EDICT_TO_PROG(trace.ent); @@ -1971,7 +1976,7 @@ void SV_Physics_Toss (prvm_edict_t *ent) } else { - if (trace.plane.normal[2] > 0.7 && ent->fields.server->velocity[2] < 60) + if (trace.plane.normal[2] > 0.7 && ent->fields.server->velocity[2] < sv_gravity.value * (60.0 / 800.0)) { ent->fields.server->flags = (int)ent->fields.server->flags | FL_ONGROUND; ent->fields.server->groundentity = PRVM_EDICT_TO_PROG(trace.ent); @@ -1997,6 +2002,8 @@ void SV_Physics_Toss (prvm_edict_t *ent) else ent->fields.server->flags = (int)ent->fields.server->flags & ~FL_ONGROUND; } + if (!sv_gameplayfix_slidemoveprojectiles.integer) + break; } // check for in water