Videomenu: Change the HUD scale option to a more generic UI scale option

This commit is contained in:
svdijk 2015-11-08 12:46:38 +01:00
parent dae3de4b73
commit 64d4e8e619

View file

@ -34,6 +34,8 @@ extern void M_ForceMenuOff(void);
static cvar_t *gl_mode; static cvar_t *gl_mode;
static cvar_t *gl_hudscale; static cvar_t *gl_hudscale;
static cvar_t *gl_consolescale;
static cvar_t *gl_menuscale;
static cvar_t *fov; static cvar_t *fov;
extern cvar_t *scr_viewsize; extern cvar_t *scr_viewsize;
extern cvar_t *vid_gamma; extern cvar_t *vid_gamma;
@ -46,7 +48,7 @@ static menuframework_s s_opengl_menu;
static menulist_s s_mode_list; static menulist_s s_mode_list;
static menulist_s s_aspect_list; static menulist_s s_aspect_list;
static menulist_s s_hudscale_list; static menulist_s s_uiscale_list;
static menuslider_s s_screensize_slider; static menuslider_s s_screensize_slider;
static menuslider_s s_brightness_slider; static menuslider_s s_brightness_slider;
static menulist_s s_fs_box; static menulist_s s_fs_box;
@ -161,32 +163,38 @@ ApplyChanges(void *unused)
} }
} }
/* HUD scaling */ /* UI scaling */
if (s_hudscale_list.curvalue == 0) if (s_uiscale_list.curvalue == 0)
{ {
Cvar_SetValue("gl_hudscale", 1); Cvar_SetValue("gl_hudscale", 1);
} }
else if (s_hudscale_list.curvalue == 1) else if (s_uiscale_list.curvalue == 1)
{ {
Cvar_SetValue("gl_hudscale", -1); Cvar_SetValue("gl_hudscale", -1);
} }
else if (s_hudscale_list.curvalue == 2) else if (s_uiscale_list.curvalue == 2)
{ {
Cvar_SetValue("gl_hudscale", 1.5); Cvar_SetValue("gl_hudscale", 1.5);
} }
else if (s_hudscale_list.curvalue == 3) else if (s_uiscale_list.curvalue == 3)
{ {
Cvar_SetValue("gl_hudscale", 2); Cvar_SetValue("gl_hudscale", 2);
} }
else if (s_hudscale_list.curvalue == 4) else if (s_uiscale_list.curvalue == 4)
{ {
Cvar_SetValue("gl_hudscale", 2.5); Cvar_SetValue("gl_hudscale", 2.5);
} }
else if (s_hudscale_list.curvalue == 5) else if (s_uiscale_list.curvalue == 5)
{ {
Cvar_SetValue("gl_hudscale", 3); Cvar_SetValue("gl_hudscale", 3);
} }
if (s_uiscale_list.curvalue != 6)
{
Cvar_SetValue("gl_consolescale", gl_hudscale->value);
Cvar_SetValue("gl_menuscale", gl_hudscale->value);
}
/* Restarts automatically */ /* Restarts automatically */
Cvar_SetValue("vid_fullscreen", s_fs_box.curvalue); Cvar_SetValue("vid_fullscreen", s_fs_box.curvalue);
@ -267,7 +275,7 @@ VID_MenuInit(void)
0 0
}; };
static const char *hudscale_names[] = { static const char *uiscale_names[] = {
"no (1x)", "no (1x)",
"auto", "auto",
"1.5x", "1.5x",
@ -302,6 +310,14 @@ VID_MenuInit(void)
{ {
gl_hudscale = Cvar_Get("gl_hudscale", "-1", CVAR_ARCHIVE); gl_hudscale = Cvar_Get("gl_hudscale", "-1", CVAR_ARCHIVE);
} }
if (!gl_consolescale)
{
gl_consolescale = Cvar_Get("gl_consolescale", "1", CVAR_ARCHIVE);
}
if (!gl_menuscale)
{
gl_menuscale = Cvar_Get("gl_menuscale", "1", CVAR_ARCHIVE);
}
if (!horplus) if (!horplus)
{ {
@ -385,38 +401,43 @@ VID_MenuInit(void)
s_aspect_list.curvalue = 5; s_aspect_list.curvalue = 5;
} }
s_hudscale_list.generic.type = MTYPE_SPINCONTROL; s_uiscale_list.generic.type = MTYPE_SPINCONTROL;
s_hudscale_list.generic.name = "hud scale"; s_uiscale_list.generic.name = "ui scale";
s_hudscale_list.generic.x = 0; s_uiscale_list.generic.x = 0;
s_hudscale_list.generic.y = (y += 10); s_uiscale_list.generic.y = (y += 10);
s_hudscale_list.itemnames = hudscale_names; s_uiscale_list.itemnames = uiscale_names;
if (gl_hudscale->value == 1) if (gl_hudscale->value != gl_consolescale->value ||
gl_hudscale->value != gl_menuscale->value)
{ {
s_hudscale_list.curvalue = 0; s_uiscale_list.curvalue = 6;
}
else if (gl_hudscale->value == 1)
{
s_uiscale_list.curvalue = 0;
} }
else if (gl_hudscale->value < 0) else if (gl_hudscale->value < 0)
{ {
s_hudscale_list.curvalue = 1; s_uiscale_list.curvalue = 1;
} }
else if (gl_hudscale->value == 1.5f) else if (gl_hudscale->value == 1.5f)
{ {
s_hudscale_list.curvalue = 2; s_uiscale_list.curvalue = 2;
} }
else if (gl_hudscale->value == 2) else if (gl_hudscale->value == 2)
{ {
s_hudscale_list.curvalue = 3; s_uiscale_list.curvalue = 3;
} }
else if (gl_hudscale->value == 2.5f) else if (gl_hudscale->value == 2.5f)
{ {
s_hudscale_list.curvalue = 4; s_uiscale_list.curvalue = 4;
} }
else if (gl_hudscale->value == 3) else if (gl_hudscale->value == 3)
{ {
s_hudscale_list.curvalue = 5; s_uiscale_list.curvalue = 5;
} }
else else
{ {
s_hudscale_list.curvalue = 6; s_uiscale_list.curvalue = 6;
} }
s_screensize_slider.generic.type = MTYPE_SLIDER; s_screensize_slider.generic.type = MTYPE_SLIDER;
@ -498,7 +519,7 @@ VID_MenuInit(void)
Menu_AddItem(&s_opengl_menu, (void *)&s_mode_list); Menu_AddItem(&s_opengl_menu, (void *)&s_mode_list);
Menu_AddItem(&s_opengl_menu, (void *)&s_aspect_list); Menu_AddItem(&s_opengl_menu, (void *)&s_aspect_list);
Menu_AddItem(&s_opengl_menu, (void *)&s_hudscale_list); Menu_AddItem(&s_opengl_menu, (void *)&s_uiscale_list);
Menu_AddItem(&s_opengl_menu, (void *)&s_screensize_slider); Menu_AddItem(&s_opengl_menu, (void *)&s_screensize_slider);
Menu_AddItem(&s_opengl_menu, (void *)&s_brightness_slider); Menu_AddItem(&s_opengl_menu, (void *)&s_brightness_slider);
Menu_AddItem(&s_opengl_menu, (void *)&s_fs_box); Menu_AddItem(&s_opengl_menu, (void *)&s_fs_box);