Renderer floatification: Restore playersprite rendering

This commit is contained in:
Randy Heit 2016-04-14 20:09:38 -05:00
parent ec8d038c99
commit 4a1cc61822
3 changed files with 22 additions and 22 deletions

View File

@ -386,9 +386,9 @@ void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight,
WallTMapScale2 = IYaspectMul * (1 << 18) / CenterX; WallTMapScale2 = IYaspectMul * (1 << 18) / CenterX;
// psprite scales // psprite scales
pspritexscale = (centerxwide << FRACBITS) / 160; pspritexscale = centerxwide / 160.0;
pspriteyscale = FLOAT2FIXED(pspritexscale * YaspectMul); pspriteyscale = pspritexscale * YaspectMul;
pspritexiscale = FixedDiv(FRACUNIT, pspritexscale); pspritexiscale = 1 / pspritexscale;
// thing clipping // thing clipping
clearbufshort (screenheightarray, viewwidth, (short)viewheight); clearbufshort (screenheightarray, viewwidth, (short)viewheight);

View File

@ -105,9 +105,9 @@ EXTERN_CVAR(Bool, r_deathcamera);
// This is not the same as the angle, // This is not the same as the angle,
// which increases counter clockwise (protractor). // which increases counter clockwise (protractor).
// //
fixed_t pspritexscale; double pspritexscale;
fixed_t pspriteyscale; double pspritexiscale;
fixed_t pspritexiscale; double pspriteyscale;
fixed_t sky1scale; // [RH] Sky 1 scale factor fixed_t sky1scale; // [RH] Sky 1 scale factor
fixed_t sky2scale; // [RH] Sky 2 scale factor fixed_t sky2scale; // [RH] Sky 2 scale factor
@ -1274,9 +1274,9 @@ void R_AddSprites (sector_t *sec, int lightlevel, int fakeside)
// //
// R_DrawPSprite // R_DrawPSprite
// //
void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_t sy) void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, double sx, double sy)
{ {
fixed_t tx; double tx;
int x1; int x1;
int x2; int x2;
spritedef_t* sprdef; spritedef_t* sprdef;
@ -1313,17 +1313,17 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
return; return;
// calculate edges of the shape // calculate edges of the shape
tx = sx-((320/2)<<FRACBITS); tx = sx - (320 / 2);
tx -= tex->GetScaledLeftOffset() << FRACBITS; tx -= tex->GetScaledLeftOffset();
x1 = centerx + (FixedMul(tx, pspritexscale) >> FRACBITS); x1 = xs_RoundToInt(CenterX + tx * pspritexscale);
// off the right side // off the right side
if (x1 > viewwidth) if (x1 > viewwidth)
return; return;
tx += tex->GetScaledWidth() << FRACBITS; tx += tex->GetScaledWidth();
x2 = centerx + (FixedMul(tx, pspritexscale) >> FRACBITS); x2 = xs_RoundToInt(CenterX + tx * pspritexscale);
// off the left side // off the left side
if (x2 <= 0) if (x2 <= 0)
@ -1334,7 +1334,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
vis->renderflags = owner->renderflags; vis->renderflags = owner->renderflags;
vis->floorclip = 0; vis->floorclip = 0;
vis->texturemid = int(((BASEYCENTER<<FRACBITS) - sy) * tex->Scale.Y) + (tex->TopOffset << FRACBITS); vis->texturemid = FLOAT2FIXED((BASEYCENTER - sy) * tex->Scale.Y + tex->TopOffset);
if (camera->player && (RenderTarget != screen || if (camera->player && (RenderTarget != screen ||
viewheight == RenderTarget->GetHeight() || viewheight == RenderTarget->GetHeight() ||
@ -1363,20 +1363,20 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
} }
vis->x1 = x1 < 0 ? 0 : x1; vis->x1 = x1 < 0 ? 0 : x1;
vis->x2 = x2 >= viewwidth ? viewwidth : x2; vis->x2 = x2 >= viewwidth ? viewwidth : x2;
vis->xscale = fixed_t(pspritexscale / tex->Scale.X); vis->xscale = FLOAT2FIXED(pspritexscale / tex->Scale.X);
vis->yscale = fixed_t(pspriteyscale / tex->Scale.Y); vis->yscale = FLOAT2FIXED(pspriteyscale / tex->Scale.Y);
vis->Translation = 0; // [RH] Use default colors vis->Translation = 0; // [RH] Use default colors
vis->pic = tex; vis->pic = tex;
vis->ColormapNum = 0; vis->ColormapNum = 0;
if (flip) if (flip)
{ {
vis->xiscale = -int(pspritexiscale * tex->Scale.X); vis->xiscale = -FLOAT2FIXED(pspritexiscale * tex->Scale.X);
vis->startfrac = (tex->GetWidth() << FRACBITS) - 1; vis->startfrac = (tex->GetWidth() << FRACBITS) - 1;
} }
else else
{ {
vis->xiscale = int(pspritexiscale * tex->Scale.X); vis->xiscale = FLOAT2FIXED(pspritexiscale * tex->Scale.X);
vis->startfrac = 0; vis->startfrac = 0;
} }
@ -1592,7 +1592,7 @@ void R_DrawPlayerSprites ()
// [RH] Don't draw the targeter's crosshair if the player already has a crosshair set. // [RH] Don't draw the targeter's crosshair if the player already has a crosshair set.
if (psp->state && (i != ps_targetcenter || CrosshairImage == NULL)) if (psp->state && (i != ps_targetcenter || CrosshairImage == NULL))
{ {
R_DrawPSprite (psp, i, camera, FLOAT2FIXED(psp->sx + ofsx), FLOAT2FIXED(psp->sy + ofsy)); R_DrawPSprite (psp, i, camera, psp->sx + ofsx, psp->sy + ofsy);
} }
// [RH] Don't bob the targeter. // [RH] Don't bob the targeter.
if (i == ps_flash) if (i == ps_flash)

View File

@ -112,9 +112,9 @@ extern fixed_t spryscale;
extern fixed_t sprtopscreen; extern fixed_t sprtopscreen;
extern bool sprflipvert; extern bool sprflipvert;
extern fixed_t pspritexscale; extern double pspritexscale;
extern fixed_t pspriteyscale; extern double pspritexiscale;
extern fixed_t pspritexiscale; extern double pspriteyscale;
extern FTexture *WallSpriteTile; extern FTexture *WallSpriteTile;