Use more vars for multireads to vid.height and vid.width
This commit is contained in:
parent
ff467c676c
commit
f7378caf66
6 changed files with 75 additions and 60 deletions
|
|
@ -533,6 +533,8 @@ void R_FillBackScreen(void)
|
|||
UINT8 *src, *dest;
|
||||
patch_t *patch;
|
||||
INT32 x, y, step, boff;
|
||||
const INT32 vidheight = vid.height;
|
||||
const INT32 vidwidth = vid.width;
|
||||
|
||||
// quickfix, don't cache lumps in both modes
|
||||
if (rendermode != render_soft)
|
||||
|
|
@ -540,29 +542,29 @@ void R_FillBackScreen(void)
|
|||
|
||||
// draw pattern around the status bar too (when hires),
|
||||
// so return only when in full-screen without status bar.
|
||||
if (scaledviewwidth == vid.width && viewheight == vid.height)
|
||||
if (scaledviewwidth == vidwidth && viewheight == vidheight)
|
||||
return;
|
||||
|
||||
src = scr_borderpatch;
|
||||
dest = screens[1];
|
||||
|
||||
for (y = 0; y < vid.height; y++)
|
||||
for (y = 0; y < vidheight; y++)
|
||||
{
|
||||
for (x = 0; x < vid.width/128; x++)
|
||||
for (x = 0; x < vidwidth/128; x++)
|
||||
{
|
||||
M_Memcpy (dest, src+((y&127)<<7), 128);
|
||||
dest += 128;
|
||||
}
|
||||
|
||||
if (vid.width&127)
|
||||
if (vidwidth&127)
|
||||
{
|
||||
M_Memcpy(dest, src+((y&127)<<7), vid.width&127);
|
||||
dest += (vid.width&127);
|
||||
M_Memcpy(dest, src+((y&127)<<7), vidwidth&127);
|
||||
dest += (vidwidth&127);
|
||||
}
|
||||
}
|
||||
|
||||
// don't draw the borders when viewwidth is full vid.width.
|
||||
if (scaledviewwidth == vid.width)
|
||||
// don't draw the borders when viewwidth is full vidwidth.
|
||||
if (scaledviewwidth == vidwidth)
|
||||
return;
|
||||
|
||||
step = 8;
|
||||
|
|
@ -641,13 +643,13 @@ void R_DrawViewBorder(void)
|
|||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"RDVB: vidwidth %d vidheight %d scaledviewwidth %d viewheight %d\n",
|
||||
vid.width, vid.height, scaledviewwidth, viewheight);
|
||||
vid.width, vidheight, scaledviewwidth, viewheight);
|
||||
#endif
|
||||
|
||||
if (scaledviewwidth == vid.width)
|
||||
return;
|
||||
|
||||
top = (vid.height - viewheight)>>1;
|
||||
top = (vidheight - viewheight)>>1;
|
||||
side = (vid.width - scaledviewwidth)>>1;
|
||||
|
||||
// copy top and one line of left side
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||
{
|
||||
INT32 count;
|
||||
UINT8 *dest;
|
||||
const INT32 vidheight = vid.height;
|
||||
const INT32 vidwidth = vid.width;
|
||||
|
||||
count = dc->yh - dc->yl;
|
||||
|
|
@ -108,7 +109,7 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((unsigned)dc->x >= (unsigned)vidwidth || dc->yl < 0 || dc->yh >= vid.height)
|
||||
if ((unsigned)dc->x >= (unsigned)vidwidth || dc->yl < 0 || dc->yh >= vidheight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -349,6 +350,7 @@ void R_DrawFogColumn(drawcolumndata_t *dc)
|
|||
|
||||
INT32 count;
|
||||
UINT8 *dest;
|
||||
const INT32 vidheight = vid.height;
|
||||
const INT32 vidwidth = vid.width;
|
||||
|
||||
count = dc->yh - dc->yl;
|
||||
|
|
@ -357,7 +359,7 @@ void R_DrawFogColumn(drawcolumndata_t *dc)
|
|||
if (count < 0)
|
||||
return;
|
||||
|
||||
if ((unsigned)dc->x >= (unsigned)vidwidth || dc->yl < 0 || dc->yh >= vid.height)
|
||||
if ((unsigned)dc->x >= (unsigned)vidwidth || dc->yl < 0 || dc->yh >= vidheight)
|
||||
return;
|
||||
|
||||
// Framebuffer destination address.
|
||||
|
|
@ -417,6 +419,7 @@ void R_DrawColumn_Flat(drawcolumndata_t *dc)
|
|||
INT32 count;
|
||||
UINT8 color = dc->lightmap[dc->r8_flatcolor];
|
||||
UINT8 *dest;
|
||||
const INT32 vidheight = vid.height;
|
||||
const INT32 vidwidth = vid.width;
|
||||
|
||||
count = dc->yh - dc->yl;
|
||||
|
|
@ -424,7 +427,7 @@ void R_DrawColumn_Flat(drawcolumndata_t *dc)
|
|||
if (count < 0) // Zero length, column does not exceed a pixel.
|
||||
return;
|
||||
|
||||
if ((unsigned)dc->x >= (unsigned)vidwidth || dc->yl < 0 || dc->yh >= vid.height)
|
||||
if ((unsigned)dc->x >= (unsigned)vidwidth || dc->yl < 0 || dc->yh >= vidheight)
|
||||
return;
|
||||
|
||||
// Framebuffer destination address.
|
||||
|
|
|
|||
|
|
@ -568,12 +568,14 @@ void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop)
|
|||
static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(drawspandata_t*), INT32, INT32, INT32, boolean), spandrawfunc_t* spanfunc, drawspandata_t* ds, INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2, boolean allow_parallel)
|
||||
{
|
||||
ZoneScoped;
|
||||
const INT32 vidheight = vid.height;
|
||||
const INT32 vidwidth = vid.width;
|
||||
// Alam: from r_splats's R_RasterizeFloorSplat
|
||||
if (t1 >= vid.height) t1 = vid.height-1;
|
||||
if (b1 >= vid.height) b1 = vid.height-1;
|
||||
if (t2 >= vid.height) t2 = vid.height-1;
|
||||
if (b2 >= vid.height) b2 = vid.height-1;
|
||||
if (x-1 >= vid.width) x = vid.width;
|
||||
if (t1 >= vidheight) t1 = vidheight-1;
|
||||
if (b1 >= vidheight) b1 = vidheight-1;
|
||||
if (t2 >= vidheight) t2 = vidheight-1;
|
||||
if (b2 >= vidheight) b2 = vidheight-1;
|
||||
if (x-1 >= vidwidth) x = vidwidth;
|
||||
|
||||
// We want to draw N spans per subtask to ensure the work is
|
||||
// coarse enough to not be too slow due to task scheduling overhead.
|
||||
|
|
@ -942,12 +944,13 @@ d.z = (v1.x * v2.y) - (v1.y * v2.x)
|
|||
|
||||
void R_SetTiltedSpan(drawspandata_t* ds, INT32 span)
|
||||
{
|
||||
const INT32 vidheight = vid.height;
|
||||
if (ds_su == NULL)
|
||||
ds_su = static_cast<floatv3_t*>(Z_Calloc(sizeof(*ds_su) * vid.height, PU_STATIC, NULL));
|
||||
ds_su = static_cast<floatv3_t*>(Z_Calloc(sizeof(*ds_su) * vidheight, PU_STATIC, NULL));
|
||||
if (ds_sv == NULL)
|
||||
ds_sv = static_cast<floatv3_t*>(Z_Calloc(sizeof(*ds_sv) * vid.height, PU_STATIC, NULL));
|
||||
ds_sv = static_cast<floatv3_t*>(Z_Calloc(sizeof(*ds_sv) * vidheight, PU_STATIC, NULL));
|
||||
if (ds_sz == NULL)
|
||||
ds_sz = static_cast<floatv3_t*>(Z_Calloc(sizeof(*ds_sz) * vid.height, PU_STATIC, NULL));
|
||||
ds_sz = static_cast<floatv3_t*>(Z_Calloc(sizeof(*ds_sz) * vidheight, PU_STATIC, NULL));
|
||||
|
||||
ds->sup = ds_su[span];
|
||||
ds->svp = ds_sv[span];
|
||||
|
|
@ -1000,6 +1003,7 @@ void R_DrawSinglePlane(drawspandata_t *ds, visplane_t *pl, boolean allow_paralle
|
|||
debugrender_highlight_t debug = debugrender_highlight_t::SW_HI_PLANES;
|
||||
void (*mapfunc)(drawspandata_t*, void(*)(drawspandata_t*), INT32, INT32, INT32, boolean) = R_MapPlane;
|
||||
INT16 highlight;
|
||||
const INT32 vidwidth = vid.width;
|
||||
|
||||
if (!(pl->minx <= pl->maxx))
|
||||
return;
|
||||
|
|
@ -1134,13 +1138,13 @@ void R_DrawSinglePlane(drawspandata_t *ds, visplane_t *pl, boolean allow_paralle
|
|||
}
|
||||
}
|
||||
|
||||
offset = (scry*vid.width) + scrx;
|
||||
offset = (scry*vidwidth) + scrx;
|
||||
|
||||
// No idea if this works
|
||||
VID_BlitLinearScreen(screens[0] + offset,
|
||||
screens[1] + (top*vid.width), // intentionally not +offset
|
||||
screens[1] + (top*vidwidth), // intentionally not +offset
|
||||
viewwidth, bottom-top,
|
||||
vid.width, vid.width);
|
||||
vidwidth, vidwidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ void R_ClearSegTables(void)
|
|||
static void R_Render2sidedMultiPatchColumn(drawcolumndata_t* dc, column_t *column, column_t *brightmap, INT32 baseclip)
|
||||
{
|
||||
INT32 topscreen, bottomscreen;
|
||||
const INT32 vidheight = vid.height;
|
||||
|
||||
topscreen = sprtopscreen; // + spryscale*column->topdelta; topdelta is 0 for the wall
|
||||
bottomscreen = topscreen + spryscale * lengthcol;
|
||||
|
|
@ -141,10 +142,10 @@ static void R_Render2sidedMultiPatchColumn(drawcolumndata_t* dc, column_t *colum
|
|||
if (dc->yh >= baseclip && baseclip != -1)
|
||||
dc->yh = baseclip;
|
||||
|
||||
if (dc->yl >= vid.height || dc->yh < 0)
|
||||
if (dc->yl >= vidheight || dc->yh < 0)
|
||||
return;
|
||||
|
||||
if (dc->yl <= dc->yh && dc->yh < vid.height && dc->yh > 0)
|
||||
if (dc->yl <= dc->yh && dc->yh < vidheight && dc->yh > 0)
|
||||
{
|
||||
dc->source = (UINT8 *)column + 3;
|
||||
dc->sourcelength = lengthcol;
|
||||
|
|
|
|||
|
|
@ -313,6 +313,7 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
|
|||
fixed_t planeheight = 0;
|
||||
fixed_t step;
|
||||
drawspandata_t ds = {0};
|
||||
const INT32 vidheight = vid.height;
|
||||
|
||||
int spanfunctype = SPANDRAWFUNC_SPRITE;
|
||||
|
||||
|
|
@ -337,13 +338,13 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
|
|||
} \
|
||||
ry1 = 0; \
|
||||
} \
|
||||
if (ry1 >= vid.height) { \
|
||||
if (ry1 >= vidheight) { \
|
||||
if (step) { \
|
||||
x1 <<= FRACBITS; \
|
||||
x1 -= (vid.height-1-ry1)*step; \
|
||||
x1 -= (vidheight-1-ry1)*step; \
|
||||
x1 >>= FRACBITS; \
|
||||
} \
|
||||
ry1 = vid.height - 1; \
|
||||
ry1 = vidheight - 1; \
|
||||
} \
|
||||
if (y2 < 0) { \
|
||||
if (step) { \
|
||||
|
|
@ -353,13 +354,13 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
|
|||
} \
|
||||
y2 = 0; \
|
||||
} \
|
||||
if (y2 >= vid.height) { \
|
||||
if (y2 >= vidheight) { \
|
||||
if (step) { \
|
||||
x2 <<= FRACBITS; \
|
||||
x2 += (vid.height-1-y2)*step; \
|
||||
x2 += (vidheight-1-y2)*step; \
|
||||
x2 >>= FRACBITS; \
|
||||
} \
|
||||
y2 = vid.height - 1; \
|
||||
y2 = vidheight - 1; \
|
||||
} \
|
||||
rasterize_segment_tex(x1, ry1, x2, y2, tv1, tv2, tc, dir); \
|
||||
if (ry1 < miny) \
|
||||
|
|
@ -446,8 +447,8 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
|
|||
|
||||
R_SetSpanFunc(spanfunctype, !ds.powersoftwo, false);
|
||||
|
||||
if (maxy >= vid.height)
|
||||
maxy = vid.height-1;
|
||||
if (maxy >= vidheight)
|
||||
maxy = vidheight-1;
|
||||
|
||||
for (y = miny; y <= maxy; y++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -672,6 +672,7 @@ void R_DrawMaskedColumn(drawcolumndata_t* dc, column_t *column, column_t *bright
|
|||
INT32 bottomscreen;
|
||||
fixed_t basetexturemid;
|
||||
INT32 topdelta, prevdelta = 0;
|
||||
const INT32 vidheight = vid.height;
|
||||
|
||||
basetexturemid = dc->texturemid;
|
||||
|
||||
|
|
@ -707,8 +708,8 @@ void R_DrawMaskedColumn(drawcolumndata_t* dc, column_t *column, column_t *bright
|
|||
|
||||
if (dc->yl < 0)
|
||||
dc->yl = 0;
|
||||
if (dc->yh >= vid.height) // dc_yl must be < vid.height, so reduces number of checks in tight loop
|
||||
dc->yh = vid.height - 1;
|
||||
if (dc->yh >= vidheight) // dc_yl must be < vid.height, so reduces number of checks in tight loop
|
||||
dc->yh = vidheight - 1;
|
||||
|
||||
if (dc->yh >= baseclip && baseclip != -1)
|
||||
dc->yh = baseclip;
|
||||
|
|
@ -759,6 +760,7 @@ void R_DrawFlippedMaskedColumn(drawcolumndata_t* dc, column_t *column, column_t
|
|||
fixed_t basetexturemid = dc->texturemid;
|
||||
INT32 topdelta, prevdelta = -1;
|
||||
UINT8 *d,*s;
|
||||
const INT32 vidheight = vid.height;
|
||||
|
||||
R_SetColumnFunc(colfunctype, brightmap != NULL);
|
||||
dc->brightmap = NULL;
|
||||
|
|
@ -797,8 +799,8 @@ void R_DrawFlippedMaskedColumn(drawcolumndata_t* dc, column_t *column, column_t
|
|||
|
||||
if (dc->yl < 0)
|
||||
dc->yl = 0;
|
||||
if (dc->yh >= vid.height) // dc_yl must be < vid.height, so reduces number of checks in tight loop
|
||||
dc->yh = vid.height - 1;
|
||||
if (dc->yh >= vidheight) // dc_yl must be < vid.height, so reduces number of checks in tight loop
|
||||
dc->yh = vidheight - 1;
|
||||
|
||||
if (dc->yl <= dc->yh && dc->yh > 0 && column->length != 0)
|
||||
{
|
||||
|
|
@ -921,6 +923,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
INT64 overflow_test;
|
||||
INT32 baseclip = -1;
|
||||
drawcolumndata_t dc {0};
|
||||
const INT32 vidwidth = vid.width;
|
||||
|
||||
if (!patch)
|
||||
return;
|
||||
|
|
@ -976,22 +979,22 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
dc.shadowcolor = vis->color;
|
||||
}
|
||||
else if (!(vis->cut & SC_PRECIP) &&
|
||||
R_ThingIsFlashing(vis->mobj)) // Bosses "flash"
|
||||
{
|
||||
R_SetColumnFunc(COLDRAWFUNC_TRANS, false); // translate certain pixels to white
|
||||
}
|
||||
else if (vis->transmap && dc.translation) // Color mapping
|
||||
{
|
||||
R_SetColumnFunc(COLDRAWFUNC_TRANSTRANS, false);
|
||||
dc.transmap = vis->transmap;
|
||||
}
|
||||
else if (vis->transmap)
|
||||
{
|
||||
R_SetColumnFunc(COLDRAWFUNC_FUZZY, false);
|
||||
dc.transmap = vis->transmap; //Fab : 29-04-98: translucency table
|
||||
}
|
||||
else if (dc.translation) // translate green skin to another color
|
||||
R_SetColumnFunc(COLDRAWFUNC_TRANS, false);
|
||||
R_ThingIsFlashing(vis->mobj)) // Bosses "flash"
|
||||
{
|
||||
R_SetColumnFunc(COLDRAWFUNC_TRANS, false); // translate certain pixels to white
|
||||
}
|
||||
else if (vis->transmap && dc.translation) // Color mapping
|
||||
{
|
||||
R_SetColumnFunc(COLDRAWFUNC_TRANSTRANS, false);
|
||||
dc.transmap = vis->transmap;
|
||||
}
|
||||
else if (vis->transmap)
|
||||
{
|
||||
R_SetColumnFunc(COLDRAWFUNC_FUZZY, false);
|
||||
dc.transmap = vis->transmap; //Fab : 29-04-98: translucency table
|
||||
}
|
||||
else if (dc.translation) // translate green skin to another color
|
||||
R_SetColumnFunc(COLDRAWFUNC_TRANS, false);
|
||||
|
||||
if (vis->extra_colormap && !(vis->cut & SC_FULLBRIGHT) && !(vis->renderflags & RF_NOCOLORMAPS))
|
||||
{
|
||||
|
|
@ -1062,8 +1065,8 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
vis->x1 = 0;
|
||||
}
|
||||
|
||||
if (vis->x2 >= vid.width)
|
||||
vis->x2 = vid.width-1;
|
||||
if (vis->x2 >= vidwidth)
|
||||
vis->x2 = vidwidth-1;
|
||||
|
||||
localcolfunc = (vis->cut & SC_VFLIP) ? R_DrawFlippedMaskedColumn : R_DrawMaskedColumn;
|
||||
lengthcol = patch->height;
|
||||
|
|
@ -1128,8 +1131,8 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
if (x1test < 0)
|
||||
x1test = 0;
|
||||
|
||||
if (x2test >= vid.width)
|
||||
x2test = vid.width-1;
|
||||
if (x2test >= vidwidth)
|
||||
x2test = vidwidth-1;
|
||||
|
||||
const INT32 t = (vis->startfrac + (vis->xiscale * (x2test - x1test))) >> FRACBITS;
|
||||
|
||||
|
|
@ -1171,6 +1174,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
|
|||
fixed_t this_scale = vis->thingscale;
|
||||
INT64 overflow_test;
|
||||
drawcolumndata_t dc {0};
|
||||
const INT32 vidwidth = vid.width;
|
||||
|
||||
//Fab : R_InitSprites now sets a wad lump number
|
||||
patch = vis->patch;
|
||||
|
|
@ -1210,8 +1214,8 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
|
|||
if (vis->x1 < 0)
|
||||
vis->x1 = 0;
|
||||
|
||||
if (vis->x2 >= vid.width)
|
||||
vis->x2 = vid.width-1;
|
||||
if (vis->x2 >= vidwidth)
|
||||
vis->x2 = vidwidth-1;
|
||||
|
||||
for (dc.x = vis->x1; dc.x <= vis->x2; dc.x++, frac += vis->xiscale)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue