Fix equation slopes breaking with slopes farther than 32k FU away from the map center

https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2397
This commit is contained in:
NepDisk 2025-02-10 00:52:18 -05:00
parent d1a339d7d3
commit da0f8fa98f

View file

@ -894,10 +894,11 @@ void P_InitSlopes(void)
// Returns the height of the sloped plane at (x, y) as a fixed_t
fixed_t P_GetSlopeZAt(const pslope_t *slope, fixed_t x, fixed_t y)
{
fixed_t dist = FixedMul(x - slope->o.x, slope->d.x) +
FixedMul(y - slope->o.y, slope->d.y);
fixed_t dist = FixedMul(x - slope->o.x, slope->d.x) / 2 +
FixedMul(y - slope->o.y, slope->d.y) / 2;
return slope->o.z + FixedMul(dist, slope->zdelta);
return slope->o.z + FixedMul(dist, slope->zdelta) * 2;
}
// Like P_GetSlopeZAt but falls back to z if slope is NULL