]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/checkbox_string.qc
Put GameLogInit() code in there instead of in spawnfunc(worldspawn)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / checkbox_string.qc
index 4b5b17f0e17c5b56c1d6680fdf02f8d584fa6174..4196434723197a8f02e89db82d4df971117d3239 100644 (file)
@@ -1,31 +1,5 @@
-#ifndef CHECKBOX_STRING_H
-#define CHECKBOX_STRING_H
-#include "../item/checkbox.qc"
-CLASS(XonoticCheckBoxString, CheckBox)
-       METHOD(XonoticCheckBoxString, configureXonoticCheckBoxString, void(entity, string, string, string, string));
-       METHOD(XonoticCheckBoxString, setChecked, void(entity, float));
-       ATTRIB(XonoticCheckBoxString, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticCheckBoxString, image, string, SKINGFX_CHECKBOX)
-       ATTRIB(XonoticCheckBoxString, yesString, string, string_null)
-       ATTRIB(XonoticCheckBoxString, noString, string, string_null)
+#include "checkbox_string.qh"
 
-       ATTRIB(XonoticCheckBoxString, color, vector, SKINCOLOR_CHECKBOX_N)
-       ATTRIB(XonoticCheckBoxString, colorC, vector, SKINCOLOR_CHECKBOX_C)
-       ATTRIB(XonoticCheckBoxString, colorF, vector, SKINCOLOR_CHECKBOX_F)
-       ATTRIB(XonoticCheckBoxString, colorD, vector, SKINCOLOR_CHECKBOX_D)
-
-       ATTRIB(XonoticCheckBoxString, cvarName, string, string_null)
-       METHOD(XonoticCheckBoxString, loadCvars, void(entity));
-       METHOD(XonoticCheckBoxString, saveCvars, void(entity));
-       ATTRIB(XonoticCheckBoxString, sendCvars, float, 0)
-
-       ATTRIB(XonoticCheckBoxString, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticCheckBoxString, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticCheckBoxString)
-entity makeXonoticCheckBoxString(string, string, string, string);
-#endif
-
-#ifdef IMPLEMENTATION
 entity makeXonoticCheckBoxString(string theYesValue, string theNoValue, string theCvar, string theText)
 {
        entity me;
@@ -38,12 +12,8 @@ void XonoticCheckBoxString_configureXonoticCheckBoxString(entity me, string theY
        me.yesString = theYesValue;
        me.noString = theNoValue;
        me.checked = 0;
-       if(theCvar)
-       {
-               me.cvarName = theCvar;
-               me.tooltip = getZonedTooltipForIdentifier(theCvar);
-               me.loadCvars(me);
-       }
+       me.controlledCvar = (theCvar) ? theCvar : string_null;
+       me.loadCvars(me);
        me.configureCheckBox(me, theText, me.fontSize, me.image);
 }
 void XonoticCheckBoxString_setChecked(entity me, float foo)
@@ -53,22 +23,21 @@ void XonoticCheckBoxString_setChecked(entity me, float foo)
 }
 void XonoticCheckBoxString_loadCvars(entity me)
 {
-       if (!me.cvarName)
+       if (!me.controlledCvar)
                return;
 
-       if(cvar_string(me.cvarName) == me.yesString)
+       if(cvar_string(me.controlledCvar) == me.yesString)
                me.checked = 1;
 }
 void XonoticCheckBoxString_saveCvars(entity me)
 {
-       if (!me.cvarName)
+       if (!me.controlledCvar)
                return;
 
        if(me.checked)
-               cvar_set(me.cvarName, me.yesString);
+               cvar_set(me.controlledCvar, me.yesString);
        else
-               cvar_set(me.cvarName, me.noString);
+               cvar_set(me.controlledCvar, me.noString);
 
-       CheckSendCvars(me, me.cvarName);
+       CheckSendCvars(me, me.controlledCvar);
 }
-#endif