- Fixed: P_BounceWall() cannot assume that BlockingLine is the line the actor

should bounce off of. Since the order lines in a blockmap cell are checked
  for collision is essentially undefined, there could be another line closer to
  the actor that it should bounce off of instead.

SVN r678 (trunk)
This commit is contained in:
Randy Heit 2008-01-08 03:21:01 +00:00
commit 2d4b679fcb
3 changed files with 51 additions and 50 deletions

View file

@ -2423,57 +2423,50 @@ bool P_BounceWall (AActor *mo)
return false;
}
if (BlockingLine != NULL)
{
line = BlockingLine;
}
else
{
slidemo = mo;
slidemo = mo;
//
// trace along the three leading corners
//
if (mo->momx > 0)
{
leadx = mo->x+mo->radius;
}
else
{
leadx = mo->x-mo->radius;
}
if (mo->momy > 0)
{
leady = mo->y+mo->radius;
}
else
{
leady = mo->y-mo->radius;
}
bestslidefrac = FRACUNIT+1;
if (P_PathTraverse(leadx, leady, leadx+mo->momx, leady+mo->momy,
PT_ADDLINES, PTR_BounceTraverse))
{ // Could not find a wall, so bounce off the floor/ceiling instead.
fixed_t floordist = mo->z - mo->floorz;
fixed_t ceildist = mo->ceilingz - mo->z;
if (floordist <= ceildist)
{
mo->FloorBounceMissile (mo->Sector->floorplane);
return true;
}
else
{
mo->FloorBounceMissile (mo->Sector->ceilingplane);
return true;
}
/*
else
{
return (mo->flags2 & MF2_BOUNCE2) != 0;
}
*/
}
line = bestslideline;
if (mo->momx > 0)
{
leadx = mo->x+mo->radius;
}
else
{
leadx = mo->x-mo->radius;
}
if (mo->momy > 0)
{
leady = mo->y+mo->radius;
}
else
{
leady = mo->y-mo->radius;
}
bestslidefrac = FRACUNIT+1;
if (P_PathTraverse(leadx, leady, leadx+mo->momx, leady+mo->momy,
PT_ADDLINES, PTR_BounceTraverse))
{ // Could not find a wall, so bounce off the floor/ceiling instead.
fixed_t floordist = mo->z - mo->floorz;
fixed_t ceildist = mo->ceilingz - mo->z;
if (floordist <= ceildist)
{
mo->FloorBounceMissile (mo->Sector->floorplane);
return true;
}
else
{
mo->FloorBounceMissile (mo->Sector->ceilingplane);
return true;
}
/*
else
{
return (mo->flags2 & MF2_BOUNCE2) != 0;
}
*/
}
line = bestslideline;
if (line->special == Line_Horizon)
{