implement approximation of z0 > z1 case

This commit is contained in:
Jaklyy 2024-03-16 20:17:24 -04:00
parent 672e6d03fa
commit b6fa43b0cf

View File

@ -183,7 +183,7 @@ private:
if (dir) if (dir)
{ {
// seems like y dir does different interpolation? // seems like y dir does different interpolation than x?
// this probably isn't right... // this probably isn't right...
if (z0 < z1) if (z0 < z1)
return z0 + (z1-z0) * x / xdiff; return z0 + (z1-z0) * x / xdiff;
@ -195,7 +195,7 @@ private:
if (z0 < z1) if (z0 < z1)
return z0 + (((z1-z0) / xdiff & ~0x1) * x); return z0 + (((z1-z0) / xdiff & ~0x1) * x);
else else
return z1 + (((z0-z1) / xdiff & ~0x1) * (xdiff-x) + ((z0-z1) & 0xFF)); return z1 + (((z0-z1) / xdiff & ~0x1) * (xdiff-x)) + ((z0-z1) % (xdiff << 1));
} }
} }
} }