mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-12 07:34:50 +00:00
Convert r_playersprite to a class
This commit is contained in:
parent
ee2811450d
commit
48b4915f5b
5 changed files with 41 additions and 28 deletions
|
@ -345,7 +345,7 @@ void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight,
|
||||||
WallTMapScale2 = IYaspectMul / CenterX;
|
WallTMapScale2 = IYaspectMul / CenterX;
|
||||||
|
|
||||||
// psprite scales
|
// psprite scales
|
||||||
R_SetupPlayerSpriteScale();
|
RenderPlayerSprite::SetupSpriteScale();
|
||||||
|
|
||||||
// thing clipping
|
// thing clipping
|
||||||
fillshort (screenheightarray, viewwidth, (short)viewheight);
|
fillshort (screenheightarray, viewwidth, (short)viewheight);
|
||||||
|
|
|
@ -294,7 +294,7 @@ void FSoftwareRenderer::DrawRemainingPlayerSprites()
|
||||||
{
|
{
|
||||||
if (!r_polyrenderer)
|
if (!r_polyrenderer)
|
||||||
{
|
{
|
||||||
R_DrawRemainingPlayerSprites();
|
RenderPlayerSprite::RenderRemainingPlayerSprites();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,32 +63,23 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
namespace
|
TArray<RenderPlayerSprite::vispsp_t> RenderPlayerSprite::vispsprites;
|
||||||
{
|
unsigned int RenderPlayerSprite::vispspindex;
|
||||||
// Used to store a psprite's drawing information if it needs to be drawn later.
|
|
||||||
struct vispsp_t
|
|
||||||
{
|
|
||||||
vissprite_t *vis;
|
|
||||||
FDynamicColormap *basecolormap;
|
|
||||||
int x1;
|
|
||||||
};
|
|
||||||
|
|
||||||
TArray<vispsp_t> vispsprites;
|
double RenderPlayerSprite::pspritexscale;
|
||||||
unsigned int vispspindex;
|
double RenderPlayerSprite::pspritexiscale;
|
||||||
|
double RenderPlayerSprite::pspriteyscale;
|
||||||
|
|
||||||
double pspritexscale;
|
TArray<vissprite_t> RenderPlayerSprite::avis;
|
||||||
double pspritexiscale;
|
|
||||||
double pspriteyscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
void R_SetupPlayerSpriteScale()
|
void RenderPlayerSprite::SetupSpriteScale()
|
||||||
{
|
{
|
||||||
pspritexscale = centerxwide / 160.0;
|
pspritexscale = centerxwide / 160.0;
|
||||||
pspriteyscale = pspritexscale * YaspectMul;
|
pspriteyscale = pspritexscale * YaspectMul;
|
||||||
pspritexiscale = 1 / pspritexscale;
|
pspritexiscale = 1 / pspritexscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_DrawPlayerSprites()
|
void RenderPlayerSprite::RenderPlayerSprites()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int lightnum;
|
int lightnum;
|
||||||
|
@ -191,7 +182,7 @@ namespace swrenderer
|
||||||
|
|
||||||
if ((psp->GetID() != PSP_TARGETCENTER || CrosshairImage == nullptr) && psp->GetCaller() != nullptr)
|
if ((psp->GetID() != PSP_TARGETCENTER || CrosshairImage == nullptr) && psp->GetCaller() != nullptr)
|
||||||
{
|
{
|
||||||
R_DrawPSprite(psp, camera, bobx, boby, wx, wy, r_TicFracF, spriteshade);
|
Render(psp, camera, bobx, boby, wx, wy, r_TicFracF, spriteshade);
|
||||||
}
|
}
|
||||||
|
|
||||||
psp = psp->GetNext();
|
psp = psp->GetNext();
|
||||||
|
@ -201,7 +192,7 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac, int spriteshade)
|
void RenderPlayerSprite::Render(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac, int spriteshade)
|
||||||
{
|
{
|
||||||
double tx;
|
double tx;
|
||||||
int x1;
|
int x1;
|
||||||
|
@ -215,7 +206,6 @@ namespace swrenderer
|
||||||
vissprite_t* vis;
|
vissprite_t* vis;
|
||||||
bool noaccel;
|
bool noaccel;
|
||||||
double alpha = owner->Alpha;
|
double alpha = owner->Alpha;
|
||||||
static TArray<vissprite_t> avis;
|
|
||||||
|
|
||||||
if (avis.Size() < vispspindex + 1)
|
if (avis.Size() < vispspindex + 1)
|
||||||
avis.Reserve(avis.Size() - vispspindex + 1);
|
avis.Reserve(avis.Size() - vispspindex + 1);
|
||||||
|
@ -582,7 +572,7 @@ namespace swrenderer
|
||||||
RenderSprite::Render(vis, mfloorclip, mceilingclip);
|
RenderSprite::Render(vis, mfloorclip, mceilingclip);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_DrawRemainingPlayerSprites()
|
void RenderPlayerSprite::RenderRemainingPlayerSprites()
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < vispspindex; i++)
|
for (unsigned int i = 0; i < vispspindex; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,9 +20,32 @@
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
void R_SetupPlayerSpriteScale();
|
class RenderPlayerSprite
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void SetupSpriteScale();
|
||||||
|
|
||||||
void R_DrawPlayerSprites();
|
static void RenderPlayerSprites();
|
||||||
void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac, int spriteshade);
|
static void RenderRemainingPlayerSprites();
|
||||||
void R_DrawRemainingPlayerSprites();
|
|
||||||
|
private:
|
||||||
|
static void Render(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac, int spriteshade);
|
||||||
|
|
||||||
|
// Used to store a psprite's drawing information if it needs to be drawn later.
|
||||||
|
struct vispsp_t
|
||||||
|
{
|
||||||
|
vissprite_t *vis;
|
||||||
|
FDynamicColormap *basecolormap;
|
||||||
|
int x1;
|
||||||
|
};
|
||||||
|
|
||||||
|
static TArray<vispsp_t> vispsprites;
|
||||||
|
static unsigned int vispspindex;
|
||||||
|
|
||||||
|
static double pspritexscale;
|
||||||
|
static double pspritexiscale;
|
||||||
|
static double pspriteyscale;
|
||||||
|
|
||||||
|
static TArray<vissprite_t> avis;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -727,6 +727,6 @@ namespace swrenderer
|
||||||
clip3d->DeleteHeights();
|
clip3d->DeleteHeights();
|
||||||
clip3d->fake3D = 0;
|
clip3d->fake3D = 0;
|
||||||
}
|
}
|
||||||
R_DrawPlayerSprites();
|
RenderPlayerSprite::RenderPlayerSprites();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue