]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/radiobutton.c
Merge remote-tracking branch 'origin/master' into terencehill/spectate_prev
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / radiobutton.c
index 2591356a0971bab75284940d67c0a44d97a8eb66..4ac5aa7b188030dc40c316a4982d71370946d9bc 100644 (file)
@@ -13,6 +13,7 @@ CLASS(XonoticRadioButton) EXTENDS(RadioButton)
        ATTRIB(XonoticRadioButton, cvarName, string, string_null)
        ATTRIB(XonoticRadioButton, cvarValue, string, string_null)
        ATTRIB(XonoticRadioButton, cvarOffValue, string, string_null)
+       ATTRIB(XonoticRadioButton, getCvarValueFromCvar, float, 0)
        METHOD(XonoticRadioButton, loadCvars, void(entity))
        METHOD(XonoticRadioButton, saveCvars, void(entity))
 
@@ -30,7 +31,7 @@ entity makeXonoticRadioButton(float theGroup, string theCvar, string theValue, s
        me.configureXonoticRadioButton(me, theGroup, theCvar, theValue, theText);
        return me;
 }
-void configureXonoticRadioButtonXonoticRadioButton(entity me, float theGroup, string theCvar, string theValue, string theText)
+void XonoticRadioButton_configureXonoticRadioButton(entity me, float theGroup, string theCvar, string theValue, string theText)
 {
        if(theCvar)
        {
@@ -41,7 +42,7 @@ void configureXonoticRadioButtonXonoticRadioButton(entity me, float theGroup, st
        }
        me.configureRadioButton(me, theText, me.fontSize, me.image, theGroup, 0);
 }
-void setCheckedXonoticRadioButton(entity me, float val)
+void XonoticRadioButton_setChecked(entity me, float val)
 {
        if(val != me.checked)
        {
@@ -49,7 +50,7 @@ void setCheckedXonoticRadioButton(entity me, float val)
                me.saveCvars(me);
        }
 }
-void loadCvarsXonoticRadioButton(entity me)
+void XonoticRadioButton_loadCvars(entity me)
 {
        if(me.cvarValue)
        {
@@ -72,7 +73,7 @@ void loadCvarsXonoticRadioButton(entity me)
                }
        }
 }
-void drawXonoticRadioButton(entity me)
+void XonoticRadioButton_draw(entity me)
 {
        if not(me.cvarValue)
                if not(me.cvarName)
@@ -91,14 +92,19 @@ void drawXonoticRadioButton(entity me)
                }
        SUPER(XonoticRadioButton).draw(me);
 }
-void saveCvarsXonoticRadioButton(entity me)
+void XonoticRadioButton_saveCvars(entity me)
 {
        if(me.cvarValue)
        {
                if(me.cvarName)
                {
                        if(me.checked)
-                               cvar_set(me.cvarName, me.cvarValue);
+                       {
+                               if(me.getCvarValueFromCvar)
+                                       cvar_set(me.cvarName, cvar_string(me.cvarValue));
+                               else
+                                       cvar_set(me.cvarName, me.cvarValue);
+                       }
                        else if(me.cvarOffValue)
                                cvar_set(me.cvarName, me.cvarOffValue);
                }