float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int *hitent, entity_render_t *ignoreent)
{
- float maxfrac, maxrealfrac;
+ float maxfrac;
int n;
entity_render_t *ent;
vec_t tracemins[3], tracemaxs[3];
memset (&trace, 0 , sizeof(trace_t));
trace.fraction = 1;
- trace.realfraction = 1;
VectorCopy (end, trace.endpos);
if (hitent)
if (normal)
VectorCopy(trace.plane.normal, normal);
maxfrac = trace.fraction;
- maxrealfrac = trace.realfraction;
tracemins[0] = min(start[0], end[0]);
tracemaxs[0] = max(start[0], end[0]);
Matrix4x4_Transform(&ent->inversematrix, start, starttransformed);
Matrix4x4_Transform(&ent->inversematrix, end, endtransformed);
Collision_ClipTrace_Box(&trace, ent->model->normalmins, ent->model->normalmaxs, starttransformed, vec3_origin, vec3_origin, endtransformed, SUPERCONTENTS_SOLID, SUPERCONTENTS_SOLID, 0, NULL);
- if (maxrealfrac < trace.realfraction)
+ if (maxfrac < trace.fraction)
continue;
ent->model->TraceLine(ent->model, ent->frameblend, ent->skeleton, &trace, starttransformed, endtransformed, SUPERCONTENTS_SOLID);
- if (maxrealfrac > trace.realfraction)
+ if (maxfrac > trace.fraction)
{
if (hitent)
*hitent = n;
maxfrac = trace.fraction;
- maxrealfrac = trace.realfraction;
if (normal)
{
VectorCopy(trace.plane.normal, tempnormal);
if (!BoxesOverlap(clipboxmins, clipboxmaxs, ent->mins, ent->maxs))
continue;
Collision_ClipPointToGenericEntity(&trace, ent->model, ent->frameblend, ent->skeleton, vec3_origin, vec3_origin, 0, &ent->matrix, &ent->inversematrix, start, hitsupercontentsmask);
- if (cliptrace.realfraction > trace.realfraction && hitnetworkentity)
+ if (cliptrace.fraction > trace.fraction && hitnetworkentity)
*hitnetworkentity = cl.brushmodel_entities[i];
Collision_CombineTraces(&cliptrace, &trace, NULL, true);
}
continue;
// don't hit players that don't exist
+ if (!cl.entities_active[i])
+ continue;
if (!cl.scores[i-1].name[0])
continue;
Matrix4x4_CreateTranslate(&entmatrix, origin[0], origin[1], origin[2]);
Matrix4x4_CreateTranslate(&entinversematrix, -origin[0], -origin[1], -origin[2]);
Collision_ClipPointToGenericEntity(&trace, NULL, NULL, NULL, cl.playerstandmins, cl.playerstandmaxs, SUPERCONTENTS_BODY, &entmatrix, &entinversematrix, start, hitsupercontentsmask);
- if (cliptrace.realfraction > trace.realfraction && hitnetworkentity)
+ if (cliptrace.fraction > trace.fraction && hitnetworkentity)
*hitnetworkentity = i;
Collision_CombineTraces(&cliptrace, &trace, NULL, false);
}
else
Collision_ClipPointToGenericEntity(&trace, model, touch->priv.server->frameblend, &touch->priv.server->skeleton, touchmins, touchmaxs, bodysupercontents, &matrix, &imatrix, clipstart, hitsupercontentsmask);
- if (cliptrace.realfraction > trace.realfraction && hitnetworkentity)
+ if (cliptrace.fraction > trace.fraction && hitnetworkentity)
*hitnetworkentity = 0;
Collision_CombineTraces(&cliptrace, &trace, (void *)touch, PRVM_clientedictfloat(touch, solid) == SOLID_BSP);
}
if (!BoxesOverlap(clipboxmins, clipboxmaxs, ent->mins, ent->maxs))
continue;
Collision_ClipLineToGenericEntity(&trace, ent->model, ent->frameblend, ent->skeleton, vec3_origin, vec3_origin, 0, &ent->matrix, &ent->inversematrix, start, end, hitsupercontentsmask, extend, hitsurfaces);
- if (cliptrace.realfraction > trace.realfraction && hitnetworkentity)
+ if (cliptrace.fraction > trace.fraction && hitnetworkentity)
*hitnetworkentity = cl.brushmodel_entities[i];
Collision_CombineTraces(&cliptrace, &trace, NULL, true);
}
continue;
// don't hit players that don't exist
+ if (!cl.entities_active[i])
+ continue;
if (!cl.scores[i-1].name[0])
continue;
Matrix4x4_CreateTranslate(&entmatrix, origin[0], origin[1], origin[2]);
Matrix4x4_CreateTranslate(&entinversematrix, -origin[0], -origin[1], -origin[2]);
Collision_ClipLineToGenericEntity(&trace, NULL, NULL, NULL, cl.playerstandmins, cl.playerstandmaxs, SUPERCONTENTS_BODY, &entmatrix, &entinversematrix, start, end, hitsupercontentsmask, extend, hitsurfaces);
- if (cliptrace.realfraction > trace.realfraction && hitnetworkentity)
+ if (cliptrace.fraction > trace.fraction && hitnetworkentity)
*hitnetworkentity = i;
Collision_CombineTraces(&cliptrace, &trace, NULL, false);
}
else
Collision_ClipLineToGenericEntity(&trace, model, touch->priv.server->frameblend, &touch->priv.server->skeleton, touchmins, touchmaxs, bodysupercontents, &matrix, &imatrix, clipstart, clipend, hitsupercontentsmask, extend, hitsurfaces);
- if (cliptrace.realfraction > trace.realfraction && hitnetworkentity)
+ if (cliptrace.fraction > trace.fraction && hitnetworkentity)
*hitnetworkentity = 0;
Collision_CombineTraces(&cliptrace, &trace, (void *)touch, PRVM_clientedictfloat(touch, solid) == SOLID_BSP);
}
if (!BoxesOverlap(clipboxmins, clipboxmaxs, ent->mins, ent->maxs))
continue;
Collision_ClipToGenericEntity(&trace, ent->model, ent->frameblend, ent->skeleton, vec3_origin, vec3_origin, 0, &ent->matrix, &ent->inversematrix, start, mins, maxs, end, hitsupercontentsmask, extend);
- if (cliptrace.realfraction > trace.realfraction && hitnetworkentity)
+ if (cliptrace.fraction > trace.fraction && hitnetworkentity)
*hitnetworkentity = cl.brushmodel_entities[i];
Collision_CombineTraces(&cliptrace, &trace, NULL, true);
}
continue;
// don't hit players that don't exist
+ if (!cl.entities_active[i])
+ continue;
if (!cl.scores[i-1].name[0])
continue;
Matrix4x4_CreateTranslate(&entmatrix, origin[0], origin[1], origin[2]);
Matrix4x4_CreateTranslate(&entinversematrix, -origin[0], -origin[1], -origin[2]);
Collision_ClipToGenericEntity(&trace, NULL, NULL, NULL, cl.playerstandmins, cl.playerstandmaxs, SUPERCONTENTS_BODY, &entmatrix, &entinversematrix, start, mins, maxs, end, hitsupercontentsmask, extend);
- if (cliptrace.realfraction > trace.realfraction && hitnetworkentity)
+ if (cliptrace.fraction > trace.fraction && hitnetworkentity)
*hitnetworkentity = i;
Collision_CombineTraces(&cliptrace, &trace, NULL, false);
}
else
Collision_ClipToGenericEntity(&trace, model, touch->priv.server->frameblend, &touch->priv.server->skeleton, touchmins, touchmaxs, bodysupercontents, &matrix, &imatrix, clipstart, clipmins, clipmaxs, clipend, hitsupercontentsmask, extend);
- if (cliptrace.realfraction > trace.realfraction && hitnetworkentity)
+ if (cliptrace.fraction > trace.fraction && hitnetworkentity)
*hitnetworkentity = 0;
Collision_CombineTraces(&cliptrace, &trace, (void *)touch, PRVM_clientedictfloat(touch, solid) == SOLID_BSP);
}