mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-13 07:57:52 +00:00
- some minor optimizations to FPathTraverse:
* since we can trivially decide whether a line crosses the trace behind the end point from checking the return value of P_InterceptVector, there is no need to add those to the list of intercepts as they get discarded anyway in t * maxfrac is always FRACUNIT so there's no need to waste some variable for a constant value.
This commit is contained in:
parent
ef8dc22f7d
commit
90e2dc5f5a
2 changed files with 2 additions and 4 deletions
|
@ -380,7 +380,6 @@ class FPathTraverse
|
||||||
divline_t trace;
|
divline_t trace;
|
||||||
unsigned int intercept_index;
|
unsigned int intercept_index;
|
||||||
unsigned int intercept_count;
|
unsigned int intercept_count;
|
||||||
fixed_t maxfrac;
|
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
|
|
||||||
void AddLineIntercepts(int bx, int by);
|
void AddLineIntercepts(int bx, int by);
|
||||||
|
|
|
@ -985,7 +985,7 @@ void FPathTraverse::AddLineIntercepts(int bx, int by)
|
||||||
P_MakeDivline (ld, &dl);
|
P_MakeDivline (ld, &dl);
|
||||||
frac = P_InterceptVector (&trace, &dl);
|
frac = P_InterceptVector (&trace, &dl);
|
||||||
|
|
||||||
if (frac < 0) continue; // behind source
|
if (frac < 0 || frac > 1) continue; // behind source or beyond end point
|
||||||
|
|
||||||
intercept_t newintercept;
|
intercept_t newintercept;
|
||||||
|
|
||||||
|
@ -1170,7 +1170,7 @@ intercept_t *FPathTraverse::Next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dist > maxfrac || in == NULL) return NULL; // checked everything in range
|
if (dist > FRACUNIT || in == NULL) return NULL; // checked everything in range
|
||||||
in->done = true;
|
in->done = true;
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
@ -1388,7 +1388,6 @@ FPathTraverse::FPathTraverse (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, in
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
maxfrac = FRACUNIT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FPathTraverse::~FPathTraverse()
|
FPathTraverse::~FPathTraverse()
|
||||||
|
|
Loading…
Reference in a new issue