From: havoc Date: Fri, 4 Feb 2005 07:19:58 +0000 (+0000) Subject: no longer hits triangles of your own player model when tracing the prydoncursor from... X-Git-Tag: xonotic-v0.1.0preview~5168 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=43349b0c0595559aea996ec54b4682503f9a42e0 no longer hits triangles of your own player model when tracing the prydoncursor from first person view git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4993 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_collision.c b/cl_collision.c index ef7bce39..17e7b4f8 100644 --- a/cl_collision.c +++ b/cl_collision.c @@ -70,9 +70,7 @@ float CL_TraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t n for (n = 0;n < cl_num_brushmodel_entities;n++) { ent = cl_brushmodel_entities[n]; - if (ent->mins[0] > tracemaxs[0] || ent->maxs[0] < tracemins[0] - || ent->mins[1] > tracemaxs[1] || ent->maxs[1] < tracemins[1] - || ent->mins[2] > tracemaxs[2] || ent->maxs[2] < tracemins[2]) + if (!BoxesOverlap(tracemins, tracemaxs, ent->mins, ent->maxs)) continue; Matrix4x4_Transform(&ent->inversematrix, start, starttransformed); @@ -104,7 +102,7 @@ float CL_TraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t n return maxfrac; } -float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int *hitent) +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; int n; @@ -150,6 +148,8 @@ float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, ve // if transparent and not selectable, skip entity if (!(cl_entities[n].state_current.effects & EF_SELECTABLE) && (ent->alpha < 1 || (ent->effects & (EF_ADDITIVE | EF_NODEPTHTEST)))) continue; + if (ent == ignoreent) + continue; Matrix4x4_Transform(&ent->inversematrix, start, starttransformed); Matrix4x4_Transform(&ent->inversematrix, end, endtransformed); diff --git a/cl_collision.h b/cl_collision.h index 74c42e8b..568a81fb 100644 --- a/cl_collision.h +++ b/cl_collision.h @@ -7,7 +7,7 @@ extern int cl_traceline_startcontents; // set by TraceLine float CL_TraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int hitbmodels, entity_render_t **hitent, int hitsupercontentsmask); -float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int *hitent); +float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int *hitent, entity_render_t *ignoreent); void CL_FindNonSolidLocation(const vec3_t in, vec3_t out, vec_t radius); int CL_PointQ1Contents(const vec3_t p); int CL_PointSuperContents(const vec3_t p); diff --git a/cl_input.c b/cl_input.c index 5f92b54c..db36a23d 100644 --- a/cl_input.c +++ b/cl_input.c @@ -398,7 +398,7 @@ void CL_UpdatePrydonCursor(void) VectorCopy(r_vieworigin, cl.cmd.cursor_start); VectorSet(temp, cl.cmd.cursor_screen[2] * scale[2], cl.cmd.cursor_screen[0] * scale[0], cl.cmd.cursor_screen[1] * scale[1]); Matrix4x4_Transform(&r_view_matrix, temp, cl.cmd.cursor_end); - cl.cmd.cursor_fraction = CL_SelectTraceLine(cl.cmd.cursor_start, cl.cmd.cursor_end, cl.cmd.cursor_impact, cl.cmd.cursor_normal, &cl.cmd.cursor_entitynumber); + cl.cmd.cursor_fraction = CL_SelectTraceLine(cl.cmd.cursor_start, cl.cmd.cursor_end, cl.cmd.cursor_impact, cl.cmd.cursor_normal, &cl.cmd.cursor_entitynumber, (chase_active.integer || cl.intermission) ? &cl_entities[cl.playerentity].render : NULL); // makes sparks where cursor is //CL_SparkShower(cl.cmd.cursor_impact, cl.cmd.cursor_normal, 5, 0); }