- add const qualifier on top/bottom clip arrays usage

This commit is contained in:
Magnus Norddahl 2018-03-08 00:55:37 +01:00
parent e51a1867df
commit a55be25a9d
4 changed files with 28 additions and 27 deletions

View file

@ -54,7 +54,7 @@
namespace swrenderer
{
void RenderFogBoundary::Render(RenderThread *thread, int x1, int x2, short *uclip, short *dclip, int wallshade, float lightleft, float lightstep, FDynamicColormap *basecolormap)
void RenderFogBoundary::Render(RenderThread *thread, int x1, int x2, const short *uclip, const short *dclip, int wallshade, float lightleft, float lightstep, FDynamicColormap *basecolormap)
{
// This is essentially the same as R_MapVisPlane but with an extra step
// to create new horizontal spans whenever the light changes enough that

View file

@ -31,7 +31,7 @@ namespace swrenderer
class RenderFogBoundary
{
public:
void Render(RenderThread *thread, int x1, int x2, short *uclip, short *dclip, int wallshade, float lightleft, float lightstep, FDynamicColormap *basecolormap);
void Render(RenderThread *thread, int x1, int x2, const short *uclip, const short *dclip, int wallshade, float lightleft, float lightstep, FDynamicColormap *basecolormap);
private:
void RenderSection(RenderThread *thread, int y, int y2, int x1);

View file

@ -130,8 +130,8 @@ namespace swrenderer
bool notrelevant = false;
if (ds->bFogBoundary)
{
short *mfloorclip = ds->sprbottomclip - ds->x1;
short *mceilingclip = ds->sprtopclip - ds->x1;
const short *mfloorclip = ds->sprbottomclip - ds->x1;
const short *mceilingclip = ds->sprtopclip - ds->x1;
RenderFogBoundary renderfog;
renderfog.Render(Thread, x1, x2, mceilingclip, mfloorclip, wallshade, rw_light, rw_lightstep, basecolormap);
@ -179,8 +179,8 @@ namespace swrenderer
tex = tex->GetRawTexture();
}
short *mfloorclip = ds->sprbottomclip - ds->x1;
short *mceilingclip = ds->sprtopclip - ds->x1;
const short *mfloorclip = ds->sprbottomclip - ds->x1;
const short *mceilingclip = ds->sprtopclip - ds->x1;
float *MaskedSWall = ds->swall - ds->x1;
float MaskedScaleY = ds->yscale;
@ -428,8 +428,8 @@ namespace swrenderer
rw_lightstep = ds->lightstep;
rw_light = ds->light + (x1 - ds->x1) * rw_lightstep;
short *mfloorclip = ds->sprbottomclip - ds->x1;
short *mceilingclip = ds->sprtopclip - ds->x1;
const short *mfloorclip = ds->sprbottomclip - ds->x1;
const short *mceilingclip = ds->sprtopclip - ds->x1;
//double spryscale = ds->iscale + ds->iscalestep * (x1 - ds->x1);
float *MaskedSWall = ds->swall - ds->x1;

View file

@ -62,10 +62,8 @@ namespace swrenderer
VisibleSprite *spr = this;
int i;
int x1, x2;
short topclip, botclip;
short *clip1, *clip2;
FSWColormap *colormap = spr->Light.BaseColormap;
int colormapnum = spr->Light.ColormapNum;
F3DFloor *rover;
@ -108,7 +106,7 @@ namespace swrenderer
}
sector_t *sec = nullptr;
FDynamicColormap *mybasecolormap = nullptr;
for (i = spr->sector->e->XFloor.lightlist.Size() - 1; i >= 0; i--)
for (int i = spr->sector->e->XFloor.lightlist.Size() - 1; i >= 0; i--)
{
if (clip3d->sclipTop <= spr->sector->e->XFloor.lightlist[i].plane.Zat0())
{
@ -281,14 +279,16 @@ namespace swrenderer
return;
}
i = x2 - x1;
clip1 = clipbot + x1;
clip2 = cliptop + x1;
do
{
*clip1++ = botclip;
*clip2++ = topclip;
} while (--i);
int i = x2 - x1;
short *clip1 = clipbot + x1;
short *clip2 = cliptop + x1;
do
{
*clip1++ = botclip;
*clip2++ = topclip;
} while (--i);
}
// Scan drawsegs from end to start for obscuring segs.
// The first drawseg that is closer than the sprite is the clip seg.
@ -338,9 +338,9 @@ namespace swrenderer
int r2 = MIN<int>(group.x2, x2);
// Clip bottom
clip1 = clipbot + r1;
clip2 = group.sprbottomclip + r1 - group.x1;
i = r2 - r1;
short *clip1 = clipbot + r1;
const short *clip2 = group.sprbottomclip + r1 - group.x1;
int i = r2 - r1;
do
{
if (*clip1 > *clip2)
@ -398,9 +398,9 @@ namespace swrenderer
if (ds->silhouette & SIL_BOTTOM) //bottom sil
{
clip1 = clipbot + r1;
clip2 = ds->sprbottomclip + r1 - ds->x1;
i = r2 - r1;
short *clip1 = clipbot + r1;
const short *clip2 = ds->sprbottomclip + r1 - ds->x1;
int i = r2 - r1;
do
{
if (*clip1 > *clip2)
@ -412,9 +412,9 @@ namespace swrenderer
if (ds->silhouette & SIL_TOP) // top sil
{
clip1 = cliptop + r1;
clip2 = ds->sprtopclip + r1 - ds->x1;
i = r2 - r1;
short *clip1 = cliptop + r1;
const short *clip2 = ds->sprtopclip + r1 - ds->x1;
int i = r2 - r1;
do
{
if (*clip1 < *clip2)
@ -438,6 +438,7 @@ namespace swrenderer
// If it is completely clipped away, don't bother drawing it.
if (cliptop[x2] >= clipbot[x2])
{
int i;
for (i = x1; i < x2; ++i)
{
if (cliptop[i] < clipbot[i])