diff --git a/src/swrenderer/r_main.cpp b/src/swrenderer/r_main.cpp index 630edc9aa..e6a67473f 100644 --- a/src/swrenderer/r_main.cpp +++ b/src/swrenderer/r_main.cpp @@ -345,7 +345,7 @@ void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight, WallTMapScale2 = IYaspectMul / CenterX; // psprite scales - R_SetupPlayerSpriteScale(); + RenderPlayerSprite::SetupSpriteScale(); // thing clipping fillshort (screenheightarray, viewwidth, (short)viewheight); diff --git a/src/swrenderer/r_swrenderer.cpp b/src/swrenderer/r_swrenderer.cpp index f08a2e026..7c6fc6b3f 100644 --- a/src/swrenderer/r_swrenderer.cpp +++ b/src/swrenderer/r_swrenderer.cpp @@ -294,7 +294,7 @@ void FSoftwareRenderer::DrawRemainingPlayerSprites() { if (!r_polyrenderer) { - R_DrawRemainingPlayerSprites(); + RenderPlayerSprite::RenderRemainingPlayerSprites(); } else { diff --git a/src/swrenderer/things/r_playersprite.cpp b/src/swrenderer/things/r_playersprite.cpp index dd86cafb8..07325bea3 100644 --- a/src/swrenderer/things/r_playersprite.cpp +++ b/src/swrenderer/things/r_playersprite.cpp @@ -63,32 +63,23 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor) namespace swrenderer { - namespace - { - // 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 RenderPlayerSprite::vispsprites; + unsigned int RenderPlayerSprite::vispspindex; - TArray vispsprites; - unsigned int vispspindex; + double RenderPlayerSprite::pspritexscale; + double RenderPlayerSprite::pspritexiscale; + double RenderPlayerSprite::pspriteyscale; - double pspritexscale; - double pspritexiscale; - double pspriteyscale; - } + TArray RenderPlayerSprite::avis; - void R_SetupPlayerSpriteScale() + void RenderPlayerSprite::SetupSpriteScale() { pspritexscale = centerxwide / 160.0; pspriteyscale = pspritexscale * YaspectMul; pspritexiscale = 1 / pspritexscale; } - void R_DrawPlayerSprites() + void RenderPlayerSprite::RenderPlayerSprites() { int i; int lightnum; @@ -191,7 +182,7 @@ namespace swrenderer 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(); @@ -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; int x1; @@ -215,7 +206,6 @@ namespace swrenderer vissprite_t* vis; bool noaccel; double alpha = owner->Alpha; - static TArray avis; if (avis.Size() < vispspindex + 1) avis.Reserve(avis.Size() - vispspindex + 1); @@ -582,7 +572,7 @@ namespace swrenderer RenderSprite::Render(vis, mfloorclip, mceilingclip); } - void R_DrawRemainingPlayerSprites() + void RenderPlayerSprite::RenderRemainingPlayerSprites() { for (unsigned int i = 0; i < vispspindex; i++) { diff --git a/src/swrenderer/things/r_playersprite.h b/src/swrenderer/things/r_playersprite.h index c1a4b53b1..0bf01fc65 100644 --- a/src/swrenderer/things/r_playersprite.h +++ b/src/swrenderer/things/r_playersprite.h @@ -20,9 +20,32 @@ namespace swrenderer { - void R_SetupPlayerSpriteScale(); + class RenderPlayerSprite + { + public: + static void SetupSpriteScale(); - void R_DrawPlayerSprites(); - void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac, int spriteshade); - void R_DrawRemainingPlayerSprites(); + static void RenderPlayerSprites(); + static void RenderRemainingPlayerSprites(); + + 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 vispsprites; + static unsigned int vispspindex; + + static double pspritexscale; + static double pspritexiscale; + static double pspriteyscale; + + static TArray avis; + }; } diff --git a/src/swrenderer/things/r_visiblesprite.cpp b/src/swrenderer/things/r_visiblesprite.cpp index a8241e99a..9f327003b 100644 --- a/src/swrenderer/things/r_visiblesprite.cpp +++ b/src/swrenderer/things/r_visiblesprite.cpp @@ -727,6 +727,6 @@ namespace swrenderer clip3d->DeleteHeights(); clip3d->fake3D = 0; } - R_DrawPlayerSprites(); + RenderPlayerSprite::RenderPlayerSprites(); } }