]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
vid: remove cvar vid_userefreshrate
authorbones_was_here <bones_was_here@xonotic.au>
Mon, 15 Apr 2024 23:01:37 +0000 (09:01 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sun, 21 Apr 2024 14:00:32 +0000 (00:00 +1000)
It's unnecessary and other Quake engines don't have it.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
menu.c
vid.h
vid_sdl.c
vid_shared.c

diff --git a/menu.c b/menu.c
index 38fc7adf64230976109508062a3fdb0170ba81b8..add19c65f449a5f66083b1e1940c0cf617f47113 100644 (file)
--- 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 182d6e3865c27bf2324749935038840670bd1a9e..169ad078215b1b30dd1d083dacd10497f20d317e 100644 (file)
--- 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;
index 2a9bb0c3baa2d8e0fcf83d362755722915d5c5ef..23efed15d7a3952fde62efd1d224d295b1efbc45 100644 (file)
--- 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());
index 09aa4e9af94bedcaeead4b02c3aa6a881c5b2a5b..ab488bc2ca8224786a3f0132ddc10a65289c0bda 100644 (file)
@@ -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"},