- fixed issue with wall sprite angle check.

The resulting value had no sign, so 'abs' did not work. It now uses some bit shifting magic to get a proper sign.
This commit is contained in:
Christoph Oelckers 2021-12-30 22:56:33 +01:00
parent 61d4d06783
commit f679b61a30

View file

@ -61,7 +61,7 @@ static walltype* IsOnWall(tspritetype* tspr, int height, DVector2& outpos)
// Intentionally include two sided walls. Even on them the sprite should be projected onto the wall for better results. // Intentionally include two sided walls. Even on them the sprite should be projected onto the wall for better results.
auto d = wal.delta(); auto d = wal.delta();
int walang = getangle(d.X, d.Y); int walang = getangle(d.X, d.Y);
int deltaang = abs(walang - tspr->ang) & 2047; int deltaang = abs((((walang - tspr->ang) & 2047) << 21) >> 21);
const int maxangdelta = 1; const int maxangdelta = 1;
// angle of the sprite must either be the wall's normal or the negative wall's normal to be aligned. // angle of the sprite must either be the wall's normal or the negative wall's normal to be aligned.