X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=sv_phys.c;h=35bc3410cc7c7382710358a62afefad8606608a1;hb=540acd33401d3d6dd53cd38c1f68b1a345477ed2;hp=b26ebe225e90f6020e8411a7d6491565605a320b;hpb=7ea07939bef0cbe85c54d9f68cb924198b0b1f64;p=xonotic%2Fdarkplaces.git diff --git a/sv_phys.c b/sv_phys.c index b26ebe22..35bc3410 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -409,7 +409,7 @@ SV_Move ================== */ #if COLLISIONPARANOID >= 1 -trace_t SV_TraceBox_(const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend) +static trace_t SV_TraceBox_(const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend) #else trace_t SV_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend) #endif @@ -588,17 +588,17 @@ finished: } #if COLLISIONPARANOID >= 1 -trace_t SV_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask) +trace_t SV_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend) { prvm_prog_t *prog = SVVM_prog; int endstuck; trace_t trace; vec3_t temp; - trace = SV_TraceBox_(start, mins, maxs, end, type, passedict, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask); + trace = SV_TraceBox_(start, mins, maxs, end, type, passedict, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask, extend); if (passedict) { VectorCopy(trace.endpos, temp); - endstuck = SV_TraceBox_(temp, mins, maxs, temp, type, passedict, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask).startsolid; + endstuck = SV_TraceBox_(temp, mins, maxs, temp, type, passedict, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask, extend).startsolid; #if COLLISIONPARANOID < 3 if (trace.startsolid || endstuck) #endif @@ -875,35 +875,36 @@ void SV_LinkEdict (prvm_edict_t *ent) VectorAdd(PRVM_serveredictvector(ent, origin), PRVM_serveredictvector(ent, maxs), maxs); } -// -// to make items easier to pick up and allow them to be grabbed off -// of shelves, the abs sizes are expanded -// - if ((int)PRVM_serveredictfloat(ent, flags) & FL_ITEM) - { - mins[0] -= 15; - mins[1] -= 15; - mins[2] -= 1; - maxs[0] += 15; - maxs[1] += 15; - maxs[2] += 1; - } - else + if (sv_legacy_bbox_expand.integer) { - // because movement is clipped an epsilon away from an actual edge, - // we must fully check even when bounding boxes don't quite touch - mins[0] -= 1; - mins[1] -= 1; - mins[2] -= 1; - maxs[0] += 1; - maxs[1] += 1; - maxs[2] += 1; + if ((int)PRVM_serveredictfloat(ent, flags) & FL_ITEM) + { + // to make items easier to pick up and allow them to be grabbed off + // of shelves, the abs sizes are expanded + mins[0] -= 15; + mins[1] -= 15; + mins[2] -= 1; + maxs[0] += 15; + maxs[1] += 15; + maxs[2] += 1; + } + else + { + // because movement is clipped an epsilon away from an actual edge, + // we must fully check even when bounding boxes don't quite touch + mins[0] -= 1; + mins[1] -= 1; + mins[2] -= 1; + maxs[0] += 1; + maxs[1] += 1; + maxs[2] += 1; + } } VectorCopy(mins, PRVM_serveredictvector(ent, absmin)); VectorCopy(maxs, PRVM_serveredictvector(ent, absmax)); - World_LinkEdict(&sv.world, ent, mins, maxs); + World_LinkEdict(&sv.world, ent, mins, maxs, sv_areagrid_link_SOLID_NOT.integer); } /* @@ -1255,6 +1256,9 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qbool applygravity, float if (trace.fraction == 1) break; + + time_left *= 1 - trace.fraction; + if (trace.plane.normal[2]) { if (trace.plane.normal[2] > 0.7) @@ -1282,6 +1286,7 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qbool applygravity, float trace_t steptrace3; //Con_Printf("step %f %f %f : ", PRVM_serveredictvector(ent, origin)[0], PRVM_serveredictvector(ent, origin)[1], PRVM_serveredictvector(ent, origin)[2]); VectorSet(steppush, 0, 0, stepheight); + VectorScale(PRVM_serveredictvector(ent, velocity), time_left, push); VectorCopy(PRVM_serveredictvector(ent, origin), org); if(!SV_PushEntity(&steptrace, ent, steppush, false)) { @@ -1303,7 +1308,8 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qbool applygravity, float } //Con_Printf("%f %f %f : ", PRVM_serveredictvector(ent, origin)[0], PRVM_serveredictvector(ent, origin)[1], PRVM_serveredictvector(ent, origin)[2]); // accept the new position if it made some progress... - if (fabs(PRVM_serveredictvector(ent, origin)[0] - org[0]) >= 0.03125 || fabs(PRVM_serveredictvector(ent, origin)[1] - org[1]) >= 0.03125) + // previously this checked if absolute distance >= 0.03125 which made stepping up unreliable + if (PRVM_serveredictvector(ent, origin)[0] - org[0] || PRVM_serveredictvector(ent, origin)[1] - org[1]) { //Con_Printf("accepted (delta %f %f %f)\n", PRVM_serveredictvector(ent, origin)[0] - org[0], PRVM_serveredictvector(ent, origin)[1] - org[1], PRVM_serveredictvector(ent, origin)[2] - org[2]); trace = steptrace2; @@ -1333,8 +1339,6 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qbool applygravity, float numplanes = 0; } - time_left *= 1 - trace.fraction; - // clipped to another plane if (numplanes >= MAX_CLIP_PLANES) { @@ -1539,46 +1543,6 @@ static qbool SV_NudgeOutOfSolid_PivotIsKnownGood(prvm_edict_t *ent, vec3_t pivot return true; } -qbool SV_NudgeOutOfSolid(prvm_edict_t *ent) -{ - prvm_prog_t *prog = SVVM_prog; - int bump, pass; - trace_t stucktrace; - vec3_t stuckorigin; - vec3_t stuckmins, stuckmaxs; - vec_t nudge; - vec_t separation = sv_gameplayfix_nudgeoutofsolid_separation.value; - if (sv.worldmodel && sv.worldmodel->brushq1.numclipnodes) - separation = 0.0f; // when using hulls, it can not be enlarged - VectorCopy(PRVM_serveredictvector(ent, mins), stuckmins); - VectorCopy(PRVM_serveredictvector(ent, maxs), stuckmaxs); - stuckmins[0] -= separation; - stuckmins[1] -= separation; - stuckmins[2] -= separation; - stuckmaxs[0] += separation; - stuckmaxs[1] += separation; - stuckmaxs[2] += separation; - // first pass we try to get it out of brush entities - // second pass we try to get it out of world only (can't win them all) - for (pass = 0;pass < 2;pass++) - { - VectorCopy(PRVM_serveredictvector(ent, origin), stuckorigin); - for (bump = 0;bump < 10;bump++) - { - stucktrace = SV_TraceBox(stuckorigin, stuckmins, stuckmaxs, stuckorigin, pass ? MOVE_WORLDONLY : MOVE_NOMONSTERS, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value); - if (!stucktrace.bmodelstartsolid || stucktrace.startdepth >= 0) - { - // found a good location, use it - VectorCopy(stuckorigin, PRVM_serveredictvector(ent, origin)); - return true; - } - nudge = -stucktrace.startdepth; - VectorMA(stuckorigin, nudge, stucktrace.startdepthnormal, stuckorigin); - } - } - return false; -} - /* ============ SV_PushEntity @@ -1606,7 +1570,7 @@ static qbool SV_PushEntity (trace_t *trace, prvm_edict_t *ent, vec3_t push, qboo // move start position out of solids if (sv_gameplayfix_nudgeoutofsolid.integer && sv_gameplayfix_nudgeoutofsolid_separation.value >= 0) { - SV_NudgeOutOfSolid(ent); + PHYS_NudgeOutOfSolid(prog, ent); } VectorCopy(PRVM_serveredictvector(ent, origin), start);