]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/weaponarenacheckbox.qc
Merge branch 'master' into terencehill/bot_waypoints
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / weaponarenacheckbox.qc
1 #include "weaponarenacheckbox.qh"
2
3 entity makeXonoticWeaponarenaCheckBox(string theWeapon, string theText)
4 {
5         entity me;
6         me = NEW(XonoticWeaponarenaCheckBox);
7         me.configureXonoticWeaponarenaCheckBox(me, theWeapon, theText);
8         return me;
9 }
10 void XonoticWeaponarenaCheckBox_configureXonoticWeaponarenaCheckBox(entity me, string theWeapon, string theText)
11 {
12         me.netname = theWeapon;
13         me.checked = false;
14         me.loadCvars(me);
15         me.configureCheckBox(me, theText, me.fontSize, me.image);
16 }
17 void XonoticWeaponarenaCheckBox_setChecked(entity me, float foo)
18 {
19         me.checked = !me.checked;
20         me.saveCvars(me);
21 }
22 void XonoticWeaponarenaCheckBox_loadCvars(entity me)
23 {
24         int n = tokenize_console(cvar_string("menu_weaponarena"));
25         for (int i = 0; i < n; i++)
26         {
27                 if(argv(i) == me.netname)
28                 {
29                         me.checked = true;
30                         break;
31                 }
32         }
33 }
34
35 void XonoticWeaponarenaCheckBox_saveCvars(entity me)
36 {
37         if(me.checked)
38                 localcmd(strcat("\nmenu_cmd addtolist menu_weaponarena ", me.netname, "\n"));
39         else
40                 localcmd(strcat("\nmenu_cmd removefromlist menu_weaponarena ", me.netname, "\n"));
41         localcmd("\ng_weaponarena \"$menu_weaponarena\"\n");
42 }