From ee2811450d90b750a71bc146313e474f98c6add7 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Wed, 11 Jan 2017 18:28:19 +0100 Subject: [PATCH] Convert r_wallsprite to a class --- src/swrenderer/scene/r_bsp.cpp | 2 +- src/swrenderer/things/r_visiblesprite.cpp | 2 +- src/swrenderer/things/r_wallsprite.cpp | 8 ++++---- src/swrenderer/things/r_wallsprite.h | 12 +++++++++--- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/swrenderer/scene/r_bsp.cpp b/src/swrenderer/scene/r_bsp.cpp index 9daaa78789..6faab056d1 100644 --- a/src/swrenderer/scene/r_bsp.cpp +++ b/src/swrenderer/scene/r_bsp.cpp @@ -867,7 +867,7 @@ namespace swrenderer { if ((sprite.renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE) { - R_ProjectWallSprite(thing, sprite.pos, sprite.picnum, sprite.spriteScale, sprite.renderflags, spriteshade); + RenderWallSprite::Project(thing, sprite.pos, sprite.picnum, sprite.spriteScale, sprite.renderflags, spriteshade); } else if (sprite.voxel) { diff --git a/src/swrenderer/things/r_visiblesprite.cpp b/src/swrenderer/things/r_visiblesprite.cpp index 8e5d7da117..a8241e99a0 100644 --- a/src/swrenderer/things/r_visiblesprite.cpp +++ b/src/swrenderer/things/r_visiblesprite.cpp @@ -599,7 +599,7 @@ namespace swrenderer } else { - R_DrawWallSprite(spr, clipbot, cliptop); + RenderWallSprite::Render(spr, clipbot, cliptop); } } else diff --git a/src/swrenderer/things/r_wallsprite.cpp b/src/swrenderer/things/r_wallsprite.cpp index 9ddd7bfd1f..7158197a14 100644 --- a/src/swrenderer/things/r_wallsprite.cpp +++ b/src/swrenderer/things/r_wallsprite.cpp @@ -59,7 +59,7 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor); namespace swrenderer { - void R_ProjectWallSprite(AActor *thing, const DVector3 &pos, FTextureID picnum, const DVector2 &scale, int renderflags, int spriteshade) + void RenderWallSprite::Project(AActor *thing, const DVector3 &pos, FTextureID picnum, const DVector2 &scale, int renderflags, int spriteshade) { FWallCoords wallc; double x1, x2; @@ -135,7 +135,7 @@ namespace swrenderer vis->wallc = wallc; } - void R_DrawWallSprite(vissprite_t *spr, const short *mfloorclip, const short *mceilingclip) + void RenderWallSprite::Render(vissprite_t *spr, const short *mfloorclip, const short *mceilingclip) { int x1, x2; double iyscale; @@ -223,7 +223,7 @@ namespace swrenderer R_SetColorMapLight(usecolormap, light, shade); } if (!R_ClipSpriteColumnWithPortals(x, spr)) - R_WallSpriteColumn(x, WallSpriteTile, maskedScaleY, sprflipvert, mfloorclip, mceilingclip); + DrawColumn(x, WallSpriteTile, maskedScaleY, sprflipvert, mfloorclip, mceilingclip); light += lightstep; x++; } @@ -231,7 +231,7 @@ namespace swrenderer R_FinishSetPatchStyle(); } - void R_WallSpriteColumn(int x, FTexture *WallSpriteTile, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip) + void RenderWallSprite::DrawColumn(int x, FTexture *WallSpriteTile, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip) { float iscale = swall[x] * maskedScaleY; double spryscale = 1 / iscale; diff --git a/src/swrenderer/things/r_wallsprite.h b/src/swrenderer/things/r_wallsprite.h index 2fe78a68e2..6e6793045c 100644 --- a/src/swrenderer/things/r_wallsprite.h +++ b/src/swrenderer/things/r_wallsprite.h @@ -17,7 +17,13 @@ namespace swrenderer { - void R_ProjectWallSprite(AActor *thing, const DVector3 &pos, FTextureID picnum, const DVector2 &scale, int renderflags, int spriteshade); - void R_DrawWallSprite(vissprite_t *spr, const short *mfloorclip, const short *mceilingclip); - void R_WallSpriteColumn(int x, FTexture *WallSpriteTile, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip); + class RenderWallSprite + { + public: + static void Project(AActor *thing, const DVector3 &pos, FTextureID picnum, const DVector2 &scale, int renderflags, int spriteshade); + static void Render(vissprite_t *spr, const short *mfloorclip, const short *mceilingclip); + + private: + static void DrawColumn(int x, FTexture *WallSpriteTile, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip); + }; }