]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/radiobutton.c
More stuff.
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / radiobutton.c
index 8c353eae6725aec683419db78b88d6e3ce5274d5..85cc4fc5c559a3c56125fcce05e8aef6f1f7bf6e 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))
 
@@ -74,8 +75,8 @@ void XonoticRadioButton_loadCvars(entity me)
 }
 void XonoticRadioButton_draw(entity me)
 {
-       if not(me.cvarValue)
-               if not(me.cvarName)
+       if (!me.cvarValue)
+               if (!me.cvarName)
                {
                        // this is the "other" option
                        // always select this if none other is
@@ -98,7 +99,12 @@ void XonoticRadioButton_saveCvars(entity me)
                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);
                }