- Fix mixed X/Y pos subtraction in spriteGetZOfSlopef() and use a bit more of the backend.

* Confirmed coordinate mix-up when reviewing commit `- added spriteGetZOfSlopeF for the backend`.
This commit is contained in:
Mitchell Richters 2022-09-30 12:11:12 +10:00 committed by Christoph Oelckers
parent 22ccf33569
commit 2e8e5f99e7

View file

@ -380,9 +380,7 @@ inline int tspriteGetSlope(const tspritetype* spr)
inline double spriteGetZOfSlopef(const spritetypebase* tspr, const DVector2& pos, int heinum)
{
if (heinum == 0) return tspr->pos.Z;
auto ang = tspr->angle;
double factor = -ang.Sin() * (pos.X - tspr->pos.Y) - ang.Cos() * (pos.X - tspr->pos.X);
return tspr->pos.Z + heinum * factor * (1. / SLOPEVAL_FACTOR);
return tspr->pos.Z + heinum * -tspr->angle.ToVector().dot(pos - tspr->pos.XY()) * (1. / SLOPEVAL_FACTOR);
}
//==========================================================================