- 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:
Christoph Oelckers 2016-04-06 13:19:09 +02:00
parent d4a2e9696e
commit 8cbdbdaf70
2 changed files with 4 additions and 5 deletions

View file

@ -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)

View file

@ -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)