Skip to content

Commit

Permalink
- allow a bit of tolerance for attached orthogonal wall sprites.
Browse files Browse the repository at this point in the history
We have to account for mappers adding some 'safe' distance (which isn't really safe!)
  • Loading branch information
coelckers committed Jan 14, 2022
1 parent 8281374 commit ef711f0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/core/rendering/scene/hw_walls.cpp
Expand Up @@ -50,6 +50,7 @@ DCoreActor* wall_to_sprite_actors[8]; // gets updated each frame. Todo: Encapsul

static walltype* IsOnWall(tspritetype* tspr, int height, DVector2& outpos)
{
const double maxorthdist = 3; // maximum orthogonal distance to be considered an attached sprite.
const double maxdistsq = (tspr->ang & 0x1ff)? 3 * 3 : 1; // lower tolerance for perfectly orthogonal sprites

auto sect = tspr->sectp;
Expand All @@ -71,14 +72,14 @@ static walltype* IsOnWall(tspritetype* tspr, int height, DVector2& outpos)
// In Wanton Destruction's airplane level there's such a sprite assigned to the wrong sector.
if (d.X == 0)
{
if (tspr->pos.X == wal.pos.X)
if (fabs(tspr->pos.X - wal.pos.X) < maxorthdist);
{
closest = &wal;
}
}
else if (d.Y == 0)
{
if (tspr->pos.Y == wal.pos.Y)
if (fabs(tspr->pos.Y - wal.pos.Y) < maxorthdist);
{
closest = &wal;
}
Expand Down

0 comments on commit ef711f0

Please sign in to comment.