mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 12:30:40 +00:00
- fixed last commit and optimized wall lookup code a bit.
No need to continue if a matching wall has been found.
This commit is contained in:
parent
ef711f0b2d
commit
7b1d99373b
1 changed files with 6 additions and 7 deletions
|
@ -72,16 +72,16 @@ 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.
|
// In Wanton Destruction's airplane level there's such a sprite assigned to the wrong sector.
|
||||||
if (d.X == 0)
|
if (d.X == 0)
|
||||||
{
|
{
|
||||||
if (fabs(tspr->pos.X - wal.pos.X) < maxorthdist);
|
if (fabs(tspr->pos.X - wal.pos.X) < maxorthdist)
|
||||||
{
|
{
|
||||||
closest = &wal;
|
return &wal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (d.Y == 0)
|
else if (d.Y == 0)
|
||||||
{
|
{
|
||||||
if (fabs(tspr->pos.Y - wal.pos.Y) < maxorthdist);
|
if (fabs(tspr->pos.Y - wal.pos.Y) < maxorthdist)
|
||||||
{
|
{
|
||||||
closest = &wal;
|
return &wal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -89,13 +89,12 @@ static walltype* IsOnWall(tspritetype* tspr, int height, DVector2& outpos)
|
||||||
double wdist = SquareDistToWall(tspr->pos.X, tspr->pos.Y, &wal, &outpos);
|
double wdist = SquareDistToWall(tspr->pos.X, tspr->pos.Y, &wal, &outpos);
|
||||||
if (wdist <= maxdistsq)
|
if (wdist <= maxdistsq)
|
||||||
{
|
{
|
||||||
closest = &wal;
|
return &wal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// todo: cache this in the sprite to avoid recalculation.
|
return nullptr;
|
||||||
return closest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue