Move software renderer into its own namespace to isolate its globals and make

any access explicit. This reveals the places in the code where they are being
accessed where they shouldn't and prevents accidental usage.
This commit is contained in:
Magnus Norddahl 2016-12-01 02:38:32 +01:00
commit 9416d436fe
37 changed files with 231 additions and 157 deletions

View file

@ -56,12 +56,14 @@
#define WALLYREPEAT 8
CVAR(Bool, r_np2, true, 0)
CVAR(Bool, r_fogboundary, true, 0)
CVAR(Bool, r_drawmirrors, true, 0)
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
EXTERN_CVAR(Bool, r_mipmap)
//CVAR (Int, ty, 8, 0)
//CVAR (Int, tx, 8, 0)
namespace swrenderer
{
#define HEIGHTBITS 12
#define HEIGHTSHIFT (FRACBITS-HEIGHTBITS)
@ -142,16 +144,6 @@ void wallscan_np2(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t
static void wallscan_np2_ds(drawseg_t *ds, int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat);
static void call_wallscan(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, bool mask);
//=============================================================================
//
// CVAR r_fogboundary
//
// If true, makes fog look more "real" by shading the walls separating two
// sectors with different fog.
//=============================================================================
CVAR(Bool, r_fogboundary, true, 0)
inline bool IsFogBoundary (sector_t *front, sector_t *back)
{
return r_fogboundary && fixedcolormap == NULL && front->ColorMap->Fade &&
@ -159,14 +151,6 @@ inline bool IsFogBoundary (sector_t *front, sector_t *back)
(front->GetTexture(sector_t::ceiling) != skyflatnum || back->GetTexture(sector_t::ceiling) != skyflatnum);
}
//=============================================================================
//
// CVAR r_drawmirrors
//
// Set to false to disable rendering of mirrors
//=============================================================================
CVAR(Bool, r_drawmirrors, true, 0)
//
// R_RenderMaskedSegRange
@ -1065,7 +1049,6 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2)
return;
}
EXTERN_CVAR(Bool, r_mipmap)
struct WallscanSampler
{
@ -3162,3 +3145,5 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
done:
WallC = savecoord;
}
}