From efcc2d8eac6a65d5d08f85c49b5fcc2b7bdfae24 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Tue, 16 Apr 2024 09:01:37 +1000 Subject: [PATCH] vid: remove cvar vid_userefreshrate It's unnecessary and other Quake engines don't have it. Signed-off-by: bones_was_here --- menu.c | 19 +++++-------------- vid.h | 2 -- vid_sdl.c | 2 +- vid_shared.c | 13 +++++-------- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/menu.c b/menu.c index 38fc7adf..add19c65 100644 --- a/menu.c +++ b/menu.c @@ -2830,9 +2830,9 @@ video_resolution_t video_resolutions_hardcoded[] = // this is the number of the default mode (640x480) in the list above int video_resolutions_hardcoded_count = sizeof(video_resolutions_hardcoded) / sizeof(*video_resolutions_hardcoded) - 1; -#define VIDEO_ITEMS 10 +#define VIDEO_ITEMS 9 static int video_cursor = 0; -static int video_cursor_table[VIDEO_ITEMS] = {68, 88, 96, 104, 112, 120, 128, 136, 144, 152}; +static int video_cursor_table[VIDEO_ITEMS] = {68, 88, 96, 104, 112, 120, 128, 136, 144}; static int menu_video_resolution; video_resolution_t *video_resolutions; @@ -2923,7 +2923,7 @@ static void M_Video_Draw (void) // Current and Proposed Resolution M_Print(16, video_cursor_table[t] - 12, " Current Resolution"); - if (vid_supportrefreshrate && vid.mode.userefreshrate && vid.mode.fullscreen) + if (!vid_desktopfullscreen.integer && vid.mode.refreshrate && vid.mode.fullscreen) // FIXME read current mode instead of cvar M_Print(220, video_cursor_table[t] - 12, va(vabuf, sizeof(vabuf), "%dx%d %.2fhz", vid.mode.width, vid.mode.height, vid.mode.refreshrate)); else M_Print(220, video_cursor_table[t] - 12, va(vabuf, sizeof(vabuf), "%dx%d", vid.mode.width, vid.mode.height)); @@ -2938,12 +2938,7 @@ static void M_Video_Draw (void) t++; // Refresh Rate - M_ItemPrint(16, video_cursor_table[t], " Use Refresh Rate", vid_supportrefreshrate); - M_DrawCheckbox(220, video_cursor_table[t], vid_userefreshrate.integer); - t++; - - // Refresh Rate - M_ItemPrint(16, video_cursor_table[t], " Refresh Rate", vid_supportrefreshrate && vid_userefreshrate.integer); + M_ItemPrint(16, video_cursor_table[t], " Refresh Rate", vid_fullscreen.integer && !vid_desktopfullscreen.integer); M_DrawSlider(220, video_cursor_table[t], vid_refreshrate.value, 50, 150); t++; @@ -3002,8 +2997,6 @@ static void M_Menu_Video_AdjustSliders (int dir) } else if (video_cursor == t++) Cvar_SetValueQuick (&vid_samples, bound(1, vid_samples.value * (dir > 0 ? 2 : 0.5), 32)); - else if (video_cursor == t++) - Cvar_SetValueQuick (&vid_userefreshrate, !vid_userefreshrate.integer); else if (video_cursor == t++) Cvar_SetValueQuick (&vid_refreshrate, bound(50, vid_refreshrate.value + dir, 150)); else if (video_cursor == t++) @@ -3028,9 +3021,7 @@ static void M_Video_Key(cmd_state_t *cmd, int key, int ascii) Cvar_SetValueQuick(&vid_fullscreen, vid.mode.fullscreen); Cvar_SetValueQuick(&vid_bitsperpixel, vid.mode.bitsperpixel); Cvar_SetValueQuick(&vid_samples, vid.mode.samples); - if (vid_supportrefreshrate) - Cvar_SetValueQuick(&vid_refreshrate, vid.mode.refreshrate); - Cvar_SetValueQuick(&vid_userefreshrate, vid.mode.userefreshrate); + Cvar_SetValueQuick(&vid_refreshrate, vid.mode.refreshrate); S_LocalSound ("sound/misc/menu1.wav"); M_Menu_Options_f(cmd); diff --git a/vid.h b/vid.h index 182d6e38..169ad078 100644 --- a/vid.h +++ b/vid.h @@ -59,7 +59,6 @@ typedef struct viddef_mode_s int bitsperpixel; qbool fullscreen; float refreshrate; - qbool userefreshrate; qbool stereobuffer; int samples; } @@ -137,7 +136,6 @@ extern cvar_t vid_height; extern cvar_t vid_bitsperpixel; extern cvar_t vid_samples; extern cvar_t vid_refreshrate; -extern cvar_t vid_userefreshrate; extern cvar_t vid_touchscreen_density; extern cvar_t vid_touchscreen_xdpi; extern cvar_t vid_touchscreen_ydpi; diff --git a/vid_sdl.c b/vid_sdl.c index 2a9bb0c3..23efed15 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -1449,7 +1449,7 @@ static void VID_ApplyDisplaySettings_c(cvar_t *var) SDL_DisplayMode modewanted, modeclosest; modewanted.w = vid_width.integer; modewanted.h = vid_height.integer; - modewanted.refresh_rate = vid_userefreshrate.integer ? vid_refreshrate.integer : 0; + modewanted.refresh_rate = max(0, vid_refreshrate.integer); if (!SDL_GetClosestDisplayMode(vid.displayindex, &modewanted, &modeclosest)) { Con_Printf(CON_ERROR "Error getting closest mode to %ix%i@%ihz for display %i: \"%s\"\n", modewanted.w, modewanted.h, modewanted.refresh_rate, vid.displayindex, SDL_GetError()); diff --git a/vid_shared.c b/vid_shared.c index 09aa4e9a..ab488bc2 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -137,8 +137,7 @@ cvar_t vid_width = {CF_CLIENT | CF_ARCHIVE, "vid_width", "640", "resolution"}; cvar_t vid_height = {CF_CLIENT | CF_ARCHIVE, "vid_height", "480", "resolution"}; cvar_t vid_bitsperpixel = {CF_CLIENT | CF_READONLY, "vid_bitsperpixel", "32", "how many bits per pixel to render at (this is not currently configurable)"}; cvar_t vid_samples = {CF_CLIENT | CF_ARCHIVE, "vid_samples", "1", "how many anti-aliasing samples per pixel to request from the graphics driver (4 is recommended, 1 is faster)"}; -cvar_t vid_refreshrate = {CF_CLIENT | CF_ARCHIVE, "vid_refreshrate", "60", "refresh rate to use, in hz (higher values flicker less, if supported by your monitor)"}; -cvar_t vid_userefreshrate = {CF_CLIENT | CF_ARCHIVE, "vid_userefreshrate", "0", "set this to 1 to make vid_refreshrate used, or to 0 to let the engine choose a sane default"}; +cvar_t vid_refreshrate = {CF_CLIENT | CF_ARCHIVE, "vid_refreshrate", "0", "refresh rate to use, in hz (higher values feel smoother, if supported by your monitor), 0 uses the default"}; cvar_t vid_stereobuffer = {CF_CLIENT | CF_ARCHIVE, "vid_stereobuffer", "0", "enables 'quad-buffered' stereo rendering for stereo shutterglasses, HMD (head mounted display) devices, or polarized stereo LCDs, if supported by your drivers"}; // the density cvars are completely optional, set and use when something needs to have a density-independent size. // TODO: set them when changing resolution, setting them from the commandline will be independent from the resolution - use only if you have a native fixed resolution. @@ -1305,7 +1304,6 @@ void VID_Shared_Init(void) Cvar_RegisterVariable(&vid_bitsperpixel); Cvar_RegisterVariable(&vid_samples); Cvar_RegisterVariable(&vid_refreshrate); - Cvar_RegisterVariable(&vid_userefreshrate); Cvar_RegisterVariable(&vid_stereobuffer); Cvar_RegisterVariable(&vid_touchscreen_density); Cvar_RegisterVariable(&vid_touchscreen_xdpi); @@ -1399,8 +1397,7 @@ static int VID_Mode(viddef_mode_t *mode) mode->width = vid_width.integer; mode->height = vid_height.integer; mode->bitsperpixel = vid_bitsperpixel.integer; - mode->refreshrate = vid_userefreshrate.integer ? max(1, vid_refreshrate.integer) : 0; - mode->userefreshrate = vid_userefreshrate.integer != 0; + mode->refreshrate = max(0, vid_refreshrate.integer); mode->stereobuffer = vid_stereobuffer.integer != 0; } cl_ignoremousemoves = 2; @@ -1468,8 +1465,8 @@ void VID_Restart_f(cmd_state_t *cmd) oldmode = vid.mode; Con_Printf("VID_Restart: changing from %s %dx%dx%dbpp%s, to %s %dx%dx%dbpp%s.\n", - oldmode.fullscreen ? "fullscreen" : "window", oldmode.width, oldmode.height, oldmode.bitsperpixel, oldmode.fullscreen && oldmode.userefreshrate ? va(vabuf, sizeof(vabuf), "x%.2fhz", oldmode.refreshrate) : "", - vid_fullscreen.integer ? "fullscreen" : "window", vid_width.integer, vid_height.integer, vid_bitsperpixel.integer, vid_fullscreen.integer && vid_userefreshrate.integer ? va(vabuf, sizeof(vabuf), "x%.2fhz", vid_refreshrate.value) : ""); + oldmode.fullscreen ? "fullscreen" : "window", oldmode.width, oldmode.height, oldmode.bitsperpixel, oldmode.fullscreen && oldmode.refreshrate ? va(vabuf, sizeof(vabuf), "x%.2fhz", oldmode.refreshrate) : "", + vid_fullscreen.integer ? "fullscreen" : "window", vid_width.integer, vid_height.integer, vid_bitsperpixel.integer, vid_fullscreen.integer && vid_refreshrate.integer ? va(vabuf, sizeof(vabuf), "x%.2fhz", vid_refreshrate.value) : ""); SCR_DeferLoadingPlaque(false); R_Modules_Shutdown(); VID_Shutdown(); @@ -1501,7 +1498,7 @@ static struct vidfallback_s vidfallbacks[] = { {&vid_stereobuffer, "0"}, {&vid_samples, "1"}, - {&vid_userefreshrate, "0"}, + {&vid_refreshrate, "0"}, {&vid_width, "640"}, {&vid_height, "480"}, {&vid_bitsperpixel, "32"}, -- 2.39.2