- Increased precision of texture scaling factors to full fixed point. In the process
I got rid of the old tx and ty CVARs because they made the texture scaling much more complicated than it was actually needed (and besides, they were completely useless except for testing purposes anyway.) SVN r522 (trunk)
This commit is contained in:
parent
6e5b1f1182
commit
e08da03a3d
15 changed files with 133 additions and 144 deletions
|
|
@ -1302,8 +1302,8 @@ void R_ProjectSprite (AActor *thing, int fakeside)
|
|||
}
|
||||
|
||||
// [RH] Added scaling
|
||||
gzt = fz + MulScale3(thing->scaleY, tex->TopOffset * tex->ScaleX);
|
||||
gzb = fz + MulScale3(thing->scaleY, (tex->TopOffset - tex->GetHeight()) * tex->ScaleY);
|
||||
gzt = fz + MulScale16(thing->scaleY, tex->TopOffset * tex->yScale);
|
||||
gzb = fz + MulScale16(thing->scaleY, (tex->TopOffset - tex->GetHeight()) * tex->yScale);
|
||||
|
||||
// [RH] Reject sprites that are off the top or bottom of the screen
|
||||
if (MulScale12 (globaluclip, tz) > viewz - gzb ||
|
||||
|
|
@ -1319,7 +1319,7 @@ void R_ProjectSprite (AActor *thing, int fakeside)
|
|||
}
|
||||
|
||||
// calculate edges of the shape
|
||||
const fixed_t thingxscalemul = MulScale3(thing->scaleX, tex->ScaleX);
|
||||
const fixed_t thingxscalemul = MulScale16(thing->scaleX, tex->xScale);
|
||||
|
||||
tx -= (flip ? (tex->GetWidth() - tex->LeftOffset - 1) : tex->LeftOffset) * thingxscalemul;
|
||||
x1 = centerx + MulScale32 (tx, xscale);
|
||||
|
|
@ -1335,7 +1335,7 @@ void R_ProjectSprite (AActor *thing, int fakeside)
|
|||
if (x2 < WindowLeft || x2 <= x1)
|
||||
return;
|
||||
|
||||
xscale = MulScale19 (thing->scaleX, xscale * tex->ScaleX);
|
||||
xscale = FixedMul(FixedMul(thing->scaleX, xscale), tex->xScale);
|
||||
iscale = (tex->GetWidth() << FRACBITS) / (x2 - x1);
|
||||
x2--;
|
||||
|
||||
|
|
@ -1382,16 +1382,16 @@ void R_ProjectSprite (AActor *thing, int fakeside)
|
|||
vis->RenderStyle = thing->RenderStyle;
|
||||
vis->AlphaColor = thing->alphacolor;
|
||||
vis->xscale = xscale;
|
||||
vis->yscale = Scale (InvZtoScale, MulScale3(thing->scaleY, tex->ScaleY), tz)>>4;
|
||||
vis->yscale = Scale (InvZtoScale, MulScale16(thing->scaleY, tex->yScale), tz)>>4;
|
||||
vis->idepth = (DWORD)DivScale32 (1, tz) >> 1; // tz is 20.12, so idepth ought to be 12.20, but
|
||||
vis->cx = tx2; // signed math makes it 13.19
|
||||
vis->gx = fx;
|
||||
vis->gy = fy;
|
||||
vis->gz = gzb; // [RH] use gzb, not thing->z
|
||||
vis->gzt = gzt; // killough 3/27/98
|
||||
vis->floorclip = FixedDiv (thing->floorclip, MulScale3(thing->scaleY, tex->ScaleY));
|
||||
vis->floorclip = FixedDiv (thing->floorclip, MulScale16(thing->scaleY, tex->yScale));
|
||||
vis->texturemid = (tex->TopOffset << FRACBITS) -
|
||||
FixedDiv (viewz-fz+thing->floorclip, MulScale3(thing->scaleY, tex->ScaleY));
|
||||
FixedDiv (viewz-fz+thing->floorclip, MulScale16(thing->scaleY, tex->yScale));
|
||||
vis->x1 = x1 < WindowLeft ? WindowLeft : x1;
|
||||
vis->x2 = x2 > WindowRight ? WindowRight : x2;
|
||||
vis->Translation = thing->Translation; // [RH] thing translation table
|
||||
|
|
@ -1528,7 +1528,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
|
|||
vis->floorclip = 0;
|
||||
|
||||
|
||||
vis->texturemid = MulScale3((BASEYCENTER<<FRACBITS) - sy, tex->ScaleY) + (tex->TopOffset << FRACBITS);
|
||||
vis->texturemid = MulScale16((BASEYCENTER<<FRACBITS) - sy, tex->yScale) + (tex->TopOffset << FRACBITS);
|
||||
|
||||
|
||||
if (camera->player && (RenderTarget != screen ||
|
||||
|
|
@ -1559,19 +1559,19 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
|
|||
}
|
||||
vis->x1 = x1 < 0 ? 0 : x1;
|
||||
vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2;
|
||||
vis->xscale = DivScale3(pspritexscale, tex->ScaleX);
|
||||
vis->yscale = DivScale3(pspriteyscale, tex->ScaleY);
|
||||
vis->xscale = DivScale16(pspritexscale, tex->xScale);
|
||||
vis->yscale = DivScale16(pspriteyscale, tex->yScale);
|
||||
vis->Translation = 0; // [RH] Use default colors
|
||||
vis->pic = tex;
|
||||
|
||||
if (flip)
|
||||
{
|
||||
vis->xiscale = -MulScale3(pspritexiscale, tex->ScaleX);
|
||||
vis->xiscale = -MulScale16(pspritexiscale, tex->xScale);
|
||||
vis->startfrac = (tex->GetWidth() << FRACBITS) - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
vis->xiscale = MulScale3(pspritexiscale, tex->ScaleX);
|
||||
vis->xiscale = MulScale16(pspritexiscale, tex->xScale);
|
||||
vis->startfrac = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue