Skip to content

Commit

Permalink
Expose screen flashes menu option
Browse files Browse the repository at this point in the history
and save all gl_cshiftpercent* cvars to config for finer-grained control via console
  • Loading branch information
andrei-drexler committed Nov 10, 2024
1 parent d6943b4 commit c6afd64
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
14 changes: 14 additions & 0 deletions Quake/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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") \
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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));
Expand Down
10 changes: 5 additions & 5 deletions Quake/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down

0 comments on commit c6afd64

Please sign in to comment.