Emulate slope overflow in Polymost in order to match the rest of the engine's slope algorithms

Patch from Nuke.YKT.

git-svn-id: https://svn.eduke32.com/eduke32@7868 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-08-01 06:50:33 +00:00 committed by Christoph Oelckers
parent 0f4ccaf970
commit 9335b339b0

View file

@ -3455,7 +3455,7 @@ static void mslopevlin(uint8_t *p, const intptr_t *slopalptr, bssize_t cnt, int3
#define BITSOFPRECISION 3 //Don't forget to change this in A.ASM also! #define BITSOFPRECISION 3 //Don't forget to change this in A.ASM also!
static void fgrouscan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat) static void fgrouscan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat)
{ {
int32_t i, j, l, globalx1, globaly1, y1, y2, daslope, daz; int32_t i, j, l, globalx1, globaly1, y1, y2, daslope, daz, wxi, wyi;
float fi, wx, wy, dasqr; float fi, wx, wy, dasqr;
float globalx, globaly, globalx2, globaly2, globalx3, globaly3, globalz, globalzd, globalzx; float globalx, globaly, globalx2, globaly2, globalx3, globaly3, globalz, globalzd, globalzx;
int32_t shoffs, m1, m2; int32_t shoffs, m1, m2;
@ -3493,11 +3493,11 @@ static void fgrouscan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat)
if (waloff[globalpicnum] == 0) tileLoad(globalpicnum); if (waloff[globalpicnum] == 0) tileLoad(globalpicnum);
wal = (uwalltype *)&wall[sec->wallptr]; wal = (uwalltype *)&wall[sec->wallptr];
wx = wall[wal->point2].x - wal->x; wxi = wall[wal->point2].x - wal->x;
wy = wall[wal->point2].y - wal->y; wyi = wall[wal->point2].y - wal->y;
dasqr = 1073741824.f/Bsqrtf(wx*wx+wy*wy); dasqr = 1073741824.f/nsqrtasm(uhypsq(wxi,wyi));
fi = daslope*dasqr*(1.f/2097152.f); fi = daslope*dasqr*(1.f/2097152.f);
wx *= fi; wy *= fi; wx = wxi*fi; wy = wyi*fi;
globalx = -float(singlobalang)*float(xdimenrecip)*(1.f/524288.f); globalx = -float(singlobalang)*float(xdimenrecip)*(1.f/524288.f);
globaly = float(cosglobalang)*float(xdimenrecip)*(1.f/524288.f); globaly = float(cosglobalang)*float(xdimenrecip)*(1.f/524288.f);
@ -3516,7 +3516,7 @@ static void fgrouscan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat)
dx = (wall[wal->point2].x-wal->x)*dasqr*(1.f/16384.f); dx = (wall[wal->point2].x-wal->x)*dasqr*(1.f/16384.f);
dy = (wall[wal->point2].y-wal->y)*dasqr*(1.f/16384.f); dy = (wall[wal->point2].y-wal->y)*dasqr*(1.f/16384.f);
fi = Bsqrtf(daslope*daslope+16777216.f); fi = float(nsqrtasm(daslope*daslope+16777216));
x = globalx; y = globaly; x = globalx; y = globaly;
globalx = (x*dx+y*dy)*(1.f/65536.f); globalx = (x*dx+y*dy)*(1.f/65536.f);