We don't actually need x1 or x2 until these points in the function, at least for papersprites

This commit is contained in:
Monster Iestyn 2020-05-19 17:23:22 +01:00
parent 1a790235c6
commit 12e1094143

View file

@ -1560,7 +1560,6 @@ static void R_ProjectSprite(mobj_t *thing)
tx = FixedMul(tr_x, viewsin) - FixedMul(tr_y, viewcos); tx = FixedMul(tr_x, viewsin) - FixedMul(tr_y, viewcos);
xscale = FixedDiv(projection, tz); xscale = FixedDiv(projection, tz);
x1 = (centerxfrac + FixedMul(tx,xscale))>>FRACBITS;
// Get paperoffset (offset) and paperoffset (distance) // Get paperoffset (offset) and paperoffset (distance)
paperoffset = -FixedMul(tr_x, cosmul) - FixedMul(tr_y, sinmul); paperoffset = -FixedMul(tr_x, cosmul) - FixedMul(tr_y, sinmul);
@ -1579,7 +1578,6 @@ static void R_ProjectSprite(mobj_t *thing)
tx2 = FixedMul(tr_x, viewsin) - FixedMul(tr_y, viewcos); tx2 = FixedMul(tr_x, viewsin) - FixedMul(tr_y, viewcos);
xscale2 = FixedDiv(projection, tz2); xscale2 = FixedDiv(projection, tz2);
x2 = ((centerxfrac + FixedMul(tx2,xscale2))>>FRACBITS);
if (max(tz, tz2) < FixedMul(MINZ, this_scale)) // non-papersprite clipping is handled earlier if (max(tz, tz2) < FixedMul(MINZ, this_scale)) // non-papersprite clipping is handled earlier
return; return;
@ -1595,7 +1593,6 @@ static void R_ProjectSprite(mobj_t *thing)
tz = FixedMul(MINZ, this_scale); tz = FixedMul(MINZ, this_scale);
yscale = FixedDiv(projectiony, tz); yscale = FixedDiv(projectiony, tz);
xscale = FixedDiv(projection, tz); xscale = FixedDiv(projection, tz);
x1 = (centerxfrac + FixedMul(tx,xscale))>>FRACBITS;
} }
else if (tz2 < FixedMul(MINZ, this_scale)) else if (tz2 < FixedMul(MINZ, this_scale))
{ {
@ -1604,15 +1601,18 @@ static void R_ProjectSprite(mobj_t *thing)
tz2 = FixedMul(MINZ, this_scale); tz2 = FixedMul(MINZ, this_scale);
yscale2 = FixedDiv(projectiony, tz2); yscale2 = FixedDiv(projectiony, tz2);
xscale2 = FixedDiv(projection, tz2); xscale2 = FixedDiv(projection, tz2);
x2 = (centerxfrac + FixedMul(tx2,xscale2))>>FRACBITS;
} }
// TODO: tx clamping // TODO: tx clamping
x1 = (centerxfrac + FixedMul(tx,xscale))>>FRACBITS;
// off the right side? // off the right side?
if (x1 > viewwidth) if (x1 > viewwidth)
return; return;
x2 = (centerxfrac + FixedMul(tx2,xscale2))>>FRACBITS;
// off the left side // off the left side
if (x2 < 0) if (x2 < 0)
return; return;