From bb9f6374df6ea8ef211dbacfd172cabd33a34dee Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 7 Sep 2004 23:15:19 +0000 Subject: [PATCH] Latched vars were not displaying on the menus (only really noticable in the video menu) git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@172 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/m_items.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/engine/client/m_items.c b/engine/client/m_items.c index 7c95fe9f5..07ea32e40 100644 --- a/engine/client/m_items.c +++ b/engine/client/m_items.c @@ -172,11 +172,13 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu) if (option->slider.var) { #define SLIDER_RANGE 10 - float range = (option->slider.var->value - option->slider.min)/(option->slider.max-option->slider.min); + float range; int i; int x = xpos+option->common.posx; int y = ypos+option->common.posy; + range = (option->slider.current - option->slider.min)/(option->slider.max-option->slider.min); + if (option->slider.text) { if (!menu->cursoritem && menu->selecteditem == option) @@ -206,6 +208,8 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu) on = option->check.func(option, CHK_CHECKED); else if (!option->check.var) on = option->check.value; + else if (option->check.var->latched_string) + on = atof(option->check.var->latched_string); else on = option->check.var->value; @@ -715,7 +719,7 @@ void MC_Slider_Key(menuslider_t *option, int key) range = 0; option->current = range = (range * (option->max-option->min)) + option->min; if (option->var) - Cvar_SetValue(option->var, range); + Cvar_SetValue(option->var, range); } else if (key == K_RIGHTARROW) { @@ -724,7 +728,7 @@ void MC_Slider_Key(menuslider_t *option, int key) range = 1; option->current = range = (range * (option->max-option->min)) + option->min; if (option->var) - Cvar_SetValue(option->var, range); + Cvar_SetValue(option->var, range); } else if (key == K_ENTER || key == K_MOUSE1) { @@ -754,7 +758,10 @@ void MC_CheckBox_Key(menucheck_t *option, int key) option->value = !option->value; else { - Cvar_SetValue(option->var, !option->var->value); + if (option->var->latched_string) + Cvar_SetValue(option->var, !atof(option->var->latched_string)); + else + Cvar_SetValue(option->var, !option->var->value); S_LocalSound ("misc/menu2.wav"); } }