From df581ae69fb1ed40af221ed6635ec7d8da5adaf0 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Sun, 19 Oct 2025 16:34:35 -0400 Subject: [PATCH] Remove dead renderer code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit based on https://github.com/Indev450/SRB2Kart-Saturn/commit/0eeacaf51ea2fc291b35159f02817bf5d6bbd6cb remove - broken viewborder code (if we really want it back for some reason, we should rather port RR´s fixed version of it) - remove console clipping code for software (this was broken eiherway) - remove hud message clearing stuff - remove renderscreen and linesize variables (they just pointed to vid.screen and vid.widht) --- src/Makefile.d/sdl.mk | 2 +- src/console.c | 31 ------- src/console.h | 5 - src/d_main.cpp | 12 --- src/doomstat.h | 2 +- src/doomtype.h | 1 - src/hardware/hw_draw.c | 204 +---------------------------------------- src/hardware/hw_main.h | 2 - src/hu_stuff.c | 70 -------------- src/hu_stuff.h | 1 - src/i_video.h | 2 +- src/m_menu.c | 3 +- src/r_draw.cpp | 159 +------------------------------- src/r_draw.h | 36 +------- src/r_draw_span.cpp | 1 - src/r_main.cpp | 9 +- src/r_plane.cpp | 2 +- src/r_segs.cpp | 5 +- src/r_things.cpp | 6 +- src/screen.c | 7 +- src/screen.h | 2 - src/sdl/CMakeLists.txt | 2 +- src/st_stuff.c | 4 - 23 files changed, 18 insertions(+), 550 deletions(-) diff --git a/src/Makefile.d/sdl.mk b/src/Makefile.d/sdl.mk index 74a3bd107..c3a5045c1 100644 --- a/src/Makefile.d/sdl.mk +++ b/src/Makefile.d/sdl.mk @@ -11,7 +11,7 @@ makedir:=$(makedir)/SDL sources+=$(call List,sdl/Sourcefile) -opts+=-DDIRECTFULLSCREEN -DHAVE_SDL +opts+=-DHAVE_SDL ifndef NOHW sources+=sdl/ogl_sdl.c diff --git a/src/console.c b/src/console.c index 87c3a3e1e..9c30ee78c 100644 --- a/src/console.c +++ b/src/console.c @@ -73,14 +73,9 @@ static boolean consoleready; // console prompt is ready INT32 con_destlines; // vid lines used by console at final position static INT32 con_curlines; // vid lines currently used by console - INT32 con_clipviewtop; // (useless) - static INT32 con_hudlines; // number of console heads up message lines static INT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines - INT32 con_clearlines; // top screen lines to refresh when view reduced - boolean con_hudupdate; // when messages scroll, we need a backgrnd refresh - // console text output static char *con_line; // console text output current line static size_t con_cx; // cursor position in current line @@ -440,9 +435,6 @@ void CON_Init(void) Lock_state(); - //note: CON_Ticker should always execute at least once before D_Display() - con_clipviewtop = -1; // -1 does not clip - con_hudlines = atoi(cons_hudlines.defaultvalue); Unlock_state(); @@ -724,7 +716,6 @@ void CON_ToggleOff(void) con_curlines = 0; CON_ClearHUD(); con_forcepic = 0; - con_clipviewtop = -1; // remove console clipping of view I_UpdateMouseGrab(); @@ -773,18 +764,6 @@ void CON_Ticker(void) CON_ChangeHeight(); } - // clip the view, so that the part under the console is not drawn - con_clipviewtop = -1; - if (cons_backpic.value) // clip only when using an opaque background - { - if (con_curlines > 0) - con_clipviewtop = con_curlines - viewwindowy - 1 - 10; - // NOTE: BIG HACK::SUBTRACT 10, SO THAT WATER DON'T COPY LINES OF THE CONSOLE - // WINDOW!!! (draw some more lines behind the bottom of the console) - if (con_clipviewtop < 0) - con_clipviewtop = -1; // maybe not necessary, provided it's < 0 - } - // check if console ready for prompt if (con_destlines >= minheight) consoleready = true; @@ -1111,9 +1090,6 @@ static void CON_Linefeed(void) con_line = &con_buffer[(con_cy%con_totallines)*con_width]; memset(con_line, ' ', con_width); - - // make sure the view borders are refreshed if hud messages scroll - con_hudupdate = true; // see HU_Erase() } // Outputs text into the console text buffer @@ -1486,9 +1462,6 @@ static void CON_DrawHudlines(void) //V_DrawCharacter(x, y, (p[c]&0xff) | cv_constextsize.value | V_NOSCALESTART, true); y += charheight; } - - // top screen lines that might need clearing when view is reduced - con_clearlines = y; // this is handled by HU_Erase(); } // Lactozilla: Draws the console's background picture. @@ -1554,10 +1527,6 @@ static void CON_DrawConsole(void) if (con_curlines <= 0) return; - //FIXME: refresh borders only when console bg is translucent - con_clearlines = con_curlines; // clear console draw from view borders - con_hudupdate = true; // always refresh while console is on - // draw console background if (cons_backpic.value || con_forcepic) CON_DrawBackpic(); diff --git a/src/console.h b/src/console.h index fb2f5827c..bcc503a21 100644 --- a/src/console.h +++ b/src/console.h @@ -60,14 +60,9 @@ typedef enum extern con_loadprogress_t con_startup_loadprogress; -// top clip value for view render: do not draw part of view hidden by console -extern INT32 con_clipviewtop; - // 0 means console if off, or moving out extern INT32 con_destlines; -extern INT32 con_clearlines; // lines of top of screen to refresh -extern boolean con_hudupdate; // hud messages have changed, need refresh extern UINT32 con_scalefactor; // console text scale factor extern consvar_t cons_backcolor, cons_menuhighlight; diff --git a/src/d_main.cpp b/src/d_main.cpp index 35c8e5b6a..41040b753 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -526,19 +526,16 @@ static void D_Display(void) case GS_LEVEL: if (!gametic) break; - HU_Erase(); AM_Drawer(); break; case GS_INTERMISSION: Y_IntermissionDrawer(); - HU_Erase(); HU_Drawer(); break; case GS_VOTING: Y_VoteDrawer(); - HU_Erase(); HU_Drawer(); break; @@ -556,31 +553,26 @@ static void D_Display(void) case GS_CUTSCENE: F_CutsceneDrawer(); - HU_Erase(); HU_Drawer(); break; case GS_EVALUATION: F_GameEvaluationDrawer(); - HU_Erase(); HU_Drawer(); break; case GS_CREDITS: F_CreditDrawer(); - HU_Erase(); HU_Drawer(); break; case GS_BLANCREDITS: F_BlanCreditDrawer(); - HU_Erase(); HU_Drawer(); break; case GS_SECRETCREDITS: F_SecretCreditsDrawer(); - HU_Erase(); HU_Drawer(); break; @@ -590,7 +582,6 @@ static void D_Display(void) { // I don't think HOM from nothing drawing is independent... F_WaitingPlayersDrawer(); - HU_Erase(); HU_Drawer(); } case GS_DEDICATEDSERVER: @@ -770,7 +761,6 @@ static void D_WipeDraw(boolean menu) I_UpdateNoBlit(); - HU_Erase(); HU_Drawer(); if (menu) { @@ -1711,9 +1701,7 @@ void D_SRB2Main(void) //--------------------------------------------------------- CONFIG.CFG M_FirstLoadConfig(); // WARNING : this do a "COM_BufExecute()" -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen -#endif // set user default mode or mode set at cmdline SCR_CheckDefaultMode(); diff --git a/src/doomstat.h b/src/doomstat.h index 442c0d198..d35dd05db 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -180,7 +180,7 @@ extern boolean lastdraw; extern INT32 postimgparam[MAXSPLITSCREENPLAYERS]; extern INT32 viewwindowx, viewwindowy; -extern INT32 viewwidth, scaledviewwidth; +extern INT32 viewwidth; extern boolean gamedataloaded; diff --git a/src/doomtype.h b/src/doomtype.h index c3126a2af..6ffda2b23 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -44,7 +44,6 @@ extern "C" { #define UINT64 uint64_t #ifdef __APPLE_CC__ -#define DIRECTFULLSCREEN 1 #define DEBUG_LOG #define NOIPX #endif diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index bfd9835c7..f2e3cb95a 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -33,11 +33,6 @@ #include "../r_plane.h" // R_FlatDimensionsFromLumpSize #include -#include "../i_video.h" // for rendermode != render_glide - -#ifndef O_BINARY -#define O_BINARY 0 -#endif typedef struct { @@ -57,72 +52,6 @@ static UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229 static UINT8 softwaretranstogl_hi[11] = { 0, 51,102,153,204,255,255,255,255,255,255}; static UINT8 softwaretranstogl_lo[11] = { 0, 12, 24, 36, 48, 60, 71, 83, 95,111,127}; -// -// -----------------+ -// HWR_DrawPatch : Draw a 'tile' graphic -// Notes : x,y : positions relative to the original Doom resolution -// : textes(console+score) + menus + status bar -// -----------------+ -void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option) -{ - FOutVector v[4]; - FBITFIELD flags; - GLPatch_t *hwrPatch; - -// 3--2 -// | /| -// |/ | -// 0--1 - float sdupx = FIXED_TO_FLOAT(vid.fdupx)*2.0f; - float sdupy = FIXED_TO_FLOAT(vid.fdupy)*2.0f; - float pdupx = FIXED_TO_FLOAT(vid.fdupx)*2.0f; - float pdupy = FIXED_TO_FLOAT(vid.fdupy)*2.0f; - - // make patch ready in hardware cache - HWR_GetPatch(gpatch); - hwrPatch = ((GLPatch_t *)gpatch->hardware); - - switch (option & V_SCALEPATCHMASK) - { - case V_NOSCALEPATCH: - pdupx = pdupy = 2.0f; - break; - case V_SMALLSCALEPATCH: - 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.meddupx*FRACUNIT); - pdupy = 2.0f * FIXED_TO_FLOAT(vid.meddupx*FRACUNIT); - break; - } - - if (option & V_NOSCALESTART) - sdupx = sdupy = 2.0f; - - v[0].x = v[3].x = (x*sdupx-(gpatch->leftoffset)*pdupx)/vid.width - 1; - v[2].x = v[1].x = (x*sdupx+(gpatch->width-gpatch->leftoffset)*pdupx)/vid.width - 1; - v[0].y = v[1].y = 1-(y*sdupy-(gpatch->topoffset)*pdupy)/vid.height; - v[2].y = v[3].y = 1-(y*sdupy+(gpatch->height-gpatch->topoffset)*pdupy)/vid.height; - - v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; - - v[0].s = v[3].s = 0.0f; - v[2].s = v[1].s = hwrPatch->max_s; - v[0].t = v[1].t = 0.0f; - v[2].t = v[3].t = hwrPatch->max_t; - - flags = PF_Translucent|PF_NoDepthTest; - - /*if (option & V_WRAPX) - flags |= PF_ForceWrapX; - if (option & V_WRAPY) - flags |= PF_ForceWrapY;*/ - - // clip it since it is used for bunny scroll in doom I - HWD.pfnDrawPolygon(NULL, v, 4, flags); -} - void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap) { FOutVector v[4]; @@ -775,137 +704,6 @@ void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight) HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); } - -// ========================================================================== -// R_DRAW.C STUFF -// ========================================================================== - -// ------------------ -// HWR_DrawViewBorder -// Fill the space around the view window with a Doom flat texture, draw the -// beveled edges. -// 'clearlines' is useful to clear the heads up messages, when the view -// window is reduced, it doesn't refresh all the view borders. -// ------------------ -void HWR_DrawViewBorder(INT32 clearlines) -{ - INT32 x, y; - INT32 top, side; - INT32 baseviewwidth, baseviewheight; - INT32 basewindowx, basewindowy; - patch_t *patch; - -// if (gl_viewwidth == vid.width) -// return; - - if (!clearlines) - clearlines = BASEVIDHEIGHT; // refresh all - - // calc view size based on original game resolution - baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7; - baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdupy)); - top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdupy)); - side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwindowx), vid.fdupx)); - - // top - HWR_DrawFlatFill(0, 0, - BASEVIDWIDTH, (top < clearlines ? top : clearlines), - st_borderpatchnum); - - // left - if (top < clearlines) - HWR_DrawFlatFill(0, top, side, - (clearlines-top < baseviewheight ? clearlines-top : baseviewheight), - st_borderpatchnum); - - // right - if (top < clearlines) - HWR_DrawFlatFill(side + baseviewwidth, top, side, - (clearlines-top < baseviewheight ? clearlines-top : baseviewheight), - st_borderpatchnum); - - // bottom - if (top + baseviewheight < clearlines) - HWR_DrawFlatFill(0, top + baseviewheight, - BASEVIDWIDTH, BASEVIDHEIGHT, st_borderpatchnum); - - // - // draw the view borders - // - - basewindowx = (BASEVIDWIDTH - baseviewwidth)>>1; - if (baseviewwidth == BASEVIDWIDTH) - basewindowy = 0; - else - basewindowy = top; - - // top edge - if (clearlines > basewindowy - 8) - { - patch = W_CachePatchNum(viewborderlump[BRDR_T], PU_PATCH); - for (x = 0; x < baseviewwidth; x += 8) - HWR_DrawPatch(patch, basewindowx + x, basewindowy - 8, - 0); - } - - // bottom edge - if (clearlines > basewindowy + baseviewheight) - { - patch = W_CachePatchNum(viewborderlump[BRDR_B], PU_PATCH); - for (x = 0; x < baseviewwidth; x += 8) - HWR_DrawPatch(patch, basewindowx + x, - basewindowy + baseviewheight, 0); - } - - // left edge - if (clearlines > basewindowy) - { - patch = W_CachePatchNum(viewborderlump[BRDR_L], PU_PATCH); - for (y = 0; y < baseviewheight && basewindowy + y < clearlines; - y += 8) - { - HWR_DrawPatch(patch, basewindowx - 8, basewindowy + y, - 0); - } - } - - // right edge - if (clearlines > basewindowy) - { - patch = W_CachePatchNum(viewborderlump[BRDR_R], PU_PATCH); - for (y = 0; y < baseviewheight && basewindowy+y < clearlines; - y += 8) - { - HWR_DrawPatch(patch, basewindowx + baseviewwidth, - basewindowy + y, 0); - } - } - - // Draw beveled corners. - if (clearlines > basewindowy - 8) - HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TL], - PU_PATCH), - basewindowx - 8, basewindowy - 8, 0); - - if (clearlines > basewindowy - 8) - HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TR], - PU_PATCH), - basewindowx + baseviewwidth, basewindowy - 8, 0); - - if (clearlines > basewindowy+baseviewheight) - HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BL], - PU_PATCH), - basewindowx - 8, basewindowy + baseviewheight, 0); - - if (clearlines > basewindowy + baseviewheight) - HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BR], - PU_PATCH), - basewindowx + baseviewwidth, - basewindowy + baseviewheight, 0); -} - - - // ========================================================================== // AM_MAP.C DRAWING STUFF // ========================================================================== @@ -1206,7 +1004,7 @@ static inline boolean saveTGA(const char *file_name, void *buffer, INT32 i; UINT8 *buf8 = buffer; - fd = open(file_name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); + fd = open(file_name, O_WRONLY | O_CREAT | O_TRUNC, 0666); if (fd < 0) return false; diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 9fa695a61..52581545f 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -38,11 +38,9 @@ void HWR_RenderSkyboxView(player_t *player); void HWR_RenderPlayerView(void); void HWR_ClearSkyDome(void); void HWR_BuildSkyDome(void); -void HWR_DrawViewBorder(INT32 clearlines); void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum); void HWR_InitTextureMapping(void); void HWR_SetViewSize(void); -void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option); void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap); void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t scale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h); void HWR_MakePatch(const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap); diff --git a/src/hu_stuff.c b/src/hu_stuff.c index f32610e78..b569eac3c 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2176,76 +2176,6 @@ void HU_Drawer(void) } } -//====================================================================== -// HUD MESSAGES CLEARING FROM SCREEN -//====================================================================== - -// Clear old messages from the borders around the view window -// (only for reduced view, refresh the borders when needed) -// -// startline: y coord to start clear, -// clearlines: how many lines to clear. -// -static INT32 oldclearlines; - -void HU_Erase(void) -{ - INT32 topline, bottomline; - INT32 y, yoffset; - -#ifdef HWRENDER - // clear hud msgs on double buffer (OpenGL mode) - boolean secondframe; - static INT32 secondframelines; -#endif - - if (con_clearlines == oldclearlines && !con_hudupdate && !chat_on) - return; - -#ifdef HWRENDER - // clear the other frame in double-buffer modes - secondframe = (con_clearlines != oldclearlines); - if (secondframe) - secondframelines = oldclearlines; -#endif - - // clear the message lines that go away, so use _oldclearlines_ - bottomline = oldclearlines; - oldclearlines = con_clearlines; - if (chat_on && OLDCHAT) - if (bottomline < 8) - bottomline = 8; // only do it for consolechat. consolechat is gay. - - if (automapactive || viewwindowx == 0) // hud msgs don't need to be cleared - return; - - // software mode copies view border pattern & beveled edges from the backbuffer - if (rendermode == render_soft) - { - topline = 0; - for (y = topline, yoffset = y*vid.width; y < bottomline; y++, yoffset += vid.width) - { - if (y < viewwindowy || y >= viewwindowy + viewheight) - R_VideoErase(yoffset, vid.width); // erase entire line - else - { - R_VideoErase(yoffset, viewwindowx); // erase left border - // erase right border - R_VideoErase(yoffset + viewwindowx + viewwidth, viewwindowx); - } - } - con_hudupdate = false; // if it was set.. - } -#ifdef HWRENDER - else if (rendermode != render_none) - { - // refresh just what is needed from the view borders - HWR_DrawViewBorder(secondframelines); - con_hudupdate = secondframe; - } -#endif -} - //====================================================================== // IN-LEVEL MULTIPLAYER RANKINGS //====================================================================== diff --git a/src/hu_stuff.h b/src/hu_stuff.h index fd95c5a76..7cbbb2063 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -131,7 +131,6 @@ void HU_TickSongCredits(void); void HU_DrawSongCredits(void); void HU_Drawer(void); char HU_dequeueChatChar(void); -void HU_Erase(void); void HU_clearChatChars(void); void HU_drawPing(INT32 x, INT32 y, UINT32 ping, UINT32 mindelay, UINT32 pl, INT32 flags, boolean icon); void HU_drawOldPing(INT32 x, INT32 y, UINT32 ping, UINT32 mindelay, UINT32 pl, INT32 flags); diff --git a/src/i_video.h b/src/i_video.h index 450c3c3db..9d101a0b0 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -108,8 +108,8 @@ void VID_CheckGLLoaded(rendermode_t oldrender); \return name of video mode */ const char *VID_GetModeName(INT32 modenum); -void VID_PrepareModeList(void); /// note hack for SDL +void VID_PrepareModeList(void); /** \brief can video system do fullscreen */ diff --git a/src/m_menu.c b/src/m_menu.c index 0b3068898..661b75498 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8177,9 +8177,8 @@ INT32 MR_VideoModeMenu(INT32 choice) memset(modedescs, 0, sizeof(modedescs)); -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) VID_PrepareModeList(); // FIXME: hack -#endif + vidm_nummodes = 0; vidm_selected = 0; nummodes = VID_NumModes(); diff --git a/src/r_draw.cpp b/src/r_draw.cpp index 23835fe4f..0a09ebd82 100644 --- a/src/r_draw.cpp +++ b/src/r_draw.cpp @@ -67,8 +67,7 @@ drawspandata_t g_ds; /** \brief view info */ -INT32 linesize, viewwidth, scaledviewwidth, viewheight, viewwindowx, viewwindowy; -UINT8 *renderscreen; // haleyjd +INT32 viewwidth, viewheight, viewwindowx, viewwindowy; UINT8 r8_flatcolor; @@ -525,21 +524,13 @@ void R_ResetColumnBuffer(void) Creates lookup tables for getting the framebuffer address of a pixel to draw. - \param width witdh of buffer - \param height hieght of buffer - \return void */ -void R_InitViewBuffer(INT32 width, INT32 height) +void R_InitViewBuffer(void) { - if (width > MAXVIDWIDTH) - width = MAXVIDWIDTH; - if (height > MAXVIDHEIGHT) - height = MAXVIDHEIGHT; - viewwindowx = 0; viewwindowy = 0; INT32 bufsize = (vid.width * 8) * sizeof(*temp_dc.buf); @@ -564,28 +555,6 @@ void R_InitViewBuffer(INT32 width, INT32 height) #endif memset(temp_dc.buf, 0, bufsize); - - linesize = vid.width; // killough 11/98 - renderscreen = vid.screens[0]; // haleyjd 07/02/14 -} - -/** \brief viewborder patches lump numbers -*/ -lumpnum_t viewborderlump[8]; - -/** \brief Store the lumpnumber of the viewborder patches -*/ - -void R_InitViewBorder(void) -{ - viewborderlump[BRDR_T] = W_GetNumForName("brdr_t"); - viewborderlump[BRDR_B] = W_GetNumForName("brdr_b"); - viewborderlump[BRDR_L] = W_GetNumForName("brdr_l"); - viewborderlump[BRDR_R] = W_GetNumForName("brdr_r"); - viewborderlump[BRDR_TL] = W_GetNumForName("brdr_tl"); - viewborderlump[BRDR_BL] = W_GetNumForName("brdr_bl"); - viewborderlump[BRDR_TR] = W_GetNumForName("brdr_tr"); - viewborderlump[BRDR_BR] = W_GetNumForName("brdr_br"); } /** \brief The R_VideoErase function @@ -632,130 +601,6 @@ void R_VideoErase(size_t ofs, INT32 count) M_Memcpy(vid.screens[0] + ofs, vid.screens[1] + ofs, count); } -#if 0 -/** \brief R_FillBackScreen - - Fills the back screen with a pattern for variable screen sizes - Also draws a beveled edge. -*/ -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) - return; - - // draw pattern around the status bar too (when hires), - // so return only when in full-screen without status bar. - if (scaledviewwidth == vidwidth && viewheight == vidheight) - return; - - src = scr_borderpatch; - dest = vid.screens[1]; - - for (y = 0; y < vidheight; y++) - { - for (x = 0; x < vidwidth/128; x++) - { - M_Memcpy (dest, src+((y&127)<<7), 128); - dest += 128; - } - - if (vidwidth&127) - { - M_Memcpy(dest, src+((y&127)<<7), vidwidth&127); - dest += (vidwidth&127); - } - } - - // don't draw the borders when viewwidth is full vidwidth. - if (scaledviewwidth == vidwidth) - return; - - step = 8; - boff = 8; - - patch = W_CacheLumpNum(viewborderlump[BRDR_T], PU_CACHE); - for (x = 0; x < scaledviewwidth; x += step) - V_DrawPatch(viewwindowx + x, viewwindowy - boff, 1, patch); - - patch = W_CacheLumpNum(viewborderlump[BRDR_B], PU_CACHE); - for (x = 0; x < scaledviewwidth; x += step) - V_DrawPatch(viewwindowx + x, viewwindowy + viewheight, 1, patch); - - patch = W_CacheLumpNum(viewborderlump[BRDR_L], PU_CACHE); - for (y = 0; y < viewheight; y += step) - V_DrawPatch(viewwindowx - boff, viewwindowy + y, 1, patch); - - patch = W_CacheLumpNum(viewborderlump[BRDR_R],PU_CACHE); - for (y = 0; y < viewheight; y += step) - V_DrawPatch(viewwindowx + scaledviewwidth, viewwindowy + y, 1, - patch); - - // Draw beveled corners. - V_DrawPatch(viewwindowx - boff, viewwindowy - boff, 1, - W_CacheLumpNum(viewborderlump[BRDR_TL], PU_CACHE)); - V_DrawPatch(viewwindowx + scaledviewwidth, viewwindowy - boff, 1, - W_CacheLumpNum(viewborderlump[BRDR_TR], PU_CACHE)); - V_DrawPatch(viewwindowx - boff, viewwindowy + viewheight, 1, - W_CacheLumpNum(viewborderlump[BRDR_BL], PU_CACHE)); - V_DrawPatch(viewwindowx + scaledviewwidth, viewwindowy + viewheight, 1, - W_CacheLumpNum(viewborderlump[BRDR_BR], PU_CACHE)); -} - -/** \brief The R_DrawViewBorder - - Draws the border around the view - for different size windows? -*/ -void R_DrawViewBorder(void) -{ - INT32 top, side, ofs; - - if (rendermode == render_none) - return; -#ifdef HWRENDER - if (rendermode != render_soft) - { - HWR_DrawViewBorder(0); - return; - } - else -#endif - -#ifdef DEBUG - fprintf(stderr,"RDVB: vidwidth %d vidheight %d scaledviewwidth %d viewheight %d\n", - vid.width, vidheight, scaledviewwidth, viewheight); -#endif - - if (scaledviewwidth == vid.width) - return; - - top = (vidheight - viewheight)>>1; - side = (vid.width - scaledviewwidth)>>1; - - // copy top and one line of left side - R_VideoErase(0, top*vid.width+side); - - // copy one line of right side and bottom - ofs = (viewheight+top)*vid.width - side; - R_VideoErase(ofs, top*vid.width + side); - - // copy sides using wraparound - ofs = top*vid.width + vid.width-side; - side <<= 1; - - // simpler using our VID_Blit routine - VID_BlitLinearScreen(vid.screens[1] + ofs, vid.screens[0] + ofs, side, viewheight - 1, - vid.width, vid.width); -} -#endif - // ========================================================================== // INCLUDE MAIN DRAWERS CODE HERE // ========================================================================== diff --git a/src/r_draw.h b/src/r_draw.h index 216870767..6a742c609 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -23,12 +23,10 @@ extern "C" { // ------------------------------- // COMMON STUFF FOR 8bpp AND 16bpp // ------------------------------- -extern UINT8 *renderscreen; -extern INT32 linesize; FUNCINLINE static ATTRINLINE UINT8 *R_Address(INT32 px, INT32 py) { - return renderscreen + (py + viewwindowy) * linesize + (viewwindowx + px); + return vid.screens[0] + (py + viewwindowy) * vid.width + (viewwindowx + px); } extern UINT8 r8_flatcolor; @@ -56,25 +54,6 @@ void SCR_SetDrawFuncs(enum columncontext_e _columncontext); void R_ResetColumnBuffer(void); -/// \brief Top border -#define BRDR_T 0 -/// \brief Bottom border -#define BRDR_B 1 -/// \brief Left border -#define BRDR_L 2 -/// \brief Right border -#define BRDR_R 3 -/// \brief Topleft border -#define BRDR_TL 4 -/// \brief Topright border -#define BRDR_TR 5 -/// \brief Bottomleft border -#define BRDR_BL 6 -/// \brief Bottomright border -#define BRDR_BR 7 - -extern lumpnum_t viewborderlump[8]; - // --------------------------------------------- // color mode dependent drawer function pointers // --------------------------------------------- @@ -140,7 +119,7 @@ extern spandrawfunc_t *spanfuncs_bm_npo2[SPANDRAWFUNC_MAX]; extern spandrawfunc_t *spanfuncs_flat[SPANDRAWFUNC_MAX]; // ------------------------------------------------ -// r_draw.c COMMON ROUTINES FOR BOTH 8bpp and 16bpp +// r_draw.c // ------------------------------------------------ #define GTC_CACHE 1 @@ -193,18 +172,9 @@ UINT8 R_InvPaletteRemap(UINT8 color); // Color ramp modification should force a recache extern UINT8 skincolor_modified[]; -void R_InitViewBuffer(INT32 width, INT32 height); -void R_InitViewBorder(void); +void R_InitViewBuffer(void); void R_VideoErase(size_t ofs, INT32 count); -// Rendering function. -#if 0 -void R_FillBackScreen(void); - -// If the view size is not full screen, draws a border around it. -void R_DrawViewBorder(void); -#endif - #define TRANSPARENTPIXEL 255 #define BRIGHTPIXEL 0 diff --git a/src/r_draw_span.cpp b/src/r_draw_span.cpp index a4228a453..ae9baec94 100644 --- a/src/r_draw_span.cpp +++ b/src/r_draw_span.cpp @@ -796,7 +796,6 @@ void R_DrawFogSpan(drawspandata_t* ds) UINT8 *colormap; UINT8 *dest; - const INT32 vidwidth = vid.width; colormap = ds->colormap; diff --git a/src/r_main.cpp b/src/r_main.cpp index 9a7d3d7e2..37b3dc36b 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -965,18 +965,15 @@ void R_ExecuteSetViewSize(void) // status bar overlay st_overlay = cv_showhud.value; - scaledviewwidth = vid.width; + viewwidth = vid.width; viewheight = vid.height; if (r_splitscreen) viewheight >>= 1; - viewwidth = scaledviewwidth; - if (r_splitscreen > 1) { viewwidth >>= 1; - scaledviewwidth >>= 1; } centerx = viewwidth/2; @@ -1009,7 +1006,7 @@ void R_ExecuteSetViewSize(void) } } - R_InitViewBuffer(scaledviewwidth, viewheight); + R_InitViewBuffer(); // thing clipping for (i = 0; i < viewwidth; i++) @@ -1072,8 +1069,6 @@ void R_Init(void) CONS_Printf("R_InitColormaps()...\n"); R_InitColormaps(); - //I_OutputMsg("\nR_InitViewBorder"); - R_InitViewBorder(); R_SetViewSize(); // setsizeneeded is set true //I_OutputMsg("\nR_InitPlanes"); diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 0fbe40534..f1dc3a552 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -676,7 +676,7 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc)(drawcolumndata_t*), bo R_CheckDebugHighlight(SW_HI_SKY); - // Reset column drawer function (note: couldn't we just call walldrawerfunc directly?) + // Reset column drawer function (note: couldn't we just call colfuncs[BASEDRAWFUNC] directly?) // (that is, unless we'll need to switch drawers in future for some reason) R_SetColumnFunc(BASEDRAWFUNC, false); diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 7de00301b..a34fb7dad 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -30,7 +30,6 @@ #include "m_misc.h" #include "p_local.h" // Camera... #include "p_slopes.h" -#include "console.h" // con_clipviewtop #include "taglist.h" #include "r_draw.h" #include "core/memory.h" @@ -759,8 +758,6 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) sector_t tempsec; INT32 templight; INT32 i, p; - fixed_t bottombounds = viewheight << FRACBITS; - fixed_t topbounds = (con_clipviewtop - 1) << FRACBITS; fixed_t offsetvalue = 0; lightlist_t *light; r_lightlist_t *rlight; @@ -1086,7 +1083,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) bottom_frac += bottom_step; // SoM: If column is out of range, why bother with it?? - if (windowbottom < topbounds || windowtop > bottombounds) + if (windowbottom < 0 || windowtop > (viewheight << FRACBITS)) { if (dc->numlights) { diff --git a/src/r_things.cpp b/src/r_things.cpp index 0b332bff0..431be8cd1 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -3333,8 +3333,6 @@ void R_InitDrawNodes(void) // R_DrawSprite // //Fab : 26-04-98: -// NOTE : uses con_clipviewtop, so that when console is on, -// don't draw the part of sprites hidden under the console static void R_DrawSprite(vissprite_t *spr) { mfloorclip = spr->clipbot; @@ -3376,7 +3374,7 @@ void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2, portal_t* portal) for (x = x1; x <= x2; x++) { spr->clipbot[x] = (INT16)viewheight; - spr->cliptop[x] = (INT16)con_clipviewtop; + spr->cliptop[x] = (INT16)-1; } return; } @@ -3559,7 +3557,7 @@ void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2, portal_t* portal) if (spr->cliptop[x] == CLIP_UNDEF) //Fab : 26-04-98: was -1, now clips against console bottom - spr->cliptop[x] = (INT16)con_clipviewtop; + spr->cliptop[x] = (INT16)-1; // Sprite is completely above or below clip plane if (spr->szt >= spr->clipbot[x] || spr->sz <= spr->cliptop[x]) diff --git a/src/screen.c b/src/screen.c index b9e233841..df4a2aace 100644 --- a/src/screen.c +++ b/src/screen.c @@ -94,10 +94,6 @@ consvar_t cv_accuratefps = CVAR_INIT ("fpssampling", "Accurate", CV_SAVE, accura // SCREEN VARIABLES // ========================================================================= -UINT8 *scr_borderpatch; // flat used to fill the reduced view borders set at ST_Init() - -// ========================================================================= - void SCR_SetDrawFuncs(enum columncontext_e _columncontext) { // @@ -478,7 +474,6 @@ void SCR_SetDefaultMode(void) // Change fullscreen on/off according to cv_fullscreen void SCR_ChangeFullscreen(void) { -#ifdef DIRECTFULLSCREEN I_SetBorderlessWindow(); // Running this here so we can have borderless window at startup // allow_fullscreen is set by VID_PrepareModeList @@ -491,8 +486,8 @@ void SCR_ChangeFullscreen(void) VID_PrepareModeList(); setmodeneeded = VID_GetModeForSize(vid.width, vid.height) + 1; } + return; -#endif } void SCR_ChangeRenderer(void) diff --git a/src/screen.h b/src/screen.h index f1f25a2ff..539ede6d4 100644 --- a/src/screen.h +++ b/src/screen.h @@ -95,8 +95,6 @@ void SCR_ChangeRenderer(void); extern CV_PossibleValue_t cv_renderer_t[]; -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; extern consvar_t cv_vhseffect, cv_shittyscreen, cv_votebgscaling; extern consvar_t cv_parallelsoftware; diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index e49596525..c9a7101c5 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -71,7 +71,7 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES Windows) endif() target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXER -DSOUND=SOUND_MIXER) -target_compile_definitions(SRB2SDL2 PRIVATE -DDIRECTFULLSCREEN -DHAVE_SDL) +target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_SDL) #### Installation #### if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin) diff --git a/src/st_stuff.c b/src/st_stuff.c index 8fe54c0e0..15e347691 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -169,10 +169,6 @@ void ST_UnloadGraphics(void) void ST_LoadGraphics(void) { - // SRB2 border patch - // st_borderpatchnum = W_GetNumForName("GFZFLR01"); - // scr_borderpatch = W_CacheLumpNum(st_borderpatchnum, PU_HUDGFX); - // the original Doom uses 'STF' as base name for all face graphics // Graue 04-08-2004: face/name graphics are now indexed by skins // but load them in R_AddSkins, that gets called