- Slider controls in the options menu now display their values

numerically next to the slider.
- The minimum value for m_yaw, m_pitch, m_forward, and m_side from the
  menu has been dropped from 0.5 to 0, so those particular mouse motions can
  be disabled entirely without using the console.


SVN r1729 (trunk)
This commit is contained in:
Randy Heit 2009-07-23 03:03:15 +00:00
parent 55c32e0f44
commit 371f944262
4 changed files with 40 additions and 30 deletions

View file

@ -1,4 +1,11 @@
July 17, 2009 (Changes by Graf Zahl) July 22, 2009
- Slider controls in the options menu now display their values
numerically next to the slider.
- The minimum value for m_yaw, m_pitch, m_forward, and m_side from the
menu has been dropped from 0.5 to 0, so those particular mouse motions can
be disabled entirely without using the console.
July 17, 2009 (Changes by Graf Zahl)
- fixed blue colormap - fixed blue colormap
- Added parameters to A_VileAttack. - Added parameters to A_VileAttack.
- Removed redundant definition of use_joystick from SDL/i_input.cpp. - Removed redundant definition of use_joystick from SDL/i_input.cpp.

View file

@ -112,7 +112,6 @@ protected:
// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- // EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
void M_DrawSlider (int x, int y, float min, float max, float cur);
void R_GetPlayerTranslation (int color, FPlayerSkin *skin, FRemapTable *table); void R_GetPlayerTranslation (int color, FPlayerSkin *skin, FRemapTable *table);
// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- // PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
@ -2230,9 +2229,9 @@ static void M_PlayerSetupDrawer ()
x = SmallFont->StringWidth ("Green") + 8 + PSetupDef.x; x = SmallFont->StringWidth ("Green") + 8 + PSetupDef.x;
color = players[consoleplayer].userinfo.color; color = players[consoleplayer].userinfo.color;
M_DrawSlider (x, PSetupDef.y + LINEHEIGHT*2+yo, 0.0f, 255.0f, float(RPART(color))); M_DrawSlider (x, PSetupDef.y + LINEHEIGHT*2+yo, 0.0f, 255.0f, float(RPART(color)), -1);
M_DrawSlider (x, PSetupDef.y + LINEHEIGHT*3+yo, 0.0f, 255.0f, float(GPART(color))); M_DrawSlider (x, PSetupDef.y + LINEHEIGHT*3+yo, 0.0f, 255.0f, float(GPART(color)), -1);
M_DrawSlider (x, PSetupDef.y + LINEHEIGHT*4+yo, 0.0f, 255.0f, float(BPART(color))); M_DrawSlider (x, PSetupDef.y + LINEHEIGHT*4+yo, 0.0f, 255.0f, float(BPART(color)), -1);
// [GRB] Draw class setting // [GRB] Draw class setting
int pclass = players[consoleplayer].userinfo.PlayerClass; int pclass = players[consoleplayer].userinfo.PlayerClass;

View file

@ -84,6 +84,9 @@ void M_DeactivateMenuInput ();
void M_NotifyNewSave (const char *file, const char *title, bool okForQuicksave); void M_NotifyNewSave (const char *file, const char *title, bool okForQuicksave);
// Draw a slider. Set fracdigits negative to not display the current value numerically.
void M_DrawSlider (int x, int y, double min, double max, double cur, int fracdigits=1);
// //
// MENU TYPEDEFS // MENU TYPEDEFS
// //

View file

@ -262,12 +262,12 @@ static menuitem_t MouseItems[] =
{ redtext, " ", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} }, { redtext, " ", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} },
{ slider, "Overall sensitivity", {&mouse_sensitivity}, {0.5}, {2.5}, {0.1f}, {NULL} }, { slider, "Overall sensitivity", {&mouse_sensitivity}, {0.5}, {2.5}, {0.1f}, {NULL} },
{ discrete, "Prescale mouse movement",{&m_noprescale}, {2.0}, {0.0}, {0.0}, {NoYes} }, { discrete, "Prescale mouse movement",{&m_noprescale}, {2.0}, {0.0}, {0.0}, {NoYes} },
{ discrete, "Smooth mouse movement",{&smooth_mouse}, {2.0}, {0.0}, {0.0}, {YesNo} }, { discrete, "Smooth mouse movement",{&smooth_mouse}, {2.0}, {0.0}, {0.0}, {YesNo} },
{ redtext, " ", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} }, { redtext, " ", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} },
{ slider, "Turning speed", {&m_yaw}, {0.5}, {2.5}, {0.1f}, {NULL} }, { slider, "Turning speed", {&m_yaw}, {0.0}, {2.5}, {0.1f}, {NULL} },
{ slider, "Mouselook speed", {&m_pitch}, {0.5}, {2.5}, {0.1f}, {NULL} }, { slider, "Mouselook speed", {&m_pitch}, {0.0}, {2.5}, {0.1f}, {NULL} },
{ slider, "Forward/Backward speed",{&m_forward}, {0.5}, {2.5}, {0.1f}, {NULL} }, { slider, "Forward/Backward speed",{&m_forward}, {0.0}, {2.5}, {0.1f}, {NULL} },
{ slider, "Strafing speed", {&m_side}, {0.5}, {2.5}, {0.1f}, {NULL} }, { slider, "Strafing speed", {&m_side}, {0.0}, {2.5}, {0.1f}, {NULL} },
{ redtext, " ", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} }, { redtext, " ", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} },
{ discrete, "Always Mouselook", {&freelook}, {2.0}, {0.0}, {0.0}, {OnOff} }, { discrete, "Always Mouselook", {&freelook}, {2.0}, {0.0}, {0.0}, {OnOff} },
{ discrete, "Invert Mouse", {&invertmouse}, {2.0}, {0.0}, {0.0}, {OnOff} }, { discrete, "Invert Mouse", {&invertmouse}, {2.0}, {0.0}, {0.0}, {OnOff} },
@ -1545,21 +1545,22 @@ bool M_StartOptionsMenu (void)
return true; return true;
} }
void M_DrawSlider (int x, int y, float min, float max, float cur) void M_DrawSlider (int x, int y, double min, double max, double cur,int fracdigits)
{ {
float range; double range;
range = max - min; range = max - min;
cur = clamp(cur, min, max) - min;
if (cur > max)
cur = max;
else if (cur < min)
cur = min;
cur -= min;
M_DrawConText(CR_WHITE, x, y, "\x10\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x12"); M_DrawConText(CR_WHITE, x, y, "\x10\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x12");
M_DrawConText(CR_ORANGE, x + 5 + (int)((cur * 78.f) / range), y, "\x13"); M_DrawConText(CR_ORANGE, x + 5 + (int)((cur * 78) / range), y, "\x13");
if (fracdigits >= 0)
{
char textbuf[16];
mysnprintf(textbuf, countof(textbuf), "%.*f", fracdigits, cur);
screen->DrawText(SmallFont, CR_DARKGRAY, x + 12*8 + 4, y, textbuf, DTA_Clean, true, TAG_DONE);
}
} }
int M_FindCurVal (float cur, value_t *values, int numvals) int M_FindCurVal (float cur, value_t *values, int numvals)
@ -1882,7 +1883,7 @@ void M_OptDrawer ()
case joy_sens: case joy_sens:
value.Float = SELECTED_JOYSTICK->GetSensitivity(); value.Float = SELECTED_JOYSTICK->GetSensitivity();
M_DrawSlider (indent + 14, y + labelofs, item->b.min, item->c.max, value.Float); M_DrawSlider (indent + 14, y + labelofs, item->b.min, item->c.max, value.Float, 1);
break; break;
case joy_slider: case joy_slider:
@ -1895,7 +1896,7 @@ void M_OptDrawer ()
assert(item->e.joyslidernum == 1); assert(item->e.joyslidernum == 1);
value.Float = SELECTED_JOYSTICK->GetAxisDeadZone(item->a.joyselection); value.Float = SELECTED_JOYSTICK->GetAxisDeadZone(item->a.joyselection);
} }
M_DrawSlider (indent + 14, y + labelofs, item->b.min, item->c.max, fabs(value.Float)); M_DrawSlider (indent + 14, y + labelofs, item->b.min, item->c.max, fabs(value.Float), 3);
break; break;
case joy_inverter: case joy_inverter:
@ -1908,16 +1909,16 @@ void M_OptDrawer ()
case slider: case slider:
value = item->a.cvar->GetGenericRep (CVAR_Float); value = item->a.cvar->GetGenericRep (CVAR_Float);
M_DrawSlider (indent + 14, y + labelofs, item->b.min, item->c.max, value.Float); M_DrawSlider (indent + 14, y + labelofs, item->b.min, item->c.max, value.Float, 1);
break; break;
case absslider: case absslider:
value = item->a.cvar->GetGenericRep (CVAR_Float); value = item->a.cvar->GetGenericRep (CVAR_Float);
M_DrawSlider (indent + 14, y + labelofs, item->b.min, item->c.max, fabs(value.Float)); M_DrawSlider (indent + 14, y + labelofs, item->b.min, item->c.max, fabs(value.Float), 1);
break; break;
case intslider: case intslider:
M_DrawSlider (indent + 14, y + labelofs, item->b.min, item->c.max, item->a.fval); M_DrawSlider (indent + 14, y + labelofs, item->b.min, item->c.max, item->a.fval, 0);
break; break;
case control: case control:
@ -2967,7 +2968,7 @@ static void ColorPickerDrawer ()
DWORD oldColor = DWORD(*ColorPickerItems[0].a.colorcvar) | 0xFF000000; DWORD oldColor = DWORD(*ColorPickerItems[0].a.colorcvar) | 0xFF000000;
int x = screen->GetWidth()*2/3; int x = screen->GetWidth()*2/3;
int y = (15 + BigFont->GetHeight() + SmallFont->GetHeight()*2 - 102) * CleanYfac + screen->GetHeight()/2; int y = (15 + BigFont->GetHeight() + SmallFont->GetHeight()*5 - 90) * CleanYfac + screen->GetHeight()/2;
screen->Clear (x, y, x + 48*CleanXfac, y + 48*CleanYfac, -1, oldColor); screen->Clear (x, y, x + 48*CleanXfac, y + 48*CleanYfac, -1, oldColor);
screen->Clear (x + 48*CleanXfac, y, x + 48*2*CleanXfac, y + 48*CleanYfac, -1, newColor); screen->Clear (x + 48*CleanXfac, y, x + 48*2*CleanXfac, y + 48*CleanYfac, -1, newColor);
@ -3102,9 +3103,9 @@ static void UpdateJoystickConfigMenu(IJoystickConfig *joy)
item.type = joy_sens; item.type = joy_sens;
item.label = "Overall sensitivity"; item.label = "Overall sensitivity";
item.b.min = 0.5f; item.b.min = 0;
item.c.max = 2.f; item.c.max = 2;
item.d.step = 0.2f; item.d.step = 0.1f;
JoystickConfigItems.Push(item); JoystickConfigItems.Push(item);
item.type = redtext; item.type = redtext;
@ -3134,7 +3135,7 @@ static void UpdateJoystickConfigMenu(IJoystickConfig *joy)
item.label = "Sensitivity"; item.label = "Sensitivity";
item.b.min = 0; item.b.min = 0;
item.c.max = 4; item.c.max = 4;
item.d.step = 0.2f; item.d.step = 0.1f;
item.e.joyslidernum = 0; item.e.joyslidernum = 0;
JoystickConfigItems.Push(item); JoystickConfigItems.Push(item);