diff --git a/src/m_menu.c b/src/m_menu.c index 0bed7567f..7416bd4fd 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1425,6 +1425,11 @@ static menuitem_t OP_ExpOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "FFloorclip", &cv_ffloorclip, 95}, {IT_STRING | IT_CVAR, NULL, "Spriteclip", &cv_spriteclip, 105}, + +#if defined(HAVE_SDL) + {IT_STRING | IT_CVAR, NULL, "Scale Quality", &cv_scalequality, 115}, +#endif + #ifdef HWRENDER {IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 95}, @@ -1449,6 +1454,7 @@ static const char* OP_ExpTooltips[] = "Which version of R_PointToAngle should\nbe used for Sector Clipping?\n64 may fix rendering issues on larger maps\nat the cost of performance.", "Hides 3DFloors which are not visible\npotentially resulting in a performance boost.", "Hides Sprites which are not visible\npotentially resulting in a performance boost.", + "Scale Quality", #ifdef HWRENDER "Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.", "Change the depth of the Palette in Palette rendering mod\n 16 bits is like software looks ingame\nwhile 24 bits is how software looks in screenshots.", @@ -1470,6 +1476,7 @@ enum op_exp_angleshit, op_exp_ffclip, op_exp_sprclip, + op_exp_sclqal, #ifdef HWRENDER op_exp_grscrtx, op_exp_spltwal, @@ -4444,6 +4451,7 @@ void M_Init(void) if (rendermode == render_opengl){ OP_ExpOptionsMenu[op_exp_ffclip].status = IT_DISABLED; OP_ExpOptionsMenu[op_exp_sprclip].status = IT_DISABLED; + OP_ExpOptionsMenu[op_exp_sclqal].status = IT_DISABLED; } #endif diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 7a85fb6cd..eed9c8302 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -87,6 +87,8 @@ #include "../discord.h" #endif +static void ScaleQuality_OnChange(void); + // maximum number of windowed modes (see windowedModes[][]) #define MAXWINMODES (22) @@ -117,6 +119,9 @@ static void Impl_SetVsync(void); consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Impl_SetVsync, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_stretch = {"stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t scalequality_cons_t[] = {{0, "Nearest"}, {1, "Linear"}, {2, "Best"}, {0, NULL}}; +consvar_t cv_scalequality = {"vid_scalequality", "Nearest", CV_SAVE|CV_CALL|CV_NOINIT, scalequality_cons_t, ScaleQuality_OnChange, 0, NULL, NULL, 0, 0, NULL}; + // these cant be used since config is read after window creation, so need to use command line parameter instead //static CV_PossibleValue_t msaa_cons_t[] = {{0, "Off"}, {2, "2X"}, {4, "4X"}, {8, "8X"}, {16, "16X"}, {0, NULL}}; //consvar_t cv_msaa = {"msaa", "Off", CV_SAVE, msaa_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -164,6 +169,12 @@ static SDL_Texture *texture; static SDL_bool havefocus = SDL_TRUE; static const char *fallback_resolution_name = "Fallback"; +static void ScaleQuality_OnChange(void) +{ + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, cv_scalequality.string); + COM_ImmedExecute(va("vid_mode %d", vid.modenum)); // Hack to make it apply without restarting +} + // windowed video modes from which to choose from. static INT32 windowedModes[MAXWINMODES][2] = { @@ -2109,6 +2120,7 @@ void I_StartupGraphics(void) COM_AddCommand ("vid_mode", VID_Command_Mode_f); CV_RegisterVar (&cv_vidwait); CV_RegisterVar (&cv_stretch); + CV_RegisterVar(&cv_scalequality); disable_mouse = M_CheckParm("-nomouse"); disable_fullscreen = M_CheckParm("-win") ? 1 : 0; diff --git a/src/v_video.h b/src/v_video.h index 3b011a10f..4625b3057 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -27,10 +27,10 @@ extern UINT8 *screens[5]; -extern consvar_t cv_ticrate, cv_allcaps, cv_constextsize, cv_menucaps,\ -cv_globalgamma, cv_globalsaturation, \ +extern consvar_t cv_ticrate, cv_allcaps, cv_constextsize, cv_menucaps, cv_scalequality,\ +cv_globalgamma, cv_globalsaturation,\ cv_rhue, cv_yhue, cv_ghue, cv_chue, cv_bhue, cv_mhue,\ -cv_rgamma, cv_ygamma, cv_ggamma, cv_cgamma, cv_bgamma, cv_mgamma, \ +cv_rgamma, cv_ygamma, cv_ggamma, cv_cgamma, cv_bgamma, cv_mgamma,\ cv_rsaturation, cv_ysaturation, cv_gsaturation, cv_csaturation, cv_bsaturation, cv_msaturation;