X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=cl_collision.c;h=8978f374f25a457f8a491ae90e60ec04e547bdee;hb=1d5ee6468f876ae21eb64b12e17bb3f8ea8dd877;hp=959309386d84b7db0271dfd96725d72d0fcae3c5;hpb=ddcccee8e93bfabf3c32972e58b608b211a38e6c;p=xonotic%2Fdarkplaces.git diff --git a/cl_collision.c b/cl_collision.c index 95930938..8978f374 100644 --- a/cl_collision.c +++ b/cl_collision.c @@ -73,7 +73,7 @@ float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, ve Collision_ClipTrace_Box(&trace, ent->model->normalmins, ent->model->normalmaxs, starttransformed, vec3_origin, vec3_origin, endtransformed, SUPERCONTENTS_SOLID, SUPERCONTENTS_SOLID, 0, NULL); #ifdef COLLISION_STUPID_TRACE_ENDPOS_IN_SOLID_WORKAROUND if(!VectorCompare(start, pEnd) && collision_endposnudge.value > 0) - Collision_ShortenTrace(&trace, len / (len + 1), pEnd); + Collision_ShortenTrace(&trace, len / (len + collision_endposnudge.value), pEnd); #endif if (maxrealfrac < trace.realfraction) continue; @@ -157,8 +157,8 @@ void CL_LinkEdict(prvm_edict_t *ent) if( model != NULL ) { - if (!model->TraceBox && developer.integer >= 1) - Con_Printf("edict %i: SOLID_BSP with non-collidable model\n", PRVM_NUM_FOR_EDICT(ent)); + if (!model->TraceBox) + Con_DPrintf("edict %i: SOLID_BSP with non-collidable model\n", PRVM_NUM_FOR_EDICT(ent)); if (ent->fields.client->angles[0] || ent->fields.client->angles[2] || ent->fields.client->avelocity[0] || ent->fields.client->avelocity[2]) { @@ -246,7 +246,7 @@ trace_t CL_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int dp_model_t *model; // list of entities to test for collisions int numtouchedicts; - prvm_edict_t *touchedicts[MAX_EDICTS]; + static prvm_edict_t *touchedicts[MAX_EDICTS]; if (hitnetworkentity) *hitnetworkentity = 0; @@ -458,12 +458,15 @@ trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_ dp_model_t *model; // list of entities to test for collisions int numtouchedicts; - prvm_edict_t *touchedicts[MAX_EDICTS]; + static prvm_edict_t *touchedicts[MAX_EDICTS]; #ifdef COLLISION_STUPID_TRACE_ENDPOS_IN_SOLID_WORKAROUND vec3_t end; vec_t len = 0; - if(!VectorCompare(start, pEnd) && collision_endposnudge.value > 0) + if (VectorCompare(start, pEnd)) + return CL_TracePoint(start, type, passedict, hitsupercontentsmask, hitnetworkbrushmodels, hitnetworkplayers, hitnetworkentity, hitcsqcentities); + + if(collision_endposnudge.value > 0) { // TRICK: make the trace 1 qu longer! VectorSubtract(pEnd, start, end); @@ -472,10 +475,10 @@ trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_ } else VectorCopy(pEnd, end); -#endif - +#else if (VectorCompare(start, end)) return CL_TracePoint(start, type, passedict, hitsupercontentsmask, hitnetworkbrushmodels, hitnetworkplayers, hitnetworkentity, hitcsqcentities); +#endif if (hitnetworkentity) *hitnetworkentity = 0; @@ -658,7 +661,7 @@ skipnetworkplayers: finished: #ifdef COLLISION_STUPID_TRACE_ENDPOS_IN_SOLID_WORKAROUND if(!VectorCompare(start, pEnd) && collision_endposnudge.value > 0) - Collision_ShortenTrace(&cliptrace, len / (len + 1), pEnd); + Collision_ShortenTrace(&cliptrace, len / (len + collision_endposnudge.value), pEnd); #endif return cliptrace; } @@ -696,11 +699,24 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co dp_model_t *model; // list of entities to test for collisions int numtouchedicts; - prvm_edict_t *touchedicts[MAX_EDICTS]; + static prvm_edict_t *touchedicts[MAX_EDICTS]; #ifdef COLLISION_STUPID_TRACE_ENDPOS_IN_SOLID_WORKAROUND vec3_t end; vec_t len = 0; + if (VectorCompare(mins, maxs)) + { + vec3_t shiftstart, shiftend; + VectorAdd(start, mins, shiftstart); + VectorAdd(pEnd, mins, shiftend); + if (VectorCompare(start, pEnd)) + trace = CL_TracePoint(shiftstart, type, passedict, hitsupercontentsmask, hitnetworkbrushmodels, hitnetworkplayers, hitnetworkentity, hitcsqcentities); + else + trace = CL_TraceLine(shiftstart, shiftend, type, passedict, hitsupercontentsmask, hitnetworkbrushmodels, hitnetworkplayers, hitnetworkentity, hitcsqcentities); + VectorSubtract(trace.endpos, mins, trace.endpos); + return trace; + } + if(!VectorCompare(start, pEnd) && collision_endposnudge.value > 0) { // TRICK: make the trace 1 qu longer! @@ -710,8 +726,7 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co } else VectorCopy(pEnd, end); -#endif - +#else if (VectorCompare(mins, maxs)) { vec3_t shiftstart, shiftend; @@ -724,6 +739,7 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co VectorSubtract(trace.endpos, mins, trace.endpos); return trace; } +#endif if (hitnetworkentity) *hitnetworkentity = 0; @@ -919,7 +935,7 @@ skipnetworkplayers: finished: #ifdef COLLISION_STUPID_TRACE_ENDPOS_IN_SOLID_WORKAROUND if(!VectorCompare(start, pEnd) && collision_endposnudge.value > 0) - Collision_ShortenTrace(&cliptrace, len / (len + 1), pEnd); + Collision_ShortenTrace(&cliptrace, len / (len + collision_endposnudge.value), pEnd); #endif return cliptrace; }