Merge pull request 'remove ylookup, columnofs and topleft' (#171) from murderylookupcolumntopleft into blankart-dev

Reviewed-on: https://codeberg.org/NepDisk/blankart/pulls/171
This commit is contained in:
NepDisk 2025-10-19 16:43:15 +02:00
commit 8288b6779f
20 changed files with 181 additions and 339 deletions

View file

@ -345,7 +345,7 @@ static void AM_FrameBufferInit(void)
f_x = f_y = 0;
f_w = vid.width;
f_h = vid.height;
am_buf = screens[0];
am_buf = vid.screens[0];
}
//

View file

@ -293,7 +293,6 @@ boolean D_RenderLevel(void)
viewwindowy = 0;
viewwindowx = 0;
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
objectsdrawn = 0;
ps_rendercalltime = I_GetPreciseTime();
@ -305,12 +304,12 @@ boolean D_RenderLevel(void)
if (cv_homremoval.value == 1)
{
// Clear the software screen buffer to remove HOM
memset(screens[0], 31, vid.width * vid.height * vid.bpp);
memset(vid.screens[0], 31, vid.width * vid.height);
}
else
{
//'development' HOM removal -- makes it blindingly obvious if HOM is spotted.
memset(screens[0], 32+(timeinmap&15), vid.width * vid.height * vid.bpp);
memset(vid.screens[0], 32+(timeinmap&15), vid.width * vid.height);
}
}
@ -357,29 +356,20 @@ boolean D_RenderLevel(void)
viewwindowx = 0;
viewwindowy = viewheight;
}
M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0]));
break;
case 2:
viewwindowx = 0;
viewwindowy = viewheight;
M_Memcpy(ylookup, ylookup3, viewheight*sizeof (ylookup[0]));
break;
case 3:
viewwindowx = viewwidth;
viewwindowy = viewheight;
M_Memcpy(ylookup, ylookup4, viewheight*sizeof (ylookup[0]));
default:
break;
}
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
}
R_RenderPlayerView();
if (i > 0)
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
}
}
}
@ -658,7 +648,7 @@ static void D_Display(void)
V_DrawFadeScreen(TC_RAINBOW, (leveltime & 0x20) ? SKINCOLOR_PASTEL : SKINCOLOR_MOONSLAM);
// vid size change is now finished if it was on...
vid.recalc = 0;
vid.recalc = false;
#ifdef HAVE_THREADS
I_lock_mutex(&m_menu_mutex);

View file

@ -317,7 +317,7 @@ void F_WipeStartScreen(void)
return;
}
#endif
wipe_scr_start = screens[3];
wipe_scr_start = vid.screens[3];
I_ReadScreen(wipe_scr_start, 1);
#endif
}
@ -334,7 +334,7 @@ void F_WipeEndScreen(void)
return;
}
#endif
wipe_scr_end = screens[4];
wipe_scr_end = vid.screens[4];
I_ReadScreen(wipe_scr_end, 1);
V_DrawBlock(0, 0, 0, vid.width, vid.height, wipe_scr_start);
#endif
@ -364,7 +364,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
paldiv = FixedDiv(257<<FRACBITS, 11<<FRACBITS);
// Init the wipe
wipe_scr = screens[0];
wipe_scr = vid.screens[0];
D_WipeLoop(WIPELOOP_RUNWIPE, wipetype, drawMenu);
#endif

View file

@ -88,12 +88,12 @@ void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option)
pdupx = pdupy = 2.0f;
break;
case V_SMALLSCALEPATCH:
pdupx = 2.0f * FIXED_TO_FLOAT(vid.fsmalldupx);
pdupy = 2.0f * FIXED_TO_FLOAT(vid.fsmalldupy);
pdupx = 2.0f * FIXED_TO_FLOAT(vid.smalldupx*FRACUNIT);
pdupy = 2.0f * FIXED_TO_FLOAT(vid.smalldupy*FRACUNIT);
break;
case V_MEDSCALEPATCH:
pdupx = 2.0f * FIXED_TO_FLOAT(vid.fmeddupx);
pdupy = 2.0f * FIXED_TO_FLOAT(vid.fmeddupy);
pdupx = 2.0f * FIXED_TO_FLOAT(vid.meddupx*FRACUNIT);
pdupy = 2.0f * FIXED_TO_FLOAT(vid.meddupx*FRACUNIT);
break;
}

View file

@ -1300,7 +1300,7 @@ void M_SaveFrame(void)
if (rendermode == render_soft)
{
// munge planar buffer to linear
linear = screens[2];
linear = vid.screens[2];
I_ReadScreen(linear, 1);
}
#ifdef HWRENDER
@ -1613,7 +1613,7 @@ void M_DoScreenShot(void)
if (rendermode == render_soft)
{
// munge planar buffer to linear
linear = screens[2];
linear = vid.screens[2];
I_ReadScreen(linear, 1);
M_CreateScreenShotPalette();
palette = screenshot_palette;

View file

@ -68,7 +68,7 @@ raster_bbox_seg
while (y < h)
{
topleft[x + y * vid.width] = pixel;
*R_Address(x, y) = pixel;
y++;
}
}

View file

@ -1177,7 +1177,7 @@ typedef struct
//
// Water ripple effect
// Needs the height of the plane, and the vertical position of the span.
// Sets planeripple.xfrac and planeripple.yfrac, added to ds_xfrac and ds_yfrac, if the span is not tilted.
// Sets planeripple.xfrac and planeripple.yfrac, added to ds->xfrac and ds->yfrac, if the span is not tilted.
//
struct
{

View file

@ -66,34 +66,9 @@ drawspandata_t g_ds;
/** \brief view info
*/
INT32 viewwidth, scaledviewwidth, viewheight, viewwindowx, viewwindowy;
/** \brief pointer to the start of each line of the screen,
*/
UINT8 *ylookup[MAXVIDHEIGHT*4];
/** \brief pointer to the start of each line of the screen, for view1 (splitscreen)
*/
UINT8 *ylookup1[MAXVIDHEIGHT*4];
/** \brief pointer to the start of each line of the screen, for view2 (splitscreen)
*/
UINT8 *ylookup2[MAXVIDHEIGHT*4];
/** \brief pointer to the start of each line of the screen, for view3 (splitscreen)
*/
UINT8 *ylookup3[MAXVIDHEIGHT*4];
/** \brief pointer to the start of each line of the screen, for view4 (splitscreen)
*/
UINT8 *ylookup4[MAXVIDHEIGHT*4];
/** \brief x byte offset for columns inside the viewwindow,
so the first column starts at (SCRWIDTH - VIEWWIDTH)/2
*/
INT32 columnofs[MAXVIDWIDTH*4];
UINT8 *topleft;
INT32 linesize, viewwidth, scaledviewwidth, viewheight, viewwindowx, viewwindowy;
UINT8 *renderscreen; // haleyjd
UINT8 r8_flatcolor;
@ -474,33 +449,16 @@ UINT16 R_GetSuperColorByName(const char *name)
void R_InitViewBuffer(INT32 width, INT32 height)
{
INT32 i, bytesperpixel = vid.bpp;
if (width > MAXVIDWIDTH)
width = MAXVIDWIDTH;
if (height > MAXVIDHEIGHT)
height = MAXVIDHEIGHT;
if (bytesperpixel < 1 || bytesperpixel > 4)
I_Error("R_InitViewBuffer: wrong bytesperpixel value %d\n", bytesperpixel);
viewwindowx = 0;
viewwindowy = 0;
// Column offset for those columns of the view window, but relative to the entire screen
for (i = 0; i < width; i++)
columnofs[i] = (viewwindowx + i) * bytesperpixel;
// Precalculate all row offsets.
for (i = 0; i < height; i++)
{
ylookup[i] = ylookup1[i] = screens[0] + i*vid.width*bytesperpixel;
if (r_splitscreen == 1)
ylookup2[i] = screens[0] + (i+viewheight)*vid.width*bytesperpixel;
else
ylookup2[i] = screens[0] + i*vid.width*bytesperpixel + (viewwidth*bytesperpixel);
ylookup3[i] = screens[0] + (i+viewheight)*vid.width*bytesperpixel;
ylookup4[i] = screens[0] + (i+viewheight)*vid.width*bytesperpixel + (viewwidth*bytesperpixel);
}
linesize = vid.width; // killough 11/98
renderscreen = vid.screens[0]; // haleyjd 07/02/14
}
/** \brief viewborder patches lump numbers
@ -522,6 +480,50 @@ void R_InitViewBorder(void)
viewborderlump[BRDR_BR] = W_GetNumForName("brdr_br");
}
/** \brief The R_VideoErase function
*
*
*
*
*
*
* Copy a screen buffer.
*
*
*
*
*
* \param ofs offest from buffer
*
*
* \param count bytes to erase
*
*
*
*
*
* \return void
*
*
*
*
*
*
*
*
*/
void R_VideoErase(size_t ofs, INT32 count)
{
// LFB copy.
// This might not be a good idea if memcpy
// is not optimal, e.g. byte by byte on
// a 32bit CPU, as GNU GCC/Linux libc did
// at one point.
M_Memcpy(vid.screens[0] + ofs, vid.screens[1] + ofs, count);
}
#if 0
/** \brief R_FillBackScreen
@ -546,7 +548,7 @@ void R_FillBackScreen(void)
return;
src = scr_borderpatch;
dest = screens[1];
dest = vid.screens[1];
for (y = 0; y < vidheight; y++)
{
@ -597,30 +599,7 @@ void R_FillBackScreen(void)
V_DrawPatch(viewwindowx + scaledviewwidth, viewwindowy + viewheight, 1,
W_CacheLumpNum(viewborderlump[BRDR_BR], PU_CACHE));
}
#endif
/** \brief The R_VideoErase function
Copy a screen buffer.
\param ofs offest from buffer
\param count bytes to erase
\return void
*/
void R_VideoErase(size_t ofs, INT32 count)
{
// LFB copy.
// This might not be a good idea if memcpy
// is not optimal, e.g. byte by byte on
// a 32bit CPU, as GNU GCC/Linux libc did
// at one point.
M_Memcpy(screens[0] + ofs, screens[1] + ofs, count);
}
#if 0
/** \brief The R_DrawViewBorder
Draws the border around the view
@ -664,7 +643,7 @@ void R_DrawViewBorder(void)
side <<= 1;
// simpler using our VID_Blit routine
VID_BlitLinearScreen(screens[1] + ofs, screens[0] + ofs, side, viewheight - 1,
VID_BlitLinearScreen(vid.screens[1] + ofs, vid.screens[0] + ofs, side, viewheight - 1,
vid.width, vid.width);
}
#endif

View file

@ -23,13 +23,13 @@ extern "C" {
// -------------------------------
// COMMON STUFF FOR 8bpp AND 16bpp
// -------------------------------
extern UINT8 *ylookup[MAXVIDHEIGHT*4];
extern UINT8 *ylookup1[MAXVIDHEIGHT*4];
extern UINT8 *ylookup2[MAXVIDHEIGHT*4];
extern UINT8 *ylookup3[MAXVIDHEIGHT*4];
extern UINT8 *ylookup4[MAXVIDHEIGHT*4];
extern INT32 columnofs[MAXVIDWIDTH*4];
extern UINT8 *topleft;
extern UINT8 *renderscreen;
extern INT32 linesize;
FUNCINLINE static ATTRINLINE UINT8 *R_Address(INT32 px, INT32 py)
{
return renderscreen + (py + viewwindowy) * linesize + (viewwindowx + px);
}
extern UINT8 r8_flatcolor;
// -------------------------

View file

@ -208,11 +208,8 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
INT32 npow2max;
// Framebuffer destination address.
// Use ylookup LUT to avoid multiply with ScreenWidth.
// Use columnofs LUT for subwindows?
//dest = ylookup[dc_yl] + columnofs[dc_x];
dest = &topleft[dc->yl * vidwidth + dc->x];
dest = R_Address(dc->x, dc->yl);
count++;
@ -363,10 +360,7 @@ void R_DrawFogColumn(drawcolumndata_t *dc)
return;
// Framebuffer destination address.
// Use ylookup LUT to avoid multiply with ScreenWidth.
// Use columnofs LUT for subwindows?
//dest = ylookup[dc_yl] + columnofs[dc_x];
dest = &topleft[dc->yl*vidwidth + dc->x];
dest = R_Address(dc->x, dc->yl);
// Determine scaling, which is the only mapping to be done.
do
@ -397,7 +391,7 @@ void R_DrawDropShadowColumn(drawcolumndata_t *dc)
if (count <= 0) // Zero length, column does not exceed a pixel.
return;
dest = &topleft[dc->yl*vidwidth + dc->x];
dest = R_Address(dc->x, dc->yl);
const UINT8 *transmap_offset = dc->transmap + (dc->shadowcolor << 8);
while ((count -= 2) >= 0)
@ -431,11 +425,7 @@ void R_DrawColumn_Flat(drawcolumndata_t *dc)
return;
// Framebuffer destination address.
// Use ylookup LUT to avoid multiply with ScreenWidth.
// Use columnofs LUT for subwindows?
//dest = ylookup[dc_yl] + columnofs[dc_x];
dest = &topleft[dc->yl*vidwidth + dc->x];
dest = R_Address(dc->x, dc->yl);
count++;

View file

@ -149,7 +149,7 @@ static void R_DrawSpanTemplate(drawspandata_t* ds)
UINT8 *dsrc;
const INT32 vidwidth = vid.width;
const UINT8 * restrict deststop = screens[0] + vid.rowbytes * vid.height;
const UINT8 * restrict deststop = vid.screens[0] + vid.rowbytes * vid.height;
size_t count = (ds->x2 - ds->x1 + 1);
size_t i;
@ -172,10 +172,10 @@ static void R_DrawSpanTemplate(drawspandata_t* ds)
xposition <<= ds->nflatshiftup; yposition <<= ds->nflatshiftup;
xstep <<= ds->nflatshiftup; ystep <<= ds->nflatshiftup;
dest = ylookup[ds->y] + columnofs[ds->x1];
dest = R_Address(ds->x1, ds->y);
if constexpr (Type & DS_RIPPLE)
{
dsrc = screens[1] + (ds->y + ds->bgofs) * vidwidth + ds->x1;
dsrc = vid.screens[1] + (ds->y + ds->bgofs) * vidwidth + ds->x1;
}
else
{
@ -254,14 +254,14 @@ static void R_CalcTiltedLighting(INT32 *lightbuffer, INT32 x1, INT32 x2, fixed_t
template<DrawSpanType Type>
static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
{
// x1, x2 = ds_x1, ds_x2
// x1, x2 = ds->x1, ds_x2
int width = ds->x2 - ds->x1;
float iz, uz, vz;
UINT32 u, v;
int i;
UINT8 *colormap;
UINT8 *dest;
UINT8 *dest = R_Address(ds->x1, ds->y);
UINT8 *dsrc;
const INT32 vidwidth = vid.width;
@ -297,10 +297,9 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
colormap = ds->colormap;
dest = ylookup[ds->y] + columnofs[ds->x1];
if constexpr (Type & DS_RIPPLE)
{
dsrc = screens[1] + (ds->y + ds->bgofs) * vidwidth + ds->x1;
dsrc = vid.screens[1] + (ds->y + ds->bgofs) * vidwidth + ds->x1;
}
else
{
@ -437,10 +436,10 @@ static void R_DrawNPO2SpanTemplate(drawspandata_t* ds)
fixed_t x, y;
fixed_t fixedwidth, fixedheight;
UINT8 *dest;
UINT8 *dest = R_Address(ds->x1, ds->y);
UINT8 *dsrc;
const INT32 vidwidth = vid.width;
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
const UINT8 *deststop = vid.screens[0] + vid.rowbytes * vid.height;
size_t count = (ds->x2 - ds->x1 + 1);
@ -452,11 +451,9 @@ static void R_DrawNPO2SpanTemplate(drawspandata_t* ds)
yposition += ds->waterofs;
}
dest = ylookup[ds->y] + columnofs[ds->x1];
if constexpr (Type & DS_RIPPLE)
{
dsrc = screens[1] + (ds->y + ds->bgofs) * vidwidth + ds->x1;
dsrc = vid.screens[1] + (ds->y + ds->bgofs) * vidwidth + ds->x1;
}
else
{
@ -515,7 +512,7 @@ static void R_DrawNPO2SpanTemplate(drawspandata_t* ds)
template<DrawSpanType Type>
static void R_DrawTiltedNPO2SpanTemplate(drawspandata_t* ds)
{
// x1, x2 = ds_x1, ds_x2
// x1, x2 = ds->x1, ds_x2
int width = ds->x2 - ds->x1;
float iz, uz, vz;
UINT32 u, v;
@ -555,11 +552,11 @@ static void R_DrawTiltedNPO2SpanTemplate(drawspandata_t* ds)
colormap = ds->colormap;
dest = ylookup[ds->y] + columnofs[ds->x1];
dest = R_Address(ds->x1, ds->y);
if constexpr (Type & DS_RIPPLE)
{
dsrc = screens[1] + (ds->y + ds->bgofs) * vidwidth + ds->x1;
dsrc = vid.screens[1] + (ds->y + ds->bgofs) * vidwidth + ds->x1;
}
else
{
@ -779,8 +776,7 @@ void R_DrawFogSpan(drawspandata_t* ds)
colormap = ds->colormap;
//dest = ylookup[ds_y] + columnofs[ds_x1];
dest = &topleft[ds->y *vidwidth + ds->x1];
dest = R_Address(ds->x1, ds->y);
count = ds->x2 - ds->x1 + 1;
@ -806,12 +802,12 @@ void R_DrawFogSpan_Tilted(drawspandata_t* ds)
{
ZoneScoped;
// x1, x2 = ds_x1, ds_x2
// x1, x2 = ds->x1, ds_x2
int width = ds->x2 - ds->x1;
double iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
INT32 tiltlighting[MAXVIDWIDTH];
UINT8 *dest = ylookup[ds->y] + columnofs[ds->x1];
UINT8 *dest = R_Address(ds->x1, ds->y);
const INT32 vidwidth = vid.width;
// Lighting is simple. It's just linear interpolation from start to end
@ -839,7 +835,7 @@ void R_DrawSpan_Flat(drawspandata_t* ds)
{
ZoneScoped;
UINT8 *dest = ylookup[ds->y] + columnofs[ds->x1];
UINT8 *dest = R_Address(ds->x1, ds->y);
memset(dest, ds->colormap[ds->r8_flatcolor], (ds->x2 - ds->x1) + 1);
}
@ -847,13 +843,13 @@ void R_DrawTiltedSpan_Flat(drawspandata_t* ds)
{
ZoneScoped;
// x1, x2 = ds_x1, ds_x2
// x1, x2 = ds->x1, ds_x2
int width = ds->x2 - ds->x1;
double iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
INT32 tiltlighting[MAXVIDWIDTH];
const INT32 vidwidth = vid.width;
UINT8 *dest = ylookup[ds->y];
UINT8 *dest = R_Address(ds->x1, ds->y);
// Lighting is simple. It's just linear interpolation from start to end
{

View file

@ -862,8 +862,8 @@ void R_CheckViewMorph(int s)
void R_ApplyViewMorph(int s)
{
UINT8 *tmpscr = screens[4];
UINT8 *srcscr = screens[0];
UINT8 *tmpscr = vid.screens[4];
UINT8 *srcscr = vid.screens[0];
INT32 width = vid.width;
INT32 height = vid.height;
INT32 p;
@ -904,8 +904,7 @@ void R_ApplyViewMorph(int s)
tmpscr[p] = srcscr[viewmorph[s].scrmap[p]];
}
VID_BlitLinearScreen(tmpscr, srcscr,
width*vid.bpp, height, width*vid.bpp, vid.width);
VID_BlitLinearScreen(tmpscr, srcscr, width, height, width, vid.width);
}
angle_t R_ViewRollAngle(const player_t *player, UINT8 viewnum)
@ -1669,7 +1668,7 @@ void R_RenderPlayerView(void)
if (bot > viewheight-1)
bot = viewheight-1;
UINT8* p = &topleft[x + top * vid.width];
UINT8* p = R_Address(top, x);
while (top <= bot)
{
@ -1735,7 +1734,7 @@ void R_RenderPlayerView(void)
for (; yl < yh; ++yl)
{
topleft[portal->start + i + (yl * vid.width)] = pal;
*R_Address(0, portal->start + i + yl) = pal;
}
}

View file

@ -165,7 +165,7 @@ static void R_MapPlane(drawspandata_t *ds, spandrawfunc_t *spanfunc, INT32 y, IN
ds->xstep = ds->ystep = FRACUNIT;
// [RH] Instead of using the xtoviewangle array, I calculated the fractional values
// at the middle of the screen, then used the calculated ds_xstep and ds_ystep
// at the middle of the screen, then used the calculated ds->xstep and ds->ystep
// to step from those to the proper texture coordinate to start drawing at.
// That way, the texture coordinate is always calculated by its position
// on the screen and not by its position relative to the edge of the visplane.
@ -1141,8 +1141,8 @@ void R_DrawSinglePlane(drawspandata_t *ds, visplane_t *pl, boolean allow_paralle
offset = (scry*vidwidth) + scrx;
// No idea if this works
VID_BlitLinearScreen(screens[0] + offset,
screens[1] + (top*vidwidth), // intentionally not +offset
VID_BlitLinearScreen(vid.screens[0] + offset,
vid.screens[1] + (top*vidwidth), // intentionally not +offset
viewwidth, bottom-top,
vidwidth, vidwidth);
}

View file

@ -727,19 +727,9 @@ void R_DrawMaskedColumn(drawcolumndata_t* dc, column_t *column, column_t *bright
dc->texturemid = basetexturemid - (topdelta<<FRACBITS);
// Drawn by R_DrawColumn.
// This stuff is a likely cause of the splitscreen water crash bug.
// FIXTHIS: Figure out what "something more proper" is and do it.
// quick fix... something more proper should be done!!!
if (ylookup[dc->yl])
{
drawcolumndata_t dc_copy = *dc;
coldrawfunc_t* colfunccopy = colfunc;
colfunccopy(const_cast<drawcolumndata_t*>(&dc_copy));
}
#ifdef PARANOIA
else
I_Error("R_DrawMaskedColumn: Invalid ylookup for dc_yl %d", dc->yl);
#endif
drawcolumndata_t dc_copy = *dc;
coldrawfunc_t* colfunccopy = colfunc;
colfunccopy(const_cast<drawcolumndata_t*>(&dc_copy));
}
column = (column_t *)((UINT8 *)column + column->length + 4);
if (brightmap != NULL)
@ -820,16 +810,9 @@ void R_DrawFlippedMaskedColumn(drawcolumndata_t* dc, column_t *column, column_t
dc->texturemid = basetexturemid - (topdelta<<FRACBITS);
// Still drawn by R_DrawColumn.
if (ylookup[dc->yl])
{
drawcolumndata_t dc_copy = *dc;
coldrawfunc_t* colfunccopy = colfunc;
colfunccopy(const_cast<drawcolumndata_t*>(&dc_copy));
}
#ifdef PARANOIA
else
I_Error("R_DrawMaskedColumn: Invalid ylookup for dc_yl %d", dc->yl);
#endif
drawcolumndata_t dc_copy = *dc;
coldrawfunc_t* colfunccopy = colfunc;
colfunccopy(const_cast<drawcolumndata_t*>(&dc_copy));
Z_Free(dc->source);
}
column = (column_t *)((UINT8 *)column + column->length + 4);

View file

@ -94,7 +94,6 @@ consvar_t cv_accuratefps = CVAR_INIT ("fpssampling", "Accurate", CV_SAVE, accura
// SCREEN VARIABLES
// =========================================================================
INT32 scr_bpp; // current video mode bytes per pixel
UINT8 *scr_borderpatch; // flat used to fill the reduced view borders set at ST_Init()
// =========================================================================
@ -324,7 +323,7 @@ void SCR_SetMode(void)
if (!setmodeneeded)
VID_CheckRenderer();
vid.recalc = 1;
vid.recalc = true;
}
// Set the video mode in the video interface.
@ -373,9 +372,6 @@ void SCR_Recalc(void)
if (dedicated)
return;
// bytes per pixel quick access
scr_bpp = vid.bpp;
V_Recalc();
// toggle off (then back on) the automap because some screensize-dependent values will
@ -451,7 +447,7 @@ void SCR_SetDefaultMode(void)
// remember the default screen size
CV_SetValue(&cv_scr_width, vid.width);
CV_SetValue(&cv_scr_height, vid.height);
CV_SetValue(&cv_scr_depth, vid.bpp*8);
//CV_SetValue(&cv_scr_depth, vid.bpp*8);
}
// Change fullscreen on/off according to cv_fullscreen

View file

@ -53,29 +53,24 @@ struct viddef_t
{
INT32 modenum; // vidmode num indexes videomodes list
UINT8 *buffer; // invisible screens buffer
// Each screen is [vid.width*vid.height];
UINT8 *screens[5];
// screens[0] = main display window
// screens[1] = back screen, alternative blitting
// screens[2] = screenshot buffer, gif movie buffer
// screens[3] = fade screen start
// screens[4] = fade screen end, postimage tempoarary buffer
size_t rowbytes; // bytes per scanline of the VIDEO mode
INT32 width; // PIXELS per scanline
INT32 height;
union { // don't need numpages for OpenGL, so we can use it for fullscreen/windowed mode
INT32 numpages; // always 1, page flipping todo
INT32 windowed; // windowed or fullscren mode?
} u;
INT32 recalc; // if true, recalc vid-based stuff
UINT8 *direct; // linear frame buffer, or vga base mem.
boolean recalc; // if true, recalc vid-based stuff
INT32 dupx, dupy; // scale 1, 2, 3 value for menus & overlays
INT32/*fixed_t*/ fdupx, fdupy; // same as dupx, dupy, but exact value when aspect ratio isn't 320/200
INT32 bpp; // BYTES per pixel: 1 = 256color, 2 = highcolor
INT32 baseratio; // Used to get the correct value for lighting walls
// for Win32 version
DNWH WndParent; // handle of the application's window
UINT8 smalldupx, smalldupy; // factor for a little bit of scaling
UINT8 meddupx, meddupy; // factor for moderate, but not full, scaling
#ifdef HWRENDER
INT32/*fixed_t*/ fsmalldupx, fsmalldupy;
INT32/*fixed_t*/ fmeddupx, fmeddupy;
INT32 glstate;
#endif
};
@ -87,35 +82,6 @@ enum
VID_GL_LIBRARY_ERROR = -1,
};
// internal additional info for vesa modes only
struct vesa_extra_t
{
INT32 vesamode; // vesa mode number plus LINEAR_MODE bit
void *plinearmem; // linear address of start of frame buffer
};
// a video modes from the video modes list,
// note: video mode 0 is always standard VGA320x200.
struct vmode_t
{
vmode_t *pnext;
char *name;
UINT32 width, height;
UINT32 rowbytes; // bytes per scanline
UINT32 bytesperpixel; // 1 for 256c, 2 for highcolor
INT32 windowed; // if true this is a windowed mode
INT32 numpages;
vesa_extra_t *pextradata; // vesa mode extra data
#ifdef _WIN32
INT32 (WINAPI *setmode)(viddef_t *lvid, vmode_t *pcurrentmode);
#else
INT32 (*setmode)(viddef_t *lvid, vmode_t *pcurrentmode);
#endif
INT32 misc; // misc for display driver (r_opengl.dll etc)
};
#define NUMSPECIALMODES 4
extern vmode_t specialmodes[NUMSPECIALMODES];
// ----------------
// screen variables
// ----------------
@ -129,7 +95,6 @@ void SCR_ChangeRenderer(void);
extern CV_PossibleValue_t cv_renderer_t[];
extern INT32 scr_bpp;
extern UINT8 *scr_borderpatch; // patch used to fill the view borders
extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_renderer, cv_renderhitbox, cv_fullscreen;

View file

@ -142,8 +142,6 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen);
static void Impl_VideoSetupSurfaces(int width, int height);
static void Impl_SetupSoftwareBuffer(void);
static void Impl_InitOpenGL(void);
#if defined(HAVE_IMAGE)
@ -305,29 +303,6 @@ static void Impl_VideoSetupSurfaces(int width, int height)
texture = SDL_CreateTexture(renderer, sw_texture_format, SDL_TEXTUREACCESS_STREAMING, width, height);
}
static void Impl_SetupSoftwareBuffer(void)
{
// Set up game's software render buffer
size_t size;
vid.rowbytes = vid.width * vid.bpp;
vid.direct = NULL;
free(vid.buffer);
size = vid.rowbytes*vid.height * NUMSCREENS;
vid.buffer = static_cast<UINT8*>(malloc(size));
if (vid.buffer)
{
// Clear the buffer
// HACK: Wasn't sure where else to put this.
memset(vid.buffer, 31, size);
}
else
I_Error("%s", M_GetText("Not enough memory for video buffer\n"));
}
static SDL_Rect src_rect = { 0, 0, 0, 0 };
static SDL_bool SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen, SDL_bool reposition)
@ -381,12 +356,6 @@ static SDL_bool SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen, SDL_b
if (Impl_RenderContextReset() == SDL_FALSE)
I_Error("Couldn't create or reset rendering context");
if (vid.buffer)
{
free(vid.buffer);
vid.buffer = NULL;
}
return SDL_TRUE;
}
@ -1317,14 +1286,14 @@ void I_FinishUpdate(void)
ST_AskToJoinEnvelope();
#endif
if (rendermode == render_soft && screens[0])
if (rendermode == render_soft && vid.screens[0])
{
void *pixels;
int pitch;
SDL_LockTexture(texture, NULL, &pixels, &pitch);
int step = pitch / 4 - vid.width;
UINT32 *restrict dst = (UINT32*)pixels;
UINT8 *restrict src = screens[0];
UINT8 *restrict src = vid.screens[0];
UINT32 *restrict palette = localPalette;
for (int32_t y = 0; y < vid.height; y++)
{
@ -1365,12 +1334,12 @@ void I_ReadScreen(UINT8 * restrict scr, INT32 scale)
if (rendermode != render_soft)
I_Error ("I_ReadScreen: called while in non-software mode");
else if (scale == 1)
VID_BlitLinearScreen(screens[0], scr,
vid.width*vid.bpp, vid.height,
VID_BlitLinearScreen(vid.screens[0], scr,
vid.width, vid.height,
vid.rowbytes, vid.rowbytes);
else
{
UINT8 * restrict source = screens[0];
UINT8 * restrict source = vid.screens[0];
INT32 w = vid.width/scale*scale, h = vid.height/scale*scale;
// size_t saves a lea + movsxd over INT32. mind your types!
@ -1515,7 +1484,7 @@ boolean VID_CheckRenderer(void)
if (rendermode == render_soft)
{
Impl_SetupSoftwareBuffer();
vid.rowbytes = vid.width;
SCR_SetDrawFuncs();
}
#ifdef HWRENDER
@ -1534,7 +1503,6 @@ INT32 VID_SetMode(INT32 modeNum)
SDLdoUngrabMouse();
vid.recalc = true;
vid.bpp = 1;
if (modeNum >= 0 && modeNum < MAXWINMODES)
{
@ -1735,9 +1703,6 @@ void I_StartupGraphics(void)
// Fury: we do window initialization after GL setup to allow
// SDL_GL_LoadLibrary to work well on Windows
vid.recalc = true;
vid.direct = NULL;
vid.bpp = 1;
vid.WndParent = NULL;
// Create window
// Default size for startup
@ -1827,9 +1792,6 @@ void I_ShutdownGraphics(void)
icoSurface = NULL;
#endif
free(vid.buffer);
vid.buffer = NULL;
rendermode = render_none;
I_OutputMsg("I_ShutdownGraphics(): ");

View file

@ -50,14 +50,6 @@
#include "k_boss.h"
#include "i_time.h"
// Each screen is [vid.width*vid.height];
UINT8 *screens[5];
// screens[0] = main display window
// screens[1] = back screen, alternative blitting
// screens[2] = screenshot buffer, gif movie buffer
// screens[3] = fade screen start
// screens[4] = fade screen end, postimage tempoarary buffer
static CV_PossibleValue_t fps_cons_t[] = {{0, "No"}, {1, "Normal"}, {2, "Compact"}, {3, "Old"}, {4, "Old Compact"}, {0, NULL}};
consvar_t cv_ticrate = CVAR_INIT ("showfps", "No", CV_SAVE, fps_cons_t, NULL);
@ -901,7 +893,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
y -= offsety;
}
desttop = screens[scrn&V_SCREENMASK];
desttop = vid.screens[scrn&V_SCREENMASK];
if (!desttop)
return;
@ -1004,7 +996,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
}
}
if (dest >= screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
if (dest >= vid.screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
*dest = source[ofs>>FRACBITS];
dest += vidwidth;
@ -1031,7 +1023,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
}
}
if (dest >= screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
if (dest >= vid.screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
*dest = source[ofs>>FRACBITS];
dest += vidwidth;
@ -1080,7 +1072,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
}
}
if (dest >= screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
if (dest >= vid.screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
*dest = *(v_colormap + source[ofs>>FRACBITS]);
dest += vidwidth;
@ -1107,7 +1099,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
}
}
if (dest >= screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
if (dest >= vid.screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
*dest = *(v_colormap + source[ofs>>FRACBITS]);
dest += vidwidth;
@ -1156,7 +1148,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
}
}
if (dest >= screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
if (dest >= vid.screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
*dest = *(v_translevel + (((*(v_colormap + source[ofs>>FRACBITS]))<<8)&0xff00) + (*dest&0xff));
dest += vidwidth;
@ -1183,7 +1175,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
}
}
if (dest >= screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
if (dest >= vid.screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
*dest = *(v_translevel + (((*(v_colormap + source[ofs>>FRACBITS]))<<8)&0xff00) + (*dest&0xff));
dest += vidwidth;
@ -1232,7 +1224,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
}
}
if (dest >= screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
if (dest >= vid.screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
*dest = *(v_translevel + ((source[ofs>>FRACBITS]<<8)&0xff00) + (*dest&0xff));
dest += vidwidth;
@ -1259,7 +1251,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
}
}
if (dest >= screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
if (dest >= vid.screens[scrn&V_SCREENMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
*dest = *(v_translevel + ((source[ofs>>FRACBITS]<<8)&0xff00) + (*dest&0xff));
dest += vidwidth;
@ -1313,8 +1305,8 @@ void V_DrawBlock(INT32 x, INT32 y, INT32 scrn, INT32 width, INT32 height, const
I_Error("Bad V_DrawBlock");
#endif
dest = screens[scrn] + y*vid.width + x;
deststop = screens[scrn] + vid.rowbytes * vid.height;
dest = vid.screens[scrn] + y*vid.width + x;
deststop = vid.screens[scrn] + vid.rowbytes * vid.height;
while (height--)
{
@ -1368,7 +1360,7 @@ void V_DrawFixedFill(fixed_t x, fixed_t y, INT32 w, INT32 h, INT32 c)
if (rendermode == render_opengl)
goto fillscreen;
#endif
memset(screens[0], (c&255), vid.width * vid.height * vid.bpp);
memset(vid.screens[0], (c&255), vid.width * vid.height);
return;
}
@ -1422,8 +1414,8 @@ fillscreen:
}
#endif
dest = screens[0] + y*vid.width + x;
deststop = screens[0] + vid.rowbytes * vid.height;
dest = vid.screens[0] + y*vid.width + x;
deststop = vid.screens[0] + vid.rowbytes * vid.height;
c &= 255;
@ -1440,7 +1432,7 @@ fillscreen:
else
{
for (;(--h >= 0) && dest < deststop; dest += vid.width)
memset(dest, c, w * vid.bpp);
memset(dest, c, w);
}
}
@ -1546,8 +1538,8 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
if (y + h > vid.height)
h = vid.height-y;
dest = screens[0] + y*vid.width + x;
deststop = screens[0] + vid.rowbytes * vid.height;
dest = vid.screens[0] + y*vid.width + x;
deststop = vid.screens[0] + vid.rowbytes * vid.height;
c &= 255;
@ -1645,14 +1637,14 @@ void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c)
if (h > w)
h = w;
dest = screens[0] + y*vid.width + x;
deststop = screens[0] + vid.rowbytes * vid.height;
dest = vid.screens[0] + y*vid.width + x;
deststop = vid.screens[0] + vid.rowbytes * vid.height;
c &= 255;
for (;(--h >= 0) && dest < deststop; dest += vid.width)
{
memset(dest, c, w * vid.bpp);
memset(dest, c, w);
if (wait)
wait--;
else
@ -1718,8 +1710,8 @@ void V_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c, UINT16 color, U
if (y + h > vid.height)
h = vid.height-y;
dest = screens[0] + y*vid.width + x;
deststop = screens[0] + vid.rowbytes * vid.height;
dest = vid.screens[0] + y*vid.width + x;
deststop = vid.screens[0] + vid.rowbytes * vid.height;
c &= 255;
@ -1802,8 +1794,8 @@ void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum)
dupx = dupy = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
dest = screens[0] + y*dupy*vid.width + x*dupx;
deststop = screens[0] + vid.rowbytes * vid.height;
dest = vid.screens[0] + y*dupy*vid.width + x*dupx;
deststop = vid.screens[0] + vid.rowbytes * vid.height;
// from V_DrawScaledPatch
if (vid.width != BASEVIDWIDTH * dupx)
@ -1904,7 +1896,7 @@ void V_DrawVhsEffect(boolean rewind)
{
static fixed_t upbary = 100*FRACUNIT, downbary = 150*FRACUNIT;
UINT8 *buf = screens[0], *tmp = screens[4];
UINT8 *buf = vid.screens[0], *tmp = vid.screens[4];
UINT16 y;
UINT32 x, pos = 0;
@ -1997,8 +1989,8 @@ void V_DrawFadeScreen(UINT16 color, UINT8 strength)
: ((color & 0xFF00) // Color is not palette index?
? ((UINT8 *)colormaps + strength*256) // Do COLORMAP fade.
: ((UINT8 *)R_GetTranslucencyTable((9-strength)+1) + color*256)); // Else, do TRANSMAP** fade.
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
UINT8 *buf = screens[0];
const UINT8 *deststop = vid.screens[0] + vid.rowbytes * vid.height;
UINT8 *buf = vid.screens[0];
// heavily simplified -- we don't need to know x or y
// position when we're doing a full screen fade
@ -2039,8 +2031,8 @@ void V_DrawCustomFadeScreen(const char *lump, UINT8 strength)
if (clm != NULL)
{
const UINT8 *fadetable = ((UINT8 *)clm + strength*256);
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
UINT8 *buf = screens[0];
const UINT8 *deststop = vid.screens[0] + vid.rowbytes * vid.height;
UINT8 *buf = vid.screens[0];
// heavily simplified -- we don't need to know x or y
// position when we're doing a full screen fade
@ -2070,8 +2062,8 @@ void V_DrawFadeConsBack(INT32 plines)
// heavily simplified -- we don't need to know x or y position,
// just the stop position
deststop = screens[0] + vid.rowbytes * min(plines, vid.height);
for (buf = screens[0]; buf < deststop; ++buf)
deststop = vid.screens[0] + vid.rowbytes * min(plines, vid.height);
for (buf = vid.screens[0]; buf < deststop; ++buf)
*buf = consolebgmap[*buf];
}
@ -2090,8 +2082,8 @@ void V_EncoreInvertScreen(void)
#endif
{
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
UINT8 *buf = screens[0];
const UINT8 *deststop = vid.screens[0] + vid.rowbytes * vid.height;
UINT8 *buf = vid.screens[0];
for (; buf < deststop; ++buf)
{
@ -2165,7 +2157,7 @@ void V_DrawPromptBack(INT32 boxheight, INT32 color)
// heavily simplified -- we don't need to know x or y position,
// just the start and stop positions
buf = deststop = screens[0] + vid.rowbytes * vid.height;
buf = deststop = vid.screens[0] + vid.rowbytes * vid.height;
if (boxheight < 0)
buf += vid.rowbytes * boxheight;
else // 4 lines of space plus gaps between and some leeway
@ -3675,8 +3667,8 @@ void V_DoPostProcessor(INT32 view, INT32 param)
else
xoffset = 0;
UINT8 *tmpscr = screens[4];
UINT8 *srcscr = screens[0];
UINT8 *tmpscr = vid.screens[4];
UINT8 *srcscr = vid.screens[0];
if (thiscam->postimgflags & POSTIMG_WATER)
{
@ -3717,7 +3709,7 @@ void V_DoPostProcessor(INT32 view, INT32 param)
/*
* Unoptimized version
* for (x = 0; x < vid.width*vid.bpp; x++)
* for (x = 0; x < vid.width; x++)
* {
* newpix = (x + sine);
*
@ -3813,7 +3805,7 @@ void V_DoPostProcessor(INT32 view, INT32 param)
INT32 y, x, x2;
for (y = yoffset; y < yoffset+viewheight; y++)
for (x = xoffset, x2 = xoffset+((viewwidth*vid.bpp)-1); x < xoffset+(viewwidth*vid.bpp); x++, x2--)
for (x = xoffset, x2 = xoffset+((viewwidth)-1); x < xoffset+(viewwidth); x++, x2--)
tmpscr[y*vid.width + x2] = srcscr[y*vid.width + x];
UINT8 *tmp = tmpscr;
@ -3833,8 +3825,8 @@ void V_DoPostProcessor(INT32 view, INT32 param)
srcscr = tmp;
}
VID_BlitLinearScreen(srcscr+vid.width*vid.bpp*yoffset+xoffset, tmpscr+vid.width*vid.bpp*yoffset+xoffset,
viewwidth*vid.bpp, viewheight, vid.width*vid.bpp, vid.width);
VID_BlitLinearScreen(srcscr+vid.width*yoffset+xoffset, tmpscr+vid.width*yoffset+xoffset,
viewwidth, viewheight, vid.width, vid.width);
#endif
}
@ -3890,26 +3882,29 @@ UINT8 GetColorLUTDirect(colorlookup_t *lut, UINT8 r, UINT8 g, UINT8 b)
void V_Init(void)
{
INT32 i;
UINT8 *base = vid.buffer;
const INT32 screensize = vid.rowbytes * vid.height;
for (i = 0; i < NUMSCREENS; i++)
screens[i] = NULL;
// start address of NUMSCREENS * width*height vidbuffers
if (base)
{
for (i = 0; i < NUMSCREENS; i++)
screens[i] = base + i*screensize;
if (vid.screens[i])
free(vid.screens[i]);
vid.screens[i] = NULL;
}
if (vid.direct)
screens[0] = vid.direct;
// start address of NUMSCREENS * width*height vidbuffers
if (screensize > 0)
{
for (i = 0; i < NUMSCREENS; i++)
{
vid.screens[i] = malloc(screensize);
memset(vid.screens[i], 0, screensize);
}
}
#ifdef DEBUG
CONS_Debug(DBG_RENDER, "V_Init done:\n");
for (i = 0; i < NUMSCREENS; i++)
CONS_Debug(DBG_RENDER, " screens[%d] = %x\n", i, screens[i]);
CONS_Debug(DBG_RENDER, " vid.screens[%d] = %x\n", i, screens[i]);
#endif
}
@ -3933,15 +3928,7 @@ void V_Recalc(void)
vid.meddupx = (UINT8)(vid.dupx >> 1) + 1;
vid.meddupy = (UINT8)(vid.dupy >> 1) + 1;
#ifdef HWRENDER
vid.fmeddupx = vid.meddupx*FRACUNIT;
vid.fmeddupy = vid.meddupy*FRACUNIT;
#endif
vid.smalldupx = (UINT8)(vid.dupx / 3) + 1;
vid.smalldupy = (UINT8)(vid.dupy / 3) + 1;
#ifdef HWRENDER
vid.fsmalldupx = vid.smalldupx*FRACUNIT;
vid.fsmalldupy = vid.smalldupy*FRACUNIT;
#endif
}

View file

@ -30,11 +30,6 @@ extern "C" {
// VIDEO
//
// Screen 0 is the screen updated by I_Update screen.
// Screen 1 is an extra buffer.
extern UINT8 *screens[5];
extern consvar_t cv_ticrate, cv_constextsize,
cv_globalgamma, cv_globalsaturation,
cv_rhue, cv_yhue, cv_ghue, cv_chue, cv_bhue, cv_mhue,

View file

@ -345,8 +345,8 @@ void Y_ConsiderScreenBuffer(void)
if (rendermode == render_soft)
{
y_screenbuffer = Z_Malloc(vid.width*vid.bpp * vid.height, PU_STATIC, NULL);
VID_BlitLinearScreen(screens[0], y_screenbuffer, vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
y_screenbuffer = Z_Malloc(vid.width * vid.height, PU_STATIC, NULL);
VID_BlitLinearScreen(vid.screens[0], y_screenbuffer, vid.width, vid.height, vid.width, vid.rowbytes);
}
#ifdef HWRENDER
else if (rendermode == render_opengl)
@ -398,7 +398,7 @@ void Y_IntermissionDrawer(void)
else if (y_screenbuffer != NULL)
{
if (rendermode == render_soft)
VID_BlitLinearScreen(y_screenbuffer, screens[0], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
VID_BlitLinearScreen(y_screenbuffer, vid.screens[0], vid.width, vid.height, vid.width, vid.rowbytes);
#ifdef HWRENDER
else if (rendermode == render_opengl)
HWR_DrawIntermissionBG();