X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=sv_phys.c;h=7558be896a987111e13bffa2f26f8f174138c480;hb=ef67922d463314dd46c32d0d55cc71255e1b7add;hp=13a0cc15f14536d57a6fe23a5a07b10b42716952;hpb=76e259b17603c4ab2c22bf7238c72847c5dbe505;p=xonotic%2Fdarkplaces.git diff --git a/sv_phys.c b/sv_phys.c index 13a0cc15..7558be89 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -299,7 +299,7 @@ trace_t SV_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_ #endif // clip to world - Collision_ClipLineToWorld(&cliptrace, sv.worldmodel, clipstart, clipend, hitsupercontentsmask); + Collision_ClipLineToWorld(&cliptrace, sv.worldmodel, clipstart, clipend, hitsupercontentsmask, false); cliptrace.bmodelstartsolid = cliptrace.startsolid; if (cliptrace.startsolid || cliptrace.fraction < 1) cliptrace.ent = prog->edicts; @@ -393,7 +393,7 @@ trace_t SV_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_ if (type == MOVE_MISSILE && (int)touch->fields.server->flags & FL_MONSTER) Collision_ClipToGenericEntity(&trace, model, touch->priv.server->frameblend, &touch->priv.server->skeleton, touch->fields.server->mins, touch->fields.server->maxs, bodysupercontents, &matrix, &imatrix, clipstart, clipmins2, clipmaxs2, clipend, hitsupercontentsmask); else - Collision_ClipLineToGenericEntity(&trace, model, touch->priv.server->frameblend, &touch->priv.server->skeleton, touch->fields.server->mins, touch->fields.server->maxs, bodysupercontents, &matrix, &imatrix, clipstart, clipend, hitsupercontentsmask); + Collision_ClipLineToGenericEntity(&trace, model, touch->priv.server->frameblend, &touch->priv.server->skeleton, touch->fields.server->mins, touch->fields.server->maxs, bodysupercontents, &matrix, &imatrix, clipstart, clipend, hitsupercontentsmask, false); Collision_CombineTraces(&cliptrace, &trace, (void *)touch, touch->fields.server->solid == SOLID_BSP); } @@ -1128,16 +1128,14 @@ qboolean SV_RunThink (prvm_edict_t *ent) SV_Impact Two entities have touched, so run their touch functions -returns true if the impact kept the origin of the touching entity intact ================== */ extern void VM_SetTraceGlobals(const trace_t *trace); extern sizebuf_t vm_tempstringsbuf; -qboolean SV_Impact (prvm_edict_t *e1, trace_t *trace) +void SV_Impact (prvm_edict_t *e1, trace_t *trace) { int restorevm_tempstringsbuf_cursize; int old_self, old_other; - vec3_t org; prvm_edict_t *e2 = (prvm_edict_t *)trace->ent; prvm_eval_t *val; @@ -1145,8 +1143,6 @@ qboolean SV_Impact (prvm_edict_t *e1, trace_t *trace) old_other = prog->globals.server->other; restorevm_tempstringsbuf_cursize = vm_tempstringsbuf.cursize; - VectorCopy(e1->fields.server->origin, org); - VM_SetTraceGlobals(trace); prog->globals.server->time = sv.time; @@ -1179,8 +1175,6 @@ qboolean SV_Impact (prvm_edict_t *e1, trace_t *trace) prog->globals.server->self = old_self; prog->globals.server->other = old_other; vm_tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize; - - return VectorCompare(e1->fields.server->origin, org); } @@ -1236,6 +1230,11 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qboolean applygravity, flo if (time <= 0) return 0; gravity = 0; + + if(sv_gameplayfix_nogravityonground.integer) + if((int)ent->fields.server->flags & FL_ONGROUND) + applygravity = false; + if (applygravity) { if (sv_gameplayfix_gravityunaffectedbyticrate.integer) @@ -1298,12 +1297,24 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qboolean applygravity, flo //Con_Printf("step %f %f %f : ", ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2]); VectorSet(steppush, 0, 0, stepheight); VectorCopy(ent->fields.server->origin, org); - SV_PushEntity(&steptrace, ent, steppush, false, false); + if(!SV_PushEntity(&steptrace, ent, steppush, false, false)) + { + blocked |= 8; + break; + } //Con_Printf("%f %f %f : ", ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2]); - SV_PushEntity(&steptrace2, ent, push, false, false); + if(!SV_PushEntity(&steptrace2, ent, push, false, false)) + { + blocked |= 8; + break; + } //Con_Printf("%f %f %f : ", ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2]); VectorSet(steppush, 0, 0, org[2] - ent->fields.server->origin[2]); - SV_PushEntity(&steptrace3, ent, steppush, false, false); + if(!SV_PushEntity(&steptrace3, ent, steppush, false, false)) + { + blocked |= 8; + break; + } //Con_Printf("%f %f %f : ", ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2]); // accept the new position if it made some progress... if (fabs(ent->fields.server->origin[0] - org[0]) >= 0.03125 || fabs(ent->fields.server->origin[1] - org[1]) >= 0.03125) @@ -1468,7 +1479,7 @@ static qboolean SV_PushEntity (trace_t *trace, prvm_edict_t *ent, vec3_t push, q { int type; int bump; - vec3_t original; + vec3_t original, original_velocity; vec3_t end; VectorCopy(ent->fields.server->origin, original); @@ -1498,8 +1509,11 @@ static qboolean SV_PushEntity (trace_t *trace, prvm_edict_t *ent, vec3_t push, q if (trace->bmodelstartsolid && failonbmodelstartsolid) return true; - VectorCopy (trace->endpos, ent->fields.server->origin); + + VectorCopy(ent->fields.server->origin, original); + VectorCopy(ent->fields.server->velocity, original_velocity); + SV_LinkEdict(ent); #if 0 @@ -1514,9 +1528,9 @@ static qboolean SV_PushEntity (trace_t *trace, prvm_edict_t *ent, vec3_t push, q SV_LinkEdict_TouchAreaGrid(ent); if((ent->fields.server->solid >= SOLID_TRIGGER && trace->ent && (!((int)ent->fields.server->flags & FL_ONGROUND) || ent->fields.server->groundentity != PRVM_EDICT_TO_PROG(trace->ent)))) - return SV_Impact (ent, trace); + SV_Impact (ent, trace); - return true; + return VectorCompare(ent->fields.server->origin, original) && VectorCompare(ent->fields.server->velocity, original_velocity); }