]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_settings_game_weapons.qc
Keep Apply buttons disabled, enable them as soon as user changes some setting that...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / dialog_settings_game_weapons.qc
1 #ifndef DIALOG_SETTINGS_GAME_WEAPONS_H
2 #define DIALOG_SETTINGS_GAME_WEAPONS_H
3 #include "tab.qc"
4 CLASS(XonoticGameWeaponsSettingsTab, XonoticTab)
5         METHOD(XonoticGameWeaponsSettingsTab, fill, void(entity));
6         METHOD(XonoticGameWeaponsSettingsTab, showNotify, void(entity));
7         ATTRIB(XonoticGameWeaponsSettingsTab, title, string, _("Weapons"))
8         ATTRIB(XonoticGameWeaponsSettingsTab, intendedWidth, float, 0.9)
9         ATTRIB(XonoticGameWeaponsSettingsTab, rows, float, 15.5)
10         ATTRIB(XonoticGameWeaponsSettingsTab, columns, float, 6)
11         ATTRIB(XonoticGameWeaponsSettingsTab, weaponsList, entity, NULL)
12 ENDCLASS(XonoticGameWeaponsSettingsTab)
13 entity makeXonoticGameWeaponsSettingsTab();
14 #include "../gamesettings.qh"
15 REGISTER_SETTINGS(Weapons, makeXonoticGameWeaponsSettingsTab());
16 #endif
17
18 #ifdef IMPLEMENTATION
19 void XonoticGameWeaponsSettingsTab_showNotify(entity me)
20 {
21         loadAllCvars(me);
22 }
23 entity makeXonoticGameWeaponsSettingsTab()
24 {
25         entity me;
26         me = NEW(XonoticGameWeaponsSettingsTab);
27         me.configureDialog(me);
28         return me;
29 }
30
31 void XonoticGameWeaponsSettingsTab_fill(entity me)
32 {
33         entity e;
34         entity weaponsApplyButton = makeXonoticCommandButton(_("Apply immediately"), '0 0 0',
35                 "sendcvar cl_autoswitch;"
36                 "sendcvar cl_weaponpriority;"
37                 "sendcvar cl_weaponimpulsemode;"
38                 , COMMANDBUTTON_APPLY);
39         weaponsApplyButton.disableOnClick = true;
40
41         me.TR(me);
42                 me.TDempty(me, 0.25);
43                 me.TD(me, 1, 2.5, e = makeXonoticHeaderLabel(_("Weapon Priority List (* = mutator weapon)")));
44         me.TR(me);
45                 me.TDempty(me, 0.25);
46                 me.TD(me, 9, 2.5, e = me.weaponsList = makeXonoticWeaponsList());
47                         e.applyButton = weaponsApplyButton;
48         me.gotoRC(me, 10, 0.25);
49                 me.TD(me, 1, 1.25, e = makeXonoticButton(_("Up"), '0 0 0'));
50                         e.onClick = WeaponsList_MoveUp_Click;
51                         e.onClickEntity = me.weaponsList;
52                         e.applyButton = weaponsApplyButton;
53                 me.TD(me, 1, 1.25, e = makeXonoticButton(_("Down"), '0 0 0'));
54                         e.onClick = WeaponsList_MoveDown_Click;
55                         e.onClickEntity = me.weaponsList;
56                         e.applyButton = weaponsApplyButton;
57
58         me.gotoRC(me, 0, 3); me.setFirstColumn(me, me.currentColumn);
59                 me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "cl_weaponpriority_useforcycling", _("Use priority list for weapon cycling"),
60                         _("Make use of the list above when cycling through weapons with the mouse wheel")));
61         me.TR(me);
62                 me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_weaponimpulsemode", _("Cycle through only usable weapon selections")));
63                         e.applyButton = weaponsApplyButton;
64         me.TR(me);
65         me.TR(me);
66                 me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "cl_autoswitch", _("Auto switch weapons on pickup"),
67                         _("Automatically switch to newly picked up weapons if they are better than what you are carrying")));
68                         e.applyButton = weaponsApplyButton;
69         me.TR(me);
70                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_unpress_attack_on_weapon_switch", _("Release attack buttons when you switch weapons")));
71         me.TR(me);
72         me.TR(me);
73                 me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "r_drawviewmodel", _("Draw 1st person weapon model"),
74                         _("Draw the weapon model")));
75         me.TR(me);
76                 me.TDempty(me, 0.2);
77                 me.TD(me, 1, 0.9, e = makeXonoticRadioButton_T(1, "cl_gunalign", "4", _("Left align"),
78                         _("Position of the weapon model; requires reconnect")));
79                         setDependent(e, "r_drawviewmodel", 1, 1);
80                 me.TD(me, 1, 0.9, e = makeXonoticRadioButton_T(1, "cl_gunalign", "1", _("Center"),
81                         _("Position of the weapon model; requires reconnect")));
82                         setDependent(e, "r_drawviewmodel", 1, 1);
83                 me.TD(me, 1, 1.0, e = makeXonoticRadioButton_T(1, "cl_gunalign", "3", _("Right align"),
84                         _("Position of the weapon model; requires reconnect")));
85                         setDependent(e, "r_drawviewmodel", 1, 1);
86         me.TR(me);
87         me.TR(me);
88                 me.TDempty(me, 0.2);
89                 me.TD(me, 1, 2.8, e = makeXonoticCheckBox_T(0, "cl_followmodel", _("Gun model swaying"), "-"));
90                 makeMulti(e, "cl_leanmodel");
91                 setDependent(e, "r_drawviewmodel", 1, 1);
92         me.TR(me);
93                 me.TDempty(me, 0.2);
94                 me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "cl_bobmodel", _("Gun model bobbing")));
95                 setDependent(e, "r_drawviewmodel", 1, 1);
96         me.gotoRC(me, me.rows - 1, 0); me.setFirstColumn(me, me.currentColumn);
97                 me.TD(me, 1, me.columns, weaponsApplyButton);
98 }
99 #endif