Added percentage display boolean for slider menu controls.

Changed increment for sound and some alpha menu option sliders.
This commit is contained in:
Knightmare66 2021-03-08 00:52:46 -05:00
parent 6ec18155d2
commit 2629b6f39a
9 changed files with 45 additions and 10 deletions

View file

@ -417,10 +417,16 @@ void MenuSlider_Draw (menuslider_s *s)
// draw value
tmpValue = s->curPos * s->increment + s->baseValue;
if (fabs((int)tmpValue - tmpValue) < 0.01f)
Com_sprintf (valueText, sizeof(valueText), "%i", (int)tmpValue);
else
Com_sprintf (valueText, sizeof(valueText), "%4.2f", tmpValue);
if (s->displayAsPercent) {
tmpValue *= 100.0f;
Com_sprintf (valueText, sizeof(valueText), "%.0f%%", tmpValue);
}
else {
if (fabs((int)tmpValue - tmpValue) < 0.01f)
Com_sprintf (valueText, sizeof(valueText), "%i", (int)tmpValue);
else
Com_sprintf (valueText, sizeof(valueText), "%4.2f", tmpValue);
}
Menu_DrawString (s->generic.x + s->generic.parent->x + s->generic.textSize*SLIDER_RANGE + RCOLUMN_OFFSET + 2.5*MENU_FONT_SIZE,
s->generic.y + s->generic.parent->y + 1, MENU_FONT_SIZE-2, valueText, alpha);
}

View file

@ -123,6 +123,7 @@ typedef struct
// end Knightmare
float range;
qboolean displayAsPercent;
} menuslider_s;
typedef struct

View file

@ -215,6 +215,7 @@ void Options_Controls_MenuInit ( void )
s_options_controls_sensitivity_slider.maxPos = 20;
s_options_controls_sensitivity_slider.baseValue = 1.0f;
s_options_controls_sensitivity_slider.increment = 0.5f;
s_options_controls_sensitivity_slider.displayAsPercent = false;
s_options_controls_sensitivity_slider.generic.statusbar = "changes sensitivity of mouse for head movement";
s_options_controls_invertmouse_box.generic.type = MTYPE_SPINCONTROL;
@ -255,6 +256,7 @@ void Options_Controls_MenuInit ( void )
s_options_controls_thirdperson_distance_slider.maxPos = 10;
s_options_controls_thirdperson_distance_slider.baseValue = 25.0f;
s_options_controls_thirdperson_distance_slider.increment = 5.0f;
s_options_controls_thirdperson_distance_slider.displayAsPercent = false;
s_options_controls_thirdperson_distance_slider.generic.statusbar = "changes camera distance in third-person mode";
s_options_controls_thirdperson_offset_slider.generic.type = MTYPE_SLIDER;
@ -268,6 +270,7 @@ void Options_Controls_MenuInit ( void )
s_options_controls_thirdperson_offset_slider.maxPos = 8;
s_options_controls_thirdperson_offset_slider.baseValue = 0.0f;
s_options_controls_thirdperson_offset_slider.increment = 4.0f;
s_options_controls_thirdperson_offset_slider.displayAsPercent = false;
s_options_controls_thirdperson_offset_slider.generic.statusbar = "changes horizontal camera offset in third-person mode";
s_options_controls_thirdperson_angle_slider.generic.type = MTYPE_SLIDER;
@ -281,6 +284,7 @@ void Options_Controls_MenuInit ( void )
s_options_controls_thirdperson_angle_slider.maxPos = 6;
s_options_controls_thirdperson_angle_slider.baseValue = 0.0f;
s_options_controls_thirdperson_angle_slider.increment = 5.0f;
s_options_controls_thirdperson_angle_slider.displayAsPercent = false;
s_options_controls_thirdperson_angle_slider.generic.statusbar = "changes camera angle in third-person mode";
s_options_controls_alwaysrun_box.generic.type = MTYPE_SPINCONTROL;

View file

@ -256,6 +256,7 @@ void Options_Effects_MenuInit ( void )
s_options_effects_decal_slider.maxPos = 20;
s_options_effects_decal_slider.baseValue = 0.0f;
s_options_effects_decal_slider.increment = 50.0f;
s_options_effects_decal_slider.displayAsPercent = false;
s_options_effects_decal_slider.generic.statusbar = "how many decals to display at once (max = 1000)";
s_options_effects_particle_comp_slider.generic.type = MTYPE_SLIDER;
@ -269,6 +270,7 @@ void Options_Effects_MenuInit ( void )
s_options_effects_particle_comp_slider.maxPos = 4;
s_options_effects_particle_comp_slider.baseValue = 5.0f;
s_options_effects_particle_comp_slider.increment = -1.0f;
s_options_effects_particle_comp_slider.displayAsPercent = false;
s_options_effects_particle_comp_slider.generic.statusbar = "lower = faster performance";
// Psychospaz's changeable rail trail
@ -292,6 +294,7 @@ void Options_Effects_MenuInit ( void )
s_options_effects_railcolor_slider[0].maxPos = 64;
s_options_effects_railcolor_slider[0].baseValue = 0.0f;
s_options_effects_railcolor_slider[0].increment = 4.0f;
s_options_effects_railcolor_slider[0].displayAsPercent = false;
s_options_effects_railcolor_slider[0].generic.statusbar = "changes railtrail red component";
s_options_effects_railcolor_slider[1].generic.type = MTYPE_SLIDER;
@ -305,6 +308,7 @@ void Options_Effects_MenuInit ( void )
s_options_effects_railcolor_slider[1].maxPos = 64;
s_options_effects_railcolor_slider[1].baseValue = 0.0f;
s_options_effects_railcolor_slider[1].increment = 4.0f;
s_options_effects_railcolor_slider[1].displayAsPercent = false;
s_options_effects_railcolor_slider[1].generic.statusbar = "changes railtrail green component";
s_options_effects_railcolor_slider[2].generic.type = MTYPE_SLIDER;
@ -318,6 +322,7 @@ void Options_Effects_MenuInit ( void )
s_options_effects_railcolor_slider[2].maxPos = 64;
s_options_effects_railcolor_slider[2].baseValue = 0.0f;
s_options_effects_railcolor_slider[2].increment = 4.0f;
s_options_effects_railcolor_slider[2].displayAsPercent = false;
s_options_effects_railcolor_slider[2].generic.statusbar = "changes railtrail blue component";
// foostep override option

View file

@ -268,6 +268,7 @@ void Options_Interface_MenuInit (void)
s_options_interface_menumouse_slider.maxPos = 7;
s_options_interface_menumouse_slider.baseValue = 0.25f;
s_options_interface_menumouse_slider.increment = 0.25f;
s_options_interface_menumouse_slider.displayAsPercent = false;
s_options_interface_menumouse_slider.generic.statusbar = "changes sensitivity of mouse in menus";
s_options_interface_menualpha_slider.generic.type = MTYPE_SLIDER;
@ -281,6 +282,7 @@ void Options_Interface_MenuInit (void)
s_options_interface_menualpha_slider.maxPos = 20;
s_options_interface_menualpha_slider.baseValue = 0.0f;
s_options_interface_menualpha_slider.increment = 0.05f;
s_options_interface_menualpha_slider.displayAsPercent = true;
s_options_interface_menualpha_slider.generic.statusbar = "changes opacity of menu background";
#if 0
@ -312,6 +314,7 @@ void Options_Interface_MenuInit (void)
s_options_interface_fontsize_slider.maxPos = 5;
s_options_interface_fontsize_slider.baseValue = 6.0f;
s_options_interface_fontsize_slider.increment = 2.0f;
s_options_interface_fontsize_slider.displayAsPercent = false;
s_options_interface_fontsize_slider.generic.statusbar = "changes size of console text";
s_options_interface_uifont_box.generic.type = MTYPE_SPINCONTROL;
@ -352,6 +355,7 @@ void Options_Interface_MenuInit (void)
s_options_interface_conalpha_slider.maxPos = 20;
s_options_interface_conalpha_slider.baseValue = 0.0f;
s_options_interface_conalpha_slider.increment = 0.05f;
s_options_interface_conalpha_slider.displayAsPercent = true;
s_options_interface_conalpha_slider.generic.statusbar = "changes opacity of console";
/*
@ -366,6 +370,7 @@ void Options_Interface_MenuInit (void)
s_options_interface_conheight_slider.maxPos = 10;
s_options_interface_conheight_slider.baseValue = 0.25f;
s_options_interface_conheight_slider.increment = 0.05f;
s_options_interface_conheight_slider.displayAsPercent = false;
s_options_interface_conheight_slider.generic.statusbar = "changes drop height of console";
*/

View file

@ -234,6 +234,7 @@ void Options_Screen_MenuInit ( void )
s_options_screen_crosshairscale_slider.maxPos = 19;
s_options_screen_crosshairscale_slider.baseValue = 0.25f;
s_options_screen_crosshairscale_slider.increment = 0.25f;
s_options_screen_crosshairscale_slider.displayAsPercent = false;
s_options_screen_crosshairscale_slider.generic.statusbar = "changes size of crosshair";
s_options_screen_crosshairalpha_slider.generic.type = MTYPE_SLIDER;
@ -247,6 +248,7 @@ void Options_Screen_MenuInit ( void )
s_options_screen_crosshairalpha_slider.maxPos = 19;
s_options_screen_crosshairalpha_slider.baseValue = 0.05f;
s_options_screen_crosshairalpha_slider.increment = 0.05f;
s_options_screen_crosshairalpha_slider.displayAsPercent = true;
s_options_screen_crosshairalpha_slider.generic.statusbar = "changes opacity of crosshair";
s_options_screen_crosshairpulse_slider.generic.type = MTYPE_SLIDER;
@ -260,6 +262,7 @@ void Options_Screen_MenuInit ( void )
s_options_screen_crosshairpulse_slider.maxPos = 10;
s_options_screen_crosshairpulse_slider.baseValue = 0.0f;
s_options_screen_crosshairpulse_slider.increment = 0.05f;
s_options_screen_crosshairpulse_slider.displayAsPercent = true;
s_options_screen_crosshairpulse_slider.generic.statusbar = "changes pulse amplitude of crosshair";
// hud scaling option
@ -274,6 +277,7 @@ void Options_Screen_MenuInit ( void )
s_options_screen_hudscale_slider.maxPos = 8;
s_options_screen_hudscale_slider.baseValue = 0.0f;
s_options_screen_hudscale_slider.increment = 1.0f;
s_options_screen_hudscale_slider.displayAsPercent = false;
s_options_screen_hudscale_slider.generic.statusbar = "changes size of HUD elements";
// hud trans option
@ -285,9 +289,10 @@ void Options_Screen_MenuInit ( void )
s_options_screen_hudalpha_slider.generic.callback = HudAlphaFunc;
// s_options_screen_hudalpha_slider.minvalue = 1;
// s_options_screen_hudalpha_slider.maxvalue = 11;
s_options_screen_hudalpha_slider.maxPos = 10;
s_options_screen_hudalpha_slider.maxPos = 20;
s_options_screen_hudalpha_slider.baseValue = 0.0f;
s_options_screen_hudalpha_slider.increment = 0.1f;
s_options_screen_hudalpha_slider.increment = 0.05f;
s_options_screen_hudalpha_slider.displayAsPercent = true;
s_options_screen_hudalpha_slider.generic.statusbar = "changes opacity of HUD elements";
// hud squeeze digits option

View file

@ -197,9 +197,10 @@ void Options_Sound_MenuInit ( void )
// s_options_sound_sfxvolume_slider.minvalue = 0;
// s_options_sound_sfxvolume_slider.maxvalue = 10;
// s_options_sound_sfxvolume_slider.curvalue = Cvar_VariableValue( "s_volume" ) * 10;
s_options_sound_sfxvolume_slider.maxPos = 10;
s_options_sound_sfxvolume_slider.maxPos = 20;
s_options_sound_sfxvolume_slider.baseValue = 0.0f;
s_options_sound_sfxvolume_slider.increment = 0.1f;
s_options_sound_sfxvolume_slider.increment = 0.05f;
s_options_sound_sfxvolume_slider.displayAsPercent = true;
MenuSlider_SetValue (&s_options_sound_sfxvolume_slider, Cvar_VariableValue("s_volume"));
s_options_sound_sfxvolume_slider.generic.statusbar = "volume of sound effects";
@ -212,9 +213,10 @@ void Options_Sound_MenuInit ( void )
// s_options_sound_musicvolume_slider.minvalue = 0;
// s_options_sound_musicvolume_slider.maxvalue = 10;
// s_options_sound_musicvolume_slider.curvalue = Cvar_VariableValue( "s_musicvolume" ) * 10;
s_options_sound_musicvolume_slider.maxPos = 10;
s_options_sound_musicvolume_slider.maxPos = 20;
s_options_sound_musicvolume_slider.baseValue = 0.0f;
s_options_sound_musicvolume_slider.increment = 0.1f;
s_options_sound_musicvolume_slider.increment = 0.05f;
s_options_sound_musicvolume_slider.displayAsPercent = true;
MenuSlider_SetValue (&s_options_sound_musicvolume_slider, Cvar_VariableValue("s_musicvolume"));
s_options_sound_musicvolume_slider.generic.statusbar = "volume of ogg vorbis music";

View file

@ -518,6 +518,7 @@ void Menu_Video_Init (void)
s_brightness_slider.maxPos = 20;
s_brightness_slider.baseValue = 1.3f;
s_brightness_slider.increment = -0.05f;
s_brightness_slider.displayAsPercent = false;
MenuSlider_SetValue (&s_brightness_slider, Cvar_VariableValue("vid_gamma"));
s_brightness_slider.generic.statusbar = "changes display brightness";

View file

@ -405,6 +405,7 @@ void Menu_Video_Advanced_Init (void)
s_lightmapscale_slider.maxPos = 10;
s_lightmapscale_slider.baseValue = 1.0f;
s_lightmapscale_slider.increment = 0.1f;
s_lightmapscale_slider.displayAsPercent = false;
s_lightmapscale_slider.generic.statusbar = "leave at minimum, washes out textures";
s_textureintensity_slider.generic.type = MTYPE_SLIDER;
@ -418,6 +419,7 @@ void Menu_Video_Advanced_Init (void)
s_textureintensity_slider.maxPos = 10;
s_textureintensity_slider.baseValue = 1.0f;
s_textureintensity_slider.increment = 0.1f;
s_textureintensity_slider.displayAsPercent = false;
s_textureintensity_slider.generic.statusbar = "leave at minimum, washes out textures";
s_rgbscale_box.generic.type = MTYPE_SPINCONTROL;
@ -458,6 +460,7 @@ void Menu_Video_Advanced_Init (void)
s_lightcutoff_slider.maxPos = 8;
s_lightcutoff_slider.baseValue = 0.0f;
s_lightcutoff_slider.increment = 8.0f;
s_lightcutoff_slider.displayAsPercent = false;
s_lightcutoff_slider.generic.statusbar = "lower = smoother blend, higher = faster";
s_glass_envmap_box.generic.type = MTYPE_SPINCONTROL;
@ -498,6 +501,7 @@ void Menu_Video_Advanced_Init (void)
s_waterwave_slider.maxPos = 24;
s_waterwave_slider.baseValue = 0.0f;
s_waterwave_slider.increment = 1.0f;
s_waterwave_slider.displayAsPercent = false;
s_waterwave_slider.generic.statusbar = "size of waves on flat water surfaces";
s_caustics_box.generic.type = MTYPE_SPINCONTROL;
@ -583,6 +587,7 @@ void Menu_Video_Advanced_Init (void)
s_celshading_width_slider.maxPos = 11;
s_celshading_width_slider.baseValue = 1.0f;
s_celshading_width_slider.increment = 1.0f;
s_celshading_width_slider.displayAsPercent = false;
s_celshading_width_slider.generic.statusbar = "width of cel shading outlines";
/*
@ -616,6 +621,7 @@ void Menu_Video_Advanced_Init (void)
s_screenshotjpegquality_slider.maxPos = 10;
s_screenshotjpegquality_slider.baseValue = 50.0f;
s_screenshotjpegquality_slider.increment = 5.0f;
s_screenshotjpegquality_slider.displayAsPercent = false;
s_screenshotjpegquality_slider.generic.statusbar = "quality of JPG screenshots, 50-100%";
s_saveshotsize_box.generic.type = MTYPE_SPINCONTROL;