2 CLASS(XonoticPlayerSettingsTab) EXTENDS(XonoticTab)
3 METHOD(XonoticPlayerSettingsTab, fill, void(entity))
4 METHOD(XonoticPlayerSettingsTab, draw, void(entity))
5 ATTRIB(XonoticPlayerSettingsTab, title, string, _("Player Setup"))
6 ATTRIB(XonoticPlayerSettingsTab, intendedWidth, float, 0.9)
7 ATTRIB(XonoticPlayerSettingsTab, rows, float, 22)
8 ATTRIB(XonoticPlayerSettingsTab, columns, float, 6.2) // added extra .2 for center space
9 ATTRIB(XonoticPlayerSettingsTab, playerNameLabel, entity, NULL)
10 ATTRIB(XonoticPlayerSettingsTab, playerNameLabelAlpha, float, 0)
11 ENDCLASS(XonoticPlayerSettingsTab)
12 entity makeXonoticPlayerSettingsTab();
16 entity makeXonoticPlayerSettingsTab()
19 me = spawnXonoticPlayerSettingsTab();
20 me.configureDialog(me);
23 void XonoticPlayerSettingsTab_draw(entity me)
25 if(cvar_string("_cl_name") == "Player")
26 me.playerNameLabel.alpha = ((mod(time * 2, 2) < 1) ? 1 : 0);
28 me.playerNameLabel.alpha = me.playerNameLabelAlpha;
29 SUPER(XonoticPlayerSettingsTab).draw(me);
31 void XonoticPlayerSettingsTab_fill(entity me)
33 entity e, pms, label, box;
37 me.TD(me, 1, 0.5, me.playerNameLabel = makeXonoticTextLabel(0, _("Name:")));
38 me.playerNameLabelAlpha = me.playerNameLabel.alpha;
39 me.TD(me, 1, 2.5, label = makeXonoticTextLabel(0, string_null));
41 label.allowColors = 1;
44 me.TD(me, 1, 3.0, box = makeXonoticInputBox(1, "_cl_name"));
45 box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
46 box.maxLength = -127; // negative means encoded length in bytes
47 box.saveImmediately = 1;
48 label.textEntity = box;
50 me.TD(me, 5, 1, e = makeXonoticColorpicker(box));
51 me.TD(me, 5, 2, e = makeXonoticCharmap(box));
58 me.gotoRC(me, 8, 0.0);
59 pms = makeXonoticPlayerModelSelector();
60 me.TD(me, 1, 0.6, e = makeXonoticTextLabel(1, _("Model:")));
61 me.TD(me, 1, 0.3, e = makeXonoticButton("<<", '0 0 0'));
62 e.onClick = PlayerModelSelector_Prev_Click;
63 e.onClickEntity = pms;
64 me.TD(me, me.rows - (me.currentRow + 2), 1.8, pms);
65 me.TD(me, 1, 0.3, e = makeXonoticButton(">>", '0 0 0'));
66 e.onClick = PlayerModelSelector_Next_Click;
67 e.onClickEntity = pms;
70 m = me.rows - (r + 3);
71 n = 16 - !cvar("developer");
73 for(i = 0; i < n; ++i)
75 me.gotoRC(me, r + i * m, 0.1);
76 me.TDNoMargin(me, m, 0.2, e = makeXonoticColorButton(1, 0, i), '0 1 0');
78 for(i = 0; i < n; ++i)
80 me.gotoRC(me, r + i * m, 0.4);
81 me.TDNoMargin(me, m, 0.2, e = makeXonoticColorButton(2, 1, i), '0 1 0');
85 // crosshair_enabled: 0 = no crosshair options, 1 = no crosshair selection, but everything else enabled, 2 = all crosshair options enabled
86 // FIXME: In the future, perhaps make one global crosshair_type cvar which has 0 for disabled, 1 for custom, 2 for per weapon, etc?
87 me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
88 me.TD(me, 1, 3, e = makeXonoticRadioButton(3, "crosshair_enabled", "0", _("No crosshair")));
90 me.TD(me, 1, 3, e = makeXonoticRadioButton(3, "crosshair_per_weapon", string_null, _("Per weapon crosshair")));
91 makeMulti(e, "crosshair_enabled");
93 me.TD(me, 1, 3, e = makeXonoticRadioButton(3, "crosshair_enabled", "2", _("Custom crosshair")));
96 for(i = 1; i <= 14; ++i) {
97 me.TDNoMargin(me, 1, 2 / 14, e = makeXonoticCrosshairButton(4, i), '1 1 0');
98 setDependentAND(e, "crosshair_per_weapon", 0, 0, "crosshair_enabled", 1, 2);
100 // show a larger preview of the selected crosshair
102 me.TDNoMargin(me, 3, 0.8, e = makeXonoticCrosshairButton(7, -1), '1 1 0'); // crosshair -1 makes this a preview
103 setDependentAND(e, "crosshair_per_weapon", 0, 0, "crosshair_enabled", 1, 2);
106 for(i = 15; i <= 28; ++i) {
107 me.TDNoMargin(me, 1, 2 / 14, e = makeXonoticCrosshairButton(4, i), '1 1 0');
108 setDependentAND(e, "crosshair_per_weapon", 0, 0, "crosshair_enabled", 1, 2);
112 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Crosshair size:")));
113 setDependent(e, "crosshair_enabled", 1, 2);
114 me.TD(me, 1, 2, e = makeXonoticSlider(0.1, 1.0, 0.01, "crosshair_size"));
115 setDependent(e, "crosshair_enabled", 1, 2);
117 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Crosshair alpha:")));
118 setDependent(e, "crosshair_enabled", 1, 2);
119 me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.1, "crosshair_alpha"));
120 setDependent(e, "crosshair_enabled", 1, 2);
123 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Crosshair color:")));
124 setDependent(e, "crosshair_enabled", 1, 2);
125 me.TD(me, 1, 1, e = makeXonoticRadioButton(5, "crosshair_color_per_weapon", string_null, _("Per weapon")));
126 setDependent(e, "crosshair_enabled", 1, 2);
127 me.TD(me, 1, 1, e = makeXonoticRadioButton(5, "crosshair_color_by_health", string_null, _("By health")));
128 setDependent(e, "crosshair_enabled", 1, 2);
131 me.TD(me, 1, 0.9, e = makeXonoticRadioButton(5, string_null, string_null, _("Custom")));
132 setDependent(e, "crosshair_enabled", 1, 2);
133 me.TD(me, 2, 2, e = makeXonoticColorpickerString("crosshair_color", "crosshair_color"));
134 setDependentAND3(e, "crosshair_color_per_weapon", 0, 0, "crosshair_color_by_health", 0, 0, "crosshair_enabled", 1, 2);
139 me.TD(me, 1, 2, e = makeXonoticButton(_("Other crosshair settings"), '0 0 0'));
140 e.onClick = DialogOpenButton_Click;
141 e.onClickEntity = main.crosshairDialog;
142 setDependent(e, "crosshair_enabled", 1, 2);
143 // TODO: show status of crosshair dot and hittest and pickups and such here with text
147 me.TD(me, 1, 2, e = makeXonoticButton(_("Model settings"), '0 0 0'));
148 e.onClick = DialogOpenButton_Click;
149 e.onClickEntity = main.modelDialog;
150 // TODO: show csqc model settings like forcemyplayer and deglowing/ghosting bodies with text here
153 me.TD(me, 1, 2, e = makeXonoticButton(_("View settings"), '0 0 0'));
154 e.onClick = DialogOpenButton_Click;
155 e.onClickEntity = main.viewDialog;
156 // TODO: show fov and other settings with text here
159 me.TD(me, 1, 2, e = makeXonoticButton(_("Weapon settings"), '0 0 0'));
160 e.onClick = DialogOpenButton_Click;
161 e.onClickEntity = main.weaponsDialog;
162 // I don't really think this is useful as is, and especially it doesn't look very clean...
163 // In the future, if ALL of these buttons had some information, then it would be justified/clean
164 //me.TD(me, 1, 1, e0 = makeXonoticTextLabel(0, string_null));
165 // e0.textEntity = main.weaponsDialog;
169 me.TD(me, 1, 2, e = makeXonoticButton(_("HUD settings"), '0 0 0'));
170 e.onClick = DialogOpenButton_Click;
171 e.onClickEntity = main.hudDialog;
172 // TODO: show hud config name with text here
174 me.gotoRC(me, me.rows - 1, 0);
175 me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "color -1 -1;name \"$_cl_name\";sendcvar cl_weaponpriority;sendcvar cl_autoswitch;sendcvar cl_forceplayermodels;sendcvar cl_forceplayermodelsfromxonotic;playermodel $_cl_playermodel;playerskin $_cl_playerskin", COMMANDBUTTON_APPLY));