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