mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 23:32:02 +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;
|
sy += wy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double pspritexscale = centerxwide / 160.0;
|
||||||
|
double pspriteyscale = pspritexscale * swrenderer::YaspectMul;
|
||||||
|
double pspritexiscale = 1 / pspritexscale;
|
||||||
|
|
||||||
// calculate edges of the shape
|
// calculate edges of the shape
|
||||||
double tx = sx - BaseXCenter;
|
double tx = sx - BaseXCenter;
|
||||||
|
|
||||||
tx -= tex->GetScaledLeftOffset();
|
tx -= tex->GetScaledLeftOffset();
|
||||||
int x1 = xs_RoundToInt(swrenderer::CenterX + tx * swrenderer::pspritexscale);
|
int x1 = xs_RoundToInt(swrenderer::CenterX + tx * pspritexscale);
|
||||||
|
|
||||||
// off the right side
|
// off the right side
|
||||||
if (x1 > viewwidth)
|
if (x1 > viewwidth)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tx += tex->GetScaledWidth();
|
tx += tex->GetScaledWidth();
|
||||||
int x2 = xs_RoundToInt(swrenderer::CenterX + tx * swrenderer::pspritexscale);
|
int x2 = xs_RoundToInt(swrenderer::CenterX + tx * pspritexscale);
|
||||||
|
|
||||||
// off the left side
|
// off the left side
|
||||||
if (x2 <= 0)
|
if (x2 <= 0)
|
||||||
|
@ -183,19 +187,19 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
|
||||||
|
|
||||||
int clipped_x1 = MAX(x1, 0);
|
int clipped_x1 = MAX(x1, 0);
|
||||||
int clipped_x2 = MIN(x2, viewwidth);
|
int clipped_x2 = MIN(x2, viewwidth);
|
||||||
double xscale = swrenderer::pspritexscale / tex->Scale.X;
|
double xscale = pspritexscale / tex->Scale.X;
|
||||||
double yscale = swrenderer::pspriteyscale / tex->Scale.Y;
|
double yscale = pspriteyscale / tex->Scale.Y;
|
||||||
uint32_t translation = 0; // [RH] Use default colors
|
uint32_t translation = 0; // [RH] Use default colors
|
||||||
|
|
||||||
double xiscale, startfrac;
|
double xiscale, startfrac;
|
||||||
if (flip)
|
if (flip)
|
||||||
{
|
{
|
||||||
xiscale = -swrenderer::pspritexiscale * tex->Scale.X;
|
xiscale = -pspritexiscale * tex->Scale.X;
|
||||||
startfrac = 1;
|
startfrac = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xiscale = swrenderer::pspritexiscale * tex->Scale.X;
|
xiscale = pspritexiscale * tex->Scale.X;
|
||||||
startfrac = 0;
|
startfrac = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
#include "r_memory.h"
|
#include "r_memory.h"
|
||||||
|
#include "swrenderer/things/r_playersprite.h"
|
||||||
|
|
||||||
CVAR (String, r_viewsize, "", CVAR_NOSET)
|
CVAR (String, r_viewsize, "", CVAR_NOSET)
|
||||||
CVAR (Bool, r_shadercolormaps, true, CVAR_ARCHIVE)
|
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;
|
WallTMapScale2 = IYaspectMul / CenterX;
|
||||||
|
|
||||||
// psprite scales
|
// psprite scales
|
||||||
pspritexscale = centerxwide / 160.0;
|
R_SetupPlayerSpriteScale();
|
||||||
pspriteyscale = pspritexscale * YaspectMul;
|
|
||||||
pspritexiscale = 1 / pspritexscale;
|
|
||||||
|
|
||||||
// thing clipping
|
// thing clipping
|
||||||
fillshort (screenheightarray, viewwidth, (short)viewheight);
|
fillshort (screenheightarray, viewwidth, (short)viewheight);
|
||||||
|
|
|
@ -85,9 +85,6 @@ namespace swrenderer
|
||||||
// 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).
|
||||||
//
|
//
|
||||||
double pspritexscale;
|
|
||||||
double 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
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,6 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
|
|
||||||
extern double pspritexscale;
|
|
||||||
extern double pspritexiscale;
|
|
||||||
extern double pspriteyscale;
|
|
||||||
|
|
||||||
extern FTexture *WallSpriteTile;
|
extern FTexture *WallSpriteTile;
|
||||||
|
|
||||||
extern int spriteshade;
|
extern int spriteshade;
|
||||||
|
|
|
@ -74,6 +74,17 @@ namespace swrenderer
|
||||||
|
|
||||||
TArray<vispsp_t> vispsprites;
|
TArray<vispsp_t> vispsprites;
|
||||||
unsigned int vispspindex;
|
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()
|
void R_DrawPlayerSprites()
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
|
void R_SetupPlayerSpriteScale();
|
||||||
|
|
||||||
void R_DrawPlayerSprites();
|
void R_DrawPlayerSprites();
|
||||||
void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac);
|
void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac);
|
||||||
void R_DrawRemainingPlayerSprites();
|
void R_DrawRemainingPlayerSprites();
|
||||||
|
|
Loading…
Reference in a new issue