From c6afd64e6b10a23daf94788aebce08c4a1efb61c Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Sun, 10 Nov 2024 14:23:15 +0100 Subject: [PATCH] Expose screen flashes menu option and save all gl_cshiftpercent* cvars to config for finer-grained control via console --- Quake/menu.c | 14 ++++++++++++++ Quake/view.c | 10 +++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Quake/menu.c b/Quake/menu.c index 355a3cf26..bac40bcf0 100644 --- a/Quake/menu.c +++ b/Quake/menu.c @@ -41,6 +41,7 @@ extern cvar_t cl_bob; extern cvar_t cl_rollangle; extern cvar_t cl_maxpitch; extern cvar_t cl_minpitch; +extern cvar_t gl_cshiftpercent; extern cvar_t sv_autoload; extern cvar_t r_particles; extern cvar_t gl_texturemode; @@ -3226,6 +3227,7 @@ void M_Menu_Gamepad_f (void) begin_menu (GAME_OPTIONS, m_game, TITLE("Game")) \ item (OPT_FOV, "Field Of View") \ item (OPT_FOVDISTORT, "Gun Distortion") \ + item (OPT_FLASHALPHA, "Screen Flashes") \ item (OPT_RECOIL, "Recoil") \ item (OPT_VIEWBOB, "View Bob") \ item (OPT_ANGLELIMITS, "Angle Limits") \ @@ -3776,6 +3778,10 @@ void M_AdjustSliders (int dir) Cvar_SetValueQuick (&v_gunkick, ((int) q_max (v_gunkick.value, 0.f) + 3 + dir) % 3); break; + case OPT_FLASHALPHA: // flash intensity + Cvar_SetValueQuick (&gl_cshiftpercent, CLAMP (0.f, gl_cshiftpercent.value + dir * 10.f, 100.f)); + break; + case OPT_FOV: // field of view Cvar_SetValueQuick (&scr_fov, CLAMP (FOV_MIN, scr_fov.value + dir * 5.f, FOV_MAX)); break; @@ -4104,6 +4110,9 @@ qboolean M_SetSliderValue (int option, float f) case OPT_SNDVOL: // sfx volume Cvar_SetValue ("volume", f); return true; + case OPT_FLASHALPHA: + Cvar_SetValueQuick (&gl_cshiftpercent, f * 100.f); + return true; case OPT_FOV: // field of view f = LERP (FOV_MIN, FOV_MAX, f); if (fabs (f - 90.f) < 5.f) @@ -4396,6 +4405,11 @@ static void M_Options_DrawItem (int y, int item) M_DrawCheckbox (x, y, lookspring.value); break; + case OPT_FLASHALPHA: + r = gl_cshiftpercent.value / 100.f; + M_DrawSlider (x, y, r, va ("%.0f%%", gl_cshiftpercent.value)); + break; + case OPT_FOV: r = (scr_fov.value - FOV_MIN) / (FOV_MAX - FOV_MIN); M_DrawSlider (x, y, r, va ("%.0f", scr_fov.value)); diff --git a/Quake/view.c b/Quake/view.c index 6d4d4660d..ed09d8448 100644 --- a/Quake/view.c +++ b/Quake/view.c @@ -60,11 +60,11 @@ cvar_t v_idlescale = {"v_idlescale", "0", CVAR_NONE}; cvar_t crosshair = {"crosshair", "0", CVAR_ARCHIVE}; char crosshair_char = '\0'; -cvar_t gl_cshiftpercent = {"gl_cshiftpercent", "100", CVAR_NONE}; -cvar_t gl_cshiftpercent_contents = {"gl_cshiftpercent_contents", "100", CVAR_NONE}; // QuakeSpasm -cvar_t gl_cshiftpercent_damage = {"gl_cshiftpercent_damage", "100", CVAR_NONE}; // QuakeSpasm -cvar_t gl_cshiftpercent_bonus = {"gl_cshiftpercent_bonus", "100", CVAR_NONE}; // QuakeSpasm -cvar_t gl_cshiftpercent_powerup = {"gl_cshiftpercent_powerup", "100", CVAR_NONE}; // QuakeSpasm +cvar_t gl_cshiftpercent = {"gl_cshiftpercent", "100", CVAR_ARCHIVE}; +cvar_t gl_cshiftpercent_contents = {"gl_cshiftpercent_contents", "100", CVAR_ARCHIVE}; // QuakeSpasm +cvar_t gl_cshiftpercent_damage = {"gl_cshiftpercent_damage", "100", CVAR_ARCHIVE}; // QuakeSpasm +cvar_t gl_cshiftpercent_bonus = {"gl_cshiftpercent_bonus", "100", CVAR_ARCHIVE}; // QuakeSpasm +cvar_t gl_cshiftpercent_powerup = {"gl_cshiftpercent_powerup", "100", CVAR_ARCHIVE}; // QuakeSpasm cvar_t r_viewmodel_quake = {"r_viewmodel_quake", "0", CVAR_ARCHIVE};