mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
- fixed: The PathTraverse and sight checking code may not assume that ceiling(x) == floor(x)+1.
This will fail when a trace starts directly on a block boundary in which case x is a whole number. It should always use 'floor(x)+1' to ensure that the calculated point is at the right or upper edge of a block.
This commit is contained in:
parent
d4a2e9696e
commit
8cbdbdaf70
2 changed files with 4 additions and 5 deletions
|
@ -1452,7 +1452,7 @@ void FPathTraverse::init(double x1, double y1, double x2, double y2, int flags,
|
|||
if (mapex > mapx)
|
||||
{
|
||||
mapxstep = 1;
|
||||
partialx = xs_CeilToInt(xt1) - xt1;
|
||||
partialx = 1. - xt1 + xs_FloorToInt(xt1);
|
||||
ystep = (y2 - y1) / fabs(x2 - x1);
|
||||
}
|
||||
else if (mapex < mapx)
|
||||
|
@ -1469,11 +1469,10 @@ void FPathTraverse::init(double x1, double y1, double x2, double y2, int flags,
|
|||
}
|
||||
yintercept = yt1 + partialx * ystep;
|
||||
|
||||
|
||||
if (mapey > mapy)
|
||||
{
|
||||
mapystep = 1;
|
||||
partialy = xs_CeilToInt(yt1) - yt1;
|
||||
partialy = 1. - yt1 + xs_FloorToInt(yt1);
|
||||
xstep = (x2 - x1) / fabs(y2 - y1);
|
||||
}
|
||||
else if (mapey < mapy)
|
||||
|
|
|
@ -651,7 +651,7 @@ bool SightCheck::P_SightPathTraverse ()
|
|||
if (mapex > mapx)
|
||||
{
|
||||
mapxstep = 1;
|
||||
partialx = xs_CeilToInt(xt1) - xt1;
|
||||
partialx = 1. - xt1 + xs_FloorToInt(xt1);
|
||||
ystep = (y2 - y1) / fabs(x2 - x1);
|
||||
}
|
||||
else if (mapex < mapx)
|
||||
|
@ -671,7 +671,7 @@ bool SightCheck::P_SightPathTraverse ()
|
|||
if (mapey > mapy)
|
||||
{
|
||||
mapystep = 1;
|
||||
partialy = xs_CeilToInt(yt1) - yt1;
|
||||
partialy = 1. - yt1 + xs_FloorToInt(yt1);
|
||||
xstep = (x2 - x1) / fabs(y2 - y1);
|
||||
}
|
||||
else if (mapey < mapy)
|
||||
|
|
Loading…
Reference in a new issue