mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Trace to the current portal rather than the portal's plane.
This commit is contained in:
parent
9d2914474c
commit
5af88d33fe
1 changed files with 8 additions and 7 deletions
|
@ -665,24 +665,25 @@ trace_to_leaf (const hull_t *hull, clipleaf_t *leaf,
|
||||||
const trace_t *trace, const trace_state_t *state, vec3_t stop)
|
const trace_t *trace, const trace_state_t *state, vec3_t stop)
|
||||||
{
|
{
|
||||||
clipport_t *portal;
|
clipport_t *portal;
|
||||||
plane_t *plane;
|
|
||||||
int side;
|
int side;
|
||||||
vec_t frac = 1;
|
vec_t frac = 1;
|
||||||
vec_t t1, t2, offset, f;
|
plane_t *plane;
|
||||||
|
vec_t f;
|
||||||
qboolean clipped = false;
|
qboolean clipped = false;
|
||||||
clipleaf_t *l;
|
clipleaf_t *l;
|
||||||
|
trace_state_t lstate = *state;
|
||||||
|
|
||||||
leaf->test_count = test_count;
|
leaf->test_count = test_count;
|
||||||
for (portal = leaf->portals; portal; portal = portal->next[side]) {
|
for (portal = leaf->portals; portal; portal = portal->next[side]) {
|
||||||
side = portal->leafs[1] == leaf;
|
side = portal->leafs[1] == leaf;
|
||||||
|
plane = hull->planes + portal->planenum;
|
||||||
|
if (plane == state->split_plane)
|
||||||
|
continue;
|
||||||
if (!trace_hits_portal (hull, trace, portal,
|
if (!trace_hits_portal (hull, trace, portal,
|
||||||
state->start_point, state->dist))
|
state->start_point, state->dist))
|
||||||
continue;
|
continue;
|
||||||
plane = hull->planes + portal->planenum;
|
lstate.split_plane = plane;
|
||||||
t1 = PlaneDiff (state->start_point, plane);
|
f = box_portal_dist (hull, portal, &lstate);
|
||||||
t2 = PlaneDiff (state->end_point, plane);
|
|
||||||
offset = calc_offset (trace, plane);
|
|
||||||
f = (t1 + (t1 < 0 ? offset : -offset)) / (t1 - t2);
|
|
||||||
l = portal->leafs[side^1];
|
l = portal->leafs[side^1];
|
||||||
if (f < 0 && l->contents != CONTENTS_SOLID
|
if (f < 0 && l->contents != CONTENTS_SOLID
|
||||||
&& l->test_count != test_count)
|
&& l->test_count != test_count)
|
||||||
|
|
Loading…
Reference in a new issue