]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_settings_game_crosshair.qc
fef316c1023bf5381551e79de743d668377b1b44
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / dialog_settings_game_crosshair.qc
1 #ifndef DIALOG_SETTINGS_GAME_CROSSHAIR_H
2 #define DIALOG_SETTINGS_GAME_CROSSHAIR_H
3 #include "tab.qc"
4 CLASS(XonoticGameCrosshairSettingsTab, XonoticTab)
5         METHOD(XonoticGameCrosshairSettingsTab, fill, void(entity));
6         METHOD(XonoticGameCrosshairSettingsTab, showNotify, void(entity));
7         ATTRIB(XonoticGameCrosshairSettingsTab, title, string, _("Crosshair"))
8         ATTRIB(XonoticGameCrosshairSettingsTab, intendedWidth, float, 0.9)
9         ATTRIB(XonoticGameCrosshairSettingsTab, rows, float, 13)
10         ATTRIB(XonoticGameCrosshairSettingsTab, columns, float, 6.2)
11 ENDCLASS(XonoticGameCrosshairSettingsTab)
12 entity makeXonoticGameCrosshairSettingsTab();
13 #include "../gamesettings.qh"
14 REGISTER_SETTINGS(Crosshair, makeXonoticGameCrosshairSettingsTab());
15 #endif
16
17 #ifdef IMPLEMENTATION
18 void XonoticGameCrosshairSettingsTab_showNotify(entity me)
19 {
20         loadAllCvars(me);
21 }
22 entity makeXonoticGameCrosshairSettingsTab()
23 {
24         entity me;
25         me = NEW(XonoticGameCrosshairSettingsTab);
26         me.configureDialog(me);
27         return me;
28 }
29
30 void XonoticGameCrosshairSettingsTab_fill(entity me)
31 {
32         entity e;
33
34         // crosshair_enabled: 0 = no crosshair options, 1 = no crosshair selection, but everything else enabled, 2 = all crosshair options enabled
35         // FIXME: In the future, perhaps make one global crosshair_type cvar which has 0 for disabled, 1 for custom, 2 for per weapon, etc?
36         me.TR(me); //me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
37                 me.TD(me, 1, 1, e = makeXonoticRadioButton(3, "crosshair_enabled", "0", _("No crosshair")));
38         //me.TR(me);
39                 me.TD(me, 1, 1, e = makeXonoticRadioButton_T(3, "crosshair_per_weapon", string_null, _("Per weapon"),
40                         _("Set a different crosshair for each weapon, good if you play without weapon models")));
41                 makeMulti(e, "crosshair_enabled");
42         //me.TR(me);
43                 me.TD(me, 1, 1, e = makeXonoticRadioButton(3, "crosshair_enabled", "2", _("Custom")));
44         me.TR(me);
45                 me.TDempty(me, 0.1);
46                 me.TD(me, 3, 2, e = makeXonoticCrosshairPicker());
47                         setDependentAND(e, "crosshair_per_weapon", 0, 0, "crosshair_enabled", 1, 2);
48                 me.TD(me, 3, 0.9, e = makeXonoticCrosshairPreview());
49                         setDependentAND(e, "crosshair_per_weapon", 0, 0, "crosshair_enabled", 1, 2);
50         me.TR(me);
51         me.TR(me);
52         me.TR(me);
53                 me.TDempty(me, 0.1);
54                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Crosshair size:")));
55                         setDependent(e, "crosshair_enabled", 1, 2);
56                 me.TD(me, 1, 1.9, e = makeXonoticSlider_T(0.1, 1.0, 0.01, "crosshair_size",
57                         _("Adjust the size of the crosshair")));
58                         setDependent(e, "crosshair_enabled", 1, 2);
59         me.TR(me);
60                 me.TDempty(me, 0.1);
61                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Crosshair alpha:")));
62                         setDependent(e, "crosshair_enabled", 1, 2);
63                 me.TD(me, 1, 1.9, e = makeXonoticSlider_T(0, 1, 0.1, "crosshair_alpha",
64                         _("Adjust the opacity of the crosshair")));
65                         setDependent(e, "crosshair_enabled", 1, 2);
66         me.TR(me);
67                 me.TDempty(me, 0.1);
68                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Crosshair color:")));
69                         setDependent(e, "crosshair_enabled", 1, 2);
70                 me.TD(me, 1, 0.9, e = makeXonoticRadioButton(5, "crosshair_color_special", "1", _("Per weapon")));
71                         setDependent(e, "crosshair_enabled", 1, 2);
72                 me.TD(me, 1, 1, e = makeXonoticRadioButton(5, "crosshair_color_special", "2", _("By health")));
73                         setDependent(e, "crosshair_enabled", 1, 2);
74         me.TR(me);
75                 me.TDempty(me, 0.2);
76                 me.TD(me, 1, 0.8, e = makeXonoticRadioButton(5, "crosshair_color_special", "0", _("Custom")));
77                         setDependent(e, "crosshair_enabled", 1, 2);
78                 me.TD(me, 2, 2, e = makeXonoticColorpickerString("crosshair_color", "crosshair_color"));
79                         setDependentAND(e, "crosshair_color_special", 0, 0, "crosshair_enabled", 1, 2);
80         me.TR(me);
81         me.TR(me);
82         me.TR(me);
83                 me.TDempty(me, 0.1);
84                 me.TD(me, 1, 2.9, e = makeXonoticCheckBox(0, "crosshair_ring", _("Use rings to indicate weapon status")));
85                         makeMulti(e, "crosshair_ring_reload");
86                         setDependent(e, "crosshair_enabled", 1, 2);
87         //me.TR(me);
88         //      me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Ring size:")));
89         //              setDependentAND(e, "crosshair_ring", 1, 1, "crosshair_enabled", 1, 2);
90         //      me.TD(me, 1, 2, e = makeXonoticSlider(2, 4, 0.1, "crosshair_ring_size"));
91         //              setDependentAND(e, "crosshair_ring", 1, 1, "crosshair_enabled", 1, 2);
92         me.TR(me);
93                 me.TDempty(me, 0.3);
94                 me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Ring alpha:")));
95                         setDependentAND(e, "crosshair_ring", 1, 1, "crosshair_enabled", 1, 2);
96                 me.TD(me, 1, 1.8, e = makeXonoticSlider(0.1, 1, 0.1, "crosshair_ring_alpha"));
97                         setDependentAND(e, "crosshair_ring", 1, 1, "crosshair_enabled", 1, 2);
98
99         me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
100                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "crosshair_dot", _("Enable center crosshair dot")));
101                 setDependent(e, "crosshair_enabled", 1, 2);
102         me.TR(me);
103                 me.TDempty(me, 0.1);
104                 me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Dot size:")));
105                         setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
106                 me.TD(me, 1, 2, e = makeXonoticSlider(0.2, 2, 0.1, "crosshair_dot_size"));
107                         setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
108         me.TR(me);
109                 me.TDempty(me, 0.1);
110                 me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Dot alpha:")));
111                         setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
112                 me.TD(me, 1, 2, e = makeXonoticSlider(0.1, 1, 0.1, "crosshair_dot_alpha"));
113                         setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
114         me.TR(me);
115                 me.TDempty(me, 0.1);
116                 me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Dot color:")));
117                         setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
118                 me.TD(me, 1, 2, e = makeXonoticRadioButton(1, "crosshair_dot_color_custom", "0", _("Use normal crosshair color")));
119                         setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
120         me.TR(me);
121                 me.TDempty(me, 0.2);
122                 me.TD(me, 1, 0.8, e = makeXonoticRadioButton(1, "crosshair_dot_color_custom", "1", _("Custom")));
123                         setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
124                 me.TD(me, 2, 2, e = makeXonoticColorpickerString("crosshair_dot_color", "crosshair_dot_color"));
125                         setDependentAND3(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2, "crosshair_dot_color_custom", 1, 1);
126         me.TR(me);
127         me.TR(me);
128         me.TR(me);
129                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "crosshair_effect_scalefade", _("Smooth effects of crosshairs")));
130                         setDependent(e, "crosshair_enabled", 1, 2);
131         me.TR(me);
132                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "crosshair_hittest_blur", _("Blur crosshair if the shot is obstructed")));
133                         setDependentAND(e, "crosshair_hittest", 1, 100, "crosshair_enabled", 1, 2);
134         me.TR(me);
135                 me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(1.25, 0, "crosshair_hittest_scale", _("Enlarge crosshair if targeting an enemy")));
136                         setDependentAND(e, "crosshair_hittest", 1, 100, "crosshair_enabled", 1, 2);
137         me.TR(me);
138                 me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(0.5, 0, "crosshair_hitindication", _("Animate crosshair when hitting an enemy")));
139                         setDependent(e, "crosshair_enabled", 1, 2);
140         me.TR(me);
141                 me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(0.25, 0, "crosshair_pickup", _("Animate crosshair when picking up an item")));
142                         setDependent(e, "crosshair_enabled", 1, 2);
143         /*me.TR(me);
144                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Hit testing:")));
145                 me.TD(me, 1, 2, e = makeXonoticTextSlider_T("crosshair_hittest",
146                         _("None: do not do hit tests for the crosshair; TrueAim: blur the crosshair when you would not hit the wall; Enemies: also enlarge the crosshair when you would hit an enemy")));
147                         e.addValue(e, ZCTX(_("HTTST^Disabled")), "0");
148                         e.addValue(e, ZCTX(_("HTTST^TrueAim")), "1");
149                         e.addValue(e, ZCTX(_("HTTST^Enemies")), "1.25");
150                         e.configureXonoticTextSliderValues(e);
151                         setDependent(e, "crosshair_enabled", 1, 2);*/
152
153         /*me.TR(me);
154
155         me.gotoRC(me, me.rows - 1, 0);
156                 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
157                         e.onClick = Dialog_Close;
158                         e.onClickEntity = me;*/
159 }
160 #endif