Fixed the last of the odd stretching by:
* recognising that the offsets weren't going to be accurate if you just SWAPPED yscale and yscale2 over 180 degrees * taking scale into account consistently also, some optimisations
This commit is contained in:
parent
9231a4653c
commit
2d3ebc5e49
|
@ -1117,8 +1117,9 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
|
|
||||||
angle_t ang;
|
angle_t ang;
|
||||||
fixed_t iscale;
|
fixed_t iscale;
|
||||||
fixed_t scalestep = 0; // toast '16
|
fixed_t scalestep; // toast '16
|
||||||
fixed_t offset;
|
fixed_t offset, offset2;
|
||||||
|
boolean flatsprite = true; //(thing->flags2 & MF2_PAPER);
|
||||||
|
|
||||||
//SoM: 3/17/2000
|
//SoM: 3/17/2000
|
||||||
fixed_t gz, gzt;
|
fixed_t gz, gzt;
|
||||||
|
@ -1198,13 +1199,11 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
I_Error("R_ProjectSprite: sprframes NULL for sprite %d\n", thing->sprite);
|
I_Error("R_ProjectSprite: sprframes NULL for sprite %d\n", thing->sprite);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (1) //(sprframe->rotate != SRF_SINGLE || flatsprite)
|
if (sprframe->rotate != SRF_SINGLE || flatsprite)
|
||||||
ang = R_PointToAngle (thing->x, thing->y) - thing->angle;
|
|
||||||
|
|
||||||
if (1) //(flatsprite)
|
|
||||||
{
|
{
|
||||||
ang_scale = abs(FINESINE(ang>>ANGLETOFINESHIFT));
|
ang = R_PointToAngle (thing->x, thing->y) - thing->angle;
|
||||||
//scalestep = (FINECOSINE(ang>>ANGLETOFINESHIFT));
|
if (flatsprite)
|
||||||
|
ang_scale = abs(FINESINE(ang>>ANGLETOFINESHIFT));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sprframe->rotate == SRF_SINGLE)
|
if (sprframe->rotate == SRF_SINGLE)
|
||||||
|
@ -1241,25 +1240,34 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
offset = spritecachedinfo[lump].offset - spritecachedinfo[lump].width;
|
offset = spritecachedinfo[lump].offset - spritecachedinfo[lump].width;
|
||||||
else
|
else
|
||||||
offset = -spritecachedinfo[lump].offset;
|
offset = -spritecachedinfo[lump].offset;
|
||||||
tx += FixedMul(offset, FixedMul(this_scale, ang_scale));
|
offset = FixedMul(offset, this_scale);
|
||||||
|
tx += FixedMul(offset, ang_scale);
|
||||||
x1 = (centerxfrac + FixedMul (tx,xscale)) >>FRACBITS;
|
x1 = (centerxfrac + FixedMul (tx,xscale)) >>FRACBITS;
|
||||||
|
|
||||||
// off the right side?
|
// off the right side?
|
||||||
if (x1 > viewwidth)
|
if (x1 > viewwidth)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tx += FixedMul(spritecachedinfo[lump].width, FixedMul(this_scale, ang_scale));
|
offset2 = FixedMul(spritecachedinfo[lump].width, this_scale);
|
||||||
|
tx += FixedMul(offset2, ang_scale);
|
||||||
x2 = ((centerxfrac + FixedMul (tx,xscale)) >>FRACBITS) - 1;
|
x2 = ((centerxfrac + FixedMul (tx,xscale)) >>FRACBITS) - 1;
|
||||||
|
|
||||||
// off the left side
|
// off the left side
|
||||||
if (x2 < 0)
|
if (x2 < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (1) // (flatsprite)
|
if (flatsprite)
|
||||||
{
|
{
|
||||||
fixed_t yscale2;
|
fixed_t yscale2;
|
||||||
INT32 range;
|
INT32 range;
|
||||||
|
|
||||||
|
if (ang >= ANGLE_180)
|
||||||
|
{
|
||||||
|
offset *= -1;
|
||||||
|
offset2 *= -1;
|
||||||
|
}
|
||||||
|
offset2 += offset;
|
||||||
|
|
||||||
tr_x = thing->x + FixedMul(offset, FINECOSINE(thing->angle>>ANGLETOFINESHIFT)) - viewx;
|
tr_x = thing->x + FixedMul(offset, FINECOSINE(thing->angle>>ANGLETOFINESHIFT)) - viewx;
|
||||||
tr_y = thing->y + FixedMul(offset, FINESINE(thing->angle>>ANGLETOFINESHIFT)) - viewy;
|
tr_y = thing->y + FixedMul(offset, FINESINE(thing->angle>>ANGLETOFINESHIFT)) - viewy;
|
||||||
gxt = FixedMul(tr_x, viewcos);
|
gxt = FixedMul(tr_x, viewcos);
|
||||||
|
@ -1268,28 +1276,23 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
yscale = FixedDiv(projectiony, tz);
|
yscale = FixedDiv(projectiony, tz);
|
||||||
if (yscale < 64) return; // Fix some funky visuals
|
if (yscale < 64) return; // Fix some funky visuals
|
||||||
|
|
||||||
offset += spritecachedinfo[lump].width;
|
tr_x = thing->x + FixedMul(offset2, FINECOSINE(thing->angle>>ANGLETOFINESHIFT)) - viewx;
|
||||||
tr_x = thing->x + FixedMul(offset, FINECOSINE(thing->angle>>ANGLETOFINESHIFT)) - viewx;
|
tr_y = thing->y + FixedMul(offset2, FINESINE(thing->angle>>ANGLETOFINESHIFT)) - viewy;
|
||||||
tr_y = thing->y + FixedMul(offset, FINESINE(thing->angle>>ANGLETOFINESHIFT)) - viewy;
|
|
||||||
gxt = FixedMul(tr_x, viewcos);
|
gxt = FixedMul(tr_x, viewcos);
|
||||||
gyt = -FixedMul(tr_y, viewsin);
|
gyt = -FixedMul(tr_y, viewsin);
|
||||||
tz = gxt-gyt;
|
tz = gxt-gyt;
|
||||||
yscale2 = FixedDiv(projectiony, tz);
|
yscale2 = FixedDiv(projectiony, tz);
|
||||||
if (yscale2 < 64) return; // Fix some funky visuals
|
if (yscale2 < 64) return; // Fix some funky visuals
|
||||||
|
|
||||||
if (ang >= ANGLE_180)
|
|
||||||
{
|
|
||||||
fixed_t temp = yscale2;
|
|
||||||
yscale2 = yscale;
|
|
||||||
yscale = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x2 > x1)
|
if (x2 > x1)
|
||||||
range = (x2 - x1);
|
range = (x2 - x1);
|
||||||
else
|
else
|
||||||
range = 1;
|
range = 1;
|
||||||
|
|
||||||
scalestep = (yscale2 - yscale)/range;
|
scalestep = (yscale2 - yscale)/range;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
scalestep = 0;
|
||||||
|
|
||||||
xscale = FixedMul(xscale, ang_scale);
|
xscale = FixedMul(xscale, ang_scale);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue