X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=sv_phys.c;h=591c2baf933c6e367e3a82d27f82857e09a6f07a;hb=f3bcb973304c8d33eb7b4618ae2109f74d8f6753;hp=b05dee1750357a9f33d1b2963e15f5a5ade124ac;hpb=a895f508875a5052a6b3e7f6ccf96929259917dc;p=xonotic%2Fdarkplaces.git diff --git a/sv_phys.c b/sv_phys.c index b05dee17..591c2baf 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); @@ -1953,13 +1958,19 @@ void SV_Physics_Toss (prvm_edict_t *ent) } else if (ent->fields.server->movetype == MOVETYPE_BOUNCE) { - float d; + float d, ent_gravity; + prvm_eval_t *val; ClipVelocity (ent->fields.server->velocity, trace.plane.normal, ent->fields.server->velocity, 1.5); // LordHavoc: fixed grenades not bouncing when fired down a slope + val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.gravity); + if (val!=0 && val->_float) + ent_gravity = val->_float; + else + ent_gravity = 1.0; 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_gravity) { ent->fields.server->flags = (int)ent->fields.server->flags | FL_ONGROUND; ent->fields.server->groundentity = PRVM_EDICT_TO_PROG(trace.ent); @@ -1971,7 +1982,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_gravity) { ent->fields.server->flags = (int)ent->fields.server->flags | FL_ONGROUND; ent->fields.server->groundentity = PRVM_EDICT_TO_PROG(trace.ent); @@ -1997,6 +2008,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 @@ -2212,7 +2225,7 @@ void SV_Physics_ClientEntity(prvm_edict_t *ent) } // don't run physics here if running asynchronously - if (host_client->clmovement_skipphysicsframes <= 0) + if (host_client->clmovement_inputtimeout <= 0) { SV_ClientThink(); //host_client->cmd.time = max(host_client->cmd.time, sv.time); @@ -2259,7 +2272,7 @@ void SV_Physics_ClientEntity(prvm_edict_t *ent) case MOVETYPE_WALK: SV_RunThink (ent); // don't run physics here if running asynchronously - if (host_client->clmovement_skipphysicsframes <= 0) + if (host_client->clmovement_inputtimeout <= 0) SV_WalkMove (ent); break; case MOVETYPE_TOSS: @@ -2281,8 +2294,10 @@ void SV_Physics_ClientEntity(prvm_edict_t *ent) // decrement the countdown variable used to decide when to go back to // synchronous physics - if (host_client->clmovement_skipphysicsframes > 0) - host_client->clmovement_skipphysicsframes--; + if (host_client->clmovement_inputtimeout > sv.frametime) + host_client->clmovement_inputtimeout -= sv.frametime; + else + host_client->clmovement_inputtimeout = 0; SV_CheckVelocity (ent);