mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-21 09:01:37 +00:00
Fix inconsistent distance and hit position on traces that skip everything.
As it currently stood, only traces that never found anything in traversal had their distance and final position corrected. Meanwhile, traces that skipped everything would return the distance and position of the last thing they crossed instead. This change makes both cases consistent by "filling out" the remainder of the trace line for the latter.
This commit is contained in:
parent
181eda0a83
commit
c36da35e37
1 changed files with 7 additions and 2 deletions
|
@ -894,9 +894,14 @@ bool FTraceInfo::TraceTraverse (int ptflags)
|
|||
}
|
||||
Results = res;
|
||||
}
|
||||
if (Results->HitType == TRACE_HitNone && Results->Distance == 0)
|
||||
if (Results->HitType == TRACE_HitNone)
|
||||
{
|
||||
Results->HitPos = Start + Vec * MaxDist;
|
||||
// [MK] If we didn't cross anything, it's an easy guess,
|
||||
// otherwise, complete the line using the remaining distance
|
||||
if (Results->Distance == 0)
|
||||
Results->HitPos = Start + Vec * MaxDist;
|
||||
else
|
||||
Results->HitPos += Vec * (MaxDist - Results->Distance);
|
||||
SetSourcePosition();
|
||||
Results->Distance = MaxDist;
|
||||
Results->Fraction = 1.;
|
||||
|
|
Loading…
Reference in a new issue