mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
Move player sprite scale to r_playersprite and make it private
This commit is contained in:
parent
da85de01de
commit
3b5dc96f4a
6 changed files with 25 additions and 16 deletions
|
@ -139,18 +139,22 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
|
|||
sy += wy;
|
||||
}
|
||||
|
||||
double pspritexscale = centerxwide / 160.0;
|
||||
double pspriteyscale = pspritexscale * swrenderer::YaspectMul;
|
||||
double pspritexiscale = 1 / pspritexscale;
|
||||
|
||||
// calculate edges of the shape
|
||||
double tx = sx - BaseXCenter;
|
||||
|
||||
tx -= tex->GetScaledLeftOffset();
|
||||
int x1 = xs_RoundToInt(swrenderer::CenterX + tx * swrenderer::pspritexscale);
|
||||
int x1 = xs_RoundToInt(swrenderer::CenterX + tx * pspritexscale);
|
||||
|
||||
// off the right side
|
||||
if (x1 > viewwidth)
|
||||
return;
|
||||
|
||||
tx += tex->GetScaledWidth();
|
||||
int x2 = xs_RoundToInt(swrenderer::CenterX + tx * swrenderer::pspritexscale);
|
||||
int x2 = xs_RoundToInt(swrenderer::CenterX + tx * pspritexscale);
|
||||
|
||||
// off the left side
|
||||
if (x2 <= 0)
|
||||
|
@ -183,19 +187,19 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
|
|||
|
||||
int clipped_x1 = MAX(x1, 0);
|
||||
int clipped_x2 = MIN(x2, viewwidth);
|
||||
double xscale = swrenderer::pspritexscale / tex->Scale.X;
|
||||
double yscale = swrenderer::pspriteyscale / tex->Scale.Y;
|
||||
double xscale = pspritexscale / tex->Scale.X;
|
||||
double yscale = pspriteyscale / tex->Scale.Y;
|
||||
uint32_t translation = 0; // [RH] Use default colors
|
||||
|
||||
double xiscale, startfrac;
|
||||
if (flip)
|
||||
{
|
||||
xiscale = -swrenderer::pspritexiscale * tex->Scale.X;
|
||||
xiscale = -pspritexiscale * tex->Scale.X;
|
||||
startfrac = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
xiscale = swrenderer::pspritexiscale * tex->Scale.X;
|
||||
xiscale = pspritexiscale * tex->Scale.X;
|
||||
startfrac = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
#include "version.h"
|
||||
#include "c_console.h"
|
||||
#include "r_memory.h"
|
||||
#include "swrenderer/things/r_playersprite.h"
|
||||
|
||||
CVAR (String, r_viewsize, "", CVAR_NOSET)
|
||||
CVAR (Bool, r_shadercolormaps, true, CVAR_ARCHIVE)
|
||||
|
@ -345,9 +346,7 @@ void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight,
|
|||
WallTMapScale2 = IYaspectMul / CenterX;
|
||||
|
||||
// psprite scales
|
||||
pspritexscale = centerxwide / 160.0;
|
||||
pspriteyscale = pspritexscale * YaspectMul;
|
||||
pspritexiscale = 1 / pspritexscale;
|
||||
R_SetupPlayerSpriteScale();
|
||||
|
||||
// thing clipping
|
||||
fillshort (screenheightarray, viewwidth, (short)viewheight);
|
||||
|
|
|
@ -85,9 +85,6 @@ namespace swrenderer
|
|||
// This is not the same as the angle,
|
||||
// which increases counter clockwise (protractor).
|
||||
//
|
||||
double pspritexscale;
|
||||
double pspritexiscale;
|
||||
double pspriteyscale;
|
||||
fixed_t sky1scale; // [RH] Sky 1 scale factor
|
||||
fixed_t sky2scale; // [RH] Sky 2 scale factor
|
||||
|
||||
|
|
|
@ -38,10 +38,6 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
|||
namespace swrenderer
|
||||
{
|
||||
|
||||
extern double pspritexscale;
|
||||
extern double pspritexiscale;
|
||||
extern double pspriteyscale;
|
||||
|
||||
extern FTexture *WallSpriteTile;
|
||||
|
||||
extern int spriteshade;
|
||||
|
|
|
@ -74,6 +74,17 @@ namespace swrenderer
|
|||
|
||||
TArray<vispsp_t> vispsprites;
|
||||
unsigned int vispspindex;
|
||||
|
||||
double pspritexscale;
|
||||
double pspritexiscale;
|
||||
double pspriteyscale;
|
||||
}
|
||||
|
||||
void R_SetupPlayerSpriteScale()
|
||||
{
|
||||
pspritexscale = centerxwide / 160.0;
|
||||
pspriteyscale = pspritexscale * YaspectMul;
|
||||
pspritexiscale = 1 / pspritexscale;
|
||||
}
|
||||
|
||||
void R_DrawPlayerSprites()
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
void R_SetupPlayerSpriteScale();
|
||||
|
||||
void R_DrawPlayerSprites();
|
||||
void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac);
|
||||
void R_DrawRemainingPlayerSprites();
|
||||
|
|
Loading…
Reference in a new issue