Handle some cornercases better in the scale slider.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@707 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Sander van Dijk 2012-09-04 18:24:40 +00:00
parent f00f4655dd
commit a6f48f01a0

View file

@ -981,18 +981,17 @@ void M_Menu_Options_f (void)
void M_AdjustSliders (int dir) void M_AdjustSliders (int dir)
{ {
float f; float f, l;
S_LocalSound ("misc/menu3.wav"); S_LocalSound ("misc/menu3.wav");
switch (options_cursor) switch (options_cursor)
{ {
case OPT_SCALE: // console and menu scale case OPT_SCALE: // console and menu scale
l = ceil(vid.width / 32.0) / 10;
f = scr_conscale.value + dir * .1; f = scr_conscale.value + dir * .1;
if (f < 1) if (f < 1) f = 1;
f = 1; else if(f > l) f = l;
else if (f > (vid.width / 32) / 10.0)
f = (vid.width / 32) / 10.0;
Cvar_SetValue ("scr_conscale", f); Cvar_SetValue ("scr_conscale", f);
Cvar_SetValue ("scr_menuscale", f); Cvar_SetValue ("scr_menuscale", f);
Cvar_SetValue ("scr_sbarscale", f); Cvar_SetValue ("scr_sbarscale", f);
@ -1103,7 +1102,7 @@ void M_DrawCheckbox (int x, int y, int on)
void M_Options_Draw (void) void M_Options_Draw (void)
{ {
float r; float r, l;
qpic_t *p; qpic_t *p;
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") ); M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
@ -1120,7 +1119,8 @@ void M_Options_Draw (void)
// OPT_SCALE: // OPT_SCALE:
M_Print (16, 32 + 8*OPT_SCALE, " Scale"); M_Print (16, 32 + 8*OPT_SCALE, " Scale");
r = (scr_conscale.value - 1) / (((vid.width / 32) / 10.0) - 1); l = ceil(vid.width / 32.0) / 10;
r = l > 1 ? (scr_conscale.value - 1) / (l - 1) : 0;
M_DrawSlider (220, 32 + 8*OPT_SCALE, r); M_DrawSlider (220, 32 + 8*OPT_SCALE, r);
// OPT_SCRSIZE: // OPT_SCRSIZE: