remove ylookup, columnofs and topleft lookups
move screens array to "vid" struct remove a bunch of unused stuff this speeds up 4 player splitscreen ever so slighty mostly just alot cleaner than the mess it was before
This commit is contained in:
1 parent
6153733df4
commit
2da89f1946
20 files changed
+138
-384
No files matched your search
+1
-1
@@ -341,7 +341,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];
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -46,7 +46,6 @@ INT32 VID_SetMode(INT32 modenum)
|
||||
vid.modenum = 0;
|
||||
vid.width = 320;
|
||||
vid.height = 240;
|
||||
vid.bpp = 1;
|
||||
vid.buffer = android_surface;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1321,13 +1321,6 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...)
|
||||
//
|
||||
void CONS_Error(const char *msg)
|
||||
{
|
||||
#ifdef RPC_NO_WINDOWS_H
|
||||
if (!graphics_started)
|
||||
{
|
||||
MessageBoxA(vid.WndParent, msg, "SRB2Kart Warning", MB_OK);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
CONS_Printf("\x82%s", msg); // write error msg in different colour
|
||||
CONS_Printf(M_GetText("Press ENTER to continue\n"));
|
||||
|
||||
|
||||
+2
-13
@@ -336,7 +336,6 @@ static void D_Renderview(void)
|
||||
if (!issplitscreen) // Initialize for P1
|
||||
{
|
||||
viewwindowy = viewwindowx = 0;
|
||||
topleft = screens[0];
|
||||
objectsdrawn = 0;
|
||||
}
|
||||
|
||||
@@ -350,8 +349,6 @@ static void D_Renderview(void)
|
||||
#endif
|
||||
if (issplitscreen) // Splitscreen-specific
|
||||
{
|
||||
const INT32 len = viewheight*sizeof(ylookup[0]);
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
@@ -365,28 +362,20 @@ static void D_Renderview(void)
|
||||
viewwindowx = 0;
|
||||
viewwindowy = viewheight;
|
||||
}
|
||||
M_Memcpy(ylookup, ylookup2, len);
|
||||
break;
|
||||
case 2:
|
||||
viewwindowx = 0;
|
||||
viewwindowy = viewheight;
|
||||
M_Memcpy(ylookup, ylookup3, len);
|
||||
break;
|
||||
case 3:
|
||||
viewwindowx = viewwidth;
|
||||
viewwindowy = viewheight;
|
||||
M_Memcpy(ylookup, ylookup4, len);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
|
||||
}
|
||||
|
||||
R_RenderPlayerView(&players[displayplayers[i]]);
|
||||
|
||||
if (issplitscreen)
|
||||
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
|
||||
}
|
||||
|
||||
if (!issplitscreen)
|
||||
@@ -584,7 +573,7 @@ static boolean D_Display(void)
|
||||
{
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
VID_BlitLinearScreen(screens[0], screens[1], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
|
||||
VID_BlitLinearScreen(vid.screens[0], vid.screens[1], vid.width, vid.height, vid.width, vid.rowbytes);
|
||||
}
|
||||
|
||||
lastdraw = false;
|
||||
@@ -618,7 +607,7 @@ static boolean 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);
|
||||
|
||||
+3
-3
@@ -313,7 +313,7 @@ void F_WipeStartScreen(void)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
wipe_scr_start = screens[3];
|
||||
wipe_scr_start = vid.screens[3];
|
||||
I_ReadScreen(wipe_scr_start);
|
||||
#endif
|
||||
}
|
||||
@@ -330,7 +330,7 @@ void F_WipeEndScreen(void)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
wipe_scr_end = screens[4];
|
||||
wipe_scr_end = vid.screens[4];
|
||||
I_ReadScreen(wipe_scr_end);
|
||||
V_DrawBlock(0, 0, 0, vid.width, vid.height, wipe_scr_start);
|
||||
#endif
|
||||
@@ -353,7 +353,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
||||
|
||||
// Init the wipe
|
||||
WipeInAction = true;
|
||||
wipe_scr = screens[0];
|
||||
wipe_scr = vid.screens[0];
|
||||
|
||||
// lastwipetic should either be 0 or the tic we last wiped
|
||||
// on for fade-to-black
|
||||
|
||||
@@ -96,12 +96,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;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -495,7 +495,7 @@ static void GIF_rgbconvert(UINT8 *linear, UINT8 *scr)
|
||||
static void GIF_framewrite(void)
|
||||
{
|
||||
UINT8 *p;
|
||||
UINT8 *movie_screen = screens[2];
|
||||
UINT8 *movie_screen = vid.screens[2];
|
||||
INT32 blitx, blity, blitw, blith;
|
||||
|
||||
if (!gifframe_data)
|
||||
@@ -509,7 +509,7 @@ static void GIF_framewrite(void)
|
||||
if (gif_optimize && gif_frames > 0)
|
||||
{
|
||||
// before blit movie_screen points to last frame, cur_screen points to this frame
|
||||
UINT8 *cur_screen = screens[0];
|
||||
UINT8 *cur_screen = vid.screens[0];
|
||||
GIF_optimizeregion(cur_screen, movie_screen, &blitx, &blity, &blitw, &blith);
|
||||
|
||||
// blit to temp screen
|
||||
@@ -535,7 +535,7 @@ static void GIF_framewrite(void)
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
UINT8 *linear = HWR_GetScreenshot();
|
||||
GIF_rgbconvert(linear, screens[0]);
|
||||
GIF_rgbconvert(linear, vid.screens[0]);
|
||||
//free(linear); // Allocated 'statically', no need to free now
|
||||
}
|
||||
#endif
|
||||
@@ -545,7 +545,7 @@ static void GIF_framewrite(void)
|
||||
if (gif_frames == 0 && rendermode == render_soft)
|
||||
I_ReadScreen(movie_screen);
|
||||
|
||||
movie_screen = screens[0];
|
||||
movie_screen = vid.screens[0];
|
||||
}
|
||||
|
||||
// screen regions are handled in GIF_lzw
|
||||
|
||||
+2
-2
@@ -1236,7 +1236,7 @@ void M_SaveFrame(void)
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
// munge planar buffer to linear
|
||||
linear = screens[2];
|
||||
linear = vid.screens[2];
|
||||
I_ReadScreen(linear);
|
||||
}
|
||||
#ifdef HWRENDER
|
||||
@@ -1538,7 +1538,7 @@ void M_DoScreenShot(void)
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
// munge planar buffer to linear
|
||||
linear = screens[2];
|
||||
linear = vid.screens[2];
|
||||
I_ReadScreen(linear);
|
||||
}
|
||||
|
||||
|
||||
+28
-152
@@ -38,34 +38,8 @@
|
||||
|
||||
/** \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
|
||||
|
||||
// =========================================================================
|
||||
// COLUMN DRAWING CODE STUFF
|
||||
@@ -147,71 +121,6 @@ UINT32 nflatxshift, nflatyshift, nflatshiftup, nflatmask;
|
||||
static UINT8 **translationtablecache[TT_CACHE_SIZE] = {NULL};
|
||||
static UINT8 **localtranslationtablecache[MAXLOCALSKINS] = {NULL};
|
||||
|
||||
|
||||
// See also the enum skincolors_t
|
||||
// TODO Callum: Can this be translated?
|
||||
/*
|
||||
const char *Color_Names[MAXSKINCOLORS] =
|
||||
{
|
||||
"None", // SKINCOLOR_NONE
|
||||
"White", // SKINCOLOR_WHITE
|
||||
"Silver", // SKINCOLOR_SILVER
|
||||
"Grey", // SKINCOLOR_GREY
|
||||
"Black", // SKINCOLOR_BLACK
|
||||
"Cyan", // SKINCOLOR_CYAN
|
||||
"Teal", // SKINCOLOR_TEAL
|
||||
"Steel_Blue",// SKINCOLOR_STEEL
|
||||
"Blue", // SKINCOLOR_BLUE
|
||||
"Peach", // SKINCOLOR_PEACH
|
||||
"Tan", // SKINCOLOR_TAN
|
||||
"Pink", // SKINCOLOR_PINK
|
||||
"Lavender", // SKINCOLOR_LAVENDER
|
||||
"Purple", // SKINCOLOR_PURPLE
|
||||
"Orange", // SKINCOLOR_ORANGE
|
||||
"Rosewood", // SKINCOLOR_ROSEWOOD
|
||||
"Beige", // SKINCOLOR_BEIGE
|
||||
"Brown", // SKINCOLOR_BROWN
|
||||
"Red", // SKINCOLOR_RED
|
||||
"Dark_Red", // SKINCOLOR_DARKRED
|
||||
"Neon_Green",// SKINCOLOR_NEONGREEN
|
||||
"Green", // SKINCOLOR_GREEN
|
||||
"Zim", // SKINCOLOR_ZIM
|
||||
"Olive", // SKINCOLOR_OLIVE
|
||||
"Yellow", // SKINCOLOR_YELLOW
|
||||
"Gold" // SKINCOLOR_GOLD
|
||||
};
|
||||
|
||||
const UINT8 Color_Opposite[MAXSKINCOLORS*2] =
|
||||
{
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_NONE
|
||||
SKINCOLOR_BLACK,10, // SKINCOLOR_WHITE
|
||||
SKINCOLOR_GREY,4, // SKINCOLOR_SILVER
|
||||
SKINCOLOR_SILVER,12,// SKINCOLOR_GREY
|
||||
SKINCOLOR_WHITE,8, // SKINCOLOR_BLACK
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_CYAN
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_TEAL
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_STEEL
|
||||
SKINCOLOR_ORANGE,9, // SKINCOLOR_BLUE
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_PEACH
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_TAN
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_PINK
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_LAVENDER
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_PURPLE
|
||||
SKINCOLOR_BLUE,12, // SKINCOLOR_ORANGE
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_ROSEWOOD
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_BEIGE
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_BROWN
|
||||
SKINCOLOR_GREEN,5, // SKINCOLOR_RED
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_DARKRED
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_NEONGREEN
|
||||
SKINCOLOR_RED,11, // SKINCOLOR_GREEN
|
||||
SKINCOLOR_PURPLE,3, // SKINCOLOR_ZIM
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_OLIVE
|
||||
SKINCOLOR_NONE,8, // SKINCOLOR_YELLOW
|
||||
SKINCOLOR_NONE,8 // SKINCOLOR_GOLD
|
||||
};
|
||||
*/
|
||||
|
||||
CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1];
|
||||
|
||||
/** \brief Initializes the translucency tables used by the Software renderer.
|
||||
@@ -540,19 +449,6 @@ void R_FlushTranslationColormapCache(void)
|
||||
memset(localtranslationtablecache[i], 0, MAXTRANSLATIONS * sizeof(UINT8**));
|
||||
}
|
||||
|
||||
/*
|
||||
UINT8 R_GetColorByName(const char *name)
|
||||
{
|
||||
UINT8 color = (UINT8)atoi(name);
|
||||
if (color > 0 && color < MAXSKINCOLORS)
|
||||
return color;
|
||||
for (color = 1; color < MAXSKINCOLORS; color++)
|
||||
if (!stricmp(Color_Names[color], name))
|
||||
return color;
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
// ==========================================================================
|
||||
// COMMON DRAWER FOR 8 AND 16 BIT COLOR MODES
|
||||
// ==========================================================================
|
||||
@@ -572,39 +468,20 @@ UINT8 R_GetColorByName(const char *name)
|
||||
\param height hieght of buffer
|
||||
|
||||
\return void
|
||||
|
||||
|
||||
*/
|
||||
|
||||
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 (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
|
||||
@@ -626,6 +503,28 @@ 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
|
||||
|
||||
@@ -648,7 +547,7 @@ void R_FillBackScreen(void)
|
||||
return;
|
||||
|
||||
src = scr_borderpatch;
|
||||
dest = screens[1];
|
||||
dest = vid.screens[1];
|
||||
|
||||
for (y = 0; y < vid.height; y++)
|
||||
{
|
||||
@@ -699,30 +598,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
|
||||
@@ -766,7 +642,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
|
||||
|
||||
+7
-7
@@ -20,13 +20,13 @@
|
||||
// -------------------------------
|
||||
// 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);
|
||||
}
|
||||
|
||||
// -------------------------
|
||||
// COLUMN DRAWING CODE STUFF
|
||||
|
||||
+22
-22
@@ -47,7 +47,7 @@ void R_DrawColumn_8(void)
|
||||
// Framebuffer destination address.
|
||||
// Use ylookup LUT to avoid multiply with ScreenWidth.
|
||||
// Use columnofs LUT for subwindows?
|
||||
dest = &topleft[dc_yl*vid.width + dc_x];
|
||||
dest = R_Address(dc_x, dc_yl);
|
||||
|
||||
count++;
|
||||
|
||||
@@ -172,7 +172,7 @@ void R_Draw2sMultiPatchColumn_8(void)
|
||||
// Framebuffer destination address.
|
||||
// Use ylookup LUT to avoid multiply with ScreenWidth.
|
||||
// Use columnofs LUT for subwindows?
|
||||
dest = &topleft[dc_yl*vid.width + dc_x];
|
||||
dest = R_Address(dc_x, dc_yl);
|
||||
|
||||
count++;
|
||||
|
||||
@@ -314,7 +314,7 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void)
|
||||
// Framebuffer destination address.
|
||||
// Use ylookup LUT to avoid multiply with ScreenWidth.
|
||||
// Use columnofs LUT for subwindows?
|
||||
dest = &topleft[dc_yl*vid.width + dc_x];
|
||||
dest = R_Address(dc_x, dc_yl);
|
||||
|
||||
count++;
|
||||
|
||||
@@ -458,7 +458,7 @@ void R_DrawShadeColumn_8(void)
|
||||
}
|
||||
|
||||
// FIXME. As above.
|
||||
dest = &topleft[dc_yl*vid.width + dc_x];
|
||||
dest = R_Address(dc_x, dc_yl);
|
||||
|
||||
// Looks familiar.
|
||||
fracstep = dc_iscale;
|
||||
@@ -501,7 +501,7 @@ void R_DrawTranslucentColumn_8(void)
|
||||
}
|
||||
|
||||
// FIXME. As above.
|
||||
dest = &topleft[dc_yl*vid.width + dc_x];
|
||||
dest = R_Address(dc_x, dc_yl);
|
||||
|
||||
// Looks familiar.
|
||||
fracstep = dc_iscale;
|
||||
@@ -613,7 +613,7 @@ void R_DrawTranslatedTranslucentColumn_8(void)
|
||||
}
|
||||
|
||||
// FIXME. As above.
|
||||
dest = &topleft[dc_yl*vid.width + dc_x];
|
||||
dest = R_Address(dc_x, dc_yl);
|
||||
|
||||
// Looks familiar.
|
||||
fracstep = dc_iscale;
|
||||
@@ -719,7 +719,7 @@ void R_DrawTranslatedColumn_8(void)
|
||||
}
|
||||
|
||||
// FIXME. As above.
|
||||
dest = &topleft[dc_yl*vid.width + dc_x];
|
||||
dest = R_Address(dc_x, dc_yl);
|
||||
|
||||
// Looks familiar.
|
||||
fracstep = dc_iscale;
|
||||
@@ -763,8 +763,8 @@ void R_DrawSpan_8 (void)
|
||||
|
||||
UINT8 *restrict source = ds_source;
|
||||
UINT8 *restrict colormap = ds_colormap;
|
||||
UINT8 *restrict dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
const UINT8 *restrict deststop = screens[0] + vid.rowbytes * vid.height;
|
||||
UINT8 *restrict dest = R_Address(ds_x1, ds_y);
|
||||
const UINT8 *restrict deststop = vid.screens[0] + vid.rowbytes * vid.height;
|
||||
|
||||
register intptr_t count = (ds_x2 - ds_x1 + 1);
|
||||
|
||||
@@ -911,7 +911,7 @@ void R_DrawTiltedSpan_8(void)
|
||||
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
dest = R_Address(ds_x1, ds_y);
|
||||
|
||||
source = ds_source;
|
||||
|
||||
@@ -1049,7 +1049,7 @@ void R_DrawTiltedTranslucentSpan_8(void)
|
||||
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
dest = R_Address(ds_x1, ds_y);
|
||||
|
||||
source = ds_source;
|
||||
|
||||
@@ -1189,8 +1189,8 @@ void R_DrawTiltedTranslucentWaterSpan_8(void)
|
||||
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
dsrc = screens[1] + (ds_y+ds_bgofs)*vid.width + ds_x1;
|
||||
dest = R_Address(ds_x1, ds_y);
|
||||
dsrc = vid.screens[1] + (ds_y+ds_bgofs)*vid.width + ds_x1;
|
||||
|
||||
source = ds_source;
|
||||
|
||||
@@ -1329,7 +1329,7 @@ void R_DrawTiltedSplat_8(void)
|
||||
uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx);
|
||||
vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx);
|
||||
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
dest = R_Address(ds_x1, ds_y);
|
||||
|
||||
source = ds_source;
|
||||
//colormap = ds_colormap;
|
||||
@@ -1476,7 +1476,7 @@ void R_DrawSplat_8 (void)
|
||||
|
||||
source = ds_source;
|
||||
colormap = ds_colormap;
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
dest = R_Address(ds_x1, ds_y);
|
||||
count = ds_x2 - ds_x1 + 1;
|
||||
|
||||
while (count >= 8)
|
||||
@@ -1546,7 +1546,7 @@ void R_DrawTranslucentSplat_8 (void)
|
||||
|
||||
source = ds_source;
|
||||
colormap = ds_colormap;
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
dest = R_Address(ds_x1, ds_y);
|
||||
count = ds_x2 - ds_x1 + 1;
|
||||
|
||||
while (count >= 8)
|
||||
@@ -1594,7 +1594,7 @@ void R_DrawTranslucentSpan_8 (void)
|
||||
UINT8 *source;
|
||||
UINT8 *colormap;
|
||||
register UINT8 *dest;
|
||||
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
|
||||
const UINT8 *deststop = vid.screens[0] + vid.rowbytes * vid.height;
|
||||
|
||||
register intptr_t count = (ds_x2 - ds_x1 + 1);
|
||||
|
||||
@@ -1613,7 +1613,7 @@ void R_DrawTranslucentSpan_8 (void)
|
||||
|
||||
source = ds_source;
|
||||
colormap = ds_colormap;
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
dest = R_Address(ds_x1, ds_y);
|
||||
|
||||
while (count >= 8)
|
||||
{
|
||||
@@ -1700,8 +1700,8 @@ void R_DrawTranslucentWaterSpan_8(void)
|
||||
|
||||
source = ds_source;
|
||||
colormap = ds_colormap;
|
||||
dest = ylookup[ds_y] + columnofs[ds_x1];
|
||||
dsrc = screens[1] + (ds_y+ds_bgofs)*vid.width + ds_x1;
|
||||
dest = R_Address(ds_x1, ds_y);
|
||||
dsrc = vid.screens[1] + (ds_y+ds_bgofs)*vid.width + ds_x1;
|
||||
count = ds_x2 - ds_x1 + 1;
|
||||
|
||||
while (count >= 8)
|
||||
@@ -1774,7 +1774,7 @@ void R_DrawFogSpan_8(void)
|
||||
register intptr_t count;
|
||||
|
||||
colormap = ds_colormap;
|
||||
dest = &topleft[ds_y *vid.width + ds_x1];
|
||||
dest = R_Address(dc_x, dc_yl);
|
||||
|
||||
count = ds_x2 - ds_x1 + 1;
|
||||
|
||||
@@ -1819,7 +1819,7 @@ void R_DrawFogColumn_8(void)
|
||||
// Use ylookup LUT to avoid multiply with ScreenWidth.
|
||||
// Use columnofs LUT for subwindows?
|
||||
//dest = ylookup[dc_yl] + columnofs[dc_x];
|
||||
dest = &topleft[dc_yl*vid.width + dc_x];
|
||||
dest = R_Address(dc_x, dc_yl);
|
||||
|
||||
// Determine scaling, which is the only mapping to be done.
|
||||
do
|
||||
|
||||
+3
-4
@@ -799,8 +799,8 @@ void R_CheckViewMorph(void)
|
||||
|
||||
void R_ApplyViewMorph(void)
|
||||
{
|
||||
UINT8 *tmpscr = screens[4];
|
||||
UINT8 *srcscr = screens[0];
|
||||
UINT8 *tmpscr = vid.screens[4];
|
||||
UINT8 *srcscr = vid.screens[0];
|
||||
INT32 p, end = vid.width * vid.height;
|
||||
|
||||
if (!viewmorph.use)
|
||||
@@ -835,8 +835,7 @@ void R_ApplyViewMorph(void)
|
||||
for (p = 0; p < end; p++)
|
||||
tmpscr[p] = srcscr[viewmorph.scrmap[p]];
|
||||
|
||||
VID_BlitLinearScreen(tmpscr, screens[0],
|
||||
vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.width);
|
||||
VID_BlitLinearScreen(tmpscr, vid.screens[0], vid.width, vid.height, vid.width, vid.width);
|
||||
}
|
||||
|
||||
angle_t R_ViewRollAngle(const player_t *player)
|
||||
|
||||
+5
-5
@@ -894,16 +894,16 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||
bottom = vid.height;
|
||||
|
||||
if (splitscreen > 2 && viewplayer == &players[displayplayers[3]]) // Only copy the part of the screen we need
|
||||
scr = (screens[0] + (top+(viewheight))*vid.width + viewwidth);
|
||||
scr = (vid.screens[0] + (top+(viewheight))*vid.width + viewwidth);
|
||||
else if ((splitscreen == 1 && viewplayer == &players[displayplayers[1]])
|
||||
|| (splitscreen > 1 && viewplayer == &players[displayplayers[2]]))
|
||||
scr = (screens[0] + (top+(viewheight))*vid.width);
|
||||
scr = (vid.screens[0] + (top+(viewheight))*vid.width);
|
||||
else if (splitscreen > 1 && viewplayer == &players[displayplayers[1]])
|
||||
scr = (screens[0] + ((top)*vid.width) + viewwidth);
|
||||
scr = (vid.screens[0] + ((top)*vid.width) + viewwidth);
|
||||
else
|
||||
scr = (screens[0] + ((top)*vid.width));
|
||||
scr = (vid.screens[0] + ((top)*vid.width));
|
||||
|
||||
VID_BlitLinearScreen(scr, screens[1]+((top)*vid.width),
|
||||
VID_BlitLinearScreen(scr, vid.screens[1]+((top)*vid.width),
|
||||
vid.width, bottom-top,
|
||||
vid.width, vid.width);
|
||||
}
|
||||
|
||||
+3
-15
@@ -634,15 +634,7 @@ void R_DrawMaskedColumn(column_t *column)
|
||||
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])
|
||||
colfunc();
|
||||
#ifdef PARANOIA
|
||||
else
|
||||
I_Error("R_DrawMaskedColumn: Invalid ylookup for dc_yl %d", dc_yl);
|
||||
#endif
|
||||
colfunc();
|
||||
}
|
||||
column = (column_t *)((UINT8 *)column + column->length + 4);
|
||||
}
|
||||
@@ -702,12 +694,8 @@ static void R_DrawFlippedMaskedColumn(column_t *column)
|
||||
dc_texturemid = basetexturemid - (topdelta<<FRACBITS);
|
||||
|
||||
// Still drawn by R_DrawColumn.
|
||||
if (ylookup[dc_yl])
|
||||
colfunc();
|
||||
#ifdef PARANOIA
|
||||
else
|
||||
I_Error("R_DrawMaskedColumn: Invalid ylookup for dc_yl %d", dc_yl);
|
||||
#endif
|
||||
colfunc();
|
||||
|
||||
Z_Free(dc_source);
|
||||
}
|
||||
column = (column_t *)((UINT8 *)column + column->length + 4);
|
||||
|
||||
@@ -89,7 +89,6 @@ consvar_t cv_accuratefps = {"fpssampling", "1", CV_SAVE, accuratefps_cons_t, NUL
|
||||
// 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()
|
||||
|
||||
// =========================================================================
|
||||
@@ -148,19 +147,9 @@ void SCR_Startup(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
|
||||
|
||||
vid.baseratio = FRACUNIT;
|
||||
|
||||
V_Init();
|
||||
CV_RegisterVar(&cv_highreshudscale);
|
||||
@@ -205,9 +194,6 @@ void SCR_Recalc(void)
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
// bytes per pixel quick access
|
||||
scr_bpp = vid.bpp;
|
||||
|
||||
// scale 1,2,3 times in x and y the patches for the menus and overlays...
|
||||
// calculated once and for all, used by routines in v_video.c
|
||||
vid.dupx = vid.width / BASEVIDWIDTH;
|
||||
@@ -226,22 +212,11 @@ void SCR_Recalc(void)
|
||||
|
||||
vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy);
|
||||
|
||||
//vid.baseratio = FixedDiv(vid.height << FRACBITS, BASEVIDHEIGHT << FRACBITS);
|
||||
vid.baseratio = FRACUNIT;
|
||||
|
||||
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
|
||||
|
||||
// toggle off (then back on) the automap because some screensize-dependent values will
|
||||
// be calculated next time the automap is activated.
|
||||
|
||||
+13
-51
@@ -53,71 +53,35 @@ typedef struct viddef_s
|
||||
{
|
||||
INT32 modenum; // vidmode num indexes videomodes list
|
||||
|
||||
// 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
|
||||
|
||||
UINT8 *buffer; // invisible screens 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
|
||||
} viddef_t;
|
||||
#define VIDWIDTH vid.width
|
||||
#define VIDHEIGHT vid.height
|
||||
|
||||
enum
|
||||
{
|
||||
VID_GL_LIBRARY_LOADED = 1,
|
||||
VID_GL_LIBRARY_LOADED = 1,
|
||||
VID_GL_LIBRARY_ERROR = -1,
|
||||
};
|
||||
|
||||
// internal additional info for vesa modes only
|
||||
typedef struct
|
||||
{
|
||||
INT32 vesamode; // vesa mode number plus LINEAR_MODE bit
|
||||
void *plinearmem; // linear address of start of frame buffer
|
||||
} vesa_extra_t;
|
||||
|
||||
// a video modes from the video modes list,
|
||||
// note: video mode 0 is always standard VGA320x200.
|
||||
typedef struct vmode_s
|
||||
{
|
||||
struct vmode_s *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, struct vmode_s *pcurrentmode);
|
||||
#else
|
||||
INT32 (*setmode)(viddef_t *lvid, struct vmode_s *pcurrentmode);
|
||||
#endif
|
||||
INT32 misc; // misc for display driver (r_opengl.dll etc)
|
||||
} vmode_t;
|
||||
|
||||
#define NUMSPECIALMODES 4
|
||||
extern vmode_t specialmodes[NUMSPECIALMODES];
|
||||
|
||||
// ---------------------------------------------
|
||||
// color mode dependent drawer function pointers
|
||||
// ---------------------------------------------
|
||||
@@ -135,14 +99,15 @@ extern void (*transtransfunc)(void);
|
||||
extern void (*twosmultipatchfunc)(void);
|
||||
extern void (*twosmultipatchtransfunc)(void);
|
||||
|
||||
// quick fix for tall/short skies, depending on bytesperpixel
|
||||
extern void (*walldrawerfunc)(void);
|
||||
|
||||
// ----------------
|
||||
// screen variables
|
||||
// ----------------
|
||||
extern viddef_t vid;
|
||||
extern INT32 setmodeneeded; // mode number to set if needed, or 0
|
||||
extern double averageFPS;
|
||||
|
||||
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_renderview, cv_fullscreen, cv_vhseffect, cv_shittyscreen;
|
||||
@@ -155,9 +120,6 @@ extern consvar_t cv_alwaysgrabmouse;
|
||||
|
||||
extern consvar_t cv_votebgscaling;
|
||||
|
||||
// quick fix for tall/short skies, depending on bytesperpixel
|
||||
extern void (*walldrawerfunc)(void);
|
||||
|
||||
// Change video mode, only at the start of a refresh.
|
||||
void SCR_SetMode(void);
|
||||
// Recalc screen size dependent stuff
|
||||
|
||||
+10
-21
@@ -1497,7 +1497,7 @@ void I_FinishUpdate(void)
|
||||
ST_AskToJoinEnvelope();
|
||||
#endif
|
||||
|
||||
if (rendermode == render_soft && screens[0])
|
||||
if (rendermode == render_soft && vid.screens[0])
|
||||
{
|
||||
if (!bufSurface) //Double-Check
|
||||
{
|
||||
@@ -1547,9 +1547,7 @@ void I_ReadScreen(UINT8 *scr)
|
||||
if (rendermode != render_soft)
|
||||
I_Error ("I_ReadScreen: called while in non-software mode");
|
||||
else
|
||||
VID_BlitLinearScreen(screens[0], scr,
|
||||
vid.width*vid.bpp, vid.height,
|
||||
vid.rowbytes, vid.rowbytes);
|
||||
VID_BlitLinearScreen(vid.screens[0], scr, vid.width, vid.height, vid.rowbytes, vid.rowbytes);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1753,8 +1751,7 @@ INT32 VID_SetMode(INT32 modeNum)
|
||||
{
|
||||
SDLdoUngrabMouse();
|
||||
|
||||
vid.recalc = 1;
|
||||
vid.bpp = 1;
|
||||
vid.recalc = true;
|
||||
|
||||
if (modeNum >= 0 && modeNum < MAXWINMODES)
|
||||
{
|
||||
@@ -1944,16 +1941,9 @@ static void Impl_VideoSetupSDLBuffer(void)
|
||||
bufSurface = NULL;
|
||||
}
|
||||
// Set up the SDL palletized buffer (copied to vidbuffer before being rendered to texture)
|
||||
if (vid.bpp == 1)
|
||||
{
|
||||
bufSurface = SDL_CreateRGBSurfaceFrom(screens[0],vid.width,vid.height,8,
|
||||
(int)vid.rowbytes,0x00000000,0x00000000,0x00000000,0x00000000); // 256 mode
|
||||
}
|
||||
else if (vid.bpp == 2) // Fury -- don't think this is used at all anymore
|
||||
{
|
||||
bufSurface = SDL_CreateRGBSurfaceFrom(screens[0],vid.width,vid.height,15,
|
||||
(int)vid.rowbytes,0x00007C00,0x000003E0,0x0000001F,0x00000000); // 555 mode
|
||||
}
|
||||
bufSurface = SDL_CreateRGBSurfaceFrom(vid.screens[0], vid.width, vid.height, 8,
|
||||
(int)vid.rowbytes, 0x00000000, 0x00000000, 0x00000000, 0x00000000); // 256 mode
|
||||
|
||||
if (bufSurface)
|
||||
{
|
||||
SDL_SetPaletteColors(bufSurface->format->palette, localPalette, 0, 256);
|
||||
@@ -1969,11 +1959,13 @@ static void Impl_VideoSetupBuffer(void)
|
||||
// Set up game's software render buffer
|
||||
//if (rendermode == render_soft)
|
||||
{
|
||||
vid.rowbytes = vid.width * vid.bpp;
|
||||
vid.direct = NULL;
|
||||
vid.rowbytes = vid.width;
|
||||
|
||||
if (vid.buffer)
|
||||
free(vid.buffer);
|
||||
|
||||
vid.buffer = calloc(vid.rowbytes*vid.height, NUMSCREENS);
|
||||
|
||||
if (!vid.buffer)
|
||||
{
|
||||
I_Error("%s", M_GetText("Not enough memory for video buffer\n"));
|
||||
@@ -2184,9 +2176,6 @@ void I_StartupGraphics(void)
|
||||
vid.width = BASEVIDWIDTH; // Default size for startup
|
||||
vid.height = BASEVIDHEIGHT; // BitsPerPixel is the SDL interface's
|
||||
vid.recalc = true; // Set up the console stufff
|
||||
vid.direct = NULL; // Maybe direct access?
|
||||
vid.bpp = 1; // This is the game engine's Bpp
|
||||
vid.WndParent = NULL; //For the window?
|
||||
|
||||
#ifdef HAVE_TTF
|
||||
I_ShutdownTTF();
|
||||
|
||||
+30
-41
@@ -35,14 +35,6 @@
|
||||
#include "hardware/r_opengl/r_opengl.h"
|
||||
#endif
|
||||
|
||||
// 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 = {"showfps", "No", CV_SAVE, fps_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -786,7 +778,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
if (scrn & V_HORZSCREEN)
|
||||
x += (BASEVIDWIDTH/2)<<FRACBITS;
|
||||
|
||||
desttop = screens[scrn&V_PARAMMASK];
|
||||
desttop = vid.screens[scrn&V_PARAMMASK];
|
||||
|
||||
if (!desttop)
|
||||
return;
|
||||
@@ -892,7 +884,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
|
||||
for (ofs = 0; dest < deststop && (ofs>>FRACBITS) < column->length; ofs += rowfrac)
|
||||
{
|
||||
if (dest >= screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
if (dest >= vid.screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
*dest = patchdrawfunc(dest, source, ofs);
|
||||
dest += vid.width;
|
||||
}
|
||||
@@ -959,7 +951,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
||||
y -= FixedMul(patch->topoffset<<FRACBITS, pscale);
|
||||
x -= FixedMul(patch->leftoffset<<FRACBITS, pscale);
|
||||
|
||||
desttop = screens[scrn&V_PARAMMASK];
|
||||
desttop = vid.screens[scrn&V_PARAMMASK];
|
||||
|
||||
if (!desttop)
|
||||
return;
|
||||
@@ -1034,7 +1026,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
||||
|
||||
for (; dest < deststop && (ofs>>FRACBITS) < column->length && (((ofs>>FRACBITS) - sy) + topdelta) < h; ofs += rowfrac)
|
||||
{
|
||||
if (dest >= screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
if (dest >= vid.screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
*dest = patchdrawfunc(dest, source, ofs);
|
||||
dest += vid.width;
|
||||
}
|
||||
@@ -1076,8 +1068,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--)
|
||||
{
|
||||
@@ -1117,7 +1109,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
|
||||
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
|
||||
{ // Clear the entire screen, from dest to deststop. Yes, this really works.
|
||||
memset(screens[0], (c&255), vid.width * vid.height * vid.bpp);
|
||||
memset(vid.screens[0], (c&255), vid.width * vid.height);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1172,8 +1164,8 @@ void V_DrawFill(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;
|
||||
|
||||
if (alphalevel)
|
||||
{
|
||||
@@ -1202,7 +1194,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
else
|
||||
{
|
||||
for (;(--h >= 0) && dest < deststop; dest += vid.width)
|
||||
memset(dest, c, w * vid.bpp);
|
||||
memset(dest, c, w);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1270,7 +1262,7 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||
|
||||
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
|
||||
{ // Clear the entire screen, from dest to deststop. Yes, this really works.
|
||||
memset(screens[0], (UINT8)(c&255), vid.width * vid.height * vid.bpp);
|
||||
memset(vid.screens[0], (UINT8)(c&255), vid.width * vid.height);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1317,7 +1309,7 @@ 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;
|
||||
dest = vid.screens[0] + y*vid.width + x;
|
||||
|
||||
if ((alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT)))
|
||||
{
|
||||
@@ -1440,14 +1432,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
|
||||
@@ -1512,8 +1504,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)
|
||||
@@ -1614,7 +1606,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;
|
||||
|
||||
@@ -1707,8 +1699,8 @@ void V_DrawFadeScreen(UINT16 color, UINT8 strength)
|
||||
: ((color & 0xFF00) // Color is not palette index?
|
||||
? ((UINT8 *)colormaps + strength*256) // Do COLORMAP fade.
|
||||
: ((UINT8 *)transtables + ((9-strength)<<FF_TRANSSHIFT) + 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
|
||||
@@ -1732,8 +1724,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];
|
||||
}
|
||||
|
||||
@@ -3440,8 +3432,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->postimg & POSTIMG_WATER)
|
||||
{
|
||||
@@ -3482,7 +3474,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);
|
||||
|
||||
@@ -3579,7 +3571,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;
|
||||
@@ -3599,8 +3591,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
|
||||
}
|
||||
|
||||
@@ -3660,18 +3652,15 @@ void V_Init(void)
|
||||
const INT32 screensize = vid.rowbytes * vid.height;
|
||||
|
||||
for (i = 0; i < NUMSCREENS; i++)
|
||||
screens[i] = NULL;
|
||||
vid.screens[i] = NULL;
|
||||
|
||||
// start address of NUMSCREENS * width*height vidbuffers
|
||||
if (base)
|
||||
{
|
||||
for (i = 0; i < NUMSCREENS; i++)
|
||||
screens[i] = base + i*screensize;
|
||||
vid.screens[i] = base + i*screensize;
|
||||
}
|
||||
|
||||
if (vid.direct)
|
||||
screens[0] = vid.direct;
|
||||
|
||||
#ifdef DEBUG
|
||||
CONS_Debug(DBG_RENDER, "V_Init done:\n");
|
||||
for (i = 0; i < NUMSCREENS; i++)
|
||||
|
||||
@@ -23,11 +23,6 @@
|
||||
// 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_accuratefps, cv_allcaps, cv_constextsize, cv_menucaps,
|
||||
cv_globalgamma, cv_globalsaturation,
|
||||
cv_rhue, cv_yhue, cv_ghue, cv_chue, cv_bhue, cv_mhue,
|
||||
|
||||
+1
-1
@@ -512,7 +512,7 @@ void Y_IntermissionDrawer(void)
|
||||
else
|
||||
{
|
||||
if (rendermode == render_soft)
|
||||
VID_BlitLinearScreen(screens[1], screens[0], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
|
||||
VID_BlitLinearScreen(vid.screens[1], vid.screens[0], vid.width, vid.height, vid.width, vid.rowbytes);
|
||||
#ifdef HWRENDER
|
||||
else if (rendermode == render_opengl)
|
||||
HWR_DrawIntermissionBG();
|
||||
|
||||
Reference in new issue
Block a user