From f8a09a79c468f9fc0017885f93a7cd4e67ccdbe8 Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Sun, 8 Sep 2024 10:24:52 +0200 Subject: [PATCH] Change render scale option from cycle button to slider --- Quake/menu.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/Quake/menu.c b/Quake/menu.c index bb9dd6a06..44799914f 100644 --- a/Quake/menu.c +++ b/Quake/menu.c @@ -2894,20 +2894,6 @@ static void VID_Menu_ChooseNextAnisotropy (int dir) Cvar_SetValueQuick (&gl_texture_anisotropy, CLAMP (1, aniso, (int)gl_max_anisotropy)); } -/* -================ -VID_Menu_ChooseNextScale - -chooses next scale in order, then updates r_scale cvar -================ -*/ -static void VID_Menu_ChooseNextScale (int dir) -{ - // cycle [1..vid_maxscale] - int scale = 1 + (r_refdef.scale - 1 + vid.maxscale - dir) % vid.maxscale; - Cvar_SetValueQuick (&r_scale, scale); -} - static const char *const texfilters[][2] = { {"gl_nearest_mipmap_linear", "Classic"}, @@ -3897,7 +3883,7 @@ void M_AdjustSliders (int dir) Cbuf_AddText ("toggle vid_fsaamode\n"); break; case OPT_RENDERSCALE: - VID_Menu_ChooseNextScale (-dir); + Cvar_SetValueQuick (&r_scale, CLAMP (1, r_refdef.scale + dir, vid.maxscale)); break; case OPT_ANISO: VID_Menu_ChooseNextAnisotropy (-dir); @@ -4121,6 +4107,10 @@ qboolean M_SetSliderValue (int option, float f) f += 1.f; Cvar_SetValue ("contrast", f); return true; + case OPT_RENDERSCALE: + f = floor (1 + f * (vid.maxscale - 1) + 0.5); + Cvar_SetValueQuick (&r_scale, f); + return true; case OPT_MOUSESPEED: // mouse speed f = f * 10.f + 1.f; Cvar_SetValue ("sensitivity", f); @@ -4474,7 +4464,8 @@ static void M_Options_DrawItem (int y, int item) M_Print (x, y, vid_fsaamode.value ? "Full" : "Edges only"); break; case OPT_RENDERSCALE: - M_Print (x, y, r_refdef.scale >= 2 ? va("1/%i", r_refdef.scale) : "Off"); + r = (r_refdef.scale - 1) / (float) (vid.maxscale - 1); + M_DrawSlider (x, y, r, r_refdef.scale >= 2 ? va("1/%i", r_refdef.scale) : "Off"); break; case OPT_ANISO: M_Print (x, y, gl_texture_anisotropy.value >= 2.f ?