Revert paperprojection, but keep it as a #define in case someone fixes it in a patch.

This commit is contained in:
toaster 2019-12-07 10:22:10 +00:00
parent d02648450a
commit 0bd1399c52
2 changed files with 47 additions and 3 deletions

View File

@ -7087,7 +7087,7 @@ static void P_SpawnMinecartSegments(mobj_t *mobj, boolean mode)
seg = P_SpawnMobj(x, y, z, MT_MINECARTSEG);
P_SetMobjState(seg, (statenum_t)(S_MINECARTSEG_FRONT + i));
if (i >= 2)
seg->extravalue1 = (i == 2) ? -20 : 20;
seg->extravalue1 = (i == 2) ? -18 : 18; // make -20/20 when papersprite projection fixed
else
{
seg->extravalue2 = (i == 0) ? 24 : -24;

View File

@ -1082,6 +1082,8 @@ static void R_SplitSprite(vissprite_t *sprite)
}
}
//#define PROPERPAPER // This was reverted less than 7 hours before 2.2's release because of very strange, frequent crashes.
//
// R_ProjectSprite
// Generates a vissprite for a thing
@ -1137,6 +1139,10 @@ static void R_ProjectSprite(mobj_t *thing)
UINT32 rollangle = AngleFixed(arollangle)>>FRACBITS;
#endif
#ifndef PROPERPAPER
fixed_t ang_scale = FRACUNIT;
#endif
// transform the origin point
tr_x = thing->x - viewx;
tr_y = thing->y - viewy;
@ -1221,6 +1227,10 @@ static void R_ProjectSprite(mobj_t *thing)
if (sprframe->rotate != SRF_SINGLE || papersprite)
{
ang = R_PointToAngle (thing->x, thing->y) - (thing->player ? thing->player->drawangle : thing->angle);
#ifndef PROPERPAPER
if (papersprite)
ang_scale = abs(FINESINE(ang>>ANGLETOFINESHIFT));
#endif
}
if (sprframe->rotate == SRF_SINGLE)
@ -1282,11 +1292,31 @@ static void R_ProjectSprite(mobj_t *thing)
else
offset = -spr_offset;
offset = FixedMul(offset, this_scale);
#ifndef PROPERPAPER
tx += FixedMul(offset, ang_scale);
x1 = (centerxfrac + FixedMul (tx,xscale)) >>FRACBITS;
// off the right side?
if (x1 > viewwidth)
return;
#endif
offset2 = FixedMul(spr_width, this_scale);
#ifndef PROPERPAPER
tx += FixedMul(offset2, ang_scale);
x2 = ((centerxfrac + FixedMul (tx,xscale)) >> FRACBITS) - (papersprite ? 2 : 1);
// off the left side
if (x2 < 0)
return;
#endif
if (papersprite)
{
fixed_t xscale2, yscale2, cosmul, sinmul, tz2;
fixed_t
#ifdef PROPERPAPER
xscale2,
#endif
yscale2, cosmul, sinmul, tz2;
INT32 range;
if (ang >= ANGLE_180)
@ -1306,6 +1336,7 @@ static void R_ProjectSprite(mobj_t *thing)
yscale = FixedDiv(projectiony, tz);
if (yscale < 64) return; // Fix some funky visuals
#ifdef PROPERPAPER
gxt = -FixedMul(tr_x, viewsin);
gyt = FixedMul(tr_y, viewcos);
tx = -(gyt + gxt);
@ -1315,6 +1346,7 @@ static void R_ProjectSprite(mobj_t *thing)
// off the right side?
if (x1 > viewwidth)
return;
#endif
tr_x += FixedMul(offset2, cosmul);
tr_y += FixedMul(offset2, sinmul);
@ -1324,6 +1356,7 @@ static void R_ProjectSprite(mobj_t *thing)
yscale2 = FixedDiv(projectiony, tz2);
if (yscale2 < 64) return; // ditto
#ifdef PROPERPAPER
gxt = -FixedMul(tr_x, viewsin);
gyt = FixedMul(tr_y, viewcos);
tx = -(gyt + gxt);
@ -1333,6 +1366,7 @@ static void R_ProjectSprite(mobj_t *thing)
// off the left side
if (x2 < 0)
return;
#endif
if (max(tz, tz2) < FixedMul(MINZ, this_scale)) // non-papersprite clipping is handled earlier
return;
@ -1340,10 +1374,18 @@ static void R_ProjectSprite(mobj_t *thing)
if ((range = x2 - x1) <= 0)
return;
#ifdef PROPERPAPER
range++; // fencepost problem
#endif
scalestep = (yscale2 - yscale)/range;
xscale = FixedDiv(range<<FRACBITS, abs(offset2));
xscale =
#ifdef PROPERPAPER
FixedDiv(range<<FRACBITS, abs(offset2))+1
#else
FixedMul(xscale, ang_scale)
#endif
;
// The following two are alternate sorting methods which might be more applicable in some circumstances. TODO - maybe enable via MF2?
// sortscale = max(yscale, yscale2);
@ -1353,6 +1395,7 @@ static void R_ProjectSprite(mobj_t *thing)
{
scalestep = 0;
yscale = sortscale;
#ifdef PROPERPAPER
tx += offset;
x1 = (centerxfrac + FixedMul(tx,xscale))>>FRACBITS;
@ -1366,6 +1409,7 @@ static void R_ProjectSprite(mobj_t *thing)
// off the left side
if (x2 < 0)
return;
#endif
}
if ((thing->flags2 & MF2_LINKDRAW) && thing->tracer) // toast 16/09/16 (SYMMETRY)