Regarding the sight check, after being told that in E1M3 of Doom this error occurs I did some checks and what I found was quite surprising:
It's neither a blockmap bug nor is the blockmap sight check algorithm inaccurate. I think this qualifies as a genuine bug. P_PathTraverse has the same problem which I was able to confirm with a few tests.
Code: Select all
for (count = 0 ; count < 64 ; count++)
{
if (!P_SightBlockLinesIterator (mapx, mapy))
{
return false; // early out
}
if ((mapxstep | mapystep) == 0)
break;
if ( (yintercept >> FRACBITS) == mapy)
{
yintercept += ystep;
mapx += mapxstep;
if (mapx == xt2) mapxstep = 0;
}
else if ( (xintercept >> FRACBITS) == mapx)
{
xintercept += xstep;
mapy += mapystep;
if (mapy == yt2) mapystep = 0;
}
// added this for checking
else
{
Printf("P_CheckSight failed\n");
break;
}
}
The problem is that the function occasionally runs into the 'else' branch with the Printf I have added for testing. This happens when the trace wants to change both the x- and y- blockmap coordinate at the same time. Normally *both* adjoining blocks should be checked in this instance. This code just screws up, however. What I find most disturbing in this instance is id's 'fix' to limit the iterations of this loop. Somehow I get the feeling that somebody was fundamentally unaware what he was doing (not that it surprises me with Doom's source.

)
Theoretically this bug should make it possible in rare situations to shoot through walls although I never managed to do it.
Regarding the sight check, after being told that in E1M3 of Doom this error occurs I did some checks and what I found was quite surprising:
It's neither a blockmap bug nor is the blockmap sight check algorithm inaccurate. I think this qualifies as a genuine bug. P_PathTraverse has the same problem which I was able to confirm with a few tests.
[code]
for (count = 0 ; count < 64 ; count++)
{
if (!P_SightBlockLinesIterator (mapx, mapy))
{
return false; // early out
}
if ((mapxstep | mapystep) == 0)
break;
if ( (yintercept >> FRACBITS) == mapy)
{
yintercept += ystep;
mapx += mapxstep;
if (mapx == xt2) mapxstep = 0;
}
else if ( (xintercept >> FRACBITS) == mapx)
{
xintercept += xstep;
mapy += mapystep;
if (mapy == yt2) mapystep = 0;
}
// added this for checking
else
{
Printf("P_CheckSight failed\n");
break;
}
}
[/code]
The problem is that the function occasionally runs into the 'else' branch with the Printf I have added for testing. This happens when the trace wants to change both the x- and y- blockmap coordinate at the same time. Normally *both* adjoining blocks should be checked in this instance. This code just screws up, however. What I find most disturbing in this instance is id's 'fix' to limit the iterations of this loop. Somehow I get the feeling that somebody was fundamentally unaware what he was doing (not that it surprises me with Doom's source. :( )
Theoretically this bug should make it possible in rare situations to shoot through walls although I never managed to do it.