Fix paper sprites apparently "turning" around sometimes when you turn the camera, when they're supposed to be still (sawb.wad for instance)

I cleaned up some of Sryder's changes a little too I guess
This commit is contained in:
Monster Iestyn 2017-05-13 12:49:30 +01:00
parent 459d8064ee
commit 8290ae9fd4

View file

@ -5122,15 +5122,26 @@ static void HWR_ProjectSprite(mobj_t *thing)
I_Error("sprframes NULL for sprite %d\n", thing->sprite); I_Error("sprframes NULL for sprite %d\n", thing->sprite);
#endif #endif
if (sprframe->rotate != SRF_SINGLE || papersprite) if (papersprite)
{ {
ang = R_PointToAngle (thing->x, thing->y) - thing->angle; // Use the actual view angle, rather than the angle formed
if (papersprite) // between the view point and the thing
// this makes sure paper sprites always appear at the right angle!
// Note: DO NOT do this in software mode version, it actually
// makes papersprites look WORSE there (I know, I've tried)
// Monster Iestyn - 13/05/17
ang = dup_viewangle - thing->angle;
ang_scale = FIXED_TO_FLOAT(FINESINE(ang>>ANGLETOFINESHIFT));
ang_scalez = FIXED_TO_FLOAT(FINECOSINE(ang>>ANGLETOFINESHIFT));
if (ang_scale < 0)
{ {
ang_scale = FIXED_TO_FLOAT(FINESINE(ang>>ANGLETOFINESHIFT)); ang_scale = -ang_scale;
ang_scalez = FIXED_TO_FLOAT(FINECOSINE(ang>>ANGLETOFINESHIFT)); ang_scalez = -ang_scalez;
} }
} }
else if (sprframe->rotate != SRF_SINGLE)
ang = R_PointToAngle (thing->x, thing->y) - thing->angle;
if (sprframe->rotate == SRF_SINGLE) if (sprframe->rotate == SRF_SINGLE)
{ {
@ -5163,16 +5174,8 @@ static void HWR_ProjectSprite(mobj_t *thing)
else else
offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].offset) * this_scale; offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].offset) * this_scale;
if (ang_scale < 0) z1 = tz - (offset * ang_scalez);
{ tx -= offset * ang_scale;
z1 = tz + offset * ang_scalez;
tx += offset * ang_scale;
}
else
{
z1 = tz - offset * ang_scalez;
tx -= offset * ang_scale;
}
// project x // project x
x1 = gr_windowcenterx + (tx * gr_centerx / tz); x1 = gr_windowcenterx + (tx * gr_centerx / tz);
@ -5184,16 +5187,10 @@ static void HWR_ProjectSprite(mobj_t *thing)
x1 = tx; x1 = tx;
offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width) * this_scale; offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width) * this_scale;
if (ang_scale < 0)
{ z2 = z1 + (offset * ang_scalez);
z2 = z1 - offset * ang_scalez; tx += offset * ang_scale;
tx -= offset * ang_scale;
}
else
{
z2 = z1 + offset * ang_scalez;
tx += offset * ang_scale;
}
if (papersprite && max(z1, z2) < ZCLIP_PLANE) if (papersprite && max(z1, z2) < ZCLIP_PLANE)
return; return;