Fix relative aligned floor/ceiling texture wiggling

Patch from Nuke.YKT.

git-svn-id: https://svn.eduke32.com/eduke32@8087 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-09-08 01:01:40 +00:00 committed by Christoph Oelckers
parent f144f1a0bc
commit d0a3b86c77

View file

@ -2654,7 +2654,7 @@ static int32_t setup_globals_cf1(usectorptr_t sec, int32_t pal, int32_t zd,
int32_t picnum, int32_t shade, int32_t stat,
int32_t xpanning, int32_t ypanning, int32_t x1)
{
int32_t i, j, ox, oy;
int32_t i;
if (palookup[pal] != globalpalwritten)
{
@ -2689,21 +2689,17 @@ static int32_t setup_globals_cf1(usectorptr_t sec, int32_t pal, int32_t zd,
}
else
{
j = sec->wallptr;
ox = wall[wall[j].point2].x - wall[j].x;
oy = wall[wall[j].point2].y - wall[j].y;
i = nsqrtasm(uhypsq(ox,oy)); if (i == 0) i = 1024; else i = tabledivide32(1048576, i);
globalx1 = mulscale10(dmulscale10(ox,singlobalang,-oy,cosglobalang),i);
globaly1 = mulscale10(dmulscale10(ox,cosglobalang,oy,singlobalang),i);
vec2_t const xy = { wall[wall[sec->wallptr].point2].x - wall[sec->wallptr].x,
wall[wall[sec->wallptr].point2].y - wall[sec->wallptr].y };
i = nsqrtasm(uhypsq(xy.x,xy.y)); if (i == 0) i = 1024; else i = tabledivide32(1048576, i);
int const wcos = mulscale6(xy.x, i), wsin = mulscale6(xy.y, i);
globalx1 = dmulscale14(wcos,singlobalang,-wsin,cosglobalang);
globaly1 = dmulscale14(wcos,cosglobalang,wsin,singlobalang);
globalx2 = -globalx1;
globaly2 = -globaly1;
ox = ((wall[j].x-globalposx)<<6); oy = ((wall[j].y-globalposy)<<6);
i = dmulscale14(oy,cosglobalang,-ox,singlobalang);
j = dmulscale14(ox,cosglobalang,oy,singlobalang);
ox = i; oy = j;
globalxpanning = (coord_t)globalx1*ox - (coord_t)globaly1*oy;
globalypanning = (coord_t)globaly2*ox + (coord_t)globalx2*oy;
globalxpanning = (coord_t)((globalposx - wall[sec->wallptr].x)<<6) * wcos + (coord_t)((globalposy - wall[sec->wallptr].y)<<6) * wsin;
globalypanning = (coord_t)((globalposy - wall[sec->wallptr].y)<<6) * wcos - (coord_t)((globalposx - wall[sec->wallptr].x)<<6) * wsin;
}
globalx2 = mulscale16(globalx2,viewingrangerecip);
globaly1 = mulscale16(globaly1,viewingrangerecip);